APE Price: $1.09 (+5.78%)

Contract

0x26bFa66EC90678a5D3Ee84AdcB10E7F278203F33

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Burn Count37140902024-11-06 22:54:306 hrs ago1730933670IN
0x26bFa66E...278203F33
0 APE0.0024007525.42069
Set Burn Count37131922024-11-06 22:42:447 hrs ago1730932964IN
0x26bFa66E...278203F33
0 APE0.0007514625.42069
Set Burn Count37131652024-11-06 22:42:287 hrs ago1730932948IN
0x26bFa66E...278203F33
0 APE0.0007514625.42069
Set Burn Count37131272024-11-06 22:42:017 hrs ago1730932921IN
0x26bFa66E...278203F33
0 APE0.0007514625.42069
Set Burn Count37127652024-11-06 22:37:367 hrs ago1730932656IN
0x26bFa66E...278203F33
0 APE0.0011861525.42069
0x6080604037124352024-11-06 22:33:137 hrs ago1730932393IN
 Create: BurnManager
0 APE0.0195791625.42069

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BurnManager

Compiler Version
v0.8.27+commit.40a35a09

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 1 : BurnManger.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 BurnManager {
    address public nftContractAddress;

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

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

    // 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 transfer multiple NFTs to the null address (0x0) and update burn count
    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 and transfer the token to the null address (0x0)
            nft.approve(address(this), tokenId);
            nft.transferFrom(owner, address(0), tokenId);

            // Track the number of NFTs burned by the caller
            setBurnCount(msg.sender, burnedNFTs[msg.sender] + 1);
        }
    }

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

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

    // 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];
    }
}

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 BurnManager.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 BurnManager.Tier","name":"","type":"uint8"}],"stateMutability":"view","type":"function"}]

