ETH Price: $3,323.69 (-1.10%)

Contract

0xf309EE5603bF05E5614dB930E4EAB661662aCeE6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim Multiple214979192024-12-28 2:16:5937 mins ago1735352219IN
0xf309EE56...1662aCeE6
0 ETH0.000261743.32781441
Claim Multiple214891282024-12-26 20:48:4730 hrs ago1735246127IN
0xf309EE56...1662aCeE6
0 ETH0.000652146.2
Claim Multiple214886552024-12-26 19:13:3531 hrs ago1735240415IN
0xf309EE56...1662aCeE6
0 ETH0.000599156.8
Add Root214832262024-12-26 1:00:592 days ago1735174859IN
0xf309EE56...1662aCeE6
0 ETH0.000576455.71462731
Claim Multiple214819472024-12-25 20:43:112 days ago1735159391IN
0xf309EE56...1662aCeE6
0 ETH0.001313445.02317057
Claim Multiple214810202024-12-25 17:36:352 days ago1735148195IN
0xf309EE56...1662aCeE6
0 ETH0.001216457.89881574
Claim Multiple214745472024-12-24 19:54:593 days ago1735070099IN
0xf309EE56...1662aCeE6
0 ETH0.000627085.19644757
Claim Multiple214662742024-12-23 16:07:474 days ago1734970067IN
0xf309EE56...1662aCeE6
0 ETH0.0042664716.35624746
Claim Multiple214544362024-12-22 0:24:236 days ago1734827063IN
0xf309EE56...1662aCeE6
0 ETH0.001815768.00042068
Claim Multiple214544042024-12-22 0:17:596 days ago1734826679IN
0xf309EE56...1662aCeE6
0 ETH0.001416047.57071499
Claim Multiple214543922024-12-22 0:15:356 days ago1734826535IN
0xf309EE56...1662aCeE6
0 ETH0.001502157.50076484
Claim Multiple214518382024-12-21 15:39:596 days ago1734795599IN
0xf309EE56...1662aCeE6
0 ETH0.00146358.50786956
Claim Multiple214399642024-12-19 23:50:598 days ago1734652259IN
0xf309EE56...1662aCeE6
0 ETH0.0008649710.99698159
Add Root214331552024-12-19 1:00:599 days ago1734570059IN
0xf309EE56...1662aCeE6
0 ETH0.001349513.37808937
Claim Multiple214293952024-12-18 12:23:599 days ago1734524639IN
0xf309EE56...1662aCeE6
0 ETH0.0014234516.16235021
Claim Multiple214144102024-12-16 10:14:1111 days ago1734344051IN
0xf309EE56...1662aCeE6
0 ETH0.0009996113.3627476
Claim Multiple213986532024-12-14 5:26:2313 days ago1734153983IN
0xf309EE56...1662aCeE6
0 ETH0.001031147.48456991
Claim Multiple213981922024-12-14 3:53:2313 days ago1734148403IN
0xf309EE56...1662aCeE6
0 ETH0.0014000710.32745037
Claim Multiple213955512024-12-13 19:02:2314 days ago1734116543IN
0xf309EE56...1662aCeE6
0 ETH0.0046129919.70756891
Claim Multiple213835692024-12-12 2:54:3515 days ago1733972075IN
0xf309EE56...1662aCeE6
0 ETH0.0009830212.5
Add Root213830052024-12-12 1:00:4716 days ago1733965247IN
0xf309EE56...1662aCeE6
0 ETH0.001627316.13205941
Claim Multiple213555242024-12-08 4:55:5919 days ago1733633759IN
0xf309EE56...1662aCeE6
0 ETH0.001237717.69393127
Claim Multiple213527692024-12-07 19:42:2320 days ago1733600543IN
0xf309EE56...1662aCeE6
0 ETH0.0008459113.75071577
Claim Multiple213406102024-12-06 2:55:5921 days ago1733453759IN
0xf309EE56...1662aCeE6
0 ETH0.001297816.5
Claim Multiple213401682024-12-06 1:27:2322 days ago1733448443IN
0xf309EE56...1662aCeE6
0 ETH0.0126460818.24474443
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:
AjnaRedeemer

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 14 : AjnaRedeemer.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";
import { IAjnaDripper } from "./interfaces/IAjnaDripper.sol";
import { IAjnaRedeemer } from "./interfaces/IAjnaRedeemer.sol";
import "@openzeppelin/contracts/utils/structs/BitMaps.sol";

