Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
AirdropManager
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: MIT pragma solidity =0.8.23; import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import { NotStarted, Ended, Blocked, NotAccepted, AlreadyClaimed, LengthMismatch, InvalidProof, TokenMismatch, VaultMismatch, SenderMismatch } from "./Errors.sol"; contract AirdropManager is PausableUpgradeable, OwnableUpgradeable { using SafeERC20 for IERC20; struct AirdropData { address vault; address token; bytes32 merkleRoot; bytes32 eip191MessageHash; // Store the EIP-191 formatted message hash ("\x19Ethereum Signed Message:\n" + len(message) + message) uint256 startTime; uint256 endTime; } uint256 public total; mapping(uint256 => AirdropData) public airdrops; mapping(uint256 => mapping(bytes32 => bool)) public claimed; mapping(uint256 => mapping(address => bool)) public blocked; event Claimed(address account, uint256 amount); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /// @notice Initializes the contract with necessary parameters. /// @param initialOwner_ The initial owner of the contract. function initialize(address initialOwner_) external initializer { __Pausable_init(); __Ownable_init(initialOwner_); } /// @notice Pauses the contract, preventing claims. function pause() external onlyOwner { _pause(); } /// @notice Unpauses the contract, allowing claims. function unpause() external onlyOwner { _unpause(); } /// @notice Adds addresses to the blocklist. /// @param accounts The array of addresses. function blocklist(uint256 id, address[] calldata accounts, bool status) external onlyOwner { for (uint256 i; i < accounts.length; i++) { blocked[id][accounts[i]] = status; } } /// @notice Creates a new airdrop with specified parameters /// @dev Increments the total airdrop count and stores the airdrop data /// @param vault_ Address holding the tokens to be distributed /// @param token_ ERC20 token contract address of the tokens to be distributed /// @param merkleRoot_ Merkle root hash for validating claims /// @param eip191MessageHash_ EIP-191 formatted message hash ("\x19Ethereum Signed Message:\n" + len(message) + message) /// @param startTime_ Unix timestamp when the airdrop starts /// @param endTime_ Unix timestamp when the airdrop ends function createAirdrop( address vault_, address token_, bytes32 merkleRoot_, bytes32 eip191MessageHash_, uint256 startTime_, uint256 endTime_ ) external onlyOwner { total++; airdrops[total] = AirdropData({ vault: vault_, token: token_, merkleRoot: merkleRoot_, eip191MessageHash: eip191MessageHash_, startTime: startTime_, endTime: endTime_ }); } /// @notice Updates an existing airdrop with new parameters /// @param id The ID of the airdrop to update /// @param vault_ Address holding the tokens to be distributed /// @param token_ ERC20 token contract address of the tokens to be distributed /// @param merkleRoot_ Merkle root hash for validating claims /// @param eip191MessageHash_ EIP-191 formatted message hash /// @param startTime_ Unix timestamp when the airdrop starts /// @param endTime_ Unix timestamp when the airdrop ends function updateAirdrop( uint256 id, address vault_, address token_, bytes32 merkleRoot_, bytes32 eip191MessageHash_, uint256 startTime_, uint256 endTime_ ) external onlyOwner { airdrops[id] = AirdropData({ vault: vault_, token: token_, merkleRoot: merkleRoot_, eip191MessageHash: eip191MessageHash_, startTime: startTime_, endTime: endTime_ }); } /// @notice Batch claims tokens for multiple airdrop IDs /// @param token_ The token to be claimed /// @param vault_ The vault holding the tokens /// @param ids Array of airdrop IDs to claim from /// @param amounts Array of amounts to claim for each ID /// @param proofs Array of merkle proofs for each claim /// @param agreedToTnC Must be true to accept terms and conditions function claimBatch( address token_, address vault_, uint256[] calldata ids, uint256[] calldata amounts, bytes32[][] calldata proofs, bool agreedToTnC ) external whenNotPaused { if (!agreedToTnC) { revert NotAccepted(); } if (ids.length != amounts.length || amounts.length != proofs.length) { revert LengthMismatch(); } address sender = msg.sender; uint256 totalAmount; for (uint256 i; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; _validateClaim(id, token_, vault_, sender, amount, proofs[i]); totalAmount += amount; } emit Claimed(sender, totalAmount); IERC20(token_).safeTransferFrom(vault_, sender, totalAmount); } /// @notice Internal function to validate pre-claim conditions /// @param id The airdrop ID to check /// @param sender The address attempting to claim /// @dev Checks time bounds and blocklist status function _preClaimChecks(uint256 id, address sender) internal view { AirdropData memory airdrop = airdrops[id]; if (airdrop.startTime > block.timestamp) revert NotStarted(); if (airdrop.endTime <= block.timestamp) revert Ended(); if (blocked[id][sender]) revert Blocked(); } /// @notice Internal function to process a claim after validation /// @param id The airdrop ID to claim from /// @param sender The address claiming tokens /// @param amount The amount of tokens to claim /// @param proof The merkle proof to verify eligibility /// @dev Handles merkle verification, claim recording, and token transfer function _processClaim(uint256 id, address sender, uint256 amount, bytes32[] calldata proof) internal { AirdropData memory airdrop = airdrops[id]; _preClaimChecks(id, sender); bytes32 leaf = _getLeaf(amount); if (claimed[id][leaf]) revert AlreadyClaimed(); if (!MerkleProof.verifyCalldata(proof, airdrop.merkleRoot, leaf)) revert InvalidProof(); claimed[id][leaf] = true; emit Claimed(sender, amount); IERC20(airdrop.token).safeTransferFrom(airdrop.vault, sender, amount); } /// @notice Claims tokens from an airdrop /// @param id The airdrop ID to claim from /// @param amount The amount of tokens to claim /// @param proof The merkle proof to verify eligibility /// @param agreedToTnC Must be true to accept terms and conditions function claim(uint256 id, uint256 amount, bytes32[] calldata proof, bool agreedToTnC) public whenNotPaused { if (!agreedToTnC) revert NotAccepted(); _processClaim(id, msg.sender, amount, proof); } /// @notice Claims tokens using an EIP-191 signature for verification /// @param id The airdrop ID to claim from /// @param amount The amount of tokens to claim /// @param proof The merkle proof to verify eligibility /// @param v The recovery byte of the signature /// @param r Half of the ECDSA signature pair /// @param s Half of the ECDSA signature pair /// @dev Signature must be created from the EIP-191 formatted message hash stored in the airdrop function claimWithSignature(uint256 id, uint256 amount, bytes32[] calldata proof, uint8 v, bytes32 r, bytes32 s) external whenNotPaused { address sender = msg.sender; if (ECDSA.recover(airdrops[id].eip191MessageHash, v, r, s) != sender) revert SenderMismatch(); _processClaim(id, sender, amount, proof); } /// @notice Allows eligible users to claim their airdrop in batch with a signature for verification. /// @param token_ The token to be claimed. /// @param vault_ The vault holding the tokens. /// @param ids The array of airdrop IDs. /// @param amounts The array of amounts to claim. /// @param proofs The array of Merkle proofs. /// @param vs The array of recovery bytes of the signatures. /// @param rs The array of half of the ECDSA signature pairs. /// @param ss The array of half of the ECDSA signature pairs. /// @notice Claims tokens in batch with signatures. Requires EIP-191 formatted signatures. function claimBatchWithSignature( address token_, address vault_, uint256[] calldata ids, uint256[] calldata amounts, bytes32[][] calldata proofs, uint8[] calldata vs, bytes32[] calldata rs, bytes32[] calldata ss ) external whenNotPaused { if ( ids.length != amounts.length || amounts.length != proofs.length || proofs.length != vs.length || vs.length != rs.length || rs.length != ss.length ) { revert LengthMismatch(); } address sender = msg.sender; uint256 totalAmount; for (uint256 i; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; if (ECDSA.recover(airdrops[id].eip191MessageHash, vs[i], rs[i], ss[i]) != sender) revert SenderMismatch(); _validateClaim(id, token_, vault_, sender, amount, proofs[i]); totalAmount += amount; } emit Claimed(sender, totalAmount); IERC20(token_).safeTransferFrom(vault_, sender, totalAmount); } /// @notice Internal function to validate a claim request /// @param id The airdrop ID to validate against /// @param token_ The token being claimed /// @param vault_ The vault holding the tokens /// @param sender The address attempting to claim /// @param amount The amount being claimed /// @param proof The merkle proof for verification /// @dev Performs all necessary validation checks before allowing a claim function _validateClaim( uint256 id, address token_, address vault_, address sender, uint256 amount, bytes32[] calldata proof ) internal { AirdropData memory airdrop = airdrops[id]; if (airdrop.startTime > block.timestamp) revert NotStarted(); if (airdrop.endTime <= block.timestamp) revert Ended(); if (airdrop.token != token_) revert TokenMismatch(); if (airdrop.vault != vault_) revert VaultMismatch(); if (blocked[id][sender]) revert Blocked(); bytes32 leaf = _getLeaf(amount); if (claimed[id][leaf]) revert AlreadyClaimed(); if (!MerkleProof.verifyCalldata(proof, airdrop.merkleRoot, leaf)) revert InvalidProof(); claimed[id][leaf] = true; } /// @dev Internal function to handle claims. /// @param id The ID of the airdrop. /// @param amount The amount of tokens to claim. /// @param proof The Merkle proof to prove eligibility for the claim. function _claim(uint256 id, uint256 amount, bytes32[] calldata proof) internal { AirdropData memory airdrop = airdrops[id]; address sender = msg.sender; bytes32 leaf = _getLeaf(amount); if (claimed[id][leaf]) revert AlreadyClaimed(); if (!MerkleProof.verifyCalldata(proof, airdrop.merkleRoot, leaf)) revert InvalidProof(); claimed[id][leaf] = true; emit Claimed(sender, amount); IERC20(airdrop.token).safeTransferFrom(airdrop.vault, sender, amount); } /// @notice Verifies the Merkle proof for a claim. /// @param amount The amount of tokens to verify for the claim. /// @param proof The Merkle proof to verify. /// @return true if the proof is valid, otherwise false. function verifyCalldata(uint256 id, uint256 amount, bytes32[] calldata proof) external view returns (bool) { return MerkleProof.verifyCalldata(proof, airdrops[id].merkleRoot, _getLeaf(amount)); } /// @notice Internal function to get the merkle leaf for verification /// @param amount The amount being claimed /// @return The hash of the sender's address and claim amount /// @dev Used in merkle proof verification function _getLeaf(uint256 amount) internal view returns (bytes32) { return keccak256(abi.encodePacked(msg.sender, amount)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// 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: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @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. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { 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) { OwnableStorage storage $ = _getOwnableStorage(); 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 { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Pausable struct PausableStorage { bool _paused; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300; function _getPausableStorage() private pure returns (PausableStorage storage $) { assembly { $.slot := PausableStorageLocation } } /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { PausableStorage storage $ = _getPausableStorage(); $._paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { PausableStorage storage $ = _getPausableStorage(); return $._paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity =0.8.23; error LengthMismatch(); error NotStarted(); error Ended(); error Blocked(); error NotAccepted(); error AlreadyClaimed(); error InvalidProof(); error VaultMismatch(); error TokenMismatch(); error SenderMismatch();
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } 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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
{ "remappings": [ "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-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": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AlreadyClaimed","type":"error"},{"inputs":[],"name":"Blocked","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"Ended","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"NotAccepted","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotStarted","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":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SenderMismatch","type":"error"},{"inputs":[],"name":"TokenMismatch","type":"error"},{"inputs":[],"name":"VaultMismatch","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","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":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"airdrops","outputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"bytes32","name":"eip191MessageHash","type":"bytes32"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"blocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"bool","name":"status","type":"bool"}],"name":"blocklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"bool","name":"agreedToTnC","type":"bool"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"address","name":"vault_","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes32[][]","name":"proofs","type":"bytes32[][]"},{"internalType":"bool","name":"agreedToTnC","type":"bool"}],"name":"claimBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"address","name":"vault_","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes32[][]","name":"proofs","type":"bytes32[][]"},{"internalType":"uint8[]","name":"vs","type":"uint8[]"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"}],"name":"claimBatchWithSignature","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"claimWithSignature","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"claimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault_","type":"address"},{"internalType":"address","name":"token_","type":"address"},{"internalType":"bytes32","name":"merkleRoot_","type":"bytes32"},{"internalType":"bytes32","name":"eip191MessageHash_","type":"bytes32"},{"internalType":"uint256","name":"startTime_","type":"uint256"},{"internalType":"uint256","name":"endTime_","type":"uint256"}],"name":"createAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"initialOwner_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"total","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"vault_","type":"address"},{"internalType":"address","name":"token_","type":"address"},{"internalType":"bytes32","name":"merkleRoot_","type":"bytes32"},{"internalType":"bytes32","name":"eip191MessageHash_","type":"bytes32"},{"internalType":"uint256","name":"startTime_","type":"uint256"},{"internalType":"uint256","name":"endTime_","type":"uint256"}],"name":"updateAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"verifyCalldata","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608080604052346100b8577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a009081549060ff8260401c166100a957506001600160401b036002600160401b031982821601610064575b60405161155b90816100bd8239f35b6001600160401b031990911681179091556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a15f8080610055565b63f92ee8a960e01b8152600490fd5b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c9081632ddbd13a14610c8857508063304388b814610bfa578063358cd4cd14610b2e5780633f4ba83a14610ab9578063555d61c414610a565780635c975abb14610a2857806360db5082146109bc578063715018a6146109555780638456cb59146108f05780638da5cb5b146108bc578063b5d3c35014610667578063c0ff15431461061e578063c4d66de8146104cc578063c652b11f14610472578063dca2169d146103cd578063ddc7eb17146102e1578063e124012014610157578063f2fde38b1461012c5763f70e4760146100ed575f80fd5b34610128576040366003190112610128576004355f52600260205260405f206024355f52602052602060ff60405f2054166040519015158152f35b5f80fd5b3461012857602036600319011261012857610155610148610ce8565b610150611017565b610da4565b005b346101285760c036600319011261012857610170610ce8565b610178610cd2565b67ffffffffffffffff916044358381116101285761019a903690600401610ca1565b9290606435858111610128576101b4903690600401610ca1565b95608435908111610128576101cd903690600401610ca1565b9160a435801590811503610128576101e3610e15565b6102cf578787148015906102c5575b6102b057959291905f965f945b8086106102585760408051338152602081018b9052610155918b918b918b917fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a91819081015b0390a133916001600160a01b0316611229565b9091929394976102a48560019261029f8a8c8f8f610295818f818f958f958f906102859161028c95610d2e565b3595610d2e565b35988994610d52565b94909333926110d8565b610d97565b980194939291906101ff565b6040516001621398b960e31b03198152600490fd5b50828814156101f2565b60405163029d79a560e41b8152600490fd5b346101285760c0366003190112610128576102fa610ce8565b610302610cd2565b9061030b611017565b5f54905f1982146103b95760016005920190815f556040519361032d85610cfe565b60018060a01b038092168552816020860191168152604085016044358152606086019160643583526080870193608435855260a088019560a43587525f5260016020528060405f20985116906bffffffffffffffffffffffff60a01b91828a54161789556001890192511690825416179055516002860155516003850155516004840155519101555f80f35b634e487b7160e01b5f52601160045260245ffd5b346101285760603660031901126101285760043560243567ffffffffffffffff811161012857610401903690600401610ca1565b91604435918215158093036101285761041b929192611017565b60ff5f9216915b84811061042b57005b835f526020906003825260405f20610444828886610d2e565b356001600160a01b0381169390849003610128576001935f525260405f208460ff1982541617905501610422565b346101285760803660031901126101285760443567ffffffffffffffff8111610128576104a3903690600401610ca1565b606435801590811503610128576104b8610e15565b6102cf576101559160243533600435610e3f565b34610128576020366003190112610128576104e5610ce8565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090815460ff8160401c16159167ffffffffffffffff821680159081610616575b600114908161060c575b159081610603575b506105f15767ffffffffffffffff198216600117845561058f91836105d2575b50610561611441565b610569611441565b5f80516020611506833981519152805460ff19169055610587611441565b610150611441565b61059557005b68ff00000000000000001981541690557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b68ffffffffffffffffff19166801000000000000000117845584610558565b60405163f92ee8a960e01b8152600490fd5b90501585610538565b303b159150610530565b849150610526565b3461012857604036600319011261012857610637610cd2565b6004355f52600360205260405f209060018060a01b03165f52602052602060ff60405f2054166040519015158152f35b346101285761010036600319011261012857610681610ce8565b610689610cd2565b67ffffffffffffffff91604435838111610128576106ab903690600401610ca1565b9290606435858111610128576106c5903690600401610ca1565b608435878111610128576106dd903690600401610ca1565b909760a435818111610128576106f7903690600401610ca1565b939060c43583811161012857610711903690600401610ca1565b92909360e4359081116101285761072c903690600401610ca1565b939091610737610e15565b808d148015906108b2575b80156108a8575b801561089e575b8015610894575b6102b0579b9897969594939291905f9c5f9a5b808c106107bc576101558f8f8f7fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a6040518061024586338360209093929193604081019460018060a01b031681520152565b909192939495969798999a9d8f908f8f918f918f928f948f9461080a846107f28f938d6107eb848f8194610d2e565b359b610d2e565b3597895f526001602052600360405f20015493610d2e565b3560ff81168103610128578f918f610840928f918f610839916108328b80936108499a610d2e565b3594610d2e565b3592611331565b909291926113be565b336001600160a01b039091160361088257848f9661029561029f956108709960019b610d52565b9e019a9998979695949392919061076a565b604051637c62b1c760e11b8152600490fd5b5084821415610757565b5081881415610750565b5087871415610749565b5086811415610742565b34610128575f366003190112610128575f805160206114e6833981519152546040516001600160a01b039091168152602090f35b34610128575f36600319011261012857610908611017565b610910610e15565b5f80516020611506833981519152600160ff198254161790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b34610128575f3660031901126101285761096d611017565b5f805160206114e683398151915280546001600160a01b031981169091555f906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34610128576020366003190112610128576004355f52600160205260c060405f2060018060a01b039081815416916001820154169060028101546003820154906005600484015493015493604051958652602086015260408501526060840152608083015260a0820152f35b34610128575f36600319011261012857602060ff5f8051602061150683398151915254166040519015158152f35b346101285760603660031901126101285760443567ffffffffffffffff811161012857610aaf610a8c6020923690600401610ca1565b6004355f5260018452600260405f20015490610aa960243561104f565b92611086565b6040519015158152f35b34610128575f36600319011261012857610ad1611017565b5f80516020611506833981519152805460ff811615610b1c5760ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b604051638dfc202b60e01b8152600490fd5b346101285760e036600319011261012857610b47610cd2565b6044356001600160a01b038181169182900361012857600591610b68611017565b8160405194610b7686610cfe565b1684526020840190815260408401606435815260608501906084358252608086019260a435845260a087019460c43586526004355f5260016020528060405f20985116906bffffffffffffffffffffffff60a01b91828a54161789556001890192511690825416179055516002860155516003850155516004840155519101555f80f35b346101285760c03660031901126101285760043560443567ffffffffffffffff811161012857610c2e903690600401610ca1565b9060643560ff8116810361012857610840610c6891610c4b610e15565b855f52600160205260a4359060843590600360405f200154611331565b336001600160a01b03909116036108825761015592602435903390610e3f565b34610128575f366003190112610128576020905f548152f35b9181601f840112156101285782359167ffffffffffffffff8311610128576020808501948460051b01011161012857565b602435906001600160a01b038216820361012857565b600435906001600160a01b038216820361012857565b60c0810190811067ffffffffffffffff821117610d1a57604052565b634e487b7160e01b5f52604160045260245ffd5b9190811015610d3e5760051b0190565b634e487b7160e01b5f52603260045260245ffd5b9190811015610d3e5760051b81013590601e198136030182121561012857019081359167ffffffffffffffff8311610128576020018260051b36038113610128579190565b919082018092116103b957565b6001600160a01b03908116908115610dfd575f805160206114e683398151915280546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3565b604051631e4fbdf760e01b81525f6004820152602490fd5b60ff5f805160206115068339815191525416610e2d57565b60405163d93c066560e01b8152600490fd5b9091929493815f5260209060018252604090815f2092825194610e6186610cfe565b60018060a01b0394858154168752856001820154169a8388019b8c52600282015494868901958652600383015460608a015260056004938481015460808c0152015460a08a0152835f5260018552865f20875190610ebe82610cfe565b89815416825289600182015416878301526002810154898301526003810154606083015260a060058683015492836080860152015492019182524210611007574290511115610ff757835f5260038552865f20888b165f52855260ff875f205416610fe757610f2c8b61104f565b95845f5260028652875f20875f52865260ff885f205416610fd75751610f5492879290611086565b15610fc957505f90815260028252838120928152919052819020805460ff19166001179055516001600160a01b0384168152602081018590529495610fc7958291907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a90604090a1511691511690611229565b565b84516309bde33960e01b8152fd5b8751630c8d9eab60e31b81528490fd5b865163a5baf15160e01b81528390fd5b865163477383f360e01b81528390fd5b8751636f312cbd60e01b81528490fd5b5f805160206114e6833981519152546001600160a01b0316330361103757565b60405163118cdaa760e01b8152336004820152602490fd5b60405160208101913360601b83526034820152603481526060810181811067ffffffffffffffff821117610d1a5760405251902090565b9192915f915b80831061109a575050501490565b9091926110a8848385610d2e565b3590818110156110c7575f52602052600160405f205b9301919061108c565b905f52602052600160405f206110be565b9295949094835f5260209460018652604097885f20948951906110fa82610cfe565b60018060a01b0391828854168152826001890154169a8a82019b8c5260028901549b8d83019c8d5260038a0154606084015260049960058b8201549182608087015201549060a08501918252421061121957429051111561120957518416908416036111f957518216908216036111e957865f5260038852895f2091165f52865260ff885f2054166111d95761118f9061104f565b95845f5260028652875f20875f52865260ff885f205416610fd757516111b792879290611086565b15610fc957505f5260028152825f20915f52525f20600160ff19825416179055565b875163a5baf15160e01b81528490fd5b895163c1faacc560e01b81528690fd5b8b5163936bb5ad60e01b81528890fd5b8d5163477383f360e01b81528a90fd5b8e51636f312cbd60e01b81528b90fd5b6040516323b872dd60e01b602082019081526001600160a01b039384166024830152938316604482015260648082019590955293845267ffffffffffffffff92909160a08501919084831186841017610d1a575f9384936040521694519082865af13d15611324573d90828211610d1a57601f199160405192603f81601f840116011683019383851090851117610d1a576112d2936040528252815f60203d92013e5b83611482565b8051908115159182611300575b50506112e85750565b60249060405190635274afe760e01b82526004820152fd5b81925090602091810103126101285760200151801590811503610128575f806112df565b6112d291506060906112cc565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084116113b3579160209360809260ff5f9560405194855216868401526040830152606082015282805260015afa156113a8575f516001600160a01b0381161561139e57905f905f90565b505f906001905f90565b6040513d5f823e3d90fd5b5050505f9160039190565b600481101561142d57806113d0575050565b600181036113ea5760405163f645eedf60e01b8152600490fd5b6002810361140b5760405163fce698f760e01b815260048101839052602490fd5b6003146114155750565b602490604051906335e2f38360e21b82526004820152fd5b634e487b7160e01b5f52602160045260245ffd5b60ff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460401c161561147057565b604051631afcd79f60e31b8152600490fd5b906114a9575080511561149757805190602001fd5b604051630a12f52160e11b8152600490fd5b815115806114dc575b6114ba575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b156114b256fe9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300a26469706673582212206eca6ba74a080fa2541c95814899e5f2d034dac2d157af92a30963d80ece19dc64736f6c63430008170033
Deployed Bytecode
0x6080806040526004361015610012575f80fd5b5f3560e01c9081632ddbd13a14610c8857508063304388b814610bfa578063358cd4cd14610b2e5780633f4ba83a14610ab9578063555d61c414610a565780635c975abb14610a2857806360db5082146109bc578063715018a6146109555780638456cb59146108f05780638da5cb5b146108bc578063b5d3c35014610667578063c0ff15431461061e578063c4d66de8146104cc578063c652b11f14610472578063dca2169d146103cd578063ddc7eb17146102e1578063e124012014610157578063f2fde38b1461012c5763f70e4760146100ed575f80fd5b34610128576040366003190112610128576004355f52600260205260405f206024355f52602052602060ff60405f2054166040519015158152f35b5f80fd5b3461012857602036600319011261012857610155610148610ce8565b610150611017565b610da4565b005b346101285760c036600319011261012857610170610ce8565b610178610cd2565b67ffffffffffffffff916044358381116101285761019a903690600401610ca1565b9290606435858111610128576101b4903690600401610ca1565b95608435908111610128576101cd903690600401610ca1565b9160a435801590811503610128576101e3610e15565b6102cf578787148015906102c5575b6102b057959291905f965f945b8086106102585760408051338152602081018b9052610155918b918b918b917fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a91819081015b0390a133916001600160a01b0316611229565b9091929394976102a48560019261029f8a8c8f8f610295818f818f958f958f906102859161028c95610d2e565b3595610d2e565b35988994610d52565b94909333926110d8565b610d97565b980194939291906101ff565b6040516001621398b960e31b03198152600490fd5b50828814156101f2565b60405163029d79a560e41b8152600490fd5b346101285760c0366003190112610128576102fa610ce8565b610302610cd2565b9061030b611017565b5f54905f1982146103b95760016005920190815f556040519361032d85610cfe565b60018060a01b038092168552816020860191168152604085016044358152606086019160643583526080870193608435855260a088019560a43587525f5260016020528060405f20985116906bffffffffffffffffffffffff60a01b91828a54161789556001890192511690825416179055516002860155516003850155516004840155519101555f80f35b634e487b7160e01b5f52601160045260245ffd5b346101285760603660031901126101285760043560243567ffffffffffffffff811161012857610401903690600401610ca1565b91604435918215158093036101285761041b929192611017565b60ff5f9216915b84811061042b57005b835f526020906003825260405f20610444828886610d2e565b356001600160a01b0381169390849003610128576001935f525260405f208460ff1982541617905501610422565b346101285760803660031901126101285760443567ffffffffffffffff8111610128576104a3903690600401610ca1565b606435801590811503610128576104b8610e15565b6102cf576101559160243533600435610e3f565b34610128576020366003190112610128576104e5610ce8565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090815460ff8160401c16159167ffffffffffffffff821680159081610616575b600114908161060c575b159081610603575b506105f15767ffffffffffffffff198216600117845561058f91836105d2575b50610561611441565b610569611441565b5f80516020611506833981519152805460ff19169055610587611441565b610150611441565b61059557005b68ff00000000000000001981541690557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b68ffffffffffffffffff19166801000000000000000117845584610558565b60405163f92ee8a960e01b8152600490fd5b90501585610538565b303b159150610530565b849150610526565b3461012857604036600319011261012857610637610cd2565b6004355f52600360205260405f209060018060a01b03165f52602052602060ff60405f2054166040519015158152f35b346101285761010036600319011261012857610681610ce8565b610689610cd2565b67ffffffffffffffff91604435838111610128576106ab903690600401610ca1565b9290606435858111610128576106c5903690600401610ca1565b608435878111610128576106dd903690600401610ca1565b909760a435818111610128576106f7903690600401610ca1565b939060c43583811161012857610711903690600401610ca1565b92909360e4359081116101285761072c903690600401610ca1565b939091610737610e15565b808d148015906108b2575b80156108a8575b801561089e575b8015610894575b6102b0579b9897969594939291905f9c5f9a5b808c106107bc576101558f8f8f7fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a6040518061024586338360209093929193604081019460018060a01b031681520152565b909192939495969798999a9d8f908f8f918f918f928f948f9461080a846107f28f938d6107eb848f8194610d2e565b359b610d2e565b3597895f526001602052600360405f20015493610d2e565b3560ff81168103610128578f918f610840928f918f610839916108328b80936108499a610d2e565b3594610d2e565b3592611331565b909291926113be565b336001600160a01b039091160361088257848f9661029561029f956108709960019b610d52565b9e019a9998979695949392919061076a565b604051637c62b1c760e11b8152600490fd5b5084821415610757565b5081881415610750565b5087871415610749565b5086811415610742565b34610128575f366003190112610128575f805160206114e6833981519152546040516001600160a01b039091168152602090f35b34610128575f36600319011261012857610908611017565b610910610e15565b5f80516020611506833981519152600160ff198254161790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b34610128575f3660031901126101285761096d611017565b5f805160206114e683398151915280546001600160a01b031981169091555f906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34610128576020366003190112610128576004355f52600160205260c060405f2060018060a01b039081815416916001820154169060028101546003820154906005600484015493015493604051958652602086015260408501526060840152608083015260a0820152f35b34610128575f36600319011261012857602060ff5f8051602061150683398151915254166040519015158152f35b346101285760603660031901126101285760443567ffffffffffffffff811161012857610aaf610a8c6020923690600401610ca1565b6004355f5260018452600260405f20015490610aa960243561104f565b92611086565b6040519015158152f35b34610128575f36600319011261012857610ad1611017565b5f80516020611506833981519152805460ff811615610b1c5760ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b604051638dfc202b60e01b8152600490fd5b346101285760e036600319011261012857610b47610cd2565b6044356001600160a01b038181169182900361012857600591610b68611017565b8160405194610b7686610cfe565b1684526020840190815260408401606435815260608501906084358252608086019260a435845260a087019460c43586526004355f5260016020528060405f20985116906bffffffffffffffffffffffff60a01b91828a54161789556001890192511690825416179055516002860155516003850155516004840155519101555f80f35b346101285760c03660031901126101285760043560443567ffffffffffffffff811161012857610c2e903690600401610ca1565b9060643560ff8116810361012857610840610c6891610c4b610e15565b855f52600160205260a4359060843590600360405f200154611331565b336001600160a01b03909116036108825761015592602435903390610e3f565b34610128575f366003190112610128576020905f548152f35b9181601f840112156101285782359167ffffffffffffffff8311610128576020808501948460051b01011161012857565b602435906001600160a01b038216820361012857565b600435906001600160a01b038216820361012857565b60c0810190811067ffffffffffffffff821117610d1a57604052565b634e487b7160e01b5f52604160045260245ffd5b9190811015610d3e5760051b0190565b634e487b7160e01b5f52603260045260245ffd5b9190811015610d3e5760051b81013590601e198136030182121561012857019081359167ffffffffffffffff8311610128576020018260051b36038113610128579190565b919082018092116103b957565b6001600160a01b03908116908115610dfd575f805160206114e683398151915280546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3565b604051631e4fbdf760e01b81525f6004820152602490fd5b60ff5f805160206115068339815191525416610e2d57565b60405163d93c066560e01b8152600490fd5b9091929493815f5260209060018252604090815f2092825194610e6186610cfe565b60018060a01b0394858154168752856001820154169a8388019b8c52600282015494868901958652600383015460608a015260056004938481015460808c0152015460a08a0152835f5260018552865f20875190610ebe82610cfe565b89815416825289600182015416878301526002810154898301526003810154606083015260a060058683015492836080860152015492019182524210611007574290511115610ff757835f5260038552865f20888b165f52855260ff875f205416610fe757610f2c8b61104f565b95845f5260028652875f20875f52865260ff885f205416610fd75751610f5492879290611086565b15610fc957505f90815260028252838120928152919052819020805460ff19166001179055516001600160a01b0384168152602081018590529495610fc7958291907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a90604090a1511691511690611229565b565b84516309bde33960e01b8152fd5b8751630c8d9eab60e31b81528490fd5b865163a5baf15160e01b81528390fd5b865163477383f360e01b81528390fd5b8751636f312cbd60e01b81528490fd5b5f805160206114e6833981519152546001600160a01b0316330361103757565b60405163118cdaa760e01b8152336004820152602490fd5b60405160208101913360601b83526034820152603481526060810181811067ffffffffffffffff821117610d1a5760405251902090565b9192915f915b80831061109a575050501490565b9091926110a8848385610d2e565b3590818110156110c7575f52602052600160405f205b9301919061108c565b905f52602052600160405f206110be565b9295949094835f5260209460018652604097885f20948951906110fa82610cfe565b60018060a01b0391828854168152826001890154169a8a82019b8c5260028901549b8d83019c8d5260038a0154606084015260049960058b8201549182608087015201549060a08501918252421061121957429051111561120957518416908416036111f957518216908216036111e957865f5260038852895f2091165f52865260ff885f2054166111d95761118f9061104f565b95845f5260028652875f20875f52865260ff885f205416610fd757516111b792879290611086565b15610fc957505f5260028152825f20915f52525f20600160ff19825416179055565b875163a5baf15160e01b81528490fd5b895163c1faacc560e01b81528690fd5b8b5163936bb5ad60e01b81528890fd5b8d5163477383f360e01b81528a90fd5b8e51636f312cbd60e01b81528b90fd5b6040516323b872dd60e01b602082019081526001600160a01b039384166024830152938316604482015260648082019590955293845267ffffffffffffffff92909160a08501919084831186841017610d1a575f9384936040521694519082865af13d15611324573d90828211610d1a57601f199160405192603f81601f840116011683019383851090851117610d1a576112d2936040528252815f60203d92013e5b83611482565b8051908115159182611300575b50506112e85750565b60249060405190635274afe760e01b82526004820152fd5b81925090602091810103126101285760200151801590811503610128575f806112df565b6112d291506060906112cc565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084116113b3579160209360809260ff5f9560405194855216868401526040830152606082015282805260015afa156113a8575f516001600160a01b0381161561139e57905f905f90565b505f906001905f90565b6040513d5f823e3d90fd5b5050505f9160039190565b600481101561142d57806113d0575050565b600181036113ea5760405163f645eedf60e01b8152600490fd5b6002810361140b5760405163fce698f760e01b815260048101839052602490fd5b6003146114155750565b602490604051906335e2f38360e21b82526004820152fd5b634e487b7160e01b5f52602160045260245ffd5b60ff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460401c161561147057565b604051631afcd79f60e31b8152600490fd5b906114a9575080511561149757805190602001fd5b604051630a12f52160e11b8152600490fd5b815115806114dc575b6114ba575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b156114b256fe9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300a26469706673582212206eca6ba74a080fa2541c95814899e5f2d034dac2d157af92a30963d80ece19dc64736f6c63430008170033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.