APE Price: $1.20 (+4.91%)

Contract

0x642D24c80aaE7d99911b0D6A76791b438b7D8644

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x6080604037117982024-11-06 22:24:3315 days ago1730931873IN
 Contract Creation
0 APE0.0196502125.42069

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x9042C8e4...e0f8D0e9F
The constructor portion of the code might be different and could alter the actual behaviour of the contract

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;
    function burn(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;
    }

    // Function to check how many NFTs an address has burned
    function getBurnedCount(address user) public view returns (uint256) {
        return burnedNFTs[user];
    }

    // External function to manually update the burn count (for external calls)
    function setBurnCount(address user, uint256 count) external {
        burnedNFTs[user] = count;
        updateTier(user); // Ensure tier is updated after setting burn count
    }
}

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":"getBurnedCount","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":"address","name":"user","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"setBurnCount","outputs":[],"stateMutability":"nonpayable","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"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063956994af1161008c578063b45aae5211610066578063b45aae52146101d6578063cdc0917914610202578063da2d0ed51461020a578063e44feaf51461022a57600080fd5b8063956994af146101a65780639c84a61d146101bb578063aae282e1146101c357600080fd5b806302cf64c6146100d45780631d30fa161461010457806321c7557c1461013b5780632cce89c61461016b5780638c5f49e01461018057806390029b5a14610193575b600080fd5b6100e76100e2366004610a4a565b61023d565b6040516001600160a01b0390911681526020015b60405180910390f35b61012d610112366004610a7b565b6001600160a01b031660009081526001602052604090205490565b6040519081526020016100fb565b61015e610149366004610a7b565b60026020526000908152604090205460ff1681565b6040516100fb9190610ab5565b610173610267565b6040516100fb9190610add565b6100e761018e366004610a4a565b6102c9565b6100e76101a1366004610a4a565b6102d9565b6101b96101b4366004610b29565b6102e9565b005b610173610311565b6000546100e7906001600160a01b031681565b61015e6101e4366004610a7b565b6001600160a01b031660009081526002602052604090205460ff1690565b610173610371565b61012d610218366004610a7b565b60016020526000908152604090205481565b6101b9610238366004610b55565b6103d1565b6003818154811061024d57600080fd5b6000918252602090912001546001600160a01b0316905081565b606060058054806020026020016040519081016040528092919081815260200182805480156102bf57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116102a1575b5050505050905090565b6005818154811061024d57600080fd5b6004818154811061024d57600080fd5b6001600160a01b038216600090815260016020526040902081905561030d826105e5565b5050565b606060048054806020026020016040519081016040528092919081815260200182805480156102bf576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116102a1575050505050905090565b606060038054806020026020016040519081016040528092919081815260200182805480156102bf576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116102a1575050505050905090565b600080546001600160a01b0316905b828110156105df5760008484838181106103fc576103fc610bcc565b9050602002013590506000836001600160a01b0316636352211e836040518263ffffffff1660e01b815260040161043591815260200190565b602060405180830381865afa158015610452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104769190610be2565b90506001600160a01b03811633146104e25760405162461bcd60e51b815260206004820152602560248201527f596f75206d757374206f776e2074686520746f6b656e20746f207472616e7366604482015264195c881a5d60da1b606482015260840160405180910390fd5b60405163095ea7b360e01b8152306004820152602481018390526001600160a01b0385169063095ea7b390604401600060405180830381600087803b15801561052a57600080fd5b505af115801561053e573d6000803e3d6000fd5b50506040516323b872dd60e01b81526001600160a01b0384811660048301526000602483015260448201869052871692506323b872dd9150606401600060405180830381600087803b15801561059357600080fd5b505af11580156105a7573d6000803e3d6000fd5b50503360009081526001602052604081208054935091506105c783610c15565b91905055506105d5336105e5565b50506001016103e0565b50505050565b6001600160a01b038116600090815260016020526040902054601981106106ca5760016001600160a01b03831660009081526002602052604090205460ff16600381111561063557610635610a9f565b1461030d576001600160a01b0382166000908152600260205260409020546106609060ff16836108de565b6003805460018082019092557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0385169081179091556000908152600260205260409020805460ff191682805b02179055505050565b600f81106107985760026001600160a01b03831660009081526002602052604090205460ff16600381111561070157610701610a9f565b1461030d576001600160a01b03821660009081526002602052604090205461072c9060ff16836108de565b6004805460018082019092557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b038516908117909155600090815260026020819052604090912080549192909160ff191690836106c1565b600581106108645760036001600160a01b03831660009081526002602052604090205460ff1660038111156107cf576107cf610a9f565b1461030d576001600160a01b0382166000908152600260205260409020546107fa9060ff16836108de565b6005805460018082019092557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b0319166001600160a01b0385169081179091556000908152600260205260409020805460039260ff1990911690836106c1565b6001600160a01b03821660009081526002602052604081205460ff16600381111561089157610891610a9f565b1461030d576001600160a01b0382166000908152600260205260409020546108bc9060ff16836108de565b506001600160a01b03166000908152600260205260409020805460ff19169055565b60018260038111156108f2576108f2610a9f565b036109025761030d600382610946565b600282600381111561091657610916610a9f565b036109265761030d600482610946565b600382600381111561093a5761093a610a9f565b0361030d5761030d6005825b60005b8254811015610a4557816001600160a01b031683828154811061096e5761096e610bcc565b6000918252602090912001546001600160a01b031603610a3d578254839061099890600190610c2e565b815481106109a8576109a8610bcc565b9060005260206000200160009054906101000a90046001600160a01b03168382815481106109d8576109d8610bcc565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555082805480610a1657610a16610c47565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b600101610949565b505050565b600060208284031215610a5c57600080fd5b5035919050565b6001600160a01b0381168114610a7857600080fd5b50565b600060208284031215610a8d57600080fd5b8135610a9881610a63565b9392505050565b634e487b7160e01b600052602160045260246000fd5b6020810160048310610ad757634e487b7160e01b600052602160045260246000fd5b91905290565b602080825282518282018190526000918401906040840190835b81811015610b1e5783516001600160a01b0316835260209384019390920191600101610af7565b509095945050505050565b60008060408385031215610b3c57600080fd5b8235610b4781610a63565b946020939093013593505050565b60008060208385031215610b6857600080fd5b823567ffffffffffffffff811115610b7f57600080fd5b8301601f81018513610b9057600080fd5b803567ffffffffffffffff811115610ba757600080fd5b8560208260051b8401011115610bbc57600080fd5b6020919091019590945092505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610bf457600080fd5b8151610a9881610a63565b634e487b7160e01b600052601160045260246000fd5b600060018201610c2757610c27610bff565b5060010190565b81810381811115610c4157610c41610bff565b92915050565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220666e67f127ef5e1b07de61a8748040e823bde90e1d4a4156b35bcda9471b321664736f6c634300081b0033

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.