6080604052348015600f57600080fd5b50604051610d13380380610d13833981016040819052602c916050565b600080546001600160a01b0319166001600160a01b0392909216919091179055607e565b600060208284031215606157600080fd5b81516001600160a01b0381168114607757600080fd5b9392505050565b610c868061008d6000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063956994af1161008c578063b45aae5211610066578063b45aae52146101d6578063cdc0917914610202578063da2d0ed51461020a578063e44feaf51461022a57600080fd5b8063956994af146101a65780639c84a61d146101bb578063aae282e1146101c357600080fd5b806302cf64c6146100d45780631d30fa161461010457806321c7557c1461013b5780632cce89c61461016b5780638c5f49e01461018057806390029b5a14610193575b600080fd5b6100e76100e2366004610a43565b61023d565b6040516001600160a01b0390911681526020015b60405180910390f35b61012d610112366004610a74565b6001600160a01b031660009081526001602052604090205490565b6040519081526020016100fb565b61015e610149366004610a74565b60026020526000908152604090205460ff1681565b6040516100fb9190610aae565b610173610267565b6040516100fb9190610ad6565b6100e761018e366004610a43565b6102c9565b6100e76101a1366004610a43565b6102d9565b6101b96101b4366004610b22565b6102e9565b005b610173610311565b6000546100e7906001600160a01b031681565b61015e6101e4366004610a74565b6001600160a01b031660009081526002602052604090205460ff1690565b610173610371565b61012d610218366004610a74565b60016020526000908152604090205481565b6101b9610238366004610b4e565b6103d1565b6003818154811061024d57600080fd5b6000918252602090912001546001600160a01b0316905081565b606060058054806020026020016040519081016040528092919081815260200182805480156102bf57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116102a1575b5050505050905090565b6005818154811061024d57600080fd5b6004818154811061024d57600080fd5b6001600160a01b038216600090815260016020526040902081905561030d826105de565b5050565b606060048054806020026020016040519081016040528092919081815260200182805480156102bf576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116102a1575050505050905090565b606060038054806020026020016040519081016040528092919081815260200182805480156102bf576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116102a1575050505050905090565b600080546001600160a01b0316905b828110156105d85760008484838181106103fc576103fc610bc5565b9050602002013590506000836001600160a01b0316636352211e836040518263ffffffff1660e01b815260040161043591815260200190565b602060405180830381865afa158015610452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104769190610bdb565b90506001600160a01b03811633146104e25760405162461bcd60e51b815260206004820152602560248201527f596f75206d757374206f776e2074686520746f6b656e20746f207472616e7366604482015264195c881a5d60da1b606482015260840160405180910390fd5b60405163095ea7b360e01b8152306004820152602481018390526001600160a01b0385169063095ea7b390604401600060405180830381600087803b15801561052a57600080fd5b505af115801561053e573d6000803e3d6000fd5b50506040516323b872dd60e01b81526001600160a01b0384811660048301526000602483015260448201869052871692506323b872dd9150606401600060405180830381600087803b15801561059357600080fd5b505af11580156105a7573d6000803e3d6000fd5b5050336000818152600160208190526040909120546105ce94509192506101b49190610c0e565b50506001016103e0565b50505050565b6001600160a01b038116600090815260016020526040902054601981106106c85760036001600160a01b03831660009081526002602052604090205460ff16600381111561062e5761062e610a98565b1461030d576001600160a01b0382166000908152600260205260409020546106599060ff16836108d7565b60038054600180820183557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90910180546001600160a01b0319166001600160a01b03861690811790915560009081526002602052604090208054909160ff1990911690835b02179055505050565b600f81106107965760026001600160a01b03831660009081526002602052604090205460ff1660038111156106ff576106ff610a98565b1461030d576001600160a01b03821660009081526002602052604090205461072a9060ff16836108d7565b6004805460018082019092557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b038516908117909155600090815260026020819052604090912080549192909160ff191690836106bf565b6005811061085d5760016001600160a01b03831660009081526002602052604090205460ff1660038111156107cd576107cd610a98565b1461030d576001600160a01b0382166000908152600260205260409020546107f89060ff16836108d7565b6005805460018082019092557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b0319166001600160a01b0385169081179091556000908152600260205260409020805460ff191682806106bf565b6001600160a01b03821660009081526002602052604081205460ff16600381111561088a5761088a610a98565b1461030d576001600160a01b0382166000908152600260205260409020546108b59060ff16836108d7565b506001600160a01b03166000908152600260205260409020805460ff19169055565b60038260038111156108eb576108eb610a98565b036108fb5761030d60038261093f565b600282600381111561090f5761090f610a98565b0361091f5761030d60048261093f565b600182600381111561093357610933610a98565b0361030d5761030d6005825b60005b8254811015610a3e57816001600160a01b031683828154811061096757610967610bc5565b6000918252602090912001546001600160a01b031603610a36578254839061099190600190610c27565b815481106109a1576109a1610bc5565b9060005260206000200160009054906101000a90046001600160a01b03168382815481106109d1576109d1610bc5565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555082805480610a0f57610a0f610c3a565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b600101610942565b505050565b600060208284031215610a5557600080fd5b5035919050565b6001600160a01b0381168114610a7157600080fd5b50565b600060208284031215610a8657600080fd5b8135610a9181610a5c565b9392505050565b634e487b7160e01b600052602160045260246000fd5b6020810160048310610ad057634e487b7160e01b600052602160045260246000fd5b91905290565b602080825282518282018190526000918401906040840190835b81811015610b175783516001600160a01b0316835260209384019390920191600101610af0565b509095945050505050565b60008060408385031215610b3557600080fd5b8235610b4081610a5c565b946020939093013593505050565b60008060208385031215610b6157600080fd5b823567ffffffffffffffff811115610b7857600080fd5b8301601f81018513610b8957600080fd5b803567ffffffffffffffff811115610ba057600080fd5b8560208260051b8401011115610bb557600080fd5b6020919091019590945092505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610bed57600080fd5b8151610a9181610a5c565b634e487b7160e01b600052601160045260246000fd5b80820180821115610c2157610c21610bf8565b92915050565b81810381811115610c2157610c21610bf8565b634e487b7160e01b600052603160045260246000fdfea26469706673582212206c1f36bdacd1df5307a5f1d046d9d4db92d1e6b0429bd3a94724719a7623ea3664736f6c634300081b003300000000000000000000000019e79f9db731b92f581d3ef0e6328ae918bb88ce

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063956994af1161008c578063b45aae5211610066578063b45aae52146101d6578063cdc0917914610202578063da2d0ed51461020a578063e44feaf51461022a57600080fd5b8063956994af146101a65780639c84a61d146101bb578063aae282e1146101c357600080fd5b806302cf64c6146100d45780631d30fa161461010457806321c7557c1461013b5780632cce89c61461016b5780638c5f49e01461018057806390029b5a14610193575b600080fd5b6100e76100e2366004610a43565b61023d565b6040516001600160a01b0390911681526020015b60405180910390f35b61012d610112366004610a74565b6001600160a01b031660009081526001602052604090205490565b6040519081526020016100fb565b61015e610149366004610a74565b60026020526000908152604090205460ff1681565b6040516100fb9190610aae565b610173610267565b6040516100fb9190610ad6565b6100e761018e366004610a43565b6102c9565b6100e76101a1366004610a43565b6102d9565b6101b96101b4366004610b22565b6102e9565b005b610173610311565b6000546100e7906001600160a01b031681565b61015e6101e4366004610a74565b6001600160a01b031660009081526002602052604090205460ff1690565b610173610371565b61012d610218366004610a74565b60016020526000908152604090205481565b6101b9610238366004610b4e565b6103d1565b6003818154811061024d57600080fd5b6000918252602090912001546001600160a01b0316905081565b606060058054806020026020016040519081016040528092919081815260200182805480156102bf57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116102a1575b5050505050905090565b6005818154811061024d57600080fd5b6004818154811061024d57600080fd5b6001600160a01b038216600090815260016020526040902081905561030d826105de565b5050565b606060048054806020026020016040519081016040528092919081815260200182805480156102bf576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116102a1575050505050905090565b606060038054806020026020016040519081016040528092919081815260200182805480156102bf576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116102a1575050505050905090565b600080546001600160a01b0316905b828110156105d85760008484838181106103fc576103fc610bc5565b9050602002013590506000836001600160a01b0316636352211e836040518263ffffffff1660e01b815260040161043591815260200190565b602060405180830381865afa158015610452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104769190610bdb565b90506001600160a01b03811633146104e25760405162461bcd60e51b815260206004820152602560248201527f596f75206d757374206f776e2074686520746f6b656e20746f207472616e7366604482015264195c881a5d60da1b606482015260840160405180910390fd5b60405163095ea7b360e01b8152306004820152602481018390526001600160a01b0385169063095ea7b390604401600060405180830381600087803b15801561052a57600080fd5b505af115801561053e573d6000803e3d6000fd5b50506040516323b872dd60e01b81526001600160a01b0384811660048301526000602483015260448201869052871692506323b872dd9150606401600060405180830381600087803b15801561059357600080fd5b505af11580156105a7573d6000803e3d6000fd5b5050336000818152600160208190526040909120546105ce94509192506101b49190610c0e565b50506001016103e0565b50505050565b6001600160a01b038116600090815260016020526040902054601981106106c85760036001600160a01b03831660009081526002602052604090205460ff16600381111561062e5761062e610a98565b1461030d576001600160a01b0382166000908152600260205260409020546106599060ff16836108d7565b60038054600180820183557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90910180546001600160a01b0319166001600160a01b03861690811790915560009081526002602052604090208054909160ff1990911690835b02179055505050565b600f81106107965760026001600160a01b03831660009081526002602052604090205460ff1660038111156106ff576106ff610a98565b1461030d576001600160a01b03821660009081526002602052604090205461072a9060ff16836108d7565b6004805460018082019092557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b038516908117909155600090815260026020819052604090912080549192909160ff191690836106bf565b6005811061085d5760016001600160a01b03831660009081526002602052604090205460ff1660038111156107cd576107cd610a98565b1461030d576001600160a01b0382166000908152600260205260409020546107f89060ff16836108d7565b6005805460018082019092557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b0319166001600160a01b0385169081179091556000908152600260205260409020805460ff191682806106bf565b6001600160a01b03821660009081526002602052604081205460ff16600381111561088a5761088a610a98565b1461030d576001600160a01b0382166000908152600260205260409020546108b59060ff16836108d7565b506001600160a01b03166000908152600260205260409020805460ff19169055565b60038260038111156108eb576108eb610a98565b036108fb5761030d60038261093f565b600282600381111561090f5761090f610a98565b0361091f5761030d60048261093f565b600182600381111561093357610933610a98565b0361030d5761030d6005825b60005b8254811015610a3e57816001600160a01b031683828154811061096757610967610bc5565b6000918252602090912001546001600160a01b031603610a36578254839061099190600190610c27565b815481106109a1576109a1610bc5565b9060005260206000200160009054906101000a90046001600160a01b03168382815481106109d1576109d1610bc5565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555082805480610a0f57610a0f610c3a565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b600101610942565b505050565b600060208284031215610a5557600080fd5b5035919050565b6001600160a01b0381168114610a7157600080fd5b50565b600060208284031215610a8657600080fd5b8135610a9181610a5c565b9392505050565b634e487b7160e01b600052602160045260246000fd5b6020810160048310610ad057634e487b7160e01b600052602160045260246000fd5b91905290565b602080825282518282018190526000918401906040840190835b81811015610b175783516001600160a01b0316835260209384019390920191600101610af0565b509095945050505050565b60008060408385031215610b3557600080fd5b8235610b4081610a5c565b946020939093013593505050565b60008060208385031215610b6157600080fd5b823567ffffffffffffffff811115610b7857600080fd5b8301601f81018513610b8957600080fd5b803567ffffffffffffffff811115610ba057600080fd5b8560208260051b8401011115610bb557600080fd5b6020919091019590945092505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610bed57600080fd5b8151610a9181610a5c565b634e487b7160e01b600052601160045260246000fd5b80820180821115610c2157610c21610bf8565b92915050565b81810381811115610c2157610c21610bf8565b634e487b7160e01b600052603160045260246000fdfea26469706673582212206c1f36bdacd1df5307a5f1d046d9d4db92d1e6b0429bd3a94724719a7623ea3664736f6c634300081b0033

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.