ETH Price: $3,098.65 (+4.65%)
Gas: 3 Gwei

Contract

0x8657f37439A241AD439Ee98CA89a7755cA8c90B4
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x8eb622660e0e329c8cab4e6884a4da127311a28bbb782aedafa15a4cf890134fActivate Vesting(pending)2024-05-16 17:02:2936 hrs ago1715878949IN
0x8657f374...5cA8c90B4
0 ETH(Pending)(Pending)
Release Tokens198949042024-05-18 5:59:351 min ago1716011975IN
0x8657f374...5cA8c90B4
0 ETH0.000235493.18459566
Release Tokens198949012024-05-18 5:58:472 mins ago1716011927IN
0x8657f374...5cA8c90B4
0 ETH0.000218782.95865109
Release Tokens198948842024-05-18 5:55:236 mins ago1716011723IN
0x8657f374...5cA8c90B4
0 ETH0.000223193.01819249
Release Tokens198948422024-05-18 5:46:5914 mins ago1716011219IN
0x8657f374...5cA8c90B4
0 ETH0.000181463.19199793
Release Tokens198948282024-05-18 5:43:5917 mins ago1716011039IN
0x8657f374...5cA8c90B4
0 ETH0.000225843.05408568
Release Tokens198948192024-05-18 5:42:1119 mins ago1716010931IN
0x8657f374...5cA8c90B4
0 ETH0.000217352.93925537
Release Tokens198948062024-05-18 5:39:3521 mins ago1716010775IN
0x8657f374...5cA8c90B4
0 ETH0.000170272.9952725
Release Tokens198947972024-05-18 5:37:4723 mins ago1716010667IN
0x8657f374...5cA8c90B4
0 ETH0.00022162.9971891
Release Tokens198947922024-05-18 5:36:4724 mins ago1716010607IN
0x8657f374...5cA8c90B4
0 ETH0.00024563.32130912
Release Tokens198947912024-05-18 5:36:3524 mins ago1716010595IN
0x8657f374...5cA8c90B4
0 ETH0.000185423.26169142
Release Tokens198947842024-05-18 5:34:5926 mins ago1716010499IN
0x8657f374...5cA8c90B4
0 ETH0.000254433.44072344
Release Tokens198947492024-05-18 5:27:5933 mins ago1716010079IN
0x8657f374...5cA8c90B4
0 ETH0.000222973.01531113
Release Tokens198947282024-05-18 5:23:4737 mins ago1716009827IN
0x8657f374...5cA8c90B4
0 ETH0.000170853.00546448
Release Tokens198946472024-05-18 5:07:2354 mins ago1716008843IN
0x8657f374...5cA8c90B4
0 ETH0.000213712.89004758
Release Tokens198946332024-05-18 5:04:3556 mins ago1716008675IN
0x8657f374...5cA8c90B4
0 ETH0.000222723.0119028
Release Tokens198946112024-05-18 5:00:111 hr ago1716008411IN
0x8657f374...5cA8c90B4
0 ETH0.000228923.09572597
Release Tokens198946032024-05-18 4:58:351 hr ago1716008315IN
0x8657f374...5cA8c90B4
0 ETH0.000222983.0154551
Release Tokens198945952024-05-18 4:56:591 hr ago1716008219IN
0x8657f374...5cA8c90B4
0 ETH0.000216672.93010759
Release Tokens198945852024-05-18 4:54:591 hr ago1716008099IN
0x8657f374...5cA8c90B4
0 ETH0.000223793.02632388
Release Tokens198945842024-05-18 4:54:471 hr ago1716008087IN
0x8657f374...5cA8c90B4
0 ETH0.000231333.12829243
Release Tokens198944272024-05-18 4:23:111 hr ago1716006191IN
0x8657f374...5cA8c90B4
0 ETH0.00025154.42416989
Release Tokens198944192024-05-18 4:21:231 hr ago1716006083IN
0x8657f374...5cA8c90B4
0 ETH0.000255044.48637352
Release Tokens198944082024-05-18 4:19:111 hr ago1716005951IN
0x8657f374...5cA8c90B4
0 ETH0.000320584.33517731
Release Tokens198943862024-05-18 4:14:471 hr ago1716005687IN
0x8657f374...5cA8c90B4
0 ETH0.000231674.07605876
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To Value
193386772024-03-01 6:57:1177 days ago1709276231
0x8657f374...5cA8c90B4
0.007845 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TokenVestingLinear

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 10 : TokenVestingLinear.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {MerkleProof} from '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol';

