ETH Price: $2,907.68 (+1.19%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Burn To Upgrade207587572024-09-15 21:37:5953 days ago1726436279IN
0xcF06C49f...CF443A930
0 ETH0.000392581.77148429
Burn To Upgrade190495032024-01-20 17:14:59292 days ago1705770899IN
0xcF06C49f...CF443A930
0 ETH0.0027676515.97032159
Burn To Upgrade178401102023-08-04 7:23:59461 days ago1691133839IN
0xcF06C49f...CF443A930
0 ETH0.0032436914.50582534
Burn To Upgrade177880682023-07-28 0:46:23469 days ago1690505183IN
0xcF06C49f...CF443A930
0 ETH0.0031676918.27869844
Burn To Upgrade174554052023-06-11 7:31:11515 days ago1686468671IN
0xcF06C49f...CF443A930
0 ETH0.0026506617.51836637
Burn To Upgrade173022442023-05-20 17:52:59537 days ago1684605179IN
0xcF06C49f...CF443A930
0 ETH0.0078874635.27281703
Burn To Upgrade172916682023-05-19 6:08:59538 days ago1684476539IN
0xcF06C49f...CF443A930
0 ETH0.0075249933.65185041
Burn To Upgrade172227242023-05-09 11:54:35548 days ago1683633275IN
0xcF06C49f...CF443A930
0 ETH0.0169834493.5237584
Burn To Upgrade172226722023-05-09 11:44:11548 days ago1683632651IN
0xcF06C49f...CF443A930
0 ETH0.0084166971.23676958
Burn To Upgrade171139472023-04-24 5:03:47563 days ago1682312627IN
0xcF06C49f...CF443A930
0 ETH0.0082580636.93018584
Burn To Upgrade170492692023-04-15 1:44:23573 days ago1681523063IN
0xcF06C49f...CF443A930
0 ETH0.0052083325.8323254
Burn To Upgrade169636872023-04-02 20:12:11585 days ago1680466331IN
0xcF06C49f...CF443A930
0 ETH0.0024344419.79436813
Burn To Upgrade169594422023-04-02 5:48:23585 days ago1680414503IN
0xcF06C49f...CF443A930
0 ETH0.0019598117.90683021
Burn To Upgrade169161652023-03-27 3:51:11591 days ago1679889071IN
0xcF06C49f...CF443A930
0 ETH0.0019122515.54839803
Burn To Upgrade169109142023-03-26 10:09:23592 days ago1679825363IN
0xcF06C49f...CF443A930
0 ETH0.0025914914.95383335
Burn To Upgrade168773522023-03-21 16:59:47597 days ago1679417987IN
0xcF06C49f...CF443A930
0 ETH0.0062070827.75816248
Burn To Upgrade168532222023-03-18 7:41:47600 days ago1679125307IN
0xcF06C49f...CF443A930
0 ETH0.0032127914.49730099
Burn To Upgrade168532112023-03-18 7:39:35600 days ago1679125175IN
0xcF06C49f...CF443A930
0 ETH0.0034925415.61871831
Burn To Upgrade168531892023-03-18 7:35:11600 days ago1679124911IN
0xcF06C49f...CF443A930
0 ETH0.0034511215.43348594
Burn To Upgrade168500892023-03-17 21:06:11601 days ago1679087171IN
0xcF06C49f...CF443A930
0 ETH0.0046585133.54417796
Burn To Upgrade168484742023-03-17 15:39:59601 days ago1679067599IN
0xcF06C49f...CF443A930
0 ETH0.0034103528.19316438
Burn To Upgrade167756152023-03-07 9:44:35611 days ago1678182275IN
0xcF06C49f...CF443A930
0 ETH0.0023233423.82355164
Burn To Upgrade165557922023-02-04 13:43:59642 days ago1675518239IN
0xcF06C49f...CF443A930
0 ETH0.0052748523.58922358
Burn To Upgrade165113612023-01-29 8:44:11648 days ago1674981851IN
0xcF06C49f...CF443A930
0 ETH0.0015810214.23127187
Burn To Upgrade164975322023-01-27 10:23:59650 days ago1674815039IN
0xcF06C49f...CF443A930
0 ETH0.0030056513.44132017
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CLJUpgrader

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 1 : CLJUpgrader.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

interface ICLJ{
    function burn(uint _token_id) external;
    function ownerOf(uint256 tokenId) external view returns (address owner);
    function approve(address to, uint256 tokenId) external;
    function safeTransferFrom(address from, address to, uint256 tokenId) external;
}

contract CLJUpgrader {

    event BurnedForUpgrade(uint256 indexed upgradedId, uint256 indexed burnedId);

    error TokenIdNotOwned();
    error CapReached(uint rank);
    error RequireExactBurnAmount();
    error Reentered();

    ICLJ public immutable clj;

    mapping(uint256 => uint256) public tokenUpgradeCount;
    mapping(uint256 => uint256) public rankCount;

    uint256 immutable SILVER_CAP;
    uint256 immutable GOLD_CAP;
    uint256 immutable PLATINUM_CAP;
    uint256 immutable DIAMOND_CAP;

    uint8 immutable BRONZE_THRESH = 1;
    uint8 immutable SILVER_THRESH = 2;
    uint8 immutable GOLD_THRESH = 4;
    uint8 immutable PLATINUM_THRESH = 6;
    uint8 immutable DIAMOND_THRESH = 10;

    uint256 internal _ENTERED = 1;

    modifier noReenter() {
        if (_ENTERED != 1) revert Reentered();
        _ENTERED = 2;
        _;
        _ENTERED = 1;
    }

    constructor(uint256[] memory caps){
        clj = ICLJ(0x867ba3C89fB7C8F4d72068859c26d147F5330043);

        SILVER_CAP = caps[0];
        GOLD_CAP = caps[1];
        PLATINUM_CAP = caps[2];
        DIAMOND_CAP = caps[3];

        rankCount[DIAMOND_THRESH] = 35;
    }

    function burnToUpgrade(uint256 tokenIdToUpgrade, uint256[] calldata tokenIdsToBurn)
    external
    noReenter{

        if (msg.sender != clj.ownerOf(tokenIdToUpgrade)){
                revert TokenIdNotOwned();
        }

        uint256 sumTokenValues;

        for (uint i=0; i<tokenIdsToBurn.length; i++){
            uint256 tokenIdToBurn = tokenIdsToBurn[i];
            if (msg.sender != clj.ownerOf(tokenIdToBurn)){
                revert TokenIdNotOwned();
            }
            uint256 tokenCount = tokenUpgradeCount[tokenIdToBurn];
            sumTokenValues += tokenCount + 1;

            //do this before upgrade, in case a capped rank frees a slot
            decrementCounter(tokenCount);

            delete tokenUpgradeCount[tokenIdToBurn];
            //breaks checks-effects-interactions-pattern, but should be fine
            clj.burn(tokenIdToBurn);
            emit BurnedForUpgrade(tokenIdToUpgrade, tokenIdToBurn);
        }
        upgradeIfAllowed(tokenIdToUpgrade, sumTokenValues);
    }

    function decrementCounter(uint256 tokenCount) internal{
        if (tokenCount > 0) {
            --rankCount[tokenCount];
        }
    }

    function upgradeIfAllowed(uint256 tokenIdToUpgrade, uint256 sumTokenValues) internal{
        uint256 previousCount = tokenUpgradeCount[tokenIdToUpgrade];
        uint256 nextUpgradeCount = previousCount + sumTokenValues;
        if(nextUpgradeCount == BRONZE_THRESH){
            //NOOP
        } else if (nextUpgradeCount == SILVER_THRESH){
            if (rankCount[SILVER_THRESH]+1 > SILVER_CAP) {
                revert CapReached(SILVER_THRESH);
            }
        } else if (nextUpgradeCount == GOLD_THRESH){
            if (rankCount[GOLD_THRESH]+1 > GOLD_CAP) {
                revert CapReached(GOLD_THRESH);
            }
        } else if (nextUpgradeCount == PLATINUM_THRESH){
            if (rankCount[PLATINUM_THRESH]+1 > PLATINUM_CAP) {
                revert CapReached(PLATINUM_THRESH);
            }
        } else if (nextUpgradeCount == DIAMOND_THRESH){
            if (rankCount[DIAMOND_THRESH]+1 > DIAMOND_CAP) {
                revert CapReached(DIAMOND_THRESH);
            }
        } else {
            revert RequireExactBurnAmount();
        }

        tokenUpgradeCount[tokenIdToUpgrade] = nextUpgradeCount;
        if (previousCount > 0) {
            --rankCount[previousCount];
        }
        ++rankCount[nextUpgradeCount];
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256[]","name":"caps","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"rank","type":"uint256"}],"name":"CapReached","type":"error"},{"inputs":[],"name":"Reentered","type":"error"},{"inputs":[],"name":"RequireExactBurnAmount","type":"error"},{"inputs":[],"name":"TokenIdNotOwned","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"upgradedId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"burnedId","type":"uint256"}],"name":"BurnedForUpgrade","type":"event"},{"inputs":[{"internalType":"uint256","name":"tokenIdToUpgrade","type":"uint256"},{"internalType":"uint256[]","name":"tokenIdsToBurn","type":"uint256[]"}],"name":"burnToUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"clj","outputs":[{"internalType":"contract ICLJ","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rankCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenUpgradeCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

6101c060405260016101208190526002610140819052600461016052600661018052600a6101a052553480156200003557600080fd5b5060405162000c5d38038062000c5d83398101604081905262000058916200013b565b73867ba3c89fb7c8f4d72068859c26d147f53300436080528051819060009062000086576200008662000204565b602002602001015160a0818152505080600181518110620000ab57620000ab62000204565b602002602001015160c0818152505080600281518110620000d057620000d062000204565b602002602001015160e0818152505080600381518110620000f557620000f562000204565b602090810291909101810151610100526101a05160ff16600090815260019091526040902060239055506200021a565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156200014f57600080fd5b82516001600160401b03808211156200016757600080fd5b818501915085601f8301126200017c57600080fd5b81518181111562000191576200019162000125565b8060051b604051601f19603f83011681018181108582111715620001b957620001b962000125565b604052918252848201925083810185019188831115620001d857600080fd5b938501935b82851015620001f857845184529385019392850192620001dd565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e05161010051610120516101405161016051610180516101a05161097b620002e2600039600081816106c30152818161071201526107650152600081816105f20152818161064101526106940152600081816105210152818161057001526105c30152600081816104460152818161049501526104e80152600061041e015260006106ed0152600061061c0152600061054b0152600061047001526000818160be01528181610135015281816102040152610318015261097b6000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063177e7198146100515780632d7f06c2146100845780638a77b3f614610099578063cb05fa64146100b9575b600080fd5b61007161005f366004610809565b60016020526000908152604090205481565b6040519081526020015b60405180910390f35b610097610092366004610822565b6100f8565b005b6100716100a7366004610809565b60006020819052908152604090205481565b6100e07f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161007b565b60025460011461011b5760405163b5dfd9e560e01b815260040160405180910390fd5b600280556040516331a9108f60e11b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610184573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a891906108a1565b6001600160a01b0316336001600160a01b0316146101d95760405163112dc4ed60e01b815260040160405180910390fd5b6000805b828110156103be5760008484838181106101f9576101f96108d1565b9050602002013590507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636352211e826040518263ffffffff1660e01b815260040161025091815260200190565b602060405180830381865afa15801561026d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029191906108a1565b6001600160a01b0316336001600160a01b0316146102c25760405163112dc4ed60e01b815260040160405180910390fd5b6000818152602081905260409020546102dc8160016108fd565b6102e690856108fd565b93506102f1816103d4565b6000828152602081905260408082209190915551630852cd8d60e31b8152600481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342966c6890602401600060405180830381600087803b15801561036457600080fd5b505af1158015610378573d6000803e3d6000fd5b50506040518492508991507f22020b76664eb67e61d60869fe9be8686b329dc4cec44a0b51a426b74aad0e2390600090a3505080806103b690610915565b9150506101dd565b506103c984826103fe565b505060016002555050565b80156103fb57600081815260016020526040812080549091906103f69061092e565b909155505b50565b6000828152602081905260408120549061041883836108fd565b905060ff7f00000000000000000000000000000000000000000000000000000000000000001681146107ab577f000000000000000000000000000000000000000000000000000000000000000060ff16810361051f577f0000000000000000000000000000000000000000000000000000000000000000600160007f000000000000000000000000000000000000000000000000000000000000000060ff1681526020019081526020016000205460016104d291906108fd565b111561051a57604051621a2cef60e71b815260ff7f00000000000000000000000000000000000000000000000000000000000000001660048201526024015b60405180910390fd5b6107ab565b7f000000000000000000000000000000000000000000000000000000000000000060ff1681036105f0577f0000000000000000000000000000000000000000000000000000000000000000600160007f000000000000000000000000000000000000000000000000000000000000000060ff1681526020019081526020016000205460016105ad91906108fd565b111561051a57604051621a2cef60e71b815260ff7f0000000000000000000000000000000000000000000000000000000000000000166004820152602401610511565b7f000000000000000000000000000000000000000000000000000000000000000060ff1681036106c1577f0000000000000000000000000000000000000000000000000000000000000000600160007f000000000000000000000000000000000000000000000000000000000000000060ff16815260200190815260200160002054600161067e91906108fd565b111561051a57604051621a2cef60e71b815260ff7f0000000000000000000000000000000000000000000000000000000000000000166004820152602401610511565b7f000000000000000000000000000000000000000000000000000000000000000060ff168103610792577f0000000000000000000000000000000000000000000000000000000000000000600160007f000000000000000000000000000000000000000000000000000000000000000060ff16815260200190815260200160002054600161074f91906108fd565b111561051a57604051621a2cef60e71b815260ff7f0000000000000000000000000000000000000000000000000000000000000000166004820152602401610511565b604051631711101360e21b815260040160405180910390fd5b600084815260208190526040902081905581156107e357600082815260016020526040812080549091906107de9061092e565b909155505b600081815260016020526040812080549091906107ff90610915565b9091555050505050565b60006020828403121561081b57600080fd5b5035919050565b60008060006040848603121561083757600080fd5b83359250602084013567ffffffffffffffff8082111561085657600080fd5b818601915086601f83011261086a57600080fd5b81358181111561087957600080fd5b8760208260051b850101111561088e57600080fd5b6020830194508093505050509250925092565b6000602082840312156108b357600080fd5b81516001600160a01b03811681146108ca57600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115610910576109106108e7565b500190565b600060018201610927576109276108e7565b5060010190565b60008161093d5761093d6108e7565b50600019019056fea2646970667358221220db1395c08cc595300219c1834c86f822873ab2468f51c4e472ce2d8a946b044464736f6c634300080d0033000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000085

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063177e7198146100515780632d7f06c2146100845780638a77b3f614610099578063cb05fa64146100b9575b600080fd5b61007161005f366004610809565b60016020526000908152604090205481565b6040519081526020015b60405180910390f35b610097610092366004610822565b6100f8565b005b6100716100a7366004610809565b60006020819052908152604090205481565b6100e07f000000000000000000000000867ba3c89fb7c8f4d72068859c26d147f533004381565b6040516001600160a01b03909116815260200161007b565b60025460011461011b5760405163b5dfd9e560e01b815260040160405180910390fd5b600280556040516331a9108f60e11b8152600481018490527f000000000000000000000000867ba3c89fb7c8f4d72068859c26d147f53300436001600160a01b031690636352211e90602401602060405180830381865afa158015610184573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a891906108a1565b6001600160a01b0316336001600160a01b0316146101d95760405163112dc4ed60e01b815260040160405180910390fd5b6000805b828110156103be5760008484838181106101f9576101f96108d1565b9050602002013590507f000000000000000000000000867ba3c89fb7c8f4d72068859c26d147f53300436001600160a01b0316636352211e826040518263ffffffff1660e01b815260040161025091815260200190565b602060405180830381865afa15801561026d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029191906108a1565b6001600160a01b0316336001600160a01b0316146102c25760405163112dc4ed60e01b815260040160405180910390fd5b6000818152602081905260409020546102dc8160016108fd565b6102e690856108fd565b93506102f1816103d4565b6000828152602081905260408082209190915551630852cd8d60e31b8152600481018390527f000000000000000000000000867ba3c89fb7c8f4d72068859c26d147f53300436001600160a01b0316906342966c6890602401600060405180830381600087803b15801561036457600080fd5b505af1158015610378573d6000803e3d6000fd5b50506040518492508991507f22020b76664eb67e61d60869fe9be8686b329dc4cec44a0b51a426b74aad0e2390600090a3505080806103b690610915565b9150506101dd565b506103c984826103fe565b505060016002555050565b80156103fb57600081815260016020526040812080549091906103f69061092e565b909155505b50565b6000828152602081905260408120549061041883836108fd565b905060ff7f00000000000000000000000000000000000000000000000000000000000000011681146107ab577f000000000000000000000000000000000000000000000000000000000000000260ff16810361051f577f0000000000000000000000000000000000000000000000000000000000000320600160007f000000000000000000000000000000000000000000000000000000000000000260ff1681526020019081526020016000205460016104d291906108fd565b111561051a57604051621a2cef60e71b815260ff7f00000000000000000000000000000000000000000000000000000000000000021660048201526024015b60405180910390fd5b6107ab565b7f000000000000000000000000000000000000000000000000000000000000000460ff1681036105f0577f0000000000000000000000000000000000000000000000000000000000000190600160007f000000000000000000000000000000000000000000000000000000000000000460ff1681526020019081526020016000205460016105ad91906108fd565b111561051a57604051621a2cef60e71b815260ff7f0000000000000000000000000000000000000000000000000000000000000004166004820152602401610511565b7f000000000000000000000000000000000000000000000000000000000000000660ff1681036106c1577f00000000000000000000000000000000000000000000000000000000000000c8600160007f000000000000000000000000000000000000000000000000000000000000000660ff16815260200190815260200160002054600161067e91906108fd565b111561051a57604051621a2cef60e71b815260ff7f0000000000000000000000000000000000000000000000000000000000000006166004820152602401610511565b7f000000000000000000000000000000000000000000000000000000000000000a60ff168103610792577f0000000000000000000000000000000000000000000000000000000000000085600160007f000000000000000000000000000000000000000000000000000000000000000a60ff16815260200190815260200160002054600161074f91906108fd565b111561051a57604051621a2cef60e71b815260ff7f000000000000000000000000000000000000000000000000000000000000000a166004820152602401610511565b604051631711101360e21b815260040160405180910390fd5b600084815260208190526040902081905581156107e357600082815260016020526040812080549091906107de9061092e565b909155505b600081815260016020526040812080549091906107ff90610915565b9091555050505050565b60006020828403121561081b57600080fd5b5035919050565b60008060006040848603121561083757600080fd5b83359250602084013567ffffffffffffffff8082111561085657600080fd5b818601915086601f83011261086a57600080fd5b81358181111561087957600080fd5b8760208260051b850101111561088e57600080fd5b6020830194508093505050509250925092565b6000602082840312156108b357600080fd5b81516001600160a01b03811681146108ca57600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115610910576109106108e7565b500190565b600060018201610927576109276108e7565b5060010190565b60008161093d5761093d6108e7565b50600019019056fea2646970667358221220db1395c08cc595300219c1834c86f822873ab2468f51c4e472ce2d8a946b044464736f6c634300080d0033

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

000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000085

-----Decoded View---------------
Arg [0] : caps (uint256[]): 800,400,200,133

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000320
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000190
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000c8
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000085


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
Loading...
Loading
[ 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.