When calling the mint()
function, from a smart contract that is used for minting new vaults, on Smart Vault Manager contract and trying to transfer the NFT in the onERC721Received(address, address, uint256, bytes calldata)
to a different address (lets say the buyer address) the call will revert.
Transferring of Smart Vault NFT in onERC721Received(address, address, uint256, bytes calldata)
is not possible because the Smart Vault is not yet deployed. Therefore, the _afterTokenTransfer(address, address, uint256, uint256)
hook can not execute correctly because it can not retrieve non-existing vault address.
Buyer contract used for testing vulnerability:
Unit test written in smartVaultManager.js -> it passes
Core functionality is severed here, therefore the HIGH issue tag. Impact is self-evident. User that uses a smart contract to use the protocol can not use it properly.
Manual review
Move _safeMint(msg.sender, tokenId);
line from SmartVaultManager below the smartVaultIndex.addVaultAddress(tokenId, payable(vault));
in mint()
function.
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.