/**
 * @title Token Vesting Contract (Linear)
 * @dev This contract handles the vesting of ERC20 tokens for specific users. The vesting schedule is linear. 
 * Users are pre-signed into a merkle tree and the merkle root is used to verify the user's vesting schedule.
 * Pre-signature allows us to guarantee that the user's vesting schedule is valid and cannot be tampered with.
*/
contract TokenVestingLinear is Ownable, ReentrancyGuard {
    using ECDSA for bytes32;

    /// @notice Schedule struct to store user's vesting schedule
    struct Schedule {
        uint256 allocation;           // Total allocation for the user
        uint256 claimed;              // Total amount claimed by the user
        uint64 startTimestamp;        // Vesting start time
        uint64 endTimestamp;          // Vesting end time
        uint8 initUnlockPercentage;   // Initial unlocked percentage of tokens
    }

    /**
     * @notice UserSchedule struct to store user's vesting schedule and their wallet address in bytes.
     * @dev User is in bytes to allow Solana address to be used along with Ethereum address.
    */
    struct UserSchedule {
        bytes32 user;
        Schedule schedule;
    }

    /// @notice Portal token contract
    IERC20 public token;

    /// @notice Address of the signer. Signer is used in cases where the user wants to delegate the vesting to another wallet (not one that is being vested).
    address public signerAddress;

    /// @notice Merkle root for the vesting schedule. This is used to preseed and verify the vesting schedule for a user.
    bytes32 public immutable root;
    
    
    /// @notice Mapping from user address to vesting details
    mapping(address => Schedule) public schedules;
    mapping(bytes32 => address) public primaryWalletBytesToAddress;

    /// @notice Event emitted when tokens are released
    event TokensReleased(address indexed user, uint256 amount);
    /// @notice Event emitted when a new vesting schedule is added (activated)
    event ScheduleSet(address indexed recepientAddress, bytes32 user);
    /// @notice Event emitted when a user's recepient wallet is updated
    event RecepientAddressUpdated(bytes32 indexed userAddressInBytes, address indexed currentRecepientWallet, address indexed newRecepientWallet);
    /// @notice Event emitted when the signer address is updated
    event SignerAddressSet(address signerAddress_);
    /// @notice Event emitted when the token address is updated (can only be set once)
    event TokenAddressUpdated(address newToken);


    /// @notice Error emitted when invalid recepient address is passed
    error InvalidRecepientAddressPassed();
    /// @notice Error emitted when invalid signature is passed
    error InvalidSignaturePassed();
    /// @notice Error emitted when invalid data is passed (merkle proof check failed)
    error InvalidDataPassed();
    /// @notice Error emitted when allocation is not found for a user (allocation is 0)
    error AllocationNotFound(address user);
    /// @notice Error emitted when user id is already in use (user id is in bytes from UserSchedule.user)
    error UserIdAlreadyInUse(bytes32 primaryWalletBytes);
    /// @notice Error emitted when transfer of tokens failed
    error TransferFailed();
    /// @notice Error emitted when unauthorized user tries to perform an action
    error Unauthorized();
    /// @notice Error emitted when user already exists
    error UserAlreadyExists();
    /// @notice Error emitted when token address is already set
    error TokenAddressAlreadySet();
    /// @notice Error emitted when invalid signer address is passed (address is 0)
    error InvalidSignerPassed();
    /// @notice Error emitted when invalid token address is passed (address is 0)
    error InvalidTokenPassed();
    
    /// @notice Initialize the contract with the and signer address and merkle root
    constructor(address signerAddress_, bytes32 root_) {
        if (signerAddress_ == address(0)) {
            revert InvalidSignerPassed();
        }
        signerAddress = signerAddress_;
        root = root_;
    }

    /**
     * @notice Function to convert bytes32 to address
     * @param b bytes32 to convert to address
     * @return address
     */
    function bytes32ToAddress(bytes32 b) public pure returns (address) {
        return address(uint160(uint256(b)));
    }

    /**
     * @param userSchedule UserSchedule struct containing user's vesting schedule and their wallet address in bytes
     * @param proof Merkle proof to verify the user's vesting schedule
     * @param recepientAddress Address of the recepient wallet (by default wallet that has vesting schedule associated with it)
     * @param signature Signature to verify the recepient wallet (if it's different from the wallet that has vesting schedule associated with it)
     */
    function activateVesting(UserSchedule calldata userSchedule, bytes32[] calldata proof, address recepientAddress, bytes calldata signature) external nonReentrant {
        bool isValidData = _validateMerkleProof(userSchedule, proof);
        if (!isValidData) {
            revert InvalidDataPassed();
        }
        address actualRecepientAddress = _findRecepientWallet(userSchedule, recepientAddress, signature);
        _seedUser(userSchedule, actualRecepientAddress);
    }

    /**
     * @notice Function to release tokens for a specific user
     * @param to Address of the user to release tokens to
     */
    function releaseTokens(address to) external nonReentrant {
        Schedule storage schedule = schedules[to];
        if (schedule.allocation == 0) {
            revert AllocationNotFound(to);
        }
        
        uint256 amtToClaim = _claimableAmount(schedule);
      
        schedule.claimed += amtToClaim;
        bool success = token.transfer(to, amtToClaim);
        if (!success) {
            revert TransferFailed();
        }

        emit TokensReleased(to, amtToClaim);
    }

    /**
     * @notice Function for users to update their recepient wallet
     * @param userAddressInBytes User id in bytes
     * @param newRecepientWallet New recepient wallet address (should be not 0 and not already in use)
     */
    function updateRecepientWallet(bytes32 userAddressInBytes, address newRecepientWallet) external {
        _updateRecepientWallet(userAddressInBytes, msg.sender, newRecepientWallet);
    }

    /**
     * @notice Function for admin to update the recepient wallet
     * @param userAddressInBytes User id in bytes
     * @param currentRecepientWallet Current recepient wallet address
     * @param newRecepientWallet New recepient wallet address (should be not 0 and not already in use)
     */
    function adminUpdateRecepientWallet(bytes32 userAddressInBytes, address currentRecepientWallet, address newRecepientWallet) external onlyOwner {
        _updateRecepientWallet(userAddressInBytes, currentRecepientWallet, newRecepientWallet);
    }

    /**
     * @notice Function to update the signer address
     * @param signerAddress_ New signer address
     */
    function setSignerAddress(address signerAddress_) external onlyOwner {
        if (signerAddress_ == address(0)) {
            revert InvalidSignerPassed();
        }
        signerAddress = signerAddress_;
        emit SignerAddressSet(signerAddress_);
    }

    /**
     * @notice Function to update the token address
     * @param newToken New token address (should be not 0)
     */
    function updateTokenAddress(IERC20 newToken) external onlyOwner {
        if (address(token) != address(0)) {
            revert TokenAddressAlreadySet();
        }
        if (address(newToken) == address(0)) {
            revert InvalidTokenPassed();
        }
        token = newToken;
        emit TokenAddressUpdated(address(newToken));
    }

    /**
     * @notice Function to calculate claimable amount for a specific user
     * @param user Address of the user
     * @return uint256 accumulated claimable amount
     */
    function claimableAmount(address user) external view returns (uint256) {
        return _claimableAmount(schedules[user]);
    }

    /**
     * @notice Function to calculate claimable amount for a specific user by their id in bytes
     * @param userAddressInBytes User id in bytes
     * @return uint256 accumulated claimable amount
     */
    function claimableAmountById(bytes32 userAddressInBytes) external view returns (uint256) {
        address user = primaryWalletBytesToAddress[userAddressInBytes];
        if (user == address(0)) {
            return 0;
        }

        return _claimableAmount(schedules[user]);
    }

    /**
     * @notice Internal function to initialize a user's vesting schedule
     * @param userSchedule UserSchedule struct containing user's vesting schedule and their wallet address in bytes
     * @param userAddress Address of the user
     */
    function _seedUser(UserSchedule calldata userSchedule, address userAddress) internal {        
        if (schedules[userAddress].allocation != 0) {
            revert UserAlreadyExists();
        }
        
        if (primaryWalletBytesToAddress[userSchedule.user] != address(0)) {
            revert UserIdAlreadyInUse(userSchedule.user);
        }

        primaryWalletBytesToAddress[userSchedule.user] = userAddress;
        schedules[userAddress] = userSchedule.schedule;

        emit ScheduleSet(userAddress, userSchedule.user);
    }

    /**
     * @notice Internal function to update the recepient wallet
     * @param userAddressInBytes User id in bytes
     * @param currentRecepientWallet Current recepient wallet address
     * @param newRecepientWallet New recepient wallet address (should be not 0 and not already in use)
     */
    function _updateRecepientWallet(bytes32 userAddressInBytes, address currentRecepientWallet, address newRecepientWallet) internal {
        if (primaryWalletBytesToAddress[userAddressInBytes] != currentRecepientWallet) {
            revert Unauthorized();
        }
        if (newRecepientWallet == address(0)) {
            revert InvalidRecepientAddressPassed();
        }
        if (schedules[newRecepientWallet].allocation != 0) {
            revert UserAlreadyExists();
        }
        primaryWalletBytesToAddress[userAddressInBytes] = newRecepientWallet;
        schedules[newRecepientWallet] = schedules[currentRecepientWallet];
        delete schedules[currentRecepientWallet];
        emit RecepientAddressUpdated(userAddressInBytes, currentRecepientWallet, newRecepientWallet);
    }

    /**
     * @notice Internal view function to calculate claimable amount for a specific user
     * @param schedule Schedule struct containing user's vesting schedule
     * @return uint256 accumulated claimable amount
     */
    function _claimableAmount(Schedule storage schedule) internal view returns (uint256) {
        return _vestedAmount(schedule) - schedule.claimed;
    }
    
    /**
     * @notice Internal view function to calculate vested amount for a specific user
     * @param schedule Schedule struct containing user's vesting schedule
     * @return uint256 vested amount
     */
    function _vestedAmount(Schedule storage schedule) internal view returns (uint256) {
        if (block.timestamp < schedule.startTimestamp) {
            return 0;
        }
        if (block.timestamp > schedule.endTimestamp) {
            return schedule.allocation;
        }

        uint256 initialAmt = schedule.allocation * schedule.initUnlockPercentage / 100;
        uint256 vestingAmt = schedule.allocation - initialAmt;    
        
        uint256 elapsedTime = block.timestamp - schedule.startTimestamp;
        uint256 unlockPeriod =  schedule.endTimestamp - schedule.startTimestamp;
        
        return initialAmt + (vestingAmt * elapsedTime) / unlockPeriod;
    }

    /**
     * @notice Internal view function to find the recepient wallet
     * @dev If the sender is the user OR recepient wallet is not passed, then the recepient wallet is the sender's wallet.
     * If the recepient wallet is passed and != sender (SOL users or ETH users who desire to use another address to receive
     * tokens to), then the signature is verified to check if the recepient wallet is valid.
     * @dev isValidEthereumAddress guarantees that user is an Ethereum address and not a Solana address.This ensures that if
     * senders last 20 bytes overlap with the last 20 bytes of Solana address, the transaction will revert and now allow the sender
     * to claim tokens on behalf of the Solana address.
     * @param userSchedule UserSchedule struct containing user's vesting schedule and their wallet address in bytes
     * @param recepientWallet Address of the recepient wallet
     * @param signature Signature to verify the recepient wallet (if it's different from the wallet that has vesting schedule associated with it)
     * @return address of the recepient wallet
     */
    function _findRecepientWallet(UserSchedule calldata userSchedule, address recepientWallet, bytes calldata signature) internal view returns (address) {
        if (msg.sender == bytes32ToAddress(userSchedule.user) && recepientWallet == address(0) && isValidEthereumAddress(userSchedule.user)) {
            return msg.sender;
        }

        if (recepientWallet == bytes32ToAddress(userSchedule.user) && isValidEthereumAddress(userSchedule.user)) {
            return recepientWallet;
        }

        if (recepientWallet == address(0)) {
            revert InvalidRecepientAddressPassed();
        }

        if (_validateSignature(userSchedule.user, recepientWallet, signature)) {
            return recepientWallet;
        }

        revert InvalidSignaturePassed();
    }

    /**
     * @notice Internal view function to validate signature
     * @param user User id in bytes
     * @param recepientWallet Address of the recepient wallet
     * @param signature Signature to verify the recepient wallet
     * @return bool is signature valid
     */
    function _validateSignature(bytes32 user, address recepientWallet, bytes calldata signature) internal view returns (bool) {
      bytes32 dataHash = keccak256(abi.encode(user, recepientWallet));
      bytes32 message = ECDSA.toEthSignedMessageHash(dataHash);

      address receivedAddress = ECDSA.recover(message, signature);
      return (receivedAddress != address(0) && receivedAddress == signerAddress);
    }

    /**
     * @notice Internal view function to validate merkle proof
     * @param userSchedule UserSchedule struct containing user's vesting schedule and their wallet address in bytes
     * @param proof Merkle proof to verify the user's vesting schedule
     * @return bool is merkle proof valid
     */
    function _validateMerkleProof(UserSchedule calldata userSchedule, bytes32[] calldata proof) internal view returns (bool) {
        bytes32 leaf = keccak256(abi.encode(userSchedule.user, userSchedule.schedule.allocation, userSchedule.schedule.startTimestamp, userSchedule.schedule.endTimestamp, userSchedule.schedule.initUnlockPercentage));
        return MerkleProof.verify(proof, root, leaf);
    }

    /**
     * @notice Internal view function to check if the user is an Ethereum address
     * @param solanaAddress User id in bytes
     * @return bool is Ethereum address
     */
    function isValidEthereumAddress(bytes32 solanaAddress) internal pure returns (bool) {
       return bytes12(solanaAddress) == bytes12(0);
    }
}

