π§ Exercise
contract InsecureMerkleRoot {
bytes32 merkleRoot;
mapping (bytes32 => bool) public alreadyClaimed;
uint constant AIRDROP_AMOUNT = 10;
function airdrop(bytes[] calldata proof, bytes32 leaf) external {
require(MerkleProof.verifyCalldata(proof, merkleRoot, leaf), "not verified");
require(!alreadyClaimed[leaf], "already claimed airdrop");
alreadyClaimed[leaf] = true;
mint(msg.sender, AIRDROP_AMOUNT);
}
function mint(address to, uint amount) private {
/* Minting tokens logic */
}
}Last updated