ETH Price: $3,318.33 (+2.66%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Oracle215876382025-01-09 14:52:4722 days ago1736434367IN
0x335d354e...f3f8aca9a
0 ETH0.0003776113.22429236
Claim215869272025-01-09 12:29:3522 days ago1736425775IN
0x335d354e...f3f8aca9a
0 ETH0.00056145.70107903
Update Merkle Ro...215867882025-01-09 12:01:4722 days ago1736424107IN
0x335d354e...f3f8aca9a
0 ETH0.002128716.18343049
Claim215857052025-01-09 8:22:5922 days ago1736410979IN
0x335d354e...f3f8aca9a
0 ETH0.000641176.31699925
Claim215856832025-01-09 8:18:3522 days ago1736410715IN
0x335d354e...f3f8aca9a
0 ETH0.000603386.44788107
Claim215856802025-01-09 8:17:5922 days ago1736410679IN
0x335d354e...f3f8aca9a
0 ETH0.000684657.03536776
Claim215853622025-01-09 7:14:2322 days ago1736406863IN
0x335d354e...f3f8aca9a
0 ETH0.000418054.24215718
Claim215853122025-01-09 7:04:2322 days ago1736406263IN
0x335d354e...f3f8aca9a
0 ETH0.000397564.29163641
Claim215853062025-01-09 7:03:1122 days ago1736406191IN
0x335d354e...f3f8aca9a
0 ETH0.000452294.58969915
Claim215851752025-01-09 6:36:1122 days ago1736404571IN
0x335d354e...f3f8aca9a
0 ETH0.00027862.97802096
Claim215846472025-01-09 4:49:5922 days ago1736398199IN
0x335d354e...f3f8aca9a
0 ETH0.000307564.02402946
Claim215846442025-01-09 4:49:2322 days ago1736398163IN
0x335d354e...f3f8aca9a
0 ETH0.000286513.7479657
Claim215846422025-01-09 4:48:5922 days ago1736398139IN
0x335d354e...f3f8aca9a
0 ETH0.000393743.93757971
Claim215838982025-01-09 2:19:4722 days ago1736389187IN
0x335d354e...f3f8aca9a
0 ETH0.000757047.68294359
Claim215838512025-01-09 2:10:1122 days ago1736388611IN
0x335d354e...f3f8aca9a
0 ETH0.00064756.3827545
Claim215836792025-01-09 1:35:4722 days ago1736386547IN
0x335d354e...f3f8aca9a
0 ETH0.000477015.09931599
Update Merkle Ro...215832122025-01-09 0:01:4722 days ago1736380907IN
0x335d354e...f3f8aca9a
0 ETH0.001828116.87714816
Claim215828472025-01-08 22:48:3522 days ago1736376515IN
0x335d354e...f3f8aca9a
0 ETH0.00084378.56498251
Claim215818882025-01-08 19:35:4723 days ago1736364947IN
0x335d354e...f3f8aca9a
0 ETH0.000573287
Claim215818882025-01-08 19:35:4723 days ago1736364947IN
0x335d354e...f3f8aca9a
0 ETH0.000484056.71666971
Claim215818662025-01-08 19:31:2323 days ago1736364683IN
0x335d354e...f3f8aca9a
0 ETH0.0006018610.14178156
Claim215817652025-01-08 19:11:1123 days ago1736363471IN
0x335d354e...f3f8aca9a
0 ETH0.0013942213.743023
Claim215817622025-01-08 19:10:3523 days ago1736363435IN
0x335d354e...f3f8aca9a
0 ETH0.0013494213.7
Claim215815262025-01-08 18:23:2323 days ago1736360603IN
0x335d354e...f3f8aca9a
0 ETH0.0014659419.17702759
Claim215809362025-01-08 16:25:1123 days ago1736353511IN
0x335d354e...f3f8aca9a
0 ETH0.0011213911.3861436
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CampaignManager

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion
File 1 of 7 : CampaignManager.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.17;

import {SafeERC20} from "openzeppelin-contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "openzeppelin-contracts/interfaces/IERC20.sol";
import {MerkleProof} from "openzeppelin-contracts/utils/cryptography/MerkleProof.sol";

contract CampaignManager {
    using SafeERC20 for IERC20;

    address private _oracle;
    Campaign[] private _campaigns;
    mapping(address => mapping(address => mapping(address => uint256)))
        private _userClaims; // user => token => reward_token => claimed_amount
    mapping(address => mapping(address => bytes32)) private _merkleRoots; // token => reward_token

    struct Campaign {
        address token;
        uint256 startTimestamp;
        uint256 endTimestamp;
        address rewardToken;
        uint256 rewardAmount;
        Options options;
        address owner;
        uint256 stoppedTimestamp; // 0 if not force stopped
    }
    struct Options {
        uint8 indexMode; // 0 = regular, 1 = custom endpoint (data)
        bytes data; // if indexMode = 1, data is the endpoint (with {{0}} and {{1}} replaced by startTimestamp, currentTimestamp respectively)
    }

    event CampaignCreated(
        uint256 id,
        address token,
        uint256 start,
        uint256 end,
        address rewardToken,
        uint256 rewardAmount,
        Options options,
        address owner
    );
    event CampaignStopped(uint256 id, uint256 stoppedTimestamp);
    event MerkleRootsUpdated(
        address[] tokens,
        address[] rewardTokens,
        bytes32[] roots
    );
    event Claimed(
        address account,
        address token,
        address rewardToken,
        uint256 amount
    );
    event OracleUpdated(address oldOracle, address newOracle);

    error CampaignDoesNotExist();
    error CampaignNotRunning();
    error ParamLengthMismatch();
    error NotOwner();
    error InvalidProof();
    error InvalidAmount();
    error InvalidOptions();
    error NotOracle();
    error InvalidOracle();

    constructor() {
        _oracle = msg.sender;
    }

    function create(
        address token,
        uint256 start,
        uint256 end,
        address rewardToken,
        uint256 rewardAmount,
        Options calldata options
    ) external returns (uint256) {
        if (msg.sender != _oracle) {
            // only oracle is allowed to create campaigns with no pre-defined reward amount or custom endpoint
            if (rewardAmount == 0) {
                revert InvalidAmount();
            } else if (options.indexMode != 0) {
                revert InvalidOptions();
            }
        }
        _campaigns.push(
            Campaign(
                token,
                start,
                end,
                rewardToken,
                rewardAmount,
                options,
                msg.sender,
                0
            )
        );
        if (rewardAmount > 0) {
            // pre-fund the campaign
            IERC20(rewardToken).safeTransferFrom(
                msg.sender,
                address(this),
                rewardAmount
            );
        }
        uint256 id = _campaigns.length - 1;
        emit CampaignCreated(
            id,
            token,
            start,
            end,
            rewardToken,
            rewardAmount,
            options,
            msg.sender
        );
        return id;
    }

    function stop(uint256 id) public {
        if (id >= campaignsCount()) {
            revert CampaignDoesNotExist();
        }
        Campaign storage campaign = _campaigns[id];
        if (campaign.owner != msg.sender) {
            revert NotOwner();
        }
        uint256 stoppedTimestamp = block.timestamp;
        if (
            campaign.stoppedTimestamp > 0 ||
            campaign.endTimestamp <= stoppedTimestamp
        ) {
            revert CampaignNotRunning();
        }
        campaign.stoppedTimestamp = stoppedTimestamp;
        if (campaign.rewardAmount > 0) {
            uint256 refundAmount = ((campaign.endTimestamp - stoppedTimestamp) *
                campaign.rewardAmount) /
                (campaign.endTimestamp - campaign.startTimestamp);
            // refund remaining campaign amount
            IERC20(campaign.rewardToken).safeTransfer(msg.sender, refundAmount);
        }
        emit CampaignStopped(id, stoppedTimestamp);
    }

    function updateMerkleRoots(
        address[] calldata tokens,
        address[] calldata rewardTokens,
        bytes32[] calldata merkleRoots
    ) public {
        if (_oracle != msg.sender) {
            revert NotOracle();
        }
        if (
            tokens.length != merkleRoots.length ||
            rewardTokens.length != merkleRoots.length
        ) {
            revert ParamLengthMismatch();
        }
        // uint256 i; is cheaper than uint256 i = 0;
        for (uint256 i; i < tokens.length; ) {
            _merkleRoots[tokens[i]][rewardTokens[i]] = merkleRoots[i];
            unchecked {
                ++i;
            }
        }
        emit MerkleRootsUpdated(tokens, rewardTokens, merkleRoots);
    }

    function claim(
        address token,
        address rewardToken,
        uint256 earnedAmount,
        uint256 claimAmount,
        bytes32[] calldata merkleProof
    ) external {
        bytes32 node = keccak256(abi.encodePacked(msg.sender, earnedAmount));
        bytes32 root = merkleRoot(token, rewardToken);
        if (!MerkleProof.verify(merkleProof, root, node)) {
            revert InvalidProof();
        }
        uint256 newClaimedAmount = _userClaims[msg.sender][token][rewardToken] +
            claimAmount;
        if (newClaimedAmount > earnedAmount) {
            revert InvalidAmount();
        }
        _userClaims[msg.sender][token][rewardToken] = newClaimedAmount;
        IERC20(rewardToken).transfer(msg.sender, claimAmount);
        emit Claimed(msg.sender, token, rewardToken, claimAmount);
    }

    function get(uint256 id) external view returns (Campaign memory) {
        return _campaigns[id];
    }

    function campaignsCount() public view returns (uint256) {
        return _campaigns.length;
    }

    function oracle() external view returns (address) {
        return _oracle;
    }

    function userClaims(
        address user,
        address token,
        address rewardToken
    ) external view returns (uint256) {
        return _userClaims[user][token][rewardToken];
    }

    function merkleRoot(
        address token,
        address rewardToken
    ) public view returns (bytes32) {
        return _merkleRoots[token][rewardToken];
    }

    function transferOracle(address newOracle) external {
        if (msg.sender != _oracle) {
            revert NotOracle();
        }
        if (newOracle == address(0) || newOracle == _oracle) {
            revert InvalidOracle();
        }
        address oldOracle = _oracle;
        _oracle = newOracle;
        emit OracleUpdated(oldOracle, newOracle);
    }
}

File 2 of 7 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../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;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 3 of 7 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)

