The contract reverts every time a horse is tried to be minted.
_safeMint function calls the _checkOnERC721Received function when a token is to be minted. This function checks that the contract that receives the token implements ´´´onERC721Received´´´, which would allow it to keep the token. The HorseStore contract does not have this function so no token will be minted.
Critical as it does not allow to mint horses. Therefore, it should not allow to feed them or check if they are happy.
Foundry 'forge test':
´´´
abstract contract Base_Test is Test {
HorseStore horseStore;
address user = makeAddr("user");
string public constant NFT_NAME = "HorseStore";
string public constant NFT_SYMBOL = "HS";
function setUp() public virtual {
horseStore = new HorseStore();
}
function testMint() public{
horseStore.mintHorse();
}´´´
Received error:
HorseStoreSolidity::onERC721Received(HorseStoreSolidity: [0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496], 0x0000000000000000000000000000000000000000, 0, 0x)
│ │ └─ ← "EvmError: Revert"
│ └─ ← "ERC721InvalidReceiver(0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496)"
└─ ← "ERC721InvalidReceiver(0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496)"
Implementing this onERC721Received function:
´´´
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4) {
return this.onERC721Received.selector;
}
´´´
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.