APE Price: $1.22 (+3.50%)

Contract

0x61a4eaE73B97607CB0dBd1a280d34F06ff3136ad

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x6080604036914172024-11-06 17:49:3816 days ago1730915378IN
 Create: TransferToNull
0 APE0.0188697225.42069

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TransferToNull

Compiler Version
v0.8.27+commit.40a35a09

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 1 : TransferToNull.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC721A {
    function ownerOf(uint256 tokenId) external view returns (address);
    function approve(address to, uint256 tokenId) external;
    function transferFrom(address from, address to, uint256 tokenId) external;
}

contract TransferToNull {
    address public nftContractAddress;

    // Track the number of NFTs burned by each address
    mapping(address => uint256) public burnedNFTs;

    // Enum for tier levels
    enum Tier { None, Tier1, Tier2, Tier3 }

    // Mapping to store user's tier level
    mapping(address => Tier) public userTier;

    // Arrays to store addresses by tier
    address[] public tier1Addresses;
    address[] public tier2Addresses;
    address[] public tier3Addresses;

    // Constructor to set the NFT contract address
    constructor(address _nftContractAddress) {
        nftContractAddress = _nftContractAddress;
    }

    // Function to get the current tier of an address
    function getTier(address user) public view returns (Tier) {
        return userTier[user];
    }

    // Function to transfer multiple NFTs to the null address (0x0)
    function transferToNull(uint256[] calldata tokenIds) external {
        IERC721A nft = IERC721A(nftContractAddress);

        for (uint256 i = 0; i < tokenIds.length; i++) {
            uint256 tokenId = tokenIds[i];
            // Ensure the caller owns the token
            address owner = nft.ownerOf(tokenId);
            require(owner == msg.sender, "You must own the token to transfer it");

            // Approve the transfer to this contract
            nft.approve(address(this), tokenId);

            // Transfer the token to the null address (0x0)
            nft.transferFrom(owner, address(0), tokenId);

            // Track the number of NFTs burned by the caller
            burnedNFTs[msg.sender]++;

            // Update the user's tier based on the number of NFTs burned
            updateTier(msg.sender);
        }
    }

    // Function to update the tier of the user based on the number of NFTs burned
    function updateTier(address user) internal {
        uint256 burnedCount = burnedNFTs[user];

        // Update the tier based on the burn count
        if (burnedCount >= 25) {
            if (userTier[user] != Tier.Tier1) {
                removeFromTier(userTier[user], user);
                tier1Addresses.push(user);
            }
            userTier[user] = Tier.Tier1;
        } else if (burnedCount >= 15) {
            if (userTier[user] != Tier.Tier2) {
                removeFromTier(userTier[user], user);
                tier2Addresses.push(user);
            }
            userTier[user] = Tier.Tier2;
        } else if (burnedCount >= 5) {
            if (userTier[user] != Tier.Tier3) {
                removeFromTier(userTier[user], user);
                tier3Addresses.push(user);
            }
            userTier[user] = Tier.Tier3;
        } else {
            if (userTier[user] != Tier.None) {
                removeFromTier(userTier[user], user);
            }
            userTier[user] = Tier.None;
        }
    }

    // Helper function to remove an address from the previous tier array
    function removeFromTier(Tier oldTier, address user) internal {
        if (oldTier == Tier.Tier1) {
            removeAddressFromArray(tier1Addresses, user);
        } else if (oldTier == Tier.Tier2) {
            removeAddressFromArray(tier2Addresses, user);
        } else if (oldTier == Tier.Tier3) {
            removeAddressFromArray(tier3Addresses, user);
        }
    }

    // Helper function to remove an address from an array
    function removeAddressFromArray(address[] storage tierArray, address user) internal {
        for (uint256 i = 0; i < tierArray.length; i++) {
            if (tierArray[i] == user) {
                tierArray[i] = tierArray[tierArray.length - 1];
                tierArray.pop();
                break;
            }
        }
    }

    // Function to get all addresses of users in Tier 1
    function getTier1Addresses() public view returns (address[] memory) {
        return tier1Addresses;
    }

    // Function to get all addresses of users in Tier 2
    function getTier2Addresses() public view returns (address[] memory) {
        return tier2Addresses;
    }

    // Function to get all addresses of users in Tier 3
    function getTier3Addresses() public view returns (address[] memory) {
        return tier3Addresses;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_nftContractAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"burnedNFTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getTier","outputs":[{"internalType":"enum TransferToNull.Tier","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTier1Addresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTier2Addresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTier3Addresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tier1Addresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tier2Addresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tier3Addresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"transferToNull","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userTier","outputs":[{"internalType":"enum TransferToNull.Tier","name":"","type":"uint8"}],"stateMutability":"view","type":"function"}]

6080604052348015600f57600080fd5b50604051610c92380380610c92833981016040819052602c916050565b600080546001600160a01b0319166001600160a01b0392909216919091179055607e565b600060208284031215606157600080fd5b81516001600160a01b0381168114607757600080fd5b9392505050565b610c058061008d6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80639c84a61d116100715780639c84a61d14610149578063aae282e114610151578063b45aae5214610164578063cdc0917914610190578063da2d0ed514610198578063e44feaf5146101c657600080fd5b806302cf64c6146100ae57806321c7557c146100de5780632cce89c61461010e5780638c5f49e01461012357806390029b5a14610136575b600080fd5b6100c16100bc3660046109e8565b6101db565b6040516001600160a01b0390911681526020015b60405180910390f35b6101016100ec366004610a19565b60026020526000908152604090205460ff1681565b6040516100d59190610a53565b610116610205565b6040516100d59190610a7b565b6100c16101313660046109e8565b610267565b6100c16101443660046109e8565b610277565b610116610287565b6000546100c1906001600160a01b031681565b610101610172366004610a19565b6001600160a01b031660009081526002602052604090205460ff1690565b6101166102e7565b6101b86101a6366004610a19565b60016020526000908152604090205481565b6040519081526020016100d5565b6101d96101d4366004610ac7565b610347565b005b600381815481106101eb57600080fd5b6000918252602090912001546001600160a01b0316905081565b6060600580548060200260200160405190810160405280929190818152602001828054801561025d57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161023f575b5050505050905090565b600581815481106101eb57600080fd5b600481815481106101eb57600080fd5b6060600480548060200260200160405190810160405280929190818152602001828054801561025d576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161023f575050505050905090565b6060600380548060200260200160405190810160405280929190818152602001828054801561025d576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161023f575050505050905090565b600080546001600160a01b0316905b8281101561055557600084848381811061037257610372610b3e565b9050602002013590506000836001600160a01b0316636352211e836040518263ffffffff1660e01b81526004016103ab91815260200190565b602060405180830381865afa1580156103c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ec9190610b54565b90506001600160a01b03811633146104585760405162461bcd60e51b815260206004820152602560248201527f596f75206d757374206f776e2074686520746f6b656e20746f207472616e7366604482015264195c881a5d60da1b606482015260840160405180910390fd5b60405163095ea7b360e01b8152306004820152602481018390526001600160a01b0385169063095ea7b390604401600060405180830381600087803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50506040516323b872dd60e01b81526001600160a01b0384811660048301526000602483015260448201869052871692506323b872dd9150606401600060405180830381600087803b15801561050957600080fd5b505af115801561051d573d6000803e3d6000fd5b505033600090815260016020526040812080549350915061053d83610b87565b919050555061054b3361055b565b5050600101610356565b50505050565b6001600160a01b038116600090815260016020526040902054601981106106505760016001600160a01b03831660009081526002602052604090205460ff1660038111156105ab576105ab610a3d565b14610622576001600160a01b0382166000908152600260205260409020546105d69060ff168361087c565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b038216600090815260026020526040902080546001919060ff191682805b02179055505050565b600f81106107275760026001600160a01b03831660009081526002602052604090205460ff16600381111561068757610687610a3d565b146106fe576001600160a01b0382166000908152600260205260409020546106b29060ff168361087c565b600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b0382166000908152600260208190526040909120805460ff1916600183610647565b600581106107ff5760036001600160a01b03831660009081526002602052604090205460ff16600381111561075e5761075e610a3d565b146107d5576001600160a01b0382166000908152600260205260409020546107899060ff168361087c565b600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b038216600090815260026020526040902080546003919060ff1916600183610647565b6001600160a01b03821660009081526002602052604081205460ff16600381111561082c5761082c610a3d565b14610857576001600160a01b0382166000908152600260205260409020546108579060ff168361087c565b6001600160a01b0382166000908152600260205260409020805460ff191690555b5050565b600182600381111561089057610890610a3d565b036108a0576108786003826108e4565b60028260038111156108b4576108b4610a3d565b036108c4576108786004826108e4565b60038260038111156108d8576108d8610a3d565b03610878576108786005825b60005b82548110156109e357816001600160a01b031683828154811061090c5761090c610b3e565b6000918252602090912001546001600160a01b0316036109db578254839061093690600190610ba0565b8154811061094657610946610b3e565b9060005260206000200160009054906101000a90046001600160a01b031683828154811061097657610976610b3e565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550828054806109b4576109b4610bb9565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6001016108e7565b505050565b6000602082840312156109fa57600080fd5b5035919050565b6001600160a01b0381168114610a1657600080fd5b50565b600060208284031215610a2b57600080fd5b8135610a3681610a01565b9392505050565b634e487b7160e01b600052602160045260246000fd5b6020810160048310610a7557634e487b7160e01b600052602160045260246000fd5b91905290565b602080825282518282018190526000918401906040840190835b81811015610abc5783516001600160a01b0316835260209384019390920191600101610a95565b509095945050505050565b60008060208385031215610ada57600080fd5b823567ffffffffffffffff811115610af157600080fd5b8301601f81018513610b0257600080fd5b803567ffffffffffffffff811115610b1957600080fd5b8560208260051b8401011115610b2e57600080fd5b6020919091019590945092505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610b6657600080fd5b8151610a3681610a01565b634e487b7160e01b600052601160045260246000fd5b600060018201610b9957610b99610b71565b5060010190565b81810381811115610bb357610bb3610b71565b92915050565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220b8441bfd661d4f28331f3c788e5c1bd4902ba8ae98c42ed84dca086245d841d564736f6c634300081b003300000000000000000000000019e79f9db731b92f581d3ef0e6328ae918bb88ce

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80639c84a61d116100715780639c84a61d14610149578063aae282e114610151578063b45aae5214610164578063cdc0917914610190578063da2d0ed514610198578063e44feaf5146101c657600080fd5b806302cf64c6146100ae57806321c7557c146100de5780632cce89c61461010e5780638c5f49e01461012357806390029b5a14610136575b600080fd5b6100c16100bc3660046109e8565b6101db565b6040516001600160a01b0390911681526020015b60405180910390f35b6101016100ec366004610a19565b60026020526000908152604090205460ff1681565b6040516100d59190610a53565b610116610205565b6040516100d59190610a7b565b6100c16101313660046109e8565b610267565b6100c16101443660046109e8565b610277565b610116610287565b6000546100c1906001600160a01b031681565b610101610172366004610a19565b6001600160a01b031660009081526002602052604090205460ff1690565b6101166102e7565b6101b86101a6366004610a19565b60016020526000908152604090205481565b6040519081526020016100d5565b6101d96101d4366004610ac7565b610347565b005b600381815481106101eb57600080fd5b6000918252602090912001546001600160a01b0316905081565b6060600580548060200260200160405190810160405280929190818152602001828054801561025d57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161023f575b5050505050905090565b600581815481106101eb57600080fd5b600481815481106101eb57600080fd5b6060600480548060200260200160405190810160405280929190818152602001828054801561025d576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161023f575050505050905090565b6060600380548060200260200160405190810160405280929190818152602001828054801561025d576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161023f575050505050905090565b600080546001600160a01b0316905b8281101561055557600084848381811061037257610372610b3e565b9050602002013590506000836001600160a01b0316636352211e836040518263ffffffff1660e01b81526004016103ab91815260200190565b602060405180830381865afa1580156103c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ec9190610b54565b90506001600160a01b03811633146104585760405162461bcd60e51b815260206004820152602560248201527f596f75206d757374206f776e2074686520746f6b656e20746f207472616e7366604482015264195c881a5d60da1b606482015260840160405180910390fd5b60405163095ea7b360e01b8152306004820152602481018390526001600160a01b0385169063095ea7b390604401600060405180830381600087803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50506040516323b872dd60e01b81526001600160a01b0384811660048301526000602483015260448201869052871692506323b872dd9150606401600060405180830381600087803b15801561050957600080fd5b505af115801561051d573d6000803e3d6000fd5b505033600090815260016020526040812080549350915061053d83610b87565b919050555061054b3361055b565b5050600101610356565b50505050565b6001600160a01b038116600090815260016020526040902054601981106106505760016001600160a01b03831660009081526002602052604090205460ff1660038111156105ab576105ab610a3d565b14610622576001600160a01b0382166000908152600260205260409020546105d69060ff168361087c565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b038216600090815260026020526040902080546001919060ff191682805b02179055505050565b600f81106107275760026001600160a01b03831660009081526002602052604090205460ff16600381111561068757610687610a3d565b146106fe576001600160a01b0382166000908152600260205260409020546106b29060ff168361087c565b600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b0382166000908152600260208190526040909120805460ff1916600183610647565b600581106107ff5760036001600160a01b03831660009081526002602052604090205460ff16600381111561075e5761075e610a3d565b146107d5576001600160a01b0382166000908152600260205260409020546107899060ff168361087c565b600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b038216600090815260026020526040902080546003919060ff1916600183610647565b6001600160a01b03821660009081526002602052604081205460ff16600381111561082c5761082c610a3d565b14610857576001600160a01b0382166000908152600260205260409020546108579060ff168361087c565b6001600160a01b0382166000908152600260205260409020805460ff191690555b5050565b600182600381111561089057610890610a3d565b036108a0576108786003826108e4565b60028260038111156108b4576108b4610a3d565b036108c4576108786004826108e4565b60038260038111156108d8576108d8610a3d565b03610878576108786005825b60005b82548110156109e357816001600160a01b031683828154811061090c5761090c610b3e565b6000918252602090912001546001600160a01b0316036109db578254839061093690600190610ba0565b8154811061094657610946610b3e565b9060005260206000200160009054906101000a90046001600160a01b031683828154811061097657610976610b3e565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550828054806109b4576109b4610bb9565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6001016108e7565b505050565b6000602082840312156109fa57600080fd5b5035919050565b6001600160a01b0381168114610a1657600080fd5b50565b600060208284031215610a2b57600080fd5b8135610a3681610a01565b9392505050565b634e487b7160e01b600052602160045260246000fd5b6020810160048310610a7557634e487b7160e01b600052602160045260246000fd5b91905290565b602080825282518282018190526000918401906040840190835b81811015610abc5783516001600160a01b0316835260209384019390920191600101610a95565b509095945050505050565b60008060208385031215610ada57600080fd5b823567ffffffffffffffff811115610af157600080fd5b8301601f81018513610b0257600080fd5b803567ffffffffffffffff811115610b1957600080fd5b8560208260051b8401011115610b2e57600080fd5b6020919091019590945092505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610b6657600080fd5b8151610a3681610a01565b634e487b7160e01b600052601160045260246000fd5b600060018201610b9957610b99610b71565b5060010190565b81810381811115610bb357610bb3610b71565b92915050565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220b8441bfd661d4f28331f3c788e5c1bd4902ba8ae98c42ed84dca086245d841d564736f6c634300081b0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000019e79f9db731b92f581d3ef0e6328ae918bb88ce

-----Decoded View---------------
Arg [0] : _nftContractAddress (address): 0x19E79f9db731b92f581D3Ef0E6328ae918bb88CE

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000019e79f9db731b92f581d3ef0e6328ae918bb88ce


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.