Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 515 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Burn To Upgrade | 20758757 | 87 days ago | IN | 0 ETH | 0.00039258 | ||||
Burn To Upgrade | 19049503 | 326 days ago | IN | 0 ETH | 0.00276765 | ||||
Burn To Upgrade | 17840110 | 495 days ago | IN | 0 ETH | 0.00324369 | ||||
Burn To Upgrade | 17788068 | 503 days ago | IN | 0 ETH | 0.00316769 | ||||
Burn To Upgrade | 17455405 | 549 days ago | IN | 0 ETH | 0.00265066 | ||||
Burn To Upgrade | 17302244 | 571 days ago | IN | 0 ETH | 0.00788746 | ||||
Burn To Upgrade | 17291668 | 572 days ago | IN | 0 ETH | 0.00752499 | ||||
Burn To Upgrade | 17222724 | 582 days ago | IN | 0 ETH | 0.01698344 | ||||
Burn To Upgrade | 17222672 | 582 days ago | IN | 0 ETH | 0.00841669 | ||||
Burn To Upgrade | 17113947 | 597 days ago | IN | 0 ETH | 0.00825806 | ||||
Burn To Upgrade | 17049269 | 607 days ago | IN | 0 ETH | 0.00520833 | ||||
Burn To Upgrade | 16963687 | 619 days ago | IN | 0 ETH | 0.00243444 | ||||
Burn To Upgrade | 16959442 | 619 days ago | IN | 0 ETH | 0.00195981 | ||||
Burn To Upgrade | 16916165 | 625 days ago | IN | 0 ETH | 0.00191225 | ||||
Burn To Upgrade | 16910914 | 626 days ago | IN | 0 ETH | 0.00259149 | ||||
Burn To Upgrade | 16877352 | 631 days ago | IN | 0 ETH | 0.00620708 | ||||
Burn To Upgrade | 16853222 | 634 days ago | IN | 0 ETH | 0.00321279 | ||||
Burn To Upgrade | 16853211 | 634 days ago | IN | 0 ETH | 0.00349254 | ||||
Burn To Upgrade | 16853189 | 634 days ago | IN | 0 ETH | 0.00345112 | ||||
Burn To Upgrade | 16850089 | 635 days ago | IN | 0 ETH | 0.00465851 | ||||
Burn To Upgrade | 16848474 | 635 days ago | IN | 0 ETH | 0.00341035 | ||||
Burn To Upgrade | 16775615 | 645 days ago | IN | 0 ETH | 0.00232334 | ||||
Burn To Upgrade | 16555792 | 676 days ago | IN | 0 ETH | 0.00527485 | ||||
Burn To Upgrade | 16511361 | 682 days ago | IN | 0 ETH | 0.00158102 | ||||
Burn To Upgrade | 16497532 | 684 days ago | IN | 0 ETH | 0.00300565 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
CLJUpgrader
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// 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]; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"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"}]
Contract Creation Code
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
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.