Summary
Vulnerability Details
function testTotalSupplyIsUpdating() public {
uint256 initialvalueOfTokenId = horseStore.totalSupply();
vm.prank(user1);
horseStore.mintHorse();
uint256 tokenIdOfUser1 = horseStore.tokenOfOwnerByIndex(user1, 0);
assertEq(tokenIdOfUser1, 0);
assertEq(initialvalueOfTokenId, 0);
console.log("totalSupply After user1 minted the NFT must be equal to 1 = ", horseStore.totalSupply());
assertEq(horseStore.totalSupply(), 1);
}
[⠊] Compiling...
[⠒] Compiling 1 files with 0.8.20
[⠢] Solc 0.8.20 finished in 3.04s
Compiler run successful!
Running 1 test for test/HorseStoreHuff.t.sol:HorseStoreHuff
[FAIL. Reason: assertion failed] testTotalSupplyIsUpdating() (gas: 79713)
Logs:
totalSupply After user1 minted the NFT must be equal to 1 = 0
Error: a == b not satisfied [uint]
Left: 0
Right: 1
Test result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 2.17s
Ran 1 test suites: 0 tests passed, 1 failed, 0 skipped (1 total tests)
Failing tests:
Encountered 1 failing test in test/HorseStoreHuff.t.sol:HorseStoreHuff
[FAIL. Reason: assertion failed] testTotalSupplyIsUpdating() (gas: 79713)
Encountered a total of 1 failing tests, 0 tests succeeded
function testMultiplyUserCanNotMintNFT() public {
vm.prank(user1);
horseStore.mintHorse();
vm.expectRevert("ALREADY_MINTED");
vm.prank(user2);
horseStore.mintHorse();
}
[⠒] Compiling...
No files changed, compilation skipped
Running 1 test for test/HorseStoreHuff.t.sol:HorseStoreHuff
[PASS] testMultiplyUserCanNotMintNFT() (gas: 62882)
Test result: ok. 1 passed; 0 failed; 0 skipped; finished in 2.17s
Ran 1 test suites: 1 tests passed, 0 failed, 0 skipped (1 total tests)
Impact
Tools Used
Recommendations
/* Imports */
#include "../lib/huffmate/src/data-structures/Hashmap.huff"
#include "../lib/huffmate/src/utils/CommonErrors.huff"
+ #include "../lib/huffmate/src/token/ERC721.huff"