pragma solidity ^0.8.0;

import "../token/ERC20/IERC20.sol";

File 4 of 7 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @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 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}
     *
     * _Available since v4.7._
     */
    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.
     *
     * _Available since v4.4._
     */
    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}
     *
     * _Available since v4.7._
     */
    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.
     *
     * _Available since v4.7._
     */
    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.
     *
     * _Available since v4.7._
     */
    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).
     *
     * _Available since v4.7._
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild 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 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // 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 for 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) {
            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.
     *
     * _Available since v4.7._
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild 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 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // 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 for 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) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    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)
        }
    }
}

File 5 of 7 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @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 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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 6 of 7 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @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.
 */
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].
     */
    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);
}

File 7 of 7 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @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://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @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, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * 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.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @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`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

Settings
{
  "remappings": [
    "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/contracts/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "openzeppelin-erc20-basic/=lib/openzeppelin-contracts/contracts/token/ERC20/",
    "openzeppelin-erc20-extensions/=lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/",
    "openzeppelin-erc20/=lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/",
    "openzeppelin-math/=lib/openzeppelin-contracts-upgradeable/contracts/utils/math/",
    "openzeppelin-proxy/=lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/",
    "openzeppelin-utils/=lib/openzeppelin-contracts-upgradeable/contracts/utils/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CampaignDoesNotExist","type":"error"},{"inputs":[],"name":"CampaignNotRunning","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidOptions","type":"error"},{"inputs":[],"name":"InvalidOracle","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"NotOracle","type":"error"},{"inputs":[],"name":"NotOwner","type":"error"},{"inputs":[],"name":"ParamLengthMismatch","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"end","type":"uint256"},{"indexed":false,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"components":[{"internalType":"uint8","name":"indexMode","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct CampaignManager.Options","name":"options","type":"tuple"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"CampaignCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stoppedTimestamp","type":"uint256"}],"name":"CampaignStopped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"indexed":false,"internalType":"bytes32[]","name":"roots","type":"bytes32[]"}],"name":"MerkleRootsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOracle","type":"address"},{"indexed":false,"internalType":"address","name":"newOracle","type":"address"}],"name":"OracleUpdated","type":"event"},{"inputs":[],"name":"campaignsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"earnedAmount","type":"uint256"},{"internalType":"uint256","name":"claimAmount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"components":[{"internalType":"uint8","name":"indexMode","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct CampaignManager.Options","name":"options","type":"tuple"}],"name":"create","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"get","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"endTimestamp","type":"uint256"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"components":[{"internalType":"uint8","name":"indexMode","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct CampaignManager.Options","name":"options","type":"tuple"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"stoppedTimestamp","type":"uint256"}],"internalType":"struct CampaignManager.Campaign","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"}],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"stop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOracle","type":"address"}],"name":"transferOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"bytes32[]","name":"merkleRoots","type":"bytes32[]"}],"name":"updateMerkleRoots","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"}],"name":"userClaims","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50600080546001600160a01b031916331790556117a8806100326000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80639507d39a116100665780639507d39a14610144578063b5217a5014610164578063cf3ef1d714610177578063e73268061461018a578063fa46d7ac1461019d57600080fd5b806331d42b57146100a35780633f369d40146100b857806344c89b651461010e5780636299f8cf146101165780637dc0d1d014610129575b600080fd5b6100b66100b1366004610f1b565b6101b0565b005b6100fb6100c6366004610fd1565b6001600160a01b0392831660009081526002602090815260408083209486168352938152838220929094168152925290205490565b6040519081526020015b60405180910390f35b6001546100fb565b6100b6610124366004611014565b61030c565b6000546040516001600160a01b039091168152602001610105565b610157610152366004611014565b610466565b604051610105919061109f565b6100fb61017236600461112c565b6105af565b6100fb6101853660046111ad565b6107bd565b6100b66101983660046111e0565b6107ea565b6100b66101ab3660046111fb565b6108b7565b6000546001600160a01b031633146101db57604051631bc2178f60e01b815260040160405180910390fd5b84811415806101ea5750828114155b156102085760405163325193fd60e01b815260040160405180910390fd5b60005b858110156102c25782828281811061022557610225611261565b905060200201356003600089898581811061024257610242611261565b905060200201602081019061025791906111e0565b6001600160a01b03166001600160a01b03168152602001908152602001600020600087878581811061028b5761028b611261565b90506020020160208101906102a091906111e0565b6001600160a01b0316815260208101919091526040016000205560010161020b565b507f6478b27363ab194cc20bb050c3077aea3873490053aca8414fab4b2a49c175808686868686866040516102fc969594939291906112be565b60405180910390a1505050505050565b600154811061032e57604051639b35ed3b60e01b815260040160405180910390fd5b60006001828154811061034357610343611261565b600091825260209091206007600990920201908101549091506001600160a01b03163314610384576040516330cd747160e01b815260040160405180910390fd5b6008810154429015158061039c575080826002015411155b156103ba576040516301da3e7360e61b815260040160405180910390fd5b60088201819055600482015415610428576000826001015483600201546103e19190611337565b83600401548385600201546103f69190611337565b610400919061134a565b61040a9190611361565b6003840154909150610426906001600160a01b03163383610ab8565b505b60408051848152602081018390527fea3dfb4d306253a7503e41b5f086dfc6bf5dadeb64ce30bbbf93508c8158e731910160405180910390a1505050565b61046e610e5a565b6001828154811061048157610481611261565b60009182526020918290206040805161010081018252600990930290910180546001600160a01b039081168452600182015484860152600282015484840152600382015416606084015260048101546080840152815180830190925260058101805460ff1683526006820180549495929460a0870194938401919061050590611383565b80601f016020809104026020016040519081016040528092919081815260200182805461053190611383565b801561057e5780601f106105535761010080835404028352916020019161057e565b820191906000526020600020905b81548152906001019060200180831161056157829003601f168201915b50505091909252505050815260078201546001600160a01b0316602082015260089091015460409091015292915050565b600080546001600160a01b0316331461061157826000036105e35760405163162908e360e11b815260040160405180910390fd5b6105f060208301836113ce565b60ff161561061157604051630280f17760e01b815260040160405180910390fd5b6001604051806101000160405280896001600160a01b03168152602001888152602001878152602001866001600160a01b031681526020018581526020018461065990611459565b8152336020808301919091526000604092830181905284546001808201875595825290829020845160099092020180546001600160a01b03199081166001600160a01b03938416178255858401519682019690965592840151600284015560608401516003840180549096169116179093556080820151600482015560a0820151805160058301805460ff191660ff9092169190911781559381015192939192909190600684019061070b9082611553565b50505060c08201516007820180546001600160a01b0319166001600160a01b0390921691909117905560e090910151600890910155821561075b5761075b6001600160a01b038516333086610b20565b6001805460009161076b91611337565b90507f76234507c536075bf9eccc4df3ea5a731652dce90bed5230f80cb76514d670f281898989898989336040516107aa989796959493929190611613565b60405180910390a1979650505050505050565b6001600160a01b038083166000908152600360209081526040808320938516835292905220545b92915050565b6000546001600160a01b0316331461081557604051631bc2178f60e01b815260040160405180910390fd5b6001600160a01b038116158061083857506000546001600160a01b038281169116145b1561085657604051639589a27d60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f078c3b417dadf69374a59793b829c52001247130433427049317bde56607b1b7910160405180910390a15050565b6040516bffffffffffffffffffffffff193360601b16602082015260348101859052600090605401604051602081830303815290604052805190602001209050600061090388886107bd565b9050610945848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250869150610b5e9050565b610962576040516309bde33960e01b815260040160405180910390fd5b3360009081526002602090815260408083206001600160a01b038c81168552908352818420908b16845290915281205461099d9087906116f5565b9050868111156109c05760405163162908e360e11b815260040160405180910390fd5b3360008181526002602090815260408083206001600160a01b038e81168552908352818420908d16808552925291829020849055905163a9059cbb60e01b81526004810192909252602482018890529063a9059cbb906044016020604051808303816000875af1158015610a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5c9190611708565b50604080513381526001600160a01b038b811660208301528a16818301526060810188905290517f913c992353dc81b7a8ba31496c484e9b6306bd2f6c509a649a38fdf5e1c953b29181900360800190a1505050505050505050565b6040516001600160a01b038316602482015260448101829052610b1b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b74565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610b589085906323b872dd60e01b90608401610ae4565b50505050565b600082610b6b8584610c4b565b14949350505050565b6000610bc9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c989092919063ffffffff16565b805190915015610b1b5780806020019051810190610be79190611708565b610b1b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b600081815b8451811015610c9057610c7c82868381518110610c6f57610c6f611261565b6020026020010151610caf565b915080610c888161172a565b915050610c50565b509392505050565b6060610ca78484600085610ce1565b949350505050565b6000818310610ccb576000828152602084905260409020610cda565b60008381526020839052604090205b9392505050565b606082471015610d425760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c42565b600080866001600160a01b03168587604051610d5e9190611743565b60006040518083038185875af1925050503d8060008114610d9b576040519150601f19603f3d011682016040523d82523d6000602084013e610da0565b606091505b5091509150610db187838387610dbc565b979650505050505050565b60608315610e2b578251600003610e24576001600160a01b0385163b610e245760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c42565b5081610ca7565b610ca78383815115610e405781518083602001fd5b8060405162461bcd60e51b8152600401610c42919061175f565b60405180610100016040528060006001600160a01b03168152602001600081526020016000815260200160006001600160a01b0316815260200160008152602001610ebb6040518060400160405280600060ff168152602001606081525090565b815260006020820181905260409091015290565b60008083601f840112610ee157600080fd5b50813567ffffffffffffffff811115610ef957600080fd5b6020830191508360208260051b8501011115610f1457600080fd5b9250929050565b60008060008060008060608789031215610f3457600080fd5b863567ffffffffffffffff80821115610f4c57600080fd5b610f588a838b01610ecf565b90985096506020890135915080821115610f7157600080fd5b610f7d8a838b01610ecf565b90965094506040890135915080821115610f9657600080fd5b50610fa389828a01610ecf565b979a9699509497509295939492505050565b80356001600160a01b0381168114610fcc57600080fd5b919050565b600080600060608486031215610fe657600080fd5b610fef84610fb5565b9250610ffd60208501610fb5565b915061100b60408501610fb5565b90509250925092565b60006020828403121561102657600080fd5b5035919050565b60005b83811015611048578181015183820152602001611030565b50506000910152565b6000815180845261106981602086016020860161102d565b601f01601f19169290920160200192915050565b60ff81511682526000602082015160406020850152610ca76040850182611051565b60208152600060018060a01b03808451166020840152602084015160408401526040840151606084015280606085015116608084015250608083015160a083015260a08301516101008060c08501526110fc61012085018361107d565b915060c085015161111860e08601826001600160a01b03169052565b5060e0949094015192909301919091525090565b60008060008060008060c0878903121561114557600080fd5b61114e87610fb5565b9550602087013594506040870135935061116a60608801610fb5565b92506080870135915060a087013567ffffffffffffffff81111561118d57600080fd5b87016040818a03121561119f57600080fd5b809150509295509295509295565b600080604083850312156111c057600080fd5b6111c983610fb5565b91506111d760208401610fb5565b90509250929050565b6000602082840312156111f257600080fd5b610cda82610fb5565b60008060008060008060a0878903121561121457600080fd5b61121d87610fb5565b955061122b60208801610fb5565b94506040870135935060608701359250608087013567ffffffffffffffff81111561125557600080fd5b610fa389828a01610ecf565b634e487b7160e01b600052603260045260246000fd5b8183526000602080850194508260005b858110156112b3576001600160a01b036112a083610fb5565b1687529582019590820190600101611287565b509495945050505050565b6060815260006112d260608301888a611277565b82810360208401526112e5818789611277565b838103604085015284815290506001600160fb1b0384111561130657600080fd5b8360051b808660208401370160200198975050505050505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156107e4576107e4611321565b80820281158282048414176107e4576107e4611321565b60008261137e57634e487b7160e01b600052601260045260246000fd5b500490565b600181811c9082168061139757607f821691505b6020821081036113b757634e487b7160e01b600052602260045260246000fd5b50919050565b803560ff81168114610fcc57600080fd5b6000602082840312156113e057600080fd5b610cda826113bd565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611422576114226113e9565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611451576114516113e9565b604052919050565b60006040823603121561146b57600080fd5b6114736113ff565b61147c836113bd565b815260208084013567ffffffffffffffff8082111561149a57600080fd5b9085019036601f8301126114ad57600080fd5b8135818111156114bf576114bf6113e9565b6114d1601f8201601f19168501611428565b915080825236848285010111156114e757600080fd5b80848401858401376000908201840152918301919091525092915050565b601f821115610b1b57600081815260208120601f850160051c8101602086101561152c5750805b601f850160051c820191505b8181101561154b57828155600101611538565b505050505050565b815167ffffffffffffffff81111561156d5761156d6113e9565b6115818161157b8454611383565b84611505565b602080601f8311600181146115b6576000841561159e5750858301515b600019600386901b1c1916600185901b17855561154b565b600085815260208120601f198616915b828110156115e5578886015182559484019460019091019084016115c6565b50858210156116035787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8881526001600160a01b03888116602083015260408201889052606082018790528516608082015260a0810184905261010060c0820181905260009060ff61165a866113bd565b1690830152602084013536859003601e1901811261167757600080fd5b840160208101903567ffffffffffffffff81111561169457600080fd5b8036038213156116a357600080fd5b6040610120850152806101408501526101608183828701376000858301820152601f909101601f191684010191506116e8905060e08301846001600160a01b03169052565b9998505050505050505050565b808201808211156107e4576107e4611321565b60006020828403121561171a57600080fd5b81518015158114610cda57600080fd5b60006001820161173c5761173c611321565b5060010190565b6000825161175581846020870161102d565b9190910192915050565b602081526000610cda602083018461105156fea2646970667358221220569a78b675ed32995f41f93a4aea10f7f7a5971765ecb8bc6159818df95236d464736f6c63430008110033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80639507d39a116100665780639507d39a14610144578063b5217a5014610164578063cf3ef1d714610177578063e73268061461018a578063fa46d7ac1461019d57600080fd5b806331d42b57146100a35780633f369d40146100b857806344c89b651461010e5780636299f8cf146101165780637dc0d1d014610129575b600080fd5b6100b66100b1366004610f1b565b6101b0565b005b6100fb6100c6366004610fd1565b6001600160a01b0392831660009081526002602090815260408083209486168352938152838220929094168152925290205490565b6040519081526020015b60405180910390f35b6001546100fb565b6100b6610124366004611014565b61030c565b6000546040516001600160a01b039091168152602001610105565b610157610152366004611014565b610466565b604051610105919061109f565b6100fb61017236600461112c565b6105af565b6100fb6101853660046111ad565b6107bd565b6100b66101983660046111e0565b6107ea565b6100b66101ab3660046111fb565b6108b7565b6000546001600160a01b031633146101db57604051631bc2178f60e01b815260040160405180910390fd5b84811415806101ea5750828114155b156102085760405163325193fd60e01b815260040160405180910390fd5b60005b858110156102c25782828281811061022557610225611261565b905060200201356003600089898581811061024257610242611261565b905060200201602081019061025791906111e0565b6001600160a01b03166001600160a01b03168152602001908152602001600020600087878581811061028b5761028b611261565b90506020020160208101906102a091906111e0565b6001600160a01b0316815260208101919091526040016000205560010161020b565b507f6478b27363ab194cc20bb050c3077aea3873490053aca8414fab4b2a49c175808686868686866040516102fc969594939291906112be565b60405180910390a1505050505050565b600154811061032e57604051639b35ed3b60e01b815260040160405180910390fd5b60006001828154811061034357610343611261565b600091825260209091206007600990920201908101549091506001600160a01b03163314610384576040516330cd747160e01b815260040160405180910390fd5b6008810154429015158061039c575080826002015411155b156103ba576040516301da3e7360e61b815260040160405180910390fd5b60088201819055600482015415610428576000826001015483600201546103e19190611337565b83600401548385600201546103f69190611337565b610400919061134a565b61040a9190611361565b6003840154909150610426906001600160a01b03163383610ab8565b505b60408051848152602081018390527fea3dfb4d306253a7503e41b5f086dfc6bf5dadeb64ce30bbbf93508c8158e731910160405180910390a1505050565b61046e610e5a565b6001828154811061048157610481611261565b60009182526020918290206040805161010081018252600990930290910180546001600160a01b039081168452600182015484860152600282015484840152600382015416606084015260048101546080840152815180830190925260058101805460ff1683526006820180549495929460a0870194938401919061050590611383565b80601f016020809104026020016040519081016040528092919081815260200182805461053190611383565b801561057e5780601f106105535761010080835404028352916020019161057e565b820191906000526020600020905b81548152906001019060200180831161056157829003601f168201915b50505091909252505050815260078201546001600160a01b0316602082015260089091015460409091015292915050565b600080546001600160a01b0316331461061157826000036105e35760405163162908e360e11b815260040160405180910390fd5b6105f060208301836113ce565b60ff161561061157604051630280f17760e01b815260040160405180910390fd5b6001604051806101000160405280896001600160a01b03168152602001888152602001878152602001866001600160a01b031681526020018581526020018461065990611459565b8152336020808301919091526000604092830181905284546001808201875595825290829020845160099092020180546001600160a01b03199081166001600160a01b03938416178255858401519682019690965592840151600284015560608401516003840180549096169116179093556080820151600482015560a0820151805160058301805460ff191660ff9092169190911781559381015192939192909190600684019061070b9082611553565b50505060c08201516007820180546001600160a01b0319166001600160a01b0390921691909117905560e090910151600890910155821561075b5761075b6001600160a01b038516333086610b20565b6001805460009161076b91611337565b90507f76234507c536075bf9eccc4df3ea5a731652dce90bed5230f80cb76514d670f281898989898989336040516107aa989796959493929190611613565b60405180910390a1979650505050505050565b6001600160a01b038083166000908152600360209081526040808320938516835292905220545b92915050565b6000546001600160a01b0316331461081557604051631bc2178f60e01b815260040160405180910390fd5b6001600160a01b038116158061083857506000546001600160a01b038281169116145b1561085657604051639589a27d60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f078c3b417dadf69374a59793b829c52001247130433427049317bde56607b1b7910160405180910390a15050565b6040516bffffffffffffffffffffffff193360601b16602082015260348101859052600090605401604051602081830303815290604052805190602001209050600061090388886107bd565b9050610945848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250869150610b5e9050565b610962576040516309bde33960e01b815260040160405180910390fd5b3360009081526002602090815260408083206001600160a01b038c81168552908352818420908b16845290915281205461099d9087906116f5565b9050868111156109c05760405163162908e360e11b815260040160405180910390fd5b3360008181526002602090815260408083206001600160a01b038e81168552908352818420908d16808552925291829020849055905163a9059cbb60e01b81526004810192909252602482018890529063a9059cbb906044016020604051808303816000875af1158015610a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5c9190611708565b50604080513381526001600160a01b038b811660208301528a16818301526060810188905290517f913c992353dc81b7a8ba31496c484e9b6306bd2f6c509a649a38fdf5e1c953b29181900360800190a1505050505050505050565b6040516001600160a01b038316602482015260448101829052610b1b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b74565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610b589085906323b872dd60e01b90608401610ae4565b50505050565b600082610b6b8584610c4b565b14949350505050565b6000610bc9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c989092919063ffffffff16565b805190915015610b1b5780806020019051810190610be79190611708565b610b1b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b600081815b8451811015610c9057610c7c82868381518110610c6f57610c6f611261565b6020026020010151610caf565b915080610c888161172a565b915050610c50565b509392505050565b6060610ca78484600085610ce1565b949350505050565b6000818310610ccb576000828152602084905260409020610cda565b60008381526020839052604090205b9392505050565b606082471015610d425760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c42565b600080866001600160a01b03168587604051610d5e9190611743565b60006040518083038185875af1925050503d8060008114610d9b576040519150601f19603f3d011682016040523d82523d6000602084013e610da0565b606091505b5091509150610db187838387610dbc565b979650505050505050565b60608315610e2b578251600003610e24576001600160a01b0385163b610e245760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c42565b5081610ca7565b610ca78383815115610e405781518083602001fd5b8060405162461bcd60e51b8152600401610c42919061175f565b60405180610100016040528060006001600160a01b03168152602001600081526020016000815260200160006001600160a01b0316815260200160008152602001610ebb6040518060400160405280600060ff168152602001606081525090565b815260006020820181905260409091015290565b60008083601f840112610ee157600080fd5b50813567ffffffffffffffff811115610ef957600080fd5b6020830191508360208260051b8501011115610f1457600080fd5b9250929050565b60008060008060008060608789031215610f3457600080fd5b863567ffffffffffffffff80821115610f4c57600080fd5b610f588a838b01610ecf565b90985096506020890135915080821115610f7157600080fd5b610f7d8a838b01610ecf565b90965094506040890135915080821115610f9657600080fd5b50610fa389828a01610ecf565b979a9699509497509295939492505050565b80356001600160a01b0381168114610fcc57600080fd5b919050565b600080600060608486031215610fe657600080fd5b610fef84610fb5565b9250610ffd60208501610fb5565b915061100b60408501610fb5565b90509250925092565b60006020828403121561102657600080fd5b5035919050565b60005b83811015611048578181015183820152602001611030565b50506000910152565b6000815180845261106981602086016020860161102d565b601f01601f19169290920160200192915050565b60ff81511682526000602082015160406020850152610ca76040850182611051565b60208152600060018060a01b03808451166020840152602084015160408401526040840151606084015280606085015116608084015250608083015160a083015260a08301516101008060c08501526110fc61012085018361107d565b915060c085015161111860e08601826001600160a01b03169052565b5060e0949094015192909301919091525090565b60008060008060008060c0878903121561114557600080fd5b61114e87610fb5565b9550602087013594506040870135935061116a60608801610fb5565b92506080870135915060a087013567ffffffffffffffff81111561118d57600080fd5b87016040818a03121561119f57600080fd5b809150509295509295509295565b600080604083850312156111c057600080fd5b6111c983610fb5565b91506111d760208401610fb5565b90509250929050565b6000602082840312156111f257600080fd5b610cda82610fb5565b60008060008060008060a0878903121561121457600080fd5b61121d87610fb5565b955061122b60208801610fb5565b94506040870135935060608701359250608087013567ffffffffffffffff81111561125557600080fd5b610fa389828a01610ecf565b634e487b7160e01b600052603260045260246000fd5b8183526000602080850194508260005b858110156112b3576001600160a01b036112a083610fb5565b1687529582019590820190600101611287565b509495945050505050565b6060815260006112d260608301888a611277565b82810360208401526112e5818789611277565b838103604085015284815290506001600160fb1b0384111561130657600080fd5b8360051b808660208401370160200198975050505050505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156107e4576107e4611321565b80820281158282048414176107e4576107e4611321565b60008261137e57634e487b7160e01b600052601260045260246000fd5b500490565b600181811c9082168061139757607f821691505b6020821081036113b757634e487b7160e01b600052602260045260246000fd5b50919050565b803560ff81168114610fcc57600080fd5b6000602082840312156113e057600080fd5b610cda826113bd565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611422576114226113e9565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611451576114516113e9565b604052919050565b60006040823603121561146b57600080fd5b6114736113ff565b61147c836113bd565b815260208084013567ffffffffffffffff8082111561149a57600080fd5b9085019036601f8301126114ad57600080fd5b8135818111156114bf576114bf6113e9565b6114d1601f8201601f19168501611428565b915080825236848285010111156114e757600080fd5b80848401858401376000908201840152918301919091525092915050565b601f821115610b1b57600081815260208120601f850160051c8101602086101561152c5750805b601f850160051c820191505b8181101561154b57828155600101611538565b505050505050565b815167ffffffffffffffff81111561156d5761156d6113e9565b6115818161157b8454611383565b84611505565b602080601f8311600181146115b6576000841561159e5750858301515b600019600386901b1c1916600185901b17855561154b565b600085815260208120601f198616915b828110156115e5578886015182559484019460019091019084016115c6565b50858210156116035787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8881526001600160a01b03888116602083015260408201889052606082018790528516608082015260a0810184905261010060c0820181905260009060ff61165a866113bd565b1690830152602084013536859003601e1901811261167757600080fd5b840160208101903567ffffffffffffffff81111561169457600080fd5b8036038213156116a357600080fd5b6040610120850152806101408501526101608183828701376000858301820152601f909101601f191684010191506116e8905060e08301846001600160a01b03169052565b9998505050505050505050565b808201808211156107e4576107e4611321565b60006020828403121561171a57600080fd5b81518015158114610cda57600080fd5b60006001820161173c5761173c611321565b5060010190565b6000825161175581846020870161102d565b9190910192915050565b602081526000610cda602083018461105156fea2646970667358221220569a78b675ed32995f41f93a4aea10f7f7a5971765ecb8bc6159818df95236d464736f6c63430008110033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.