APE Price: $1.35 (-1.45%)

Contract

0x97A3f5f2e40C5e4312EdD1FB7B1ba31D8Ea6d9fd

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x6080604036925152024-11-06 18:10:5519 days ago1730916655IN
 Create: TransferToNull
0 APE0.0186561125.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];

        // Check if the user needs to be moved to a higher or lower tier
        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"}]

6080604052348015600f57600080fd5b50604051610c6b380380610c6b833981016040819052602c916050565b600080546001600160a01b0319166001600160a01b0392909216919091179055607e565b600060208284031215606157600080fd5b81516001600160a01b0381168114607757600080fd5b9392505050565b610bde8061008d6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80639c84a61d116100715780639c84a61d14610149578063aae282e114610151578063b45aae5214610164578063cdc0917914610190578063da2d0ed514610198578063e44feaf5146101c657600080fd5b806302cf64c6146100ae57806321c7557c146100de5780632cce89c61461010e5780638c5f49e01461012357806390029b5a14610136575b600080fd5b6100c16100bc3660046109c1565b6101db565b6040516001600160a01b0390911681526020015b60405180910390f35b6101016100ec3660046109f2565b60026020526000908152604090205460ff1681565b6040516100d59190610a2c565b610116610205565b6040516100d59190610a54565b6100c16101313660046109c1565b610267565b6100c16101443660046109c1565b610277565b610116610287565b6000546100c1906001600160a01b031681565b6101016101723660046109f2565b6001600160a01b031660009081526002602052604090205460ff1690565b6101166102e7565b6101b86101a63660046109f2565b60016020526000908152604090205481565b6040519081526020016100d5565b6101d96101d4366004610aa0565b610347565b005b600381815481106101eb57600080fd5b6000918252602090912001546001600160a01b0316905081565b6060600580548060200260200160405190810160405280929190818152602001828054801561025d57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161023f575b5050505050905090565b600581815481106101eb57600080fd5b600481815481106101eb57600080fd5b6060600480548060200260200160405190810160405280929190818152602001828054801561025d576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161023f575050505050905090565b6060600380548060200260200160405190810160405280929190818152602001828054801561025d576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161023f575050505050905090565b600080546001600160a01b0316905b8281101561055557600084848381811061037257610372610b17565b9050602002013590506000836001600160a01b0316636352211e836040518263ffffffff1660e01b81526004016103ab91815260200190565b602060405180830381865afa1580156103c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ec9190610b2d565b90506001600160a01b03811633146104585760405162461bcd60e51b815260206004820152602560248201527f596f75206d757374206f776e2074686520746f6b656e20746f207472616e7366604482015264195c881a5d60da1b606482015260840160405180910390fd5b60405163095ea7b360e01b8152306004820152602481018390526001600160a01b0385169063095ea7b390604401600060405180830381600087803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50506040516323b872dd60e01b81526001600160a01b0384811660048301526000602483015260448201869052871692506323b872dd9150606401600060405180830381600087803b15801561050957600080fd5b505af115801561051d573d6000803e3d6000fd5b505033600090815260016020526040812080549350915061053d83610b60565b919050555061054b3361055b565b5050600101610356565b50505050565b6001600160a01b038116600090815260016020526040902054601981106106415760016001600160a01b03831660009081526002602052604090205460ff1660038111156105ab576105ab610a16565b1461063d576001600160a01b0382166000908152600260205260409020546105d69060ff1683610855565b6003805460018082019092557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0385169081179091556000908152600260205260409020805460ff191682805b02179055505b5050565b600f811061070f5760026001600160a01b03831660009081526002602052604090205460ff16600381111561067857610678610a16565b1461063d576001600160a01b0382166000908152600260205260409020546106a39060ff1683610855565b6004805460018082019092557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b038516908117909155600090815260026020819052604090912080549192909160ff19169083610637565b600581106107db5760036001600160a01b03831660009081526002602052604090205460ff16600381111561074657610746610a16565b1461063d576001600160a01b0382166000908152600260205260409020546107719060ff1683610855565b6005805460018082019092557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b0319166001600160a01b0385169081179091556000908152600260205260409020805460039260ff199091169083610637565b6001600160a01b03821660009081526002602052604081205460ff16600381111561080857610808610a16565b1461063d576001600160a01b0382166000908152600260205260409020546108339060ff1683610855565b506001600160a01b03166000908152600260205260409020805460ff19169055565b600182600381111561086957610869610a16565b036108795761063d6003826108bd565b600282600381111561088d5761088d610a16565b0361089d5761063d6004826108bd565b60038260038111156108b1576108b1610a16565b0361063d5761063d6005825b60005b82548110156109bc57816001600160a01b03168382815481106108e5576108e5610b17565b6000918252602090912001546001600160a01b0316036109b4578254839061090f90600190610b79565b8154811061091f5761091f610b17565b9060005260206000200160009054906101000a90046001600160a01b031683828154811061094f5761094f610b17565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508280548061098d5761098d610b92565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6001016108c0565b505050565b6000602082840312156109d357600080fd5b5035919050565b6001600160a01b03811681146109ef57600080fd5b50565b600060208284031215610a0457600080fd5b8135610a0f816109da565b9392505050565b634e487b7160e01b600052602160045260246000fd5b6020810160048310610a4e57634e487b7160e01b600052602160045260246000fd5b91905290565b602080825282518282018190526000918401906040840190835b81811015610a955783516001600160a01b0316835260209384019390920191600101610a6e565b509095945050505050565b60008060208385031215610ab357600080fd5b823567ffffffffffffffff811115610aca57600080fd5b8301601f81018513610adb57600080fd5b803567ffffffffffffffff811115610af257600080fd5b8560208260051b8401011115610b0757600080fd5b6020919091019590945092505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610b3f57600080fd5b8151610a0f816109da565b634e487b7160e01b600052601160045260246000fd5b600060018201610b7257610b72610b4a565b5060010190565b81810381811115610b8c57610b8c610b4a565b92915050565b634e487b7160e01b600052603160045260246000fdfea264697066735822122097ccea4e944cffc81ffd13f3619bfb6fc07d8b8ef1bf295e8de810f1ce8911ec64736f6c634300081b003300000000000000000000000019e79f9db731b92f581d3ef0e6328ae918bb88ce

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80639c84a61d116100715780639c84a61d14610149578063aae282e114610151578063b45aae5214610164578063cdc0917914610190578063da2d0ed514610198578063e44feaf5146101c657600080fd5b806302cf64c6146100ae57806321c7557c146100de5780632cce89c61461010e5780638c5f49e01461012357806390029b5a14610136575b600080fd5b6100c16100bc3660046109c1565b6101db565b6040516001600160a01b0390911681526020015b60405180910390f35b6101016100ec3660046109f2565b60026020526000908152604090205460ff1681565b6040516100d59190610a2c565b610116610205565b6040516100d59190610a54565b6100c16101313660046109c1565b610267565b6100c16101443660046109c1565b610277565b610116610287565b6000546100c1906001600160a01b031681565b6101016101723660046109f2565b6001600160a01b031660009081526002602052604090205460ff1690565b6101166102e7565b6101b86101a63660046109f2565b60016020526000908152604090205481565b6040519081526020016100d5565b6101d96101d4366004610aa0565b610347565b005b600381815481106101eb57600080fd5b6000918252602090912001546001600160a01b0316905081565b6060600580548060200260200160405190810160405280929190818152602001828054801561025d57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161023f575b5050505050905090565b600581815481106101eb57600080fd5b600481815481106101eb57600080fd5b6060600480548060200260200160405190810160405280929190818152602001828054801561025d576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161023f575050505050905090565b6060600380548060200260200160405190810160405280929190818152602001828054801561025d576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161023f575050505050905090565b600080546001600160a01b0316905b8281101561055557600084848381811061037257610372610b17565b9050602002013590506000836001600160a01b0316636352211e836040518263ffffffff1660e01b81526004016103ab91815260200190565b602060405180830381865afa1580156103c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ec9190610b2d565b90506001600160a01b03811633146104585760405162461bcd60e51b815260206004820152602560248201527f596f75206d757374206f776e2074686520746f6b656e20746f207472616e7366604482015264195c881a5d60da1b606482015260840160405180910390fd5b60405163095ea7b360e01b8152306004820152602481018390526001600160a01b0385169063095ea7b390604401600060405180830381600087803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50506040516323b872dd60e01b81526001600160a01b0384811660048301526000602483015260448201869052871692506323b872dd9150606401600060405180830381600087803b15801561050957600080fd5b505af115801561051d573d6000803e3d6000fd5b505033600090815260016020526040812080549350915061053d83610b60565b919050555061054b3361055b565b5050600101610356565b50505050565b6001600160a01b038116600090815260016020526040902054601981106106415760016001600160a01b03831660009081526002602052604090205460ff1660038111156105ab576105ab610a16565b1461063d576001600160a01b0382166000908152600260205260409020546105d69060ff1683610855565b6003805460018082019092557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0385169081179091556000908152600260205260409020805460ff191682805b02179055505b5050565b600f811061070f5760026001600160a01b03831660009081526002602052604090205460ff16600381111561067857610678610a16565b1461063d576001600160a01b0382166000908152600260205260409020546106a39060ff1683610855565b6004805460018082019092557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b038516908117909155600090815260026020819052604090912080549192909160ff19169083610637565b600581106107db5760036001600160a01b03831660009081526002602052604090205460ff16600381111561074657610746610a16565b1461063d576001600160a01b0382166000908152600260205260409020546107719060ff1683610855565b6005805460018082019092557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b0319166001600160a01b0385169081179091556000908152600260205260409020805460039260ff199091169083610637565b6001600160a01b03821660009081526002602052604081205460ff16600381111561080857610808610a16565b1461063d576001600160a01b0382166000908152600260205260409020546108339060ff1683610855565b506001600160a01b03166000908152600260205260409020805460ff19169055565b600182600381111561086957610869610a16565b036108795761063d6003826108bd565b600282600381111561088d5761088d610a16565b0361089d5761063d6004826108bd565b60038260038111156108b1576108b1610a16565b0361063d5761063d6005825b60005b82548110156109bc57816001600160a01b03168382815481106108e5576108e5610b17565b6000918252602090912001546001600160a01b0316036109b4578254839061090f90600190610b79565b8154811061091f5761091f610b17565b9060005260206000200160009054906101000a90046001600160a01b031683828154811061094f5761094f610b17565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508280548061098d5761098d610b92565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6001016108c0565b505050565b6000602082840312156109d357600080fd5b5035919050565b6001600160a01b03811681146109ef57600080fd5b50565b600060208284031215610a0457600080fd5b8135610a0f816109da565b9392505050565b634e487b7160e01b600052602160045260246000fd5b6020810160048310610a4e57634e487b7160e01b600052602160045260246000fd5b91905290565b602080825282518282018190526000918401906040840190835b81811015610a955783516001600160a01b0316835260209384019390920191600101610a6e565b509095945050505050565b60008060208385031215610ab357600080fd5b823567ffffffffffffffff811115610aca57600080fd5b8301601f81018513610adb57600080fd5b803567ffffffffffffffff811115610af257600080fd5b8560208260051b8401011115610b0757600080fd5b6020919091019590945092505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610b3f57600080fd5b8151610a0f816109da565b634e487b7160e01b600052601160045260246000fd5b600060018201610b7257610b72610b4a565b5060010190565b81810381811115610b8c57610b8c610b4a565b92915050565b634e487b7160e01b600052603160045260246000fdfea264697066735822122097ccea4e944cffc81ffd13f3619bfb6fc07d8b8ef1bf295e8de810f1ce8911ec64736f6c634300081b0033

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.