More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0xbde5337e083941161982bccf12485e0a5dfd9af2432bb8cd316a379c3a8d031f | Claim And Lock | (pending) | 19 days ago | IN | 0 ETH | (Pending) | |||
0xcccc4cf7ad37c6bfd7402a0fe800617b255617f1329f59695b1bfd8a2684c1e3 | Claim And Lock | (pending) | 19 days ago | IN | 0 ETH | (Pending) | |||
0xbb5aaf3615d8c8195e097cd555fa097e4d5429ad747f4b7d1ea5e8276ad813de | Claim And Lock | (pending) | 19 days ago | IN | 0 ETH | (Pending) | |||
0x73b9d67050aaf74812052edf023a47a4b41d697a0cfcf89c59f5175f41a3d37a | Claim And Lock | (pending) | 19 days ago | IN | 0 ETH | (Pending) | |||
0x545efde8a92afbf86f3990ef3f62e5dffac0759c14c5f75d8826c328ee9bc124 | Claim And Lock | (pending) | 19 days ago | IN | 0 ETH | (Pending) | |||
0xe419dbac93e9ea17bca0cd0f747b46484be58c6617f480dd39180152681f45f7 | Claim And Lock | (pending) | 19 days ago | IN | 0 ETH | (Pending) | |||
0xabf3b766fa85eaa2771deaaa7f2bdd77768ce184611d2c6b3dbd048eb660651e | Claim And Lock | (pending) | 19 days ago | IN | 0 ETH | (Pending) | |||
0x5fb76de1d6ffab2fff7c84b003226923ca1cd0340bc24ac63d0959942f865f48 | Claim And Lock | (pending) | 33 days ago | IN | 0 ETH | (Pending) | |||
0x477eaf2bdf0137bc272c4e5fbafebe376a722375d61770dd1b3d756bdc1de8c7 | Claim And Lock | (pending) | 40 days ago | IN | 0 ETH | (Pending) | |||
Claim And Lock | 21246368 | 58 mins ago | IN | 0 ETH | 0.00162395 | ||||
Claim And Lock | 21244724 | 6 hrs ago | IN | 0 ETH | 0.00162848 | ||||
Claim And Lock | 21244438 | 7 hrs ago | IN | 0 ETH | 0.00152893 | ||||
Claim And Lock | 21244406 | 7 hrs ago | IN | 0 ETH | 0.00205495 | ||||
Claim And Lock | 21244112 | 8 hrs ago | IN | 0 ETH | 0.0017281 | ||||
Claim And Lock | 21243846 | 9 hrs ago | IN | 0 ETH | 0.00159853 | ||||
Claim And Lock | 21243625 | 10 hrs ago | IN | 0 ETH | 0.00205795 | ||||
Claim And Lock | 21243525 | 10 hrs ago | IN | 0 ETH | 0.00125054 | ||||
Claim And Lock | 21243503 | 10 hrs ago | IN | 0 ETH | 0.00171637 | ||||
Claim And Lock | 21242970 | 12 hrs ago | IN | 0 ETH | 0.00098895 | ||||
Claim And Lock | 21242932 | 12 hrs ago | IN | 0 ETH | 0.00093613 | ||||
Claim And Lock | 21242474 | 14 hrs ago | IN | 0 ETH | 0.0011778 | ||||
Claim And Lock | 21242422 | 14 hrs ago | IN | 0 ETH | 0.00091984 | ||||
Claim And Lock | 21242266 | 14 hrs ago | IN | 0 ETH | 0.00043405 | ||||
Claim And Lock | 21242266 | 14 hrs ago | IN | 0 ETH | 0.00043439 | ||||
Claim And Lock | 21242266 | 14 hrs ago | IN | 0 ETH | 0.00043405 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xE58F634C...b79d9138a The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
CumulativeMerkleDrop
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.23; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {Ownable, Ownable2Step} from "@openzeppelin/contracts-v5/access/Ownable2Step.sol"; import {MerkleProof} from "@openzeppelin/contracts-v5/utils/cryptography/MerkleProof.sol"; import {ILock} from "./interfaces/ILock.sol"; import {ICumulativeMerkleDrop} from "./interfaces/ICumulativeMerkleDrop.sol"; /// Contract which manages initial distribution of the SWELL token via merkle drop claim process. contract CumulativeMerkleDrop is Ownable2Step, ICumulativeMerkleDrop { /*////////////////////////////////////////////////////////////// CONSTANTS //////////////////////////////////////////////////////////////*/ uint8 private constant OPEN = 1; uint8 private constant NOT_OPEN = 2; /*////////////////////////////////////////////////////////////// IMMUTABLES //////////////////////////////////////////////////////////////*/ /// @inheritdoc ICumulativeMerkleDrop IERC20 public immutable token; /*////////////////////////////////////////////////////////////// VARIABLES //////////////////////////////////////////////////////////////*/ /// @inheritdoc ICumulativeMerkleDrop uint8 public claimIsOpen; /// @inheritdoc ICumulativeMerkleDrop ILock public stakingContract; /// @inheritdoc ICumulativeMerkleDrop bytes32 public merkleRoot; /// @inheritdoc ICumulativeMerkleDrop mapping(address => uint256) public cumulativeClaimed; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor(address _owner, address _token) Ownable(_owner) { if (_token == address(0)) revert ADDRESS_NULL(); claimIsOpen = NOT_OPEN; token = IERC20(_token); } /*////////////////////////////////////////////////////////////// MODIFIERS //////////////////////////////////////////////////////////////*/ modifier onlyClaimOpen() { if (claimIsOpen != OPEN) revert CLAIM_CLOSED(); _; } /*////////////////////////////////////////////////////////////// SETTERS //////////////////////////////////////////////////////////////*/ /// @inheritdoc ICumulativeMerkleDrop function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner { if (_merkleRoot == merkleRoot) revert SAME_MERKLE_ROOT(); emit MerkleRootUpdated(merkleRoot, _merkleRoot); merkleRoot = _merkleRoot; } /// @inheritdoc ICumulativeMerkleDrop function setStakingContract(address _stakingContract) external onlyOwner { if (_stakingContract == address(0)) revert ADDRESS_NULL(); address oldStakingContract = address(stakingContract); if (_stakingContract == oldStakingContract) revert SAME_STAKING_CONTRACT(); if (ILock(_stakingContract).token() != token) revert STAKING_TOKEN_MISMATCH(); emit StakingContractUpdated(oldStakingContract, _stakingContract); stakingContract = ILock(_stakingContract); token.approve(address(_stakingContract), type(uint256).max); if (oldStakingContract != address(0)) { token.approve(oldStakingContract, 0); } } /// @inheritdoc ICumulativeMerkleDrop function clearStakingContract() external onlyOwner { address oldStakingContract = address(stakingContract); if (oldStakingContract == address(0)) revert SAME_STAKING_CONTRACT(); emit StakingContractCleared(); stakingContract = ILock(address(0)); token.approve(oldStakingContract, 0); } /// @inheritdoc ICumulativeMerkleDrop function setClaimStatus(uint8 status) external onlyOwner { if (status != OPEN && status != NOT_OPEN) revert INVALID_STATUS(); emit ClaimStatusUpdated(claimIsOpen, status); claimIsOpen = status; } /*////////////////////////////////////////////////////////////// MAIN FUNCTIONS //////////////////////////////////////////////////////////////*/ /// @inheritdoc ICumulativeMerkleDrop function claimAndLock(uint256 cumulativeAmount, uint256 amountToLock, bytes32[] calldata merkleProof) external onlyClaimOpen { // Verify the merkle proof if (!verifyProof(merkleProof, cumulativeAmount, msg.sender)) revert INVALID_PROOF(); // Mark it claimed uint256 preclaimed = cumulativeClaimed[msg.sender]; if (preclaimed >= cumulativeAmount) revert NOTHING_TO_CLAIM(); cumulativeClaimed[msg.sender] = cumulativeAmount; // Send the token uint256 amount = cumulativeAmount - preclaimed; if (amountToLock > 0) { if (amountToLock > amount) revert AMOUNT_TO_LOCK_GT_AMOUNT_CLAIMED(); // Ensure the staking contract is set before locking if (address(stakingContract) == address(0)) revert STAKING_NOT_AVAILABLE(); stakingContract.lock(msg.sender, amountToLock); } if (amount != amountToLock) token.transfer(msg.sender, amount - amountToLock); emit Claimed(msg.sender, amount, amountToLock); } /*////////////////////////////////////////////////////////////// VIEWS //////////////////////////////////////////////////////////////*/ /// @inheritdoc ICumulativeMerkleDrop function verifyProof(bytes32[] calldata proof, uint256 amount, address addr) public view returns (bool) { bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode(addr, amount)))); return MerkleProof.verify(proof, merkleRoot, leaf); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol) pragma solidity ^0.8.20; import {Ownable} from "./Ownable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is specified at deployment time in the constructor for `Ownable`. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2Step is Ownable { address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); if (pendingOwner() != sender) { revert OwnableUnauthorizedAccount(sender); } _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.20; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the Merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates Merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** *@dev The multiproof provided is not valid. */ error MerkleProofInvalidMultiproof(); /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Sorts the pair (a, b) and hashes the result. */ function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } /** * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory. */ function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.23; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface ILock { /// @notice locks the token in the staking contract. /// @param _account The account address to lock for. /// @param _amount The amount of token to lock. function lock(address _account, uint256 _amount) external; /// @notice Get the staking token address. /// @return The staking token address. function token() external view returns (IERC20); }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.23; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {ILock} from "./ILock.sol"; interface ICumulativeMerkleDrop { /// @notice error emitted when address is null. error ADDRESS_NULL(); /// @notice error emitted when claim is closed. error CLAIM_CLOSED(); /// @notice error emitted when amount to lock is greater than claimable amount. error AMOUNT_TO_LOCK_GT_AMOUNT_CLAIMED(); /// @notice error emitted when submited proof is invalid. error INVALID_PROOF(); /// @notice error emitted when claim status is invalid. error INVALID_STATUS(); /// @notice error emitted when nothing to claim. error NOTHING_TO_CLAIM(); /// @notice error emitted when an admin tries to update the merkle root with the same value. error SAME_MERKLE_ROOT(); /// @notice error emitted when an admin tries to update the staking contract to the same address. error SAME_STAKING_CONTRACT(); /// @notice error emitted when the provided staking contract token address does not match the drop token address. error STAKING_TOKEN_MISMATCH(); /// @notice error emitted when staking is set to the zero address and the user attempts to lock funds. error STAKING_NOT_AVAILABLE(); /// @notice event emitted when claim is made. /// @param account The account that made the claim. /// @param amount The amount of token claimed. /// @param amountToLock The amount of token locked. event Claimed(address indexed account, uint256 amount, uint256 amountToLock); /// @notice event emitted when claim status is updated. /// @param oldStatus The old status of the claim. /// @param newStatus The new status of the claim. event ClaimStatusUpdated(uint8 oldStatus, uint8 newStatus); /// @notice event emitted when Merkle root is updated. /// @param oldMerkleRoot The old Merkle root. /// @param newMerkleRoot The new Merkle root. event MerkleRootUpdated(bytes32 oldMerkleRoot, bytes32 newMerkleRoot); /// @notice event emitted when stakingContract contract is updated. /// @param oldStakingContract The old stakingContract contract address. /// @param newStakingContract The new stakingContract contract address. event StakingContractUpdated(address oldStakingContract, address newStakingContract); /// @notice event emitted when stakingContract contract is cleared. event StakingContractCleared(); /// @notice Claim and lock token. /// @param cumulativeAmount The cumulative amount of token claimed. /// @param amountToLock The amount of token to lock. /// @param merkleProof The merkle proof. /// @notice It is only possible to lock if there is a staking contract set. function claimAndLock(uint256 cumulativeAmount, uint256 amountToLock, bytes32[] memory merkleProof) external; /// @notice Get the status of the claim. /// @return The status of the claim, 1 for open, 2 for closed. function claimIsOpen() external view returns (uint8); /// @notice Get the cumulative claimed amount of an account. /// @return The cumulative claimed amount of an account. function cumulativeClaimed(address) external view returns (uint256); /// @notice Get the current Merkle root. /// @return The current Merkle root. function merkleRoot() external view returns (bytes32); /// @notice Set the status of the claim. /// @param status The status of the claim, 1 for open, 2 for closed. function setClaimStatus(uint8 status) external; /// @notice Set the Merkle root. /// @param _merkleRoot The new Merkle root. function setMerkleRoot(bytes32 _merkleRoot) external; /// @notice Set the staking contract address. /// @param _stakingContract The staking contract address. function setStakingContract(address _stakingContract) external; /// @notice Clear the staking contract address. /// @notice After calling, it is not possible to lock funds until a new staking contract is set. function clearStakingContract() external; /// @notice Get the staking contract address. /// @return The staking contract address. function stakingContract() external view returns (ILock); /// @notice Get the token address. /// @return The token address. function token() external view returns (IERC20); /// @notice Verify the merkle proof. /// @param proof The merkle proof. /// @param amount The amount of token claimed. /// @param addr The address of the claimer. /// @return True if the proof is valid, false otherwise. function verifyProof(bytes32[] memory proof, uint256 amount, address addr) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
{ "remappings": [ "forge-std/=lib/forge-std/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts-v5/=lib/openzeppelin-contracts-v5/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_token","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ADDRESS_NULL","type":"error"},{"inputs":[],"name":"AMOUNT_TO_LOCK_GT_AMOUNT_CLAIMED","type":"error"},{"inputs":[],"name":"CLAIM_CLOSED","type":"error"},{"inputs":[],"name":"INVALID_PROOF","type":"error"},{"inputs":[],"name":"INVALID_STATUS","type":"error"},{"inputs":[],"name":"NOTHING_TO_CLAIM","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"SAME_MERKLE_ROOT","type":"error"},{"inputs":[],"name":"SAME_STAKING_CONTRACT","type":"error"},{"inputs":[],"name":"STAKING_NOT_AVAILABLE","type":"error"},{"inputs":[],"name":"STAKING_TOKEN_MISMATCH","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"oldStatus","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"newStatus","type":"uint8"}],"name":"ClaimStatusUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountToLock","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"oldMerkleRoot","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"}],"name":"MerkleRootUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[],"name":"StakingContractCleared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldStakingContract","type":"address"},{"indexed":false,"internalType":"address","name":"newStakingContract","type":"address"}],"name":"StakingContractUpdated","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cumulativeAmount","type":"uint256"},{"internalType":"uint256","name":"amountToLock","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"claimAndLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimIsOpen","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clearStakingContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"cumulativeClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"status","type":"uint8"}],"name":"setClaimStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_stakingContract","type":"address"}],"name":"setStakingContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingContract","outputs":[{"internalType":"contract ILock","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"addr","type":"address"}],"name":"verifyProof","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106100fb575f3560e01c80638da5cb5b11610093578063e30c397811610063578063e30c39781461020d578063ee99205c1461021e578063f2fde38b14610231578063fc0c546a14610244575f80fd5b80638da5cb5b146101a45780639dd373b9146101c8578063a9919576146101db578063aae146c2146101fa575f80fd5b806345c37e14116100ce57806345c37e141461016e578063715018a61461018157806379ba5097146101895780637cb6475914610191575f80fd5b806303723c33146100ff5780632eb4a7ab1461012a57806336accd13146101415780634069543c14610164575b5f80fd5b60015461011390600160a01b900460ff1681565b60405160ff90911681526020015b60405180910390f35b61013360035481565b604051908152602001610121565b61015461014f366004610c40565b61026b565b6040519015158152602001610121565b61016c61030a565b005b61016c61017c366004610c9b565b610407565b61016c61064a565b61016c61065d565b61016c61019f366004610cea565b6106a6565b5f546001600160a01b03165b6040516001600160a01b039091168152602001610121565b61016c6101d6366004610d01565b610711565b6101336101e9366004610d01565b60046020525f908152604090205481565b61016c610208366004610d1c565b6109b2565b6001546001600160a01b03166101b0565b6002546101b0906001600160a01b031681565b61016c61023f366004610d01565b610a58565b6101b07f000000000000000000000000ec53bf9167f50cdeb3ae105f56099aaab9061f8381565b604080516001600160a01b03831660208201529081018390525f90819060600160408051601f19818403018152828252805160209182012090830152016040516020818303038152906040528051906020012090506103008686808060200260200160405190810160405280939291908181526020018383602002808284375f92019190915250506003549150849050610ac8565b9695505050505050565b610312610add565b6002546001600160a01b03168061033c57604051631b6ffff560e31b815260040160405180910390fd5b6040517fb88abc4d07058097c50fc8c5edb50d238384dd8a6de255c322f35651d7539b88905f90a1600280546001600160a01b031916905560405163095ea7b360e01b81526001600160a01b0382811660048301525f60248301527f000000000000000000000000ec53bf9167f50cdeb3ae105f56099aaab9061f83169063095ea7b3906044016020604051808303815f875af11580156103df573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104039190610d3c565b5050565b60018054600160a01b900460ff1614610433576040516396448e3760e01b815260040160405180910390fd5b61043f8282863361026b565b61045c5760405163712eb08760e01b815260040160405180910390fd5b335f9081526004602052604090205484811061048b57604051637691472960e01b815260040160405180910390fd5b335f9081526004602052604081208690556104a68287610d5b565b9050841561055857808511156104cf57604051632c5dc0c760e01b815260040160405180910390fd5b6002546001600160a01b03166104f857604051632c4377f560e01b815260040160405180910390fd5b60025460405163282d3fdf60e01b8152336004820152602481018790526001600160a01b039091169063282d3fdf906044015f604051808303815f87803b158015610541575f80fd5b505af1158015610553573d5f803e3d5ffd5b505050505b848114610607576001600160a01b037f000000000000000000000000ec53bf9167f50cdeb3ae105f56099aaab9061f831663a9059cbb336105998885610d5b565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303815f875af11580156105e1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106059190610d3c565b505b604080518281526020810187905233917f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a910160405180910390a2505050505050565b610652610add565b61065b5f610b09565b565b60015433906001600160a01b0316811461069a5760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b6106a381610b09565b50565b6106ae610add565b60035481036106d05760405163ca3ae3c960e01b815260040160405180910390fd5b60035460408051918252602082018390527ffd69edeceaf1d6832d935be1fba54ca93bf17e71520c6c9ffc08d6e9529f8757910160405180910390a1600355565b610719610add565b6001600160a01b0381166107405760405163c61d298560e01b815260040160405180910390fd5b6002546001600160a01b0390811690821681900361077157604051631b6ffff560e31b815260040160405180910390fd5b7f000000000000000000000000ec53bf9167f50cdeb3ae105f56099aaab9061f836001600160a01b0316826001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107d7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107fb9190610d7a565b6001600160a01b03161461082257604051634ed9cee160e01b815260040160405180910390fd5b604080516001600160a01b038084168252841660208201527f7042586b23181180eb30b4798702d7a0233b7fc2551e89806770e8e5d9392e6a910160405180910390a1600280546001600160a01b0319166001600160a01b0384811691821790925560405163095ea7b360e01b815260048101919091525f1960248201527f000000000000000000000000ec53bf9167f50cdeb3ae105f56099aaab9061f839091169063095ea7b3906044016020604051808303815f875af11580156108ea573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061090e9190610d3c565b506001600160a01b038116156104035760405163095ea7b360e01b81526001600160a01b0382811660048301525f60248301527f000000000000000000000000ec53bf9167f50cdeb3ae105f56099aaab9061f83169063095ea7b3906044016020604051808303815f875af1158015610989573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109ad9190610d3c565b505050565b6109ba610add565b60ff81166001148015906109d2575060ff8116600214155b156109f05760405163343b80b160e01b815260040160405180910390fd5b6001546040805160ff600160a01b9093048316815291831660208301527fa780115545f70c2b2de252dd83ef9972dc71d20d11ead5a63ff72f491f1e4de3910160405180910390a16001805460ff909216600160a01b0260ff60a01b19909216919091179055565b610a60610add565b600180546001600160a01b0383166001600160a01b03199091168117909155610a905f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b5f82610ad48584610b22565b14949350505050565b5f546001600160a01b0316331461065b5760405163118cdaa760e01b8152336004820152602401610691565b600180546001600160a01b03191690556106a381610b66565b5f81815b8451811015610b5c57610b5282868381518110610b4557610b45610d95565b6020026020010151610bb5565b9150600101610b26565b5090505b92915050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f818310610bcf575f828152602084905260409020610bdd565b5f8381526020839052604090205b9392505050565b5f8083601f840112610bf4575f80fd5b50813567ffffffffffffffff811115610c0b575f80fd5b6020830191508360208260051b8501011115610c25575f80fd5b9250929050565b6001600160a01b03811681146106a3575f80fd5b5f805f8060608587031215610c53575f80fd5b843567ffffffffffffffff811115610c69575f80fd5b610c7587828801610be4565b909550935050602085013591506040850135610c9081610c2c565b939692955090935050565b5f805f8060608587031215610cae575f80fd5b8435935060208501359250604085013567ffffffffffffffff811115610cd2575f80fd5b610cde87828801610be4565b95989497509550505050565b5f60208284031215610cfa575f80fd5b5035919050565b5f60208284031215610d11575f80fd5b8135610bdd81610c2c565b5f60208284031215610d2c575f80fd5b813560ff81168114610bdd575f80fd5b5f60208284031215610d4c575f80fd5b81518015158114610bdd575f80fd5b81810381811115610b6057634e487b7160e01b5f52601160045260245ffd5b5f60208284031215610d8a575f80fd5b8151610bdd81610c2c565b634e487b7160e01b5f52603260045260245ffdfea2646970667358221220c223754c0bfb19b31898b24506f565b4daef1180adf87e526286a7b3993e606e64736f6c63430008170033
Loading...
Loading
Loading...
Loading
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.