/* @inheritdoc IAjnaRedeemer */
contract AjnaRedeemer is AccessControl, IAjnaRedeemer {
    using BitMaps for BitMaps.BitMap;

    mapping(uint256 => bytes32) public weeklyRoots;
    mapping(address => BitMaps.BitMap) private hasClaimed;

    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
    bytes32 public constant EMERGENCY_ROLE = keccak256("EMERGENCY_ROLE");
    uint256 public immutable deploymentWeek;
    address public immutable dripper;
    IERC20 public immutable ajnaToken;

    event Claimed(address indexed user, uint256 indexed week, uint256 amount);

    constructor(IERC20 _ajnaToken, address _operator, address _dripper) {
        require(address(_ajnaToken) != address(0), "drip/invalid-ajna-token");
        require(_operator != address(0), "drip/invalid-operator");
        require(_dripper != address(0), "drip/invalid-dripper");
        deploymentWeek = block.timestamp / 1 weeks;
        ajnaToken = _ajnaToken;
        dripper = _dripper;
        _setupRole(OPERATOR_ROLE, _operator);
        _setupRole(EMERGENCY_ROLE, _operator);
        _setupRole(EMERGENCY_ROLE, _msgSender());
    }

    /* @inheritdoc IAjnaRedeemer */
    function getCurrentWeek() public view returns (uint256) {
        return block.timestamp / 1 weeks;
    }

    /* @inheritdoc IAjnaRedeemer */
    function addRoot(uint256 week, bytes32 root) external onlyRole(OPERATOR_ROLE) {
        require(weeklyRoots[week] == bytes32(0), "redeemer/root-already-added");
        require(IAjnaDripper(dripper).drip(week), "redeemer/transfer-from-failed");
        weeklyRoots[week] = root;
    }

    /* @inheritdoc IAjnaRedeemer */
    function getRoot(uint256 week) external view returns (bytes32) {
        bytes32 root = weeklyRoots[week];
        return root;
    }

    /* @inheritdoc IAjnaRedeemer */
    function claimMultiple(
        uint256[] calldata weekIds,
        uint256[] calldata amounts,
        bytes32[][] calldata proofs
    ) external {
        require(weekIds.length > 0, "redeemer/cannot-claim-zero");
        require(
            weekIds.length == amounts.length && amounts.length == proofs.length,
            "redeemer/invalid-params"
        );

        uint256 total;
        BitMaps.BitMap storage alreadyClaimed = hasClaimed[_msgSender()];
        for (uint256 i = 0; i < weekIds.length; i += 1) {
            uint256 adjustedWeekId = weekIds[i] - deploymentWeek;
            require(canClaim(proofs[i], weekIds[i], amounts[i]), "redeemer/cannot-claim");
            require(!alreadyClaimed.get(adjustedWeekId), "redeemer/already-claimed");
            alreadyClaimed.set(adjustedWeekId);
            total += amounts[i];
            emit Claimed(_msgSender(), weekIds[i], amounts[i]);
        }
        require(ajnaToken.transfer(_msgSender(), total), "redeemer/transfer-failed");
    }

    /* @inheritdoc IAjnaRedeemer */
    function canClaim(
        bytes32[] memory proof,
        uint256 week,
        uint256 amount
    ) public view returns (bool) {
        bytes32 leaf = keccak256(abi.encodePacked(_msgSender(), amount));
        return MerkleProof.verify(proof, weeklyRoots[week], leaf);
    }

    /* @inheritdoc IAjnaRedeemer */
    function emergencyWithdraw() external onlyRole(EMERGENCY_ROLE) {
        require(
            ajnaToken.transfer(dripper, ajnaToken.balanceOf(address(this))),
            "redeemer/transfer-failed"
        );
    }
}