File 3 of 10 : 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 4 of 10 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 5 of 10 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 6 of 10 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

File 7 of 10 : 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 8 of 10 : 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 9 of 10 : 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 10 of 10 : 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 11 of 10 : 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);
        }
    }
}

Settings
{
  "remappings": [
    "@layerzero-contracts/=lib/solidity-examples/contracts/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@Chainlink/=lib/chainlink-brownie-contracts/contracts/",
    "@prb/math/=lib/prb-math/",
    "@sstore2/=lib/sstore2/",
    "@prb/test/=lib/prb-math/node_modules/@prb/test/",
    "chainlink-brownie-contracts/=lib/chainlink-brownie-contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "prb-math/=lib/prb-math/src/",
    "solidity-examples/=lib/solidity-examples/contracts/",
    "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
    "sstore2/=lib/sstore2/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"signerAddress_","type":"address"},{"internalType":"bytes32","name":"root_","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"AllocationNotFound","type":"error"},{"inputs":[],"name":"InvalidDataPassed","type":"error"},{"inputs":[],"name":"InvalidRecepientAddressPassed","type":"error"},{"inputs":[],"name":"InvalidSignaturePassed","type":"error"},{"inputs":[],"name":"InvalidSignerPassed","type":"error"},{"inputs":[],"name":"InvalidTokenPassed","type":"error"},{"inputs":[],"name":"TokenAddressAlreadySet","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UserAlreadyExists","type":"error"},{"inputs":[{"internalType":"bytes32","name":"primaryWalletBytes","type":"bytes32"}],"name":"UserIdAlreadyInUse","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"userAddressInBytes","type":"bytes32"},{"indexed":true,"internalType":"address","name":"currentRecepientWallet","type":"address"},{"indexed":true,"internalType":"address","name":"newRecepientWallet","type":"address"}],"name":"RecepientAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recepientAddress","type":"address"},{"indexed":false,"internalType":"bytes32","name":"user","type":"bytes32"}],"name":"ScheduleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"signerAddress_","type":"address"}],"name":"SignerAddressSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newToken","type":"address"}],"name":"TokenAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensReleased","type":"event"},{"inputs":[{"components":[{"internalType":"bytes32","name":"user","type":"bytes32"},{"components":[{"internalType":"uint256","name":"allocation","type":"uint256"},{"internalType":"uint256","name":"claimed","type":"uint256"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"uint64","name":"endTimestamp","type":"uint64"},{"internalType":"uint8","name":"initUnlockPercentage","type":"uint8"}],"internalType":"struct TokenVestingLinear.Schedule","name":"schedule","type":"tuple"}],"internalType":"struct TokenVestingLinear.UserSchedule","name":"userSchedule","type":"tuple"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"address","name":"recepientAddress","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"activateVesting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"userAddressInBytes","type":"bytes32"},{"internalType":"address","name":"currentRecepientWallet","type":"address"},{"internalType":"address","name":"newRecepientWallet","type":"address"}],"name":"adminUpdateRecepientWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"b","type":"bytes32"}],"name":"bytes32ToAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"claimableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"userAddressInBytes","type":"bytes32"}],"name":"claimableAmountById","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"primaryWalletBytesToAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"releaseTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"root","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"schedules","outputs":[{"internalType":"uint256","name":"allocation","type":"uint256"},{"internalType":"uint256","name":"claimed","type":"uint256"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"uint64","name":"endTimestamp","type":"uint64"},{"internalType":"uint8","name":"initUnlockPercentage","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"signerAddress_","type":"address"}],"name":"setSignerAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"userAddressInBytes","type":"bytes32"},{"internalType":"address","name":"newRecepientWallet","type":"address"}],"name":"updateRecepientWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"newToken","type":"address"}],"name":"updateTokenAddress","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060405234801561001057600080fd5b506040516116be3803806116be83398101604081905261002f916100dc565b6100383361008c565b600180556001600160a01b038216610063576040516308b825f360e41b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b039390931692909217909155608052610116565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100ef57600080fd5b82516001600160a01b038116811461010657600080fd5b6020939093015192949293505050565b6080516115866101386000396000818161029e015261088f01526115866000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c806387b0be48116100a2578063b8129df311610071578063b8129df314610286578063ebf0c71714610299578063f2fde38b146102c0578063fc0c546a146102d3578063fea6bfc6146102e657600080fd5b806387b0be481461022e57806389885049146102415780638da5cb5b14610262578063acedaa1e1461027357600080fd5b80635ced058e116100de5780635ced058e1461017b5780636691461a1461018c578063715018a61461019f57806380c3780f146101a757600080fd5b8063046dc166146101105780630ae6c63a146101255780634c33531d146101385780635b7633d01461014b575b600080fd5b61012361011e3660046111b6565b61030f565b005b610123610133366004611214565b610393565b6101236101463660046112dd565b6103f5565b60035461015e906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61015e61018936600461131f565b90565b61012361019a3660046111b6565b61040d565b6101236104b3565b6101f76101b53660046111b6565b6004602052600090815260409020805460018201546002909201549091906001600160401b0380821691600160401b810490911690600160801b900460ff1685565b6040805195865260208601949094526001600160401b039283169385019390935216606083015260ff16608082015260a001610172565b61012361023c3660046111b6565b6104c7565b61025461024f3660046111b6565b610628565b604051908152602001610172565b6000546001600160a01b031661015e565b610123610281366004611338565b61064f565b61025461029436600461131f565b61065e565b6102547f000000000000000000000000000000000000000000000000000000000000000081565b6101236102ce3660046111b6565b6106ac565b60025461015e906001600160a01b031681565b61015e6102f436600461131f565b6005602052600090815260409020546001600160a01b031681565b610317610722565b6001600160a01b03811661033e576040516308b825f360e41b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527fa422625cee042645335400b23ac6e8bd86bd1a1e6cbf2ed8ab93c238f78606b5906020015b60405180910390a150565b61039b61077c565b60006103a88787876107d5565b9050806103c85760405163014793c560e21b815260040160405180910390fd5b60006103d6888686866108c3565b90506103e2888261099e565b50506103ed60018055565b505050505050565b6103fd610722565b610408838383610a9b565b505050565b610415610722565b6002546001600160a01b03161561043e5760405162c933ef60e81b815260040160405180910390fd5b6001600160a01b0381166104655760405163284e7cab60e21b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f2f0c7f17be551d1f4566672cd67adbe50173e96632f56ff80d80acc4ac00f32890602001610388565b6104bb610722565b6104c56000610c3f565b565b6104cf61077c565b6001600160a01b038116600090815260046020526040812080549091036105185760405162746ce760e21b81526001600160a01b03831660048201526024015b60405180910390fd5b600061052382610c8f565b905080826001016000828254610539919061137e565b909155505060025460405163a9059cbb60e01b81526001600160a01b03858116600483015260248201849052600092169063a9059cbb906044016020604051808303816000875af1158015610592573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b69190611391565b9050806105d6576040516312171d8360e31b815260040160405180910390fd5b836001600160a01b03167fc7798891864187665ac6dd119286e44ec13f014527aeeb2b8eb3fd413df931798360405161061191815260200190565b60405180910390a250505061062560018055565b50565b6001600160a01b038116600090815260046020526040812061064990610c8f565b92915050565b61065a823383610a9b565b5050565b6000818152600560205260408120546001600160a01b0316806106845750600092915050565b6001600160a01b03811660009081526004602052604090206106a590610c8f565b9392505050565b6106b4610722565b6001600160a01b0381166107195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161050f565b61062581610c3f565b6000546001600160a01b031633146104c55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161050f565b6002600154036107ce5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161050f565b6002600155565b600080843560208601356107ef60808801606089016113c8565b6107ff60a0890160808a016113c8565b61080f60c08a0160a08b016113f4565b6040805160208101969096528501939093526001600160401b03918216606085015216608083015260ff1660a082015260c0016040516020818303038152906040528051906020012090506108ba8484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152507f00000000000000000000000000000000000000000000000000000000000000009250859150610ca99050565b95945050505050565b6000336001600160a01b038635161480156108e557506001600160a01b038416155b80156108fa57506001600160a01b0319853516155b15610906575033610996565b84356001600160a01b0316846001600160a01b031614801561093157506001600160a01b0319853516155b1561093d575082610996565b6001600160a01b038416610964576040516307c0a94360e01b815260040160405180910390fd5b6109718535858585610cbf565b1561097d575082610996565b60405163d9cd95f560e01b815260040160405180910390fd5b949350505050565b6001600160a01b038116600090815260046020526040902054156109d5576040516361a21cbf60e11b815260040160405180910390fd5b81356000908152600560205260409020546001600160a01b031615610a10576040516383b8935d60e01b81528235600482015260240161050f565b8135600090815260056020908152604080832080546001600160a01b0319166001600160a01b03861690811790915583526004825290912090830190610a568282611411565b5050604051823581526001600160a01b038216907ffecb53e9977628b47f887adfbb8007a29451656425cd37dc4b689906150639af9060200160405180910390a25050565b6000838152600560205260409020546001600160a01b03838116911614610ad4576040516282b42960e81b815260040160405180910390fd5b6001600160a01b038116610afb576040516307c0a94360e01b815260040160405180910390fd5b6001600160a01b03811660009081526004602052604090205415610b32576040516361a21cbf60e11b815260040160405180910390fd5b600083815260056020908152604080832080546001600160a01b0319166001600160a01b038681169182179092559086168085526004909352818420818552828520815481556001828101805491830191909155600280840180549190930180546001600160401b0392831667ffffffffffffffff1982168117835585546fffffffffffffffffffffffffffffffff1990921617600160401b918290049093160291909117808255835460ff60801b19909116600160801b9182900460ff16909102179055858752918690559085905580546001600160881b03191690559051909286917f4d26cb0c6365e480fc9b1f55f396d04c555ec78a77fcd2adaa9bd029ab64f4529190a4505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008160010154610c9f83610daf565b6106499190611498565b600082610cb68584610ea9565b14949350505050565b6000808585604051602001610ce79291909182526001600160a01b0316602082015260400190565b6040516020818303038152906040528051906020012090506000610d38827f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b90506000610d7c8287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610ef692505050565b90506001600160a01b03811615801590610da357506003546001600160a01b038281169116145b98975050505050505050565b60028101546000906001600160401b0316421015610dcf57506000919050565b6002820154600160401b90046001600160401b0316421115610df057505490565b60028201548254600091606491610e1191600160801b900460ff16906114ab565b610e1b91906114c2565b90506000818460000154610e2f9190611498565b6002850154909150600090610e4d906001600160401b031642611498565b6002860154909150600090610e75906001600160401b0380821691600160401b9004166114e4565b6001600160401b0316905080610e8b83856114ab565b610e9591906114c2565b610e9f908561137e565b9695505050505050565b600081815b8451811015610eee57610eda82868381518110610ecd57610ecd61150b565b6020026020010151610f12565b915080610ee681611521565b915050610eae565b509392505050565b6000806000610f058585610f3e565b91509150610eee81610f83565b6000818310610f2e5760008281526020849052604090206106a5565b5060009182526020526040902090565b6000808251604103610f745760208301516040840151606085015160001a610f68878285856110cd565b94509450505050610f7c565b506000905060025b9250929050565b6000816004811115610f9757610f9761153a565b03610f9f5750565b6001816004811115610fb357610fb361153a565b036110005760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161050f565b60028160048111156110145761101461153a565b036110615760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161050f565b60038160048111156110755761107561153a565b036106255760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161050f565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156111045750600090506003611188565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611158573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661118157600060019250925050611188565b9150600090505b94509492505050565b6001600160a01b038116811461062557600080fd5b80356111b181611191565b919050565b6000602082840312156111c857600080fd5b81356106a581611191565b60008083601f8401126111e557600080fd5b5081356001600160401b038111156111fc57600080fd5b602083019150836020828501011115610f7c57600080fd5b60008060008060008086880361012081121561122f57600080fd5b60c081121561123d57600080fd5b5086955060c08701356001600160401b038082111561125b57600080fd5b818901915089601f83011261126f57600080fd5b81358181111561127e57600080fd5b8a60208260051b850101111561129357600080fd5b60208301975095506112a760e08a016111a6565b94506101008901359150808211156112be57600080fd5b506112cb89828a016111d3565b979a9699509497509295939492505050565b6000806000606084860312156112f257600080fd5b83359250602084013561130481611191565b9150604084013561131481611191565b809150509250925092565b60006020828403121561133157600080fd5b5035919050565b6000806040838503121561134b57600080fd5b82359150602083013561135d81611191565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561064957610649611368565b6000602082840312156113a357600080fd5b815180151581146106a557600080fd5b6001600160401b038116811461062557600080fd5b6000602082840312156113da57600080fd5b81356106a5816113b3565b60ff8116811461062557600080fd5b60006020828403121561140657600080fd5b81356106a5816113e5565b8135815560208201356001820155600281016040830135611431816113b3565b81546060850135611441816113b3565b608086013561144f816113e5565b60409190911b6fffffffffffffffff0000000000000000166001600160881b0319929092166001600160401b0393909316929092171760809190911b60ff60801b161790555050565b8181038181111561064957610649611368565b808202811582820484141761064957610649611368565b6000826114df57634e487b7160e01b600052601260045260246000fd5b500490565b6001600160401b0382811682821603908082111561150457611504611368565b5092915050565b634e487b7160e01b600052603260045260246000fd5b60006001820161153357611533611368565b5060010190565b634e487b7160e01b600052602160045260246000fdfea26469706673582212204e28ae93392197b7472cee07176e8bc79069734bdc4cd1ff3adf076da9b37fed64736f6c63430008140033000000000000000000000000e80dab5272ee4575c2fcaf383cdd13ec910a01922f2f5cd0a5aa6f0683e58b0a54a62ef40bb8830bea3223b74e9d857a97f40025

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806387b0be48116100a2578063b8129df311610071578063b8129df314610286578063ebf0c71714610299578063f2fde38b146102c0578063fc0c546a146102d3578063fea6bfc6146102e657600080fd5b806387b0be481461022e57806389885049146102415780638da5cb5b14610262578063acedaa1e1461027357600080fd5b80635ced058e116100de5780635ced058e1461017b5780636691461a1461018c578063715018a61461019f57806380c3780f146101a757600080fd5b8063046dc166146101105780630ae6c63a146101255780634c33531d146101385780635b7633d01461014b575b600080fd5b61012361011e3660046111b6565b61030f565b005b610123610133366004611214565b610393565b6101236101463660046112dd565b6103f5565b60035461015e906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61015e61018936600461131f565b90565b61012361019a3660046111b6565b61040d565b6101236104b3565b6101f76101b53660046111b6565b6004602052600090815260409020805460018201546002909201549091906001600160401b0380821691600160401b810490911690600160801b900460ff1685565b6040805195865260208601949094526001600160401b039283169385019390935216606083015260ff16608082015260a001610172565b61012361023c3660046111b6565b6104c7565b61025461024f3660046111b6565b610628565b604051908152602001610172565b6000546001600160a01b031661015e565b610123610281366004611338565b61064f565b61025461029436600461131f565b61065e565b6102547f2f2f5cd0a5aa6f0683e58b0a54a62ef40bb8830bea3223b74e9d857a97f4002581565b6101236102ce3660046111b6565b6106ac565b60025461015e906001600160a01b031681565b61015e6102f436600461131f565b6005602052600090815260409020546001600160a01b031681565b610317610722565b6001600160a01b03811661033e576040516308b825f360e41b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527fa422625cee042645335400b23ac6e8bd86bd1a1e6cbf2ed8ab93c238f78606b5906020015b60405180910390a150565b61039b61077c565b60006103a88787876107d5565b9050806103c85760405163014793c560e21b815260040160405180910390fd5b60006103d6888686866108c3565b90506103e2888261099e565b50506103ed60018055565b505050505050565b6103fd610722565b610408838383610a9b565b505050565b610415610722565b6002546001600160a01b03161561043e5760405162c933ef60e81b815260040160405180910390fd5b6001600160a01b0381166104655760405163284e7cab60e21b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f2f0c7f17be551d1f4566672cd67adbe50173e96632f56ff80d80acc4ac00f32890602001610388565b6104bb610722565b6104c56000610c3f565b565b6104cf61077c565b6001600160a01b038116600090815260046020526040812080549091036105185760405162746ce760e21b81526001600160a01b03831660048201526024015b60405180910390fd5b600061052382610c8f565b905080826001016000828254610539919061137e565b909155505060025460405163a9059cbb60e01b81526001600160a01b03858116600483015260248201849052600092169063a9059cbb906044016020604051808303816000875af1158015610592573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b69190611391565b9050806105d6576040516312171d8360e31b815260040160405180910390fd5b836001600160a01b03167fc7798891864187665ac6dd119286e44ec13f014527aeeb2b8eb3fd413df931798360405161061191815260200190565b60405180910390a250505061062560018055565b50565b6001600160a01b038116600090815260046020526040812061064990610c8f565b92915050565b61065a823383610a9b565b5050565b6000818152600560205260408120546001600160a01b0316806106845750600092915050565b6001600160a01b03811660009081526004602052604090206106a590610c8f565b9392505050565b6106b4610722565b6001600160a01b0381166107195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161050f565b61062581610c3f565b6000546001600160a01b031633146104c55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161050f565b6002600154036107ce5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161050f565b6002600155565b600080843560208601356107ef60808801606089016113c8565b6107ff60a0890160808a016113c8565b61080f60c08a0160a08b016113f4565b6040805160208101969096528501939093526001600160401b03918216606085015216608083015260ff1660a082015260c0016040516020818303038152906040528051906020012090506108ba8484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152507f2f2f5cd0a5aa6f0683e58b0a54a62ef40bb8830bea3223b74e9d857a97f400259250859150610ca99050565b95945050505050565b6000336001600160a01b038635161480156108e557506001600160a01b038416155b80156108fa57506001600160a01b0319853516155b15610906575033610996565b84356001600160a01b0316846001600160a01b031614801561093157506001600160a01b0319853516155b1561093d575082610996565b6001600160a01b038416610964576040516307c0a94360e01b815260040160405180910390fd5b6109718535858585610cbf565b1561097d575082610996565b60405163d9cd95f560e01b815260040160405180910390fd5b949350505050565b6001600160a01b038116600090815260046020526040902054156109d5576040516361a21cbf60e11b815260040160405180910390fd5b81356000908152600560205260409020546001600160a01b031615610a10576040516383b8935d60e01b81528235600482015260240161050f565b8135600090815260056020908152604080832080546001600160a01b0319166001600160a01b03861690811790915583526004825290912090830190610a568282611411565b5050604051823581526001600160a01b038216907ffecb53e9977628b47f887adfbb8007a29451656425cd37dc4b689906150639af9060200160405180910390a25050565b6000838152600560205260409020546001600160a01b03838116911614610ad4576040516282b42960e81b815260040160405180910390fd5b6001600160a01b038116610afb576040516307c0a94360e01b815260040160405180910390fd5b6001600160a01b03811660009081526004602052604090205415610b32576040516361a21cbf60e11b815260040160405180910390fd5b600083815260056020908152604080832080546001600160a01b0319166001600160a01b038681169182179092559086168085526004909352818420818552828520815481556001828101805491830191909155600280840180549190930180546001600160401b0392831667ffffffffffffffff1982168117835585546fffffffffffffffffffffffffffffffff1990921617600160401b918290049093160291909117808255835460ff60801b19909116600160801b9182900460ff16909102179055858752918690559085905580546001600160881b03191690559051909286917f4d26cb0c6365e480fc9b1f55f396d04c555ec78a77fcd2adaa9bd029ab64f4529190a4505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008160010154610c9f83610daf565b6106499190611498565b600082610cb68584610ea9565b14949350505050565b6000808585604051602001610ce79291909182526001600160a01b0316602082015260400190565b6040516020818303038152906040528051906020012090506000610d38827f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b90506000610d7c8287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610ef692505050565b90506001600160a01b03811615801590610da357506003546001600160a01b038281169116145b98975050505050505050565b60028101546000906001600160401b0316421015610dcf57506000919050565b6002820154600160401b90046001600160401b0316421115610df057505490565b60028201548254600091606491610e1191600160801b900460ff16906114ab565b610e1b91906114c2565b90506000818460000154610e2f9190611498565b6002850154909150600090610e4d906001600160401b031642611498565b6002860154909150600090610e75906001600160401b0380821691600160401b9004166114e4565b6001600160401b0316905080610e8b83856114ab565b610e9591906114c2565b610e9f908561137e565b9695505050505050565b600081815b8451811015610eee57610eda82868381518110610ecd57610ecd61150b565b6020026020010151610f12565b915080610ee681611521565b915050610eae565b509392505050565b6000806000610f058585610f3e565b91509150610eee81610f83565b6000818310610f2e5760008281526020849052604090206106a5565b5060009182526020526040902090565b6000808251604103610f745760208301516040840151606085015160001a610f68878285856110cd565b94509450505050610f7c565b506000905060025b9250929050565b6000816004811115610f9757610f9761153a565b03610f9f5750565b6001816004811115610fb357610fb361153a565b036110005760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161050f565b60028160048111156110145761101461153a565b036110615760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161050f565b60038160048111156110755761107561153a565b036106255760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161050f565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156111045750600090506003611188565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611158573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661118157600060019250925050611188565b9150600090505b94509492505050565b6001600160a01b038116811461062557600080fd5b80356111b181611191565b919050565b6000602082840312156111c857600080fd5b81356106a581611191565b60008083601f8401126111e557600080fd5b5081356001600160401b038111156111fc57600080fd5b602083019150836020828501011115610f7c57600080fd5b60008060008060008086880361012081121561122f57600080fd5b60c081121561123d57600080fd5b5086955060c08701356001600160401b038082111561125b57600080fd5b818901915089601f83011261126f57600080fd5b81358181111561127e57600080fd5b8a60208260051b850101111561129357600080fd5b60208301975095506112a760e08a016111a6565b94506101008901359150808211156112be57600080fd5b506112cb89828a016111d3565b979a9699509497509295939492505050565b6000806000606084860312156112f257600080fd5b83359250602084013561130481611191565b9150604084013561131481611191565b809150509250925092565b60006020828403121561133157600080fd5b5035919050565b6000806040838503121561134b57600080fd5b82359150602083013561135d81611191565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561064957610649611368565b6000602082840312156113a357600080fd5b815180151581146106a557600080fd5b6001600160401b038116811461062557600080fd5b6000602082840312156113da57600080fd5b81356106a5816113b3565b60ff8116811461062557600080fd5b60006020828403121561140657600080fd5b81356106a5816113e5565b8135815560208201356001820155600281016040830135611431816113b3565b81546060850135611441816113b3565b608086013561144f816113e5565b60409190911b6fffffffffffffffff0000000000000000166001600160881b0319929092166001600160401b0393909316929092171760809190911b60ff60801b161790555050565b8181038181111561064957610649611368565b808202811582820484141761064957610649611368565b6000826114df57634e487b7160e01b600052601260045260246000fd5b500490565b6001600160401b0382811682821603908082111561150457611504611368565b5092915050565b634e487b7160e01b600052603260045260246000fd5b60006001820161153357611533611368565b5060010190565b634e487b7160e01b600052602160045260246000fdfea26469706673582212204e28ae93392197b7472cee07176e8bc79069734bdc4cd1ff3adf076da9b37fed64736f6c63430008140033

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

000000000000000000000000e80dab5272ee4575c2fcaf383cdd13ec910a01922f2f5cd0a5aa6f0683e58b0a54a62ef40bb8830bea3223b74e9d857a97f40025

-----Decoded View---------------
Arg [0] : signerAddress_ (address): 0xE80DAb5272EE4575c2FCaf383cdd13eC910a0192
Arg [1] : root_ (bytes32): 0x2f2f5cd0a5aa6f0683e58b0a54a62ef40bb8830bea3223b74e9d857a97f40025

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000e80dab5272ee4575c2fcaf383cdd13ec910a0192
Arg [1] : 2f2f5cd0a5aa6f0683e58b0a54a62ef40bb8830bea3223b74e9d857a97f40025


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  ]
[ 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.