Transactions
Token Transfers
Internal Transactions
Coin Balance History
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Minter
- Optimization enabled
- true
- Compiler version
- v0.8.19+commit.7dd6d404
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2024-09-26T15:33:07.960997Z
Contract source code
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; interface INFT { function ownerOf(uint256 id) external view returns(address); function getClassForTokenID(uint256 id) external view returns(uint256); function mintWithClass(uint256 classId) external returns (uint256 _newTokenID); function silentTransfer(address _to, uint256 _tokenId) external returns (bool); } contract Migration { struct NFT { address owner; uint256 class; } INFT constant public nft = INFT(0x9C02E4aEb4a29084553b5Fdc3B5f6DF72F11E104); mapping(address user => uint256[] tokens) public users; function snapshot() external view returns(NFT[253] memory nfts) { for (uint i; i<253; i++) { nfts[i].owner = nft.ownerOf(i); nfts[i].class = nft.getClassForTokenID(i); } } uint256 public start; function record(uint len) external { len = start + len; uint i = start; if (len > 253) len = 253; for (; i<len; i++) { address owner = nft.ownerOf(i); uint256 class = nft.getClassForTokenID(i); users[owner].push(class); } start = i; } function getCalsses(address user) external view returns(uint256[] memory classes) { return users[user]; } } contract Minter { INFT constant public nft = INFT(0x9C02E4aEb4a29084553b5Fdc3B5f6DF72F11E104); Migration constant public snapshot = Migration(0xAcB2F7105ad6dF25fecEA32B99EF4785B60e0D71); mapping(address user => bool) public isProcessed; function claim() external { require(!isProcessed[msg.sender], "Already processed"); uint256[] memory classes = snapshot.getCalsses(msg.sender); require(classes.length != 0, "User is not eligible to claim"); isProcessed[msg.sender] = true; for (uint i; i < classes.length; i++) { if (classes[i] <= 2) _mint(msg.sender, 6); // mint ultra rare NFT else if (classes[i] <= 4) _mint(msg.sender, 7); // mint rare NFT else if (classes[i] == 5) _mint(msg.sender, 8); // mint common NFT else revert("wrong NFT class"); } } function _mint(address user, uint256 classId) internal { uint256 id = nft.mintWithClass(classId); nft.silentTransfer(user, id); } }
Contract ABI
[{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claim","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isProcessed","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract INFT"}],"name":"nft","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract Migration"}],"name":"snapshot","inputs":[]}]
Contract Creation Code
0x608060405234801561001057600080fd5b506105bd806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806347ccca02146100515780634e71d92d146100895780639711715a14610093578063d2157a2d146100ae575b600080fd5b61006c739c02e4aeb4a29084553b5fdc3b5f6df72f11e10481565b6040516001600160a01b0390911681526020015b60405180910390f35b6100916100e1565b005b61006c73acb2f7105ad6df25fecea32b99ef4785b60e0d7181565b6100d16100bc36600461040b565b60006020819052908152604090205460ff1681565b6040519015158152602001610080565b3360009081526020819052604090205460ff161561013a5760405162461bcd60e51b8152602060048201526011602482015270105b1c9958591e481c1c9bd8d95cdcd959607a1b60448201526064015b60405180910390fd5b6040516333fa989b60e21b815233600482015260009073acb2f7105ad6df25fecea32b99ef4785b60e0d719063cfea626c90602401600060405180830381865afa15801561018c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101b49190810190610451565b905080516000036102075760405162461bcd60e51b815260206004820152601d60248201527f55736572206973206e6f7420656c696769626c6520746f20636c61696d0000006044820152606401610131565b336000908152602081905260408120805460ff191660011790555b815181101561030057600282828151811061023f5761023f61050f565b60200260200101511161025c57610257336006610304565b6102ee565b60048282815181106102705761027061050f565b60200260200101511161028857610257336007610304565b81818151811061029a5761029a61050f565b60200260200101516005036102b457610257336008610304565b60405162461bcd60e51b815260206004820152600f60248201526e77726f6e67204e465420636c61737360881b6044820152606401610131565b806102f881610525565b915050610222565b5050565b604051633c65b3eb60e01b815260048101829052600090739c02e4aeb4a29084553b5fdc3b5f6df72f11e10490633c65b3eb906024016020604051808303816000875af1158015610359573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037d919061054c565b604051633263830f60e21b81526001600160a01b038516600482015260248101829052909150739c02e4aeb4a29084553b5fdc3b5f6df72f11e1049063c98e0c3c906044016020604051808303816000875af11580156103e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104059190610565565b50505050565b60006020828403121561041d57600080fd5b81356001600160a01b038116811461043457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561046457600080fd5b825167ffffffffffffffff8082111561047c57600080fd5b818501915085601f83011261049057600080fd5b8151818111156104a2576104a261043b565b8060051b604051601f19603f830116810181811085821117156104c7576104c761043b565b6040529182528482019250838101850191888311156104e557600080fd5b938501935b82851015610503578451845293850193928501926104ea565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161054557634e487b7160e01b600052601160045260246000fd5b5060010190565b60006020828403121561055e57600080fd5b5051919050565b60006020828403121561057757600080fd5b8151801515811461043457600080fdfea26469706673582212208a28ce34d757a9a1c5ea42f4f8794a3f6cf746da72235dd6d39a30f0d84bc1e164736f6c63430008130033
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806347ccca02146100515780634e71d92d146100895780639711715a14610093578063d2157a2d146100ae575b600080fd5b61006c739c02e4aeb4a29084553b5fdc3b5f6df72f11e10481565b6040516001600160a01b0390911681526020015b60405180910390f35b6100916100e1565b005b61006c73acb2f7105ad6df25fecea32b99ef4785b60e0d7181565b6100d16100bc36600461040b565b60006020819052908152604090205460ff1681565b6040519015158152602001610080565b3360009081526020819052604090205460ff161561013a5760405162461bcd60e51b8152602060048201526011602482015270105b1c9958591e481c1c9bd8d95cdcd959607a1b60448201526064015b60405180910390fd5b6040516333fa989b60e21b815233600482015260009073acb2f7105ad6df25fecea32b99ef4785b60e0d719063cfea626c90602401600060405180830381865afa15801561018c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101b49190810190610451565b905080516000036102075760405162461bcd60e51b815260206004820152601d60248201527f55736572206973206e6f7420656c696769626c6520746f20636c61696d0000006044820152606401610131565b336000908152602081905260408120805460ff191660011790555b815181101561030057600282828151811061023f5761023f61050f565b60200260200101511161025c57610257336006610304565b6102ee565b60048282815181106102705761027061050f565b60200260200101511161028857610257336007610304565b81818151811061029a5761029a61050f565b60200260200101516005036102b457610257336008610304565b60405162461bcd60e51b815260206004820152600f60248201526e77726f6e67204e465420636c61737360881b6044820152606401610131565b806102f881610525565b915050610222565b5050565b604051633c65b3eb60e01b815260048101829052600090739c02e4aeb4a29084553b5fdc3b5f6df72f11e10490633c65b3eb906024016020604051808303816000875af1158015610359573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037d919061054c565b604051633263830f60e21b81526001600160a01b038516600482015260248101829052909150739c02e4aeb4a29084553b5fdc3b5f6df72f11e1049063c98e0c3c906044016020604051808303816000875af11580156103e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104059190610565565b50505050565b60006020828403121561041d57600080fd5b81356001600160a01b038116811461043457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561046457600080fd5b825167ffffffffffffffff8082111561047c57600080fd5b818501915085601f83011261049057600080fd5b8151818111156104a2576104a261043b565b8060051b604051601f19603f830116810181811085821117156104c7576104c761043b565b6040529182528482019250838101850191888311156104e557600080fd5b938501935b82851015610503578451845293850193928501926104ea565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161054557634e487b7160e01b600052601160045260246000fd5b5060010190565b60006020828403121561055e57600080fd5b5051919050565b60006020828403121561057757600080fd5b8151801515811461043457600080fdfea26469706673582212208a28ce34d757a9a1c5ea42f4f8794a3f6cf746da72235dd6d39a30f0d84bc1e164736f6c63430008130033