File 2 of 14 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 14 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 4 of 14 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 5 of 14 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 6 of 14 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.2) (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 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.
        require(leavesLen + proofLen - 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 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) {
            require(proofPos == proofLen, "MerkleProof: invalid multiproof");
            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.
     *
     * _Available since v4.7._
     */
    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.
        require(leavesLen + proofLen - 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 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) {
            require(proofPos == proofLen, "MerkleProof: invalid multiproof");
            unchecked {
                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 7 of 14 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 8 of 14 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 9 of 14 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

File 10 of 14 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 11 of 14 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 12 of 14 : BitMaps.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/BitMaps.sol)
pragma solidity ^0.8.0;

/**
 * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
 * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
 */
library BitMaps {
    struct BitMap {
        mapping(uint256 => uint256) _data;
    }

    /**
     * @dev Returns whether the bit at `index` is set.
     */
    function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        return bitmap._data[bucket] & mask != 0;
    }

    /**
     * @dev Sets the bit at `index` to the boolean `value`.
     */
    function setTo(BitMap storage bitmap, uint256 index, bool value) internal {
        if (value) {
            set(bitmap, index);
        } else {
            unset(bitmap, index);
        }
    }

    /**
     * @dev Sets the bit at `index`.
     */
    function set(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        bitmap._data[bucket] |= mask;
    }

    /**
     * @dev Unsets the bit at `index`.
     */
    function unset(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        bitmap._data[bucket] &= ~mask;
    }
}

File 13 of 14 : IAjnaDripper.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { IAjnaRedeemer } from "./IAjnaRedeemer.sol";

/**
 * @title AjnaDripper
 * @notice A contract that drips a fixed amount of Ajna tokens to a designated AjnaRedeemer contract every week.
 * @dev Contract drips a specified amount of Ajna tokens defined by an offchain distribition schedule ( and it's limited by +-10% changes)
 * AjnaDripper is designed to be the only instance that will hold bulk of Ajna tokens. In case of emergency, the AjnaRedeemer contract can be
 * changed by the multisig to a new contract that will enable continuity of the rewards distribution.
 * ROLES:
 * - `DEFAULT_ADMIN_ROLE`: Can change the weekly drip amount, the designated AjnaRedeemer contract, \
 * and call the emergencyWithdraw function to transfer the Ajna tokens to the beneficiary address (trusted summer.fi address).
 * - `REDEEMER_ROLE`: Can call the drip function to transfer the weekly drip amount to the designated AjnaRedeemer contract (redeemer).
 */
interface IAjnaDripper {
    /**
     * @dev Gets the current week number since the UNIX epoch.
     *
     * The week is defined as a 7 day period starting from Thursday at 00:00:00 UTC. This means that
     * the week number changes on Thursdays, and that Thursday is always considered part of the current week.
     *
     * Effects:
     * - Calculates the current week by dividing the block timestamp by 1 week.
     *
     * @return The current week number since the UNIX epoch as a uint256 value.
     */
    function getCurrentWeek() external view returns (uint256);

    /**
     * @dev Changes the weekly drip amount, subject to admin access control.
     *
     * Requirements:
     * - The caller must have the DEFAULT_ADMIN_ROLE.
     * - The proposed weekly drip amount must be greater than 0, but less than MAX_WEEKLY_AMOUNT and 110% of the current weeklyAmount.
     * - The last update timestamp must be more than 4 weeks prior to the current block timestamp.
     *
     * Effects:
     * - Sets the weeklyAmount property to the newly specified drip amount.
     * - Sets the lastUpdate timestamp to the current block timestamp.
     *
     * @param _weeklyAmount The new value for the weekly drip amount.
     *
     * @notice This function throws an exception if the caller does not have the DEFAULT_ADMIN_ROLE, if the proposed weekly drip amount falls outside the allowed range, or if the lastUpdate timestamp is less than 4 weeks prior to the current block timestamp. Additionally, this function updates the weeklyAmount and lastUpdate properties as necessary.
     */
    function changeWeeklyAmount(uint256 _weeklyAmount) external;

    /**
     * @dev Changes the designated Ajna redeemer and weekly drip amount, subject to admin access control.
     *
     * Requirements:
     * - The caller must have the DEFAULT_ADMIN_ROLE.
     * - The proposed weekly drip amount must be within the allowable bounds.
     *
     * Effects:
     * - Revokes the Redemeer role from the current redeemer address.
     * - Grants the Redeemer role to the newly specified _redeemer contract address.
     * - Sets the weeklyAmount property to the newly specified drip amount.
     * - Sets the lastUpdate timestamp to the current block timestamp.
     * - Assigns the provided _redeemer address to the redeemer property.
     *
     * @param _redeemer The address of the contract that will be assigned the new REDEEMER_ROLE.
     *
     * @notice This function throws an exception if the caller does not have the DEFAULT_ADMIN_ROLE, or if the proposed weekly drip amount falls outside the allowed range. Additionally, this function revokes and grants the Redeemer role as necessary, and updates the weeklyAmount and lastUpdate properties.
     */
    function changeRedeemer(IAjnaRedeemer _redeemer) external;

    /**
     * @dev Initializes the designated AjnaRedeemer contract address and weekly drip amount.
     *
     * Requirements:
     * - Only the DEFAULT_ADMIN_ROLE can call this function.
     * - The new AjnaRedeemer contract address must not be zero.
     * - The current AjnaRedeemer contract address must not be set.
     * - The weeklyAmount property must not be set.
     * @dev Validates that the proposed weekly drip amount is within the allowable bounds.
     * Effects:
     * - Grants the REDEEMER_ROLE to the specified _redeemer contract address.
     * - Emits a RedeemerChanged event with the current week number, the zero address, and the new AjnaRedeemer contract address.
     *
     * @param _redeemer The address of the contract that will be assigned the REDEEMER_ROLE.
     * @param _weeklyAmount The value for the weekly drip amount.
     */
    function setup(IAjnaRedeemer _redeemer, uint256 _weeklyAmount) external;

    /**
     * @dev Allows the contract with 'REDEEMER_ROLE' to transfer a weekly amount of tokens to the designated 'redeemer' address.
     * @param week The week number for which to initiate the drip.
     * @return status A boolean indicating whether the token transfer was successful or not.
     *
     * Requirements:
     * - Only the user with 'REDEEMER_ROLE' can call this function.
     * - The weekly drip should not have already taken place for the given week.
     * - The requested week should not be earlier than the deployment week of the dripper contract and not later than the current week.
     *
     * Effects:
     * - Marks the given week as dripped in the 'weeklyDrip' mapping.
     * - Transfers the weekly amount of AJNA tokens to the 'redeemer' address.
     * - Emits a 'Dripped' event with the information about the week and the amount dripped.
     */

    function drip(uint256 week) external returns (bool status);

    /**
     * @dev Allows the default admin role to withdraw emergency funds.
     * @param amount The amount of tokens to withdraw from the contract.
     *
     * Requirements:
     * - Only the user with the default admin role can call this function.
     * - The contract should have a balance equal to or greater than the requested withdrawal amount.
     *
     * Effects:
     * - Transfers the requested amount of AJNA tokens to the designated beneficiary address.
     * - Emits a 'Transfer' event with the information about the amount and the sender address.
     * - Throws an error if any of the requirements are not met.
     */
    function emergencyWithdraw(uint256 amount) external;
}

File 14 of 14 : IAjnaRedeemer.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

/**
 * @title AjnaRedeemer
 * @notice A contract that allows users to redeem their Ajna tokens for rewards. Pulls Ajan tokens from the Ajna Dripper contract.
 *
 * ROLES:
 * - `OPERATOR_ROLE`: Can add weekly reward snapshot merkle tree roots.
 * - `EMERGENCY_ROLE`: Can withdraw all the Ajna tokens to AjnaDripper contract in case of emergency.
 */
interface IAjnaRedeemer {
    function deploymentWeek() external returns (uint256);

    /**
     * @dev Gets the current week number since the UNIX epoch.
     *
     * The week is defined as a 7 day period starting from Thursday at 00:00:00 UTC. This means that
     * the week number changes on Thursdays, and that Thursday is always considered part of the current week.
     *
     * Effects:
     * - Calculates the current week by dividing the block timestamp by 1 week.
     *
     * @return The current week number since the UNIX epoch as a uint256 value.
     */
    function getCurrentWeek() external view returns (uint256);

    /**
     * @dev Adds a Merkle root for a given week.
     *
     * Requirements:
     * - The caller must have the OPERATOR_ROLE.
     * - The provided week number must be greater than or equal to the deployment week.
     * - The provided week number must not be greater than the current week number.
     * - The provided week must not already have a root set.
     * - The drip call from the Ajna Dripper contract must succeed.
     *
     * Effects:
     * - Sets the provided Merkle root for the given week.
     *
     * @param week The week number for which to add the Merkle root.
     * @param root The Merkle root to be added for the specified week.
     */
    function addRoot(uint256 week, bytes32 root) external;

    /**
     * @dev Retrieves the Merkle root for a given week.
     *
     * Requirements:
     * - The provided week must have a root set.
     *
     * Effects:
     * - None.
     *
     * @param week The week number for which to retrieve the Merkle root.
     * @return The Merkle root associated with the specified week.
     *
     * @notice returns bytes32(0) if the provided week does not have a root set.
     */
    function getRoot(uint256 week) external view returns (bytes32);

    /**
     * @dev Claims multiple rewards using Merkle proofs.
     *
     * Requirements:
     * - The number of weeks, amounts, and proofs given must all match.
     * - The caller must not have already claimed any of the specified weeks' rewards.
     * - The provided proofs must be valid and eligible to claim a reward for their corresponding weeks and amounts.
     *
     * Effects:
     * - Rewards will be transferred to the caller's account if the claims are successful.
     * - Logs an event with the details of each successful claim.
     *
     * @param _weeks An array of week numbers for which to claim rewards.
     * @param amounts An array of reward amounts to claim.
     * @param proofs An array of Merkle proofs, one for each corresponding week and amount given.
     *
     * @notice This function throws an exception if the provided parameters are invalid or the caller has already claimed rewards for one or more of the specified weeks. Additionally, it transfers rewards to the caller if all claims are successful.
     */
    function claimMultiple(
        uint256[] calldata _weeks,
        uint256[] calldata amounts,
        bytes32[][] calldata proofs
    ) external;

    /**
     * @dev Determines if the caller is eligible to claim a reward for a specified week and amount using a Merkle proof.
     *
     * Requirements:
     * - The provided Merkle proof must be valid for the given week and amount.
     *
     * @param proof A Merkle proof, which should be generated from the root of the Merkle tree for the corresponding week.
     * @param week The number of the week for which to check eligibility.
     * @param amount The amount of rewards to claim.
     *
     * @return A boolean indicating whether or not the caller is eligible to claim rewards for the given week and amount using the provided Merkle proof.
     *
     * @notice This function does not modify any state.
     */
    function canClaim(
        bytes32[] memory proof,
        uint256 week,
        uint256 amount
    ) external view returns (bool);

    /**
     * @dev Allows a user with the EMERGENCY_ROLE to withdraw all AjnaToken tokens held by this contract.
     *
     * Requirements:
     * - The caller must have the EMERGENCY_ROLE.
     * - The contract must hold a non-zero balance of AjnaToken tokens.
     *
     * Effects:
     * - Transfers the entire balance of AjnaToken tokens held by this contract to the designated "drip" address.
     *
     * @notice This function should only be used in emergency situations and may result in significant loss of funds if used improperly.
     */

    function emergencyWithdraw() external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_ajnaToken","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_dripper","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"week","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EMERGENCY_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"week","type":"uint256"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"addRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ajnaToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"week","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"canClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"weekIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes32[][]","name":"proofs","type":"bytes32[][]"}],"name":"claimMultiple","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deploymentWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dripper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCurrentWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"week","type":"uint256"}],"name":"getRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"weeklyRoots","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]

60e06040523480156200001157600080fd5b506040516200190a3803806200190a833981016040819052620000349162000299565b6001600160a01b038316620000905760405162461bcd60e51b815260206004820152601760248201527f647269702f696e76616c69642d616a6e612d746f6b656e00000000000000000060448201526064015b60405180910390fd5b6001600160a01b038216620000e85760405162461bcd60e51b815260206004820152601560248201527f647269702f696e76616c69642d6f70657261746f720000000000000000000000604482015260640162000087565b6001600160a01b038116620001405760405162461bcd60e51b815260206004820152601460248201527f647269702f696e76616c69642d64726970706572000000000000000000000000604482015260640162000087565b6200014f62093a8042620002ed565b6080526001600160a01b0380841660c052811660a052620001917f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92983620001d0565b620001ac600080516020620018ea83398151915283620001d0565b620001c7600080516020620018ea83398151915233620001d0565b50505062000310565b620001dc8282620001e0565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001dc576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200023c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6001600160a01b03811681146200029657600080fd5b50565b600080600060608486031215620002af57600080fd5b8351620002bc8162000280565b6020850151909350620002cf8162000280565b6040850151909250620002e28162000280565b809150509250925092565b6000826200030b57634e487b7160e01b600052601260045260246000fd5b500490565b60805160a05160c05161158762000363600039600081816102bc0152818161097a0152610b4d0152600081816102030152818161057a0152610b7e015260008181610329015261071201526115876000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c80639b24b3b0116100cd578063c13c852d11610081578063d547741f11610066578063d547741f1461034b578063db2e21bc1461035e578063f5b541a61461036657600080fd5b8063c13c852d14610311578063d1aeece51461032457600080fd5b8063ab015561116100b2578063ab015561146102b7578063b75a6990146102de578063c0b09e5b146102fe57600080fd5b80639b24b3b01461028f578063a217fddf146102af57600080fd5b806336568abe116101245780636eb227ce116101095780636eb227ce1461023d578063731d829a1461024557806391d148541461025857600080fd5b806336568abe146101eb578063603ea03b146101fe57600080fd5b806301ffc9a71461015657806320df43591461017e578063248a9ca3146101b35780632f2ff15d146101d6575b600080fd5b6101696101643660046110ce565b61038d565b60405190151581526020015b60405180910390f35b6101a57fbf233dd2aafeb4d50879c4aa5c81e96d92f6e6945c906a58f9f2d1c1631b4b2681565b604051908152602001610175565b6101a56101c13660046110f8565b60009081526020819052604090206001015490565b6101e96101e4366004611111565b6103f6565b005b6101e96101f9366004611111565b610420565b6102257f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610175565b6101a56104b1565b6101e961025336600461114d565b6104c5565b610169610266366004611111565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6101a561029d3660046110f8565b60009081526001602052604090205490565b6101a5600081565b6102257f000000000000000000000000000000000000000000000000000000000000000081565b6101a56102ec3660046110f8565b60016020526000908152604090205481565b6101e961030c3660046111bb565b61064e565b61016961031f36600461126b565b610a67565b6101a57f000000000000000000000000000000000000000000000000000000000000000081565b6101e9610359366004611111565b610ad0565b6101e9610af5565b6101a57f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806103f057507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b60008281526020819052604090206001015461041181610ca8565b61041b8383610cb2565b505050565b6001600160a01b03811633146104a35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6104ad8282610d50565b5050565b60006104c062093a804261134f565b905090565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9296104ef81610ca8565b6000838152600160205260409020541561054b5760405162461bcd60e51b815260206004820152601b60248201527f72656465656d65722f726f6f742d616c72656164792d61646465640000000000604482015260640161049a565b6040517f58326b7a000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906358326b7a906024016020604051808303816000875af11580156105cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ef9190611371565b61063b5760405162461bcd60e51b815260206004820152601d60248201527f72656465656d65722f7472616e736665722d66726f6d2d6661696c6564000000604482015260640161049a565b5060009182526001602052604090912055565b8461069b5760405162461bcd60e51b815260206004820152601a60248201527f72656465656d65722f63616e6e6f742d636c61696d2d7a65726f000000000000604482015260640161049a565b84831480156106a957508281145b6106f55760405162461bcd60e51b815260206004820152601760248201527f72656465656d65722f696e76616c69642d706172616d73000000000000000000604482015260640161049a565b336000908152600260205260408120815b8781101561096f5760007f00000000000000000000000000000000000000000000000000000000000000008a8a8481811061074357610743611393565b9050602002013561075491906113a9565b90506107e886868481811061076b5761076b611393565b905060200281019061077d91906113bc565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508e92508d91508690508181106107c3576107c3611393565b905060200201358a8a868181106107dc576107dc611393565b90506020020135610a67565b6108345760405162461bcd60e51b815260206004820152601560248201527f72656465656d65722f63616e6e6f742d636c61696d0000000000000000000000604482015260640161049a565b600881901c600090815260208490526040902054600160ff83161b161561089d5760405162461bcd60e51b815260206004820152601860248201527f72656465656d65722f616c72656164792d636c61696d65640000000000000000604482015260640161049a565b600881901c60009081526020849052604090208054600160ff84161b1790558787838181106108ce576108ce611393565b90506020020135846108e09190611406565b93508989838181106108f4576108f4611393565b905060200201356109023390565b6001600160a01b03167f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a8a8a8681811061093e5761093e611393565b9050602002013560405161095491815260200190565b60405180910390a350610968600182611406565b9050610706565b506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af11580156109ed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a119190611371565b610a5d5760405162461bcd60e51b815260206004820152601860248201527f72656465656d65722f7472616e736665722d6661696c65640000000000000000604482015260640161049a565b5050505050505050565b6040516bffffffffffffffffffffffff193360601b166020820152603481018290526000908190605401604051602081830303815290604052805190602001209050610ac785600160008781526020019081526020016000205483610dcf565b95945050505050565b600082815260208190526040902060010154610aeb81610ca8565b61041b8383610d50565b7fbf233dd2aafeb4d50879c4aa5c81e96d92f6e6945c906a58f9f2d1c1631b4b26610b1f81610ca8565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb907f00000000000000000000000000000000000000000000000000000000000000009083906370a0823190602401602060405180830381865afa158015610bc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bea9190611419565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610c35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c599190611371565b610ca55760405162461bcd60e51b815260206004820152601860248201527f72656465656d65722f7472616e736665722d6661696c65640000000000000000604482015260640161049a565b50565b610ca58133610de5565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166104ad576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610d0c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156104ad576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600082610ddc8584610e58565b14949350505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166104ad57610e1681610ea5565b610e21836020610eb7565b604051602001610e32929190611456565b60408051601f198184030181529082905262461bcd60e51b825261049a916004016114d7565b600081815b8451811015610e9d57610e8982868381518110610e7c57610e7c611393565b602002602001015161109f565b915080610e958161150a565b915050610e5d565b509392505050565b60606103f06001600160a01b03831660145b60606000610ec6836002611523565b610ed1906002611406565b67ffffffffffffffff811115610ee957610ee9611255565b6040519080825280601f01601f191660200182016040528015610f13576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110610f4a57610f4a611393565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110610f9557610f95611393565b60200101906001600160f81b031916908160001a9053506000610fb9846002611523565b610fc4906001611406565b90505b6001811115611049577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061100557611005611393565b1a60f81b82828151811061101b5761101b611393565b60200101906001600160f81b031916908160001a90535060049490941c936110428161153a565b9050610fc7565b5083156110985760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161049a565b9392505050565b60008183106110bb576000828152602084905260409020611098565b6000838152602083905260409020611098565b6000602082840312156110e057600080fd5b81356001600160e01b03198116811461109857600080fd5b60006020828403121561110a57600080fd5b5035919050565b6000806040838503121561112457600080fd5b8235915060208301356001600160a01b038116811461114257600080fd5b809150509250929050565b6000806040838503121561116057600080fd5b50508035926020909101359150565b60008083601f84011261118157600080fd5b50813567ffffffffffffffff81111561119957600080fd5b6020830191508360208260051b85010111156111b457600080fd5b9250929050565b600080600080600080606087890312156111d457600080fd5b863567ffffffffffffffff808211156111ec57600080fd5b6111f88a838b0161116f565b9098509650602089013591508082111561121157600080fd5b61121d8a838b0161116f565b9096509450604089013591508082111561123657600080fd5b5061124389828a0161116f565b979a9699509497509295939492505050565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561128057600080fd5b833567ffffffffffffffff8082111561129857600080fd5b818601915086601f8301126112ac57600080fd5b81356020828211156112c0576112c0611255565b8160051b604051601f19603f830116810181811086821117156112e5576112e5611255565b60405292835281830193508481018201928a84111561130357600080fd5b948201945b8386101561132157853585529482019493820193611308565b9a918901359950506040909701359695505050505050565b634e487b7160e01b600052601160045260246000fd5b60008261136c57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561138357600080fd5b8151801515811461109857600080fd5b634e487b7160e01b600052603260045260246000fd5b818103818111156103f0576103f0611339565b6000808335601e198436030181126113d357600080fd5b83018035915067ffffffffffffffff8211156113ee57600080fd5b6020019150600581901b36038213156111b457600080fd5b808201808211156103f0576103f0611339565b60006020828403121561142b57600080fd5b5051919050565b60005b8381101561144d578181015183820152602001611435565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161148e816017850160208801611432565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516114cb816028840160208801611432565b01602801949350505050565b60208152600082518060208401526114f6816040850160208701611432565b601f01601f19169190910160400192915050565b60006001820161151c5761151c611339565b5060010190565b80820281158282048414176103f0576103f0611339565b60008161154957611549611339565b50600019019056fea2646970667358221220cb4c09c002c64a9591b71555731ef5954d38124490ac7b5bd04f643652f84fe664736f6c63430008130033bf233dd2aafeb4d50879c4aa5c81e96d92f6e6945c906a58f9f2d1c1631b4b260000000000000000000000009a96ec9b57fb64fbc60b423d1f4da7691bd35079000000000000000000000000df8234900a194d787adf4e448502cbed56557fba000000000000000000000000198c29380124d017d6b204152c2e3c266885eea0

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101515760003560e01c80639b24b3b0116100cd578063c13c852d11610081578063d547741f11610066578063d547741f1461034b578063db2e21bc1461035e578063f5b541a61461036657600080fd5b8063c13c852d14610311578063d1aeece51461032457600080fd5b8063ab015561116100b2578063ab015561146102b7578063b75a6990146102de578063c0b09e5b146102fe57600080fd5b80639b24b3b01461028f578063a217fddf146102af57600080fd5b806336568abe116101245780636eb227ce116101095780636eb227ce1461023d578063731d829a1461024557806391d148541461025857600080fd5b806336568abe146101eb578063603ea03b146101fe57600080fd5b806301ffc9a71461015657806320df43591461017e578063248a9ca3146101b35780632f2ff15d146101d6575b600080fd5b6101696101643660046110ce565b61038d565b60405190151581526020015b60405180910390f35b6101a57fbf233dd2aafeb4d50879c4aa5c81e96d92f6e6945c906a58f9f2d1c1631b4b2681565b604051908152602001610175565b6101a56101c13660046110f8565b60009081526020819052604090206001015490565b6101e96101e4366004611111565b6103f6565b005b6101e96101f9366004611111565b610420565b6102257f000000000000000000000000198c29380124d017d6b204152c2e3c266885eea081565b6040516001600160a01b039091168152602001610175565b6101a56104b1565b6101e961025336600461114d565b6104c5565b610169610266366004611111565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6101a561029d3660046110f8565b60009081526001602052604090205490565b6101a5600081565b6102257f0000000000000000000000009a96ec9b57fb64fbc60b423d1f4da7691bd3507981565b6101a56102ec3660046110f8565b60016020526000908152604090205481565b6101e961030c3660046111bb565b61064e565b61016961031f36600461126b565b610a67565b6101a57f0000000000000000000000000000000000000000000000000000000000000b0081565b6101e9610359366004611111565b610ad0565b6101e9610af5565b6101a57f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806103f057507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b60008281526020819052604090206001015461041181610ca8565b61041b8383610cb2565b505050565b6001600160a01b03811633146104a35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6104ad8282610d50565b5050565b60006104c062093a804261134f565b905090565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9296104ef81610ca8565b6000838152600160205260409020541561054b5760405162461bcd60e51b815260206004820152601b60248201527f72656465656d65722f726f6f742d616c72656164792d61646465640000000000604482015260640161049a565b6040517f58326b7a000000000000000000000000000000000000000000000000000000008152600481018490527f000000000000000000000000198c29380124d017d6b204152c2e3c266885eea06001600160a01b0316906358326b7a906024016020604051808303816000875af11580156105cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ef9190611371565b61063b5760405162461bcd60e51b815260206004820152601d60248201527f72656465656d65722f7472616e736665722d66726f6d2d6661696c6564000000604482015260640161049a565b5060009182526001602052604090912055565b8461069b5760405162461bcd60e51b815260206004820152601a60248201527f72656465656d65722f63616e6e6f742d636c61696d2d7a65726f000000000000604482015260640161049a565b84831480156106a957508281145b6106f55760405162461bcd60e51b815260206004820152601760248201527f72656465656d65722f696e76616c69642d706172616d73000000000000000000604482015260640161049a565b336000908152600260205260408120815b8781101561096f5760007f0000000000000000000000000000000000000000000000000000000000000b008a8a8481811061074357610743611393565b9050602002013561075491906113a9565b90506107e886868481811061076b5761076b611393565b905060200281019061077d91906113bc565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508e92508d91508690508181106107c3576107c3611393565b905060200201358a8a868181106107dc576107dc611393565b90506020020135610a67565b6108345760405162461bcd60e51b815260206004820152601560248201527f72656465656d65722f63616e6e6f742d636c61696d0000000000000000000000604482015260640161049a565b600881901c600090815260208490526040902054600160ff83161b161561089d5760405162461bcd60e51b815260206004820152601860248201527f72656465656d65722f616c72656164792d636c61696d65640000000000000000604482015260640161049a565b600881901c60009081526020849052604090208054600160ff84161b1790558787838181106108ce576108ce611393565b90506020020135846108e09190611406565b93508989838181106108f4576108f4611393565b905060200201356109023390565b6001600160a01b03167f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a8a8a8681811061093e5761093e611393565b9050602002013560405161095491815260200190565b60405180910390a350610968600182611406565b9050610706565b506001600160a01b037f0000000000000000000000009a96ec9b57fb64fbc60b423d1f4da7691bd350791663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af11580156109ed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a119190611371565b610a5d5760405162461bcd60e51b815260206004820152601860248201527f72656465656d65722f7472616e736665722d6661696c65640000000000000000604482015260640161049a565b5050505050505050565b6040516bffffffffffffffffffffffff193360601b166020820152603481018290526000908190605401604051602081830303815290604052805190602001209050610ac785600160008781526020019081526020016000205483610dcf565b95945050505050565b600082815260208190526040902060010154610aeb81610ca8565b61041b8383610d50565b7fbf233dd2aafeb4d50879c4aa5c81e96d92f6e6945c906a58f9f2d1c1631b4b26610b1f81610ca8565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527f0000000000000000000000009a96ec9b57fb64fbc60b423d1f4da7691bd350796001600160a01b03169063a9059cbb907f000000000000000000000000198c29380124d017d6b204152c2e3c266885eea09083906370a0823190602401602060405180830381865afa158015610bc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bea9190611419565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610c35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c599190611371565b610ca55760405162461bcd60e51b815260206004820152601860248201527f72656465656d65722f7472616e736665722d6661696c65640000000000000000604482015260640161049a565b50565b610ca58133610de5565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166104ad576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610d0c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156104ad576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600082610ddc8584610e58565b14949350505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166104ad57610e1681610ea5565b610e21836020610eb7565b604051602001610e32929190611456565b60408051601f198184030181529082905262461bcd60e51b825261049a916004016114d7565b600081815b8451811015610e9d57610e8982868381518110610e7c57610e7c611393565b602002602001015161109f565b915080610e958161150a565b915050610e5d565b509392505050565b60606103f06001600160a01b03831660145b60606000610ec6836002611523565b610ed1906002611406565b67ffffffffffffffff811115610ee957610ee9611255565b6040519080825280601f01601f191660200182016040528015610f13576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110610f4a57610f4a611393565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110610f9557610f95611393565b60200101906001600160f81b031916908160001a9053506000610fb9846002611523565b610fc4906001611406565b90505b6001811115611049577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061100557611005611393565b1a60f81b82828151811061101b5761101b611393565b60200101906001600160f81b031916908160001a90535060049490941c936110428161153a565b9050610fc7565b5083156110985760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161049a565b9392505050565b60008183106110bb576000828152602084905260409020611098565b6000838152602083905260409020611098565b6000602082840312156110e057600080fd5b81356001600160e01b03198116811461109857600080fd5b60006020828403121561110a57600080fd5b5035919050565b6000806040838503121561112457600080fd5b8235915060208301356001600160a01b038116811461114257600080fd5b809150509250929050565b6000806040838503121561116057600080fd5b50508035926020909101359150565b60008083601f84011261118157600080fd5b50813567ffffffffffffffff81111561119957600080fd5b6020830191508360208260051b85010111156111b457600080fd5b9250929050565b600080600080600080606087890312156111d457600080fd5b863567ffffffffffffffff808211156111ec57600080fd5b6111f88a838b0161116f565b9098509650602089013591508082111561121157600080fd5b61121d8a838b0161116f565b9096509450604089013591508082111561123657600080fd5b5061124389828a0161116f565b979a9699509497509295939492505050565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561128057600080fd5b833567ffffffffffffffff8082111561129857600080fd5b818601915086601f8301126112ac57600080fd5b81356020828211156112c0576112c0611255565b8160051b604051601f19603f830116810181811086821117156112e5576112e5611255565b60405292835281830193508481018201928a84111561130357600080fd5b948201945b8386101561132157853585529482019493820193611308565b9a918901359950506040909701359695505050505050565b634e487b7160e01b600052601160045260246000fd5b60008261136c57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561138357600080fd5b8151801515811461109857600080fd5b634e487b7160e01b600052603260045260246000fd5b818103818111156103f0576103f0611339565b6000808335601e198436030181126113d357600080fd5b83018035915067ffffffffffffffff8211156113ee57600080fd5b6020019150600581901b36038213156111b457600080fd5b808201808211156103f0576103f0611339565b60006020828403121561142b57600080fd5b5051919050565b60005b8381101561144d578181015183820152602001611435565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161148e816017850160208801611432565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516114cb816028840160208801611432565b01602801949350505050565b60208152600082518060208401526114f6816040850160208701611432565b601f01601f19169190910160400192915050565b60006001820161151c5761151c611339565b5060010190565b80820281158282048414176103f0576103f0611339565b60008161154957611549611339565b50600019019056fea2646970667358221220cb4c09c002c64a9591b71555731ef5954d38124490ac7b5bd04f643652f84fe664736f6c63430008130033

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

0000000000000000000000009a96ec9b57fb64fbc60b423d1f4da7691bd35079000000000000000000000000df8234900a194d787adf4e448502cbed56557fba000000000000000000000000198c29380124d017d6b204152c2e3c266885eea0

-----Decoded View---------------
Arg [0] : _ajnaToken (address): 0x9a96ec9B57Fb64FbC60B423d1f4da7691Bd35079
Arg [1] : _operator (address): 0xdF8234900a194D787AdF4E448502CbeD56557FbA
Arg [2] : _dripper (address): 0x198c29380124D017D6b204152c2e3C266885EEa0

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000009a96ec9b57fb64fbc60b423d1f4da7691bd35079
Arg [1] : 000000000000000000000000df8234900a194d787adf4e448502cbed56557fba
Arg [2] : 000000000000000000000000198c29380124d017d6b204152c2e3c266885eea0


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.