ETH Price: $3,460.06 (+5.15%)

Contract

0xf1Dc500FdE233A4055e25e5BbF516372BC4F6871
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

1 address found via
Transaction Hash
Method
Block
From
To
Approve209829462024-10-17 4:38:2337 days ago1729139903IN
Saddle Finance: SDL Token
0 ETH0.000210758.66630156
Approve209615912024-10-14 5:01:3540 days ago1728882095IN
Saddle Finance: SDL Token
0 ETH0.000454199.80155541
Approve209615382024-10-14 4:50:4740 days ago1728881447IN
Saddle Finance: SDL Token
0 ETH0.0004058.6904357
Approve209485552024-10-12 9:12:5942 days ago1728724379IN
Saddle Finance: SDL Token
0 ETH0.0002677911.01172963
Approve208475992024-09-28 7:20:3556 days ago1727508035IN
Saddle Finance: SDL Token
0 ETH0.000353967.64063514
Approve208434532024-09-27 17:28:2356 days ago1727458103IN
Saddle Finance: SDL Token
0 ETH0.0004415918.15841782
Approve207681722024-09-17 5:13:5967 days ago1726550039IN
Saddle Finance: SDL Token
0 ETH0.000053942.21834682
Transfer207423062024-09-13 14:31:3570 days ago1726237895IN
Saddle Finance: SDL Token
0 ETH0.00023334.75919679
Approve207405282024-09-13 8:33:3571 days ago1726216415IN
Saddle Finance: SDL Token
0 ETH0.000061652.53519922
Approve207391402024-09-13 3:55:1171 days ago1726199711IN
Saddle Finance: SDL Token
0 ETH0.00006021.3
Transfer207388482024-09-13 2:56:4771 days ago1726196207IN
Saddle Finance: SDL Token
0 ETH0.000078962.1530913
Transfer207386462024-09-13 2:16:2371 days ago1726193783IN
Saddle Finance: SDL Token
0 ETH0.000088822.42208495
Transfer207385922024-09-13 2:05:3571 days ago1726193135IN
Saddle Finance: SDL Token
0 ETH0.000088292.40747104
Transfer207384472024-09-13 1:36:3571 days ago1726191395IN
Saddle Finance: SDL Token
0 ETH0.000080952.20735373
Transfer207380712024-09-13 0:21:1171 days ago1726186871IN
Saddle Finance: SDL Token
0 ETH0.000132332.46103424
Transfer207188322024-09-10 7:50:1174 days ago1725954611IN
Saddle Finance: SDL Token
0 ETH0.000239374.88418239
Approve207003452024-09-07 17:53:4776 days ago1725731627IN
Saddle Finance: SDL Token
0 ETH0.000073211.58000571
Approve206466712024-08-31 6:09:5984 days ago1725084599IN
Saddle Finance: SDL Token
0 ETH0.000025251.03858497
Approve205657972024-08-19 22:56:2395 days ago1724108183IN
Saddle Finance: SDL Token
0 ETH0.000095252.05505263
Approve205514612024-08-17 22:55:2397 days ago1723935323IN
Saddle Finance: SDL Token
0 ETH0.000023780.97811386
Transfer205192432024-08-13 10:55:59102 days ago1723546559IN
Saddle Finance: SDL Token
0 ETH0.000059461.86362663
Approve205192252024-08-13 10:52:23102 days ago1723546343IN
Saddle Finance: SDL Token
0 ETH0.00009732.08804865
Approve204392582024-08-02 7:05:23113 days ago1722582323IN
Saddle Finance: SDL Token
0 ETH0.000116054.77227233
Approve202817502024-07-11 7:24:35135 days ago1720682675IN
Saddle Finance: SDL Token
0 ETH0.000089223.66884279
Approve202817502024-07-11 7:24:35135 days ago1720682675IN
Saddle Finance: SDL Token
0 ETH0.000089223.66884279
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
136251122021-11-16 6:48:531103 days ago1637045333
Saddle Finance: SDL Token
 Contract Creation0 ETH
136251102021-11-16 6:48:441103 days ago1637045324
Saddle Finance: SDL Token
 Contract Creation0 ETH
136251082021-11-16 6:48:091103 days ago1637045289
Saddle Finance: SDL Token
 Contract Creation0 ETH
136251072021-11-16 6:47:581103 days ago1637045278
Saddle Finance: SDL Token
 Contract Creation0 ETH
136251032021-11-16 6:46:561103 days ago1637045216
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250992021-11-16 6:46:071103 days ago1637045167
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250982021-11-16 6:45:511103 days ago1637045151
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250962021-11-16 6:45:051103 days ago1637045105
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250952021-11-16 6:44:161103 days ago1637045056
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250932021-11-16 6:43:511103 days ago1637045031
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250912021-11-16 6:43:331103 days ago1637045013
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250902021-11-16 6:43:291103 days ago1637045009
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250882021-11-16 6:43:081103 days ago1637044988
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250862021-11-16 6:42:301103 days ago1637044950
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250842021-11-16 6:42:181103 days ago1637044938
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250802021-11-16 6:42:021103 days ago1637044922
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250772021-11-16 6:41:491103 days ago1637044909
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250752021-11-16 6:41:001103 days ago1637044860
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250722021-11-16 6:40:391103 days ago1637044839
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250682021-11-16 6:40:231103 days ago1637044823
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250652021-11-16 6:39:541103 days ago1637044794
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250632021-11-16 6:39:331103 days ago1637044773
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250622021-11-16 6:39:061103 days ago1637044746
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250612021-11-16 6:39:051103 days ago1637044745
Saddle Finance: SDL Token
 Contract Creation0 ETH
136250592021-11-16 6:38:341103 days ago1637044714
Saddle Finance: SDL Token
 Contract Creation0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SDL

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion, MIT license
File 1 of 21 : SDL.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.6;

import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/proxy/Clones.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20VotesComp.sol";
import "./Vesting.sol";
import "./SimpleGovernance.sol";

/**
 * @title Saddle DAO token
 * @notice A token that is deployed with fixed amount and appropriate vesting contracts.
 * Transfer is blocked for a period of time until the governance can toggle the transferability.
 */
contract SDL is ERC20Permit, Pausable, SimpleGovernance {
    using SafeERC20 for IERC20;

    // Token max supply is 1,000,000,000 * 1e18 = 1e27
    uint256 public constant MAX_SUPPLY = 1e9 ether;
    uint256 public immutable govCanUnpauseAfter;
    uint256 public immutable anyoneCanUnpauseAfter;
    address public immutable vestingContractTarget;

    mapping(address => bool) public allowedTransferee;

    event Allowed(address indexed target);
    event Disallowed(address indexed target);
    event VestingContractDeployed(
        address indexed beneficiary,
        address vestingContract
    );

    struct Recipient {
        address to;
        uint256 amount;
        uint256 startTimestamp;
        uint256 cliffPeriod;
        uint256 durationPeriod;
    }

    /**
     * @notice Initializes SDL token with specified governance address and recipients. For vesting
     * durations and amounts, please refer to our documentation on token distribution schedule.
     * @param governance_ address of the governance who will own this contract
     * @param pausePeriod_ time in seconds since the deployment. After this period, this token can be unpaused
     * by the governance.
     * @param vestingContractTarget_ logic contract of Vesting.sol to use for cloning
     */
    constructor(
        address governance_,
        uint256 pausePeriod_,
        address vestingContractTarget_
    ) public ERC20("Saddle DAO", "SDL") ERC20Permit("Saddle DAO") {
        require(governance_ != address(0), "SDL: governance cannot be empty");
        require(
            vestingContractTarget_ != address(0),
            "SDL: vesting contract target cannot be empty"
        );
        require(
            pausePeriod_ > 0 && pausePeriod_ <= 52 weeks,
            "SDL: pausePeriod must be in between 0 and 52 weeks"
        );

        // Set state variables
        vestingContractTarget = vestingContractTarget_;
        governance = governance_;
        govCanUnpauseAfter = block.timestamp + pausePeriod_;
        anyoneCanUnpauseAfter = block.timestamp + 52 weeks;

        // Allow governance to transfer tokens
        allowedTransferee[governance_] = true;

        // Mint tokens to governance
        _mint(governance, MAX_SUPPLY);

        // Pause transfers at deployment
        if (pausePeriod_ > 0) {
            _pause();
        }

        emit SetGovernance(governance_);
    }

    /**
     * @notice Deploys a clone of the vesting contract for the given recipient. Details about vesting and token
     * release schedule can be found on https://docs.saddle.finance
     * @param recipient Recipient of the token through the vesting schedule.
     */
    function deployNewVestingContract(Recipient memory recipient)
        public
        onlyGovernance
        returns (address)
    {
        require(
            recipient.durationPeriod > 0,
            "SDL: duration for vesting cannot be 0"
        );

        // Deploy a clone rather than deploying a whole new contract
        Vesting vestingContract = Vesting(Clones.clone(vestingContractTarget));

        // Initialize the clone contract for the recipient
        vestingContract.initialize(
            address(this),
            recipient.to,
            recipient.startTimestamp,
            recipient.cliffPeriod,
            recipient.durationPeriod
        );

        // Send tokens to the contract
        IERC20(address(this)).safeTransferFrom(
            msg.sender,
            address(vestingContract),
            recipient.amount
        );

        // Add the vesting contract to the allowed transferee list
        allowedTransferee[address(vestingContract)] = true;
        emit Allowed(address(vestingContract));
        emit VestingContractDeployed(recipient.to, address(vestingContract));

        return address(vestingContract);
    }

    /**
     * @notice Changes the transferability of this token.
     * @dev When the transfer is not enabled, only those in allowedTransferee array can
     * transfer this token.
     */
    function enableTransfer() external {
        require(paused(), "SDL: transfer is enabled");
        uint256 unpauseAfter = msg.sender == governance
            ? govCanUnpauseAfter
            : anyoneCanUnpauseAfter;
        require(
            block.timestamp > unpauseAfter,
            "SDL: cannot enable transfer yet"
        );
        _unpause();
    }

    /**
     * @notice Add the given addresses to the list of allowed addresses that can transfer during paused period.
     * Governance will add auxiliary contracts to the allowed list to facilitate distribution during the paused period.
     * @param targets Array of addresses to add
     */
    function addToAllowedList(address[] memory targets)
        external
        onlyGovernance
    {
        for (uint256 i = 0; i < targets.length; i++) {
            allowedTransferee[targets[i]] = true;
            emit Allowed(targets[i]);
        }
    }

    /**
     * @notice Remove the given addresses from the list of allowed addresses that can transfer during paused period.
     * @param targets Array of addresses to remove
     */
    function removeFromAllowedList(address[] memory targets)
        external
        onlyGovernance
    {
        for (uint256 i = 0; i < targets.length; i++) {
            allowedTransferee[targets[i]] = false;
            emit Disallowed(targets[i]);
        }
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal override {
        super._beforeTokenTransfer(from, to, amount);
        require(!paused() || allowedTransferee[from], "SDL: paused");
        require(to != address(this), "SDL: invalid recipient");
    }

    /**
     * @notice Transfers any stuck tokens or ether out to the given destination.
     * @dev Method to claim junk and accidentally sent tokens. This will be only used to rescue
     * tokens that are mistakenly sent by users to this contract.
     * @param token Address of the ERC20 token to transfer out. Set to address(0) to transfer ether instead.
     * @param to Destination address that will receive the tokens.
     * @param balance Amount to transfer out. Set to 0 to select all available amount.
     */
    function rescueTokens(
        IERC20 token,
        address payable to,
        uint256 balance
    ) external onlyGovernance {
        require(to != address(0), "SDL: invalid recipient");

        if (token == IERC20(address(0))) {
            // for Ether
            uint256 totalBalance = address(this).balance;
            balance = balance == 0
                ? totalBalance
                : Math.min(totalBalance, balance);
            require(balance > 0, "SDL: trying to send 0 ETH");
            // slither-disable-next-line arbitrary-send
            (bool success, ) = to.call{value: balance}("");
            require(success, "SDL: ETH transfer failed");
        } else {
            // any other erc20
            uint256 totalBalance = token.balanceOf(address(this));
            balance = balance == 0
                ? totalBalance
                : Math.min(totalBalance, balance);
            require(balance > 0, "SDL: trying to send 0 balance");
            token.safeTransfer(to, balance);
        }
    }
}

File 2 of 21 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 3 of 21 : Clones.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
 * deploying minimal proxy contracts, also known as "clones".
 *
 * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
 * > a minimal bytecode implementation that delegates all calls to a known, fixed address.
 *
 * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
 * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
 * deterministic method.
 *
 * _Available since v3.4._
 */
library Clones {
    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create opcode, which should never revert.
     */
    function clone(address implementation) internal returns (address instance) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create(0, ptr, 0x37)
        }
        require(instance != address(0), "ERC1167: create failed");
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create2 opcode and a `salt` to deterministically deploy
     * the clone. Using the same `implementation` and `salt` multiple time will revert, since
     * the clones cannot be deployed twice at the same address.
     */
    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create2(0, ptr, 0x37, salt)
        }
        require(instance != address(0), "ERC1167: create2 failed");
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt,
        address deployer
    ) internal pure returns (address predicted) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)
            mstore(add(ptr, 0x38), shl(0x60, deployer))
            mstore(add(ptr, 0x4c), salt)
            mstore(add(ptr, 0x6c), keccak256(ptr, 0x37))
            predicted := keccak256(add(ptr, 0x37), 0x55)
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(address implementation, bytes32 salt)
        internal
        view
        returns (address predicted)
    {
        return predictDeterministicAddress(implementation, salt, address(this));
    }
}

File 4 of 21 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 5 of 21 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 6 of 21 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 7 of 21 : ERC20Votes.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./draft-ERC20Permit.sol";
import "../../../utils/math/Math.sol";
import "../../../utils/math/SafeCast.sol";
import "../../../utils/cryptography/ECDSA.sol";

/**
 * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,
 * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.
 *
 * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.
 *
 * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either
 * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting
 * power can be queried through the public accessors {getVotes} and {getPastVotes}.
 *
 * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it
 * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.
 * Enabling self-delegation can easily be done by overriding the {delegates} function. Keep in mind however that this
 * will significantly increase the base gas cost of transfers.
 *
 * _Available since v4.2._
 */
abstract contract ERC20Votes is ERC20Permit {
    struct Checkpoint {
        uint32 fromBlock;
        uint224 votes;
    }

    bytes32 private constant _DELEGATION_TYPEHASH =
        keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");

    mapping(address => address) private _delegates;
    mapping(address => Checkpoint[]) private _checkpoints;
    Checkpoint[] private _totalSupplyCheckpoints;

    /**
     * @dev Emitted when an account changes their delegate.
     */
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

    /**
     * @dev Emitted when a token transfer or delegate change results in changes to an account's voting power.
     */
    event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);

    /**
     * @dev Get the `pos`-th checkpoint for `account`.
     */
    function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {
        return _checkpoints[account][pos];
    }

    /**
     * @dev Get number of checkpoints for `account`.
     */
    function numCheckpoints(address account) public view virtual returns (uint32) {
        return SafeCast.toUint32(_checkpoints[account].length);
    }

    /**
     * @dev Get the address `account` is currently delegating to.
     */
    function delegates(address account) public view virtual returns (address) {
        return _delegates[account];
    }

    /**
     * @dev Gets the current votes balance for `account`
     */
    function getVotes(address account) public view returns (uint256) {
        uint256 pos = _checkpoints[account].length;
        return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;
    }

    /**
     * @dev Retrieve the number of votes for `account` at the end of `blockNumber`.
     *
     * Requirements:
     *
     * - `blockNumber` must have been already mined
     */
    function getPastVotes(address account, uint256 blockNumber) public view returns (uint256) {
        require(blockNumber < block.number, "ERC20Votes: block not yet mined");
        return _checkpointsLookup(_checkpoints[account], blockNumber);
    }

    /**
     * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.
     * It is but NOT the sum of all the delegated votes!
     *
     * Requirements:
     *
     * - `blockNumber` must have been already mined
     */
    function getPastTotalSupply(uint256 blockNumber) public view returns (uint256) {
        require(blockNumber < block.number, "ERC20Votes: block not yet mined");
        return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);
    }

    /**
     * @dev Lookup a value in a list of (sorted) checkpoints.
     */
    function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {
        // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.
        //
        // During the loop, the index of the wanted checkpoint remains in the range [low, high).
        // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.
        // - If the middle checkpoint is after `blockNumber`, we look in [low, mid)
        // - If the middle checkpoint is before `blockNumber`, we look in [mid+1, high)
        // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not
        // out of bounds (in which case we're looking too far in the past and the result is 0).
        // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is
        // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out
        // the same.
        uint256 high = ckpts.length;
        uint256 low = 0;
        while (low < high) {
            uint256 mid = Math.average(low, high);
            if (ckpts[mid].fromBlock > blockNumber) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        return high == 0 ? 0 : ckpts[high - 1].votes;
    }

    /**
     * @dev Delegate votes from the sender to `delegatee`.
     */
    function delegate(address delegatee) public virtual {
        return _delegate(_msgSender(), delegatee);
    }

    /**
     * @dev Delegates votes from signer to `delegatee`
     */
    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(block.timestamp <= expiry, "ERC20Votes: signature expired");
        address signer = ECDSA.recover(
            _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),
            v,
            r,
            s
        );
        require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce");
        return _delegate(signer, delegatee);
    }

    /**
     * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).
     */
    function _maxSupply() internal view virtual returns (uint224) {
        return type(uint224).max;
    }

    /**
     * @dev Snapshots the totalSupply after it has been increased.
     */
    function _mint(address account, uint256 amount) internal virtual override {
        super._mint(account, amount);
        require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes");

        _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);
    }

    /**
     * @dev Snapshots the totalSupply after it has been decreased.
     */
    function _burn(address account, uint256 amount) internal virtual override {
        super._burn(account, amount);

        _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);
    }

    /**
     * @dev Move voting power when tokens are transferred.
     *
     * Emits a {DelegateVotesChanged} event.
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override {
        super._afterTokenTransfer(from, to, amount);

        _moveVotingPower(delegates(from), delegates(to), amount);
    }

    /**
     * @dev Change delegation for `delegator` to `delegatee`.
     *
     * Emits events {DelegateChanged} and {DelegateVotesChanged}.
     */
    function _delegate(address delegator, address delegatee) internal virtual {
        address currentDelegate = delegates(delegator);
        uint256 delegatorBalance = balanceOf(delegator);
        _delegates[delegator] = delegatee;

        emit DelegateChanged(delegator, currentDelegate, delegatee);

        _moveVotingPower(currentDelegate, delegatee, delegatorBalance);
    }

    function _moveVotingPower(
        address src,
        address dst,
        uint256 amount
    ) private {
        if (src != dst && amount > 0) {
            if (src != address(0)) {
                (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);
                emit DelegateVotesChanged(src, oldWeight, newWeight);
            }

            if (dst != address(0)) {
                (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);
                emit DelegateVotesChanged(dst, oldWeight, newWeight);
            }
        }
    }

    function _writeCheckpoint(
        Checkpoint[] storage ckpts,
        function(uint256, uint256) view returns (uint256) op,
        uint256 delta
    ) private returns (uint256 oldWeight, uint256 newWeight) {
        uint256 pos = ckpts.length;
        oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;
        newWeight = op(oldWeight, delta);

        if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {
            ckpts[pos - 1].votes = SafeCast.toUint224(newWeight);
        } else {
            ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(block.number), votes: SafeCast.toUint224(newWeight)}));
        }
    }

    function _add(uint256 a, uint256 b) private pure returns (uint256) {
        return a + b;
    }

    function _subtract(uint256 a, uint256 b) private pure returns (uint256) {
        return a - b;
    }
}

File 8 of 21 : ERC20VotesComp.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ERC20Votes.sol";

/**
 * @dev Extension of ERC20 to support Compound's voting and delegation. This version exactly matches Compound's
 * interface, with the drawback of only supporting supply up to (2^96^ - 1).
 *
 * NOTE: You should use this contract if you need exact compatibility with COMP (for example in order to use your token
 * with Governor Alpha or Bravo) and if you are sure the supply cap of 2^96^ is enough for you. Otherwise, use the
 * {ERC20Votes} variant of this module.
 *
 * This extensions keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either
 * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting
 * power can be queried through the public accessors {getCurrentVotes} and {getPriorVotes}.
 *
 * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it
 * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.
 * Enabling self-delegation can easily be done by overriding the {delegates} function. Keep in mind however that this
 * will significantly increase the base gas cost of transfers.
 *
 * _Available since v4.2._
 */
abstract contract ERC20VotesComp is ERC20Votes {
    /**
     * @dev Comp version of the {getVotes} accessor, with `uint96` return type.
     */
    function getCurrentVotes(address account) external view returns (uint96) {
        return SafeCast.toUint96(getVotes(account));
    }

    /**
     * @dev Comp version of the {getPastVotes} accessor, with `uint96` return type.
     */
    function getPriorVotes(address account, uint256 blockNumber) external view returns (uint96) {
        return SafeCast.toUint96(getPastVotes(account, blockNumber));
    }

    /**
     * @dev Maximum token supply. Reduced to `type(uint96).max` (2^96^ - 1) to fit COMP interface.
     */
    function _maxSupply() internal view virtual override returns (uint224) {
        return type(uint96).max;
    }
}

File 9 of 21 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 10 of 21 : draft-ERC20Permit.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./draft-IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/draft-EIP712.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/Counters.sol";

/**
 * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private immutable _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}

File 11 of 21 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 12 of 21 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

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

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

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

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 13 of 21 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 14 of 21 : Context.sol
// SPDX-License-Identifier: MIT

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 15 of 21 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 16 of 21 : ECDSA.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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 {
    /**
     * @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.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        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.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return recover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return recover(hash, r, vs);
        } else {
            revert("ECDSA: invalid signature length");
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} 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.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        bytes32 s;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 27)
        }
        return recover(hash, v, r, s);
    }

    /**
     * @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) {
        // 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 (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): 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.
        require(
            uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
            "ECDSA: invalid signature 's' value"
        );
        require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value");

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        require(signer != address(0), "ECDSA: invalid signature");

        return signer;
    }

    /**
     * @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) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @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) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 17 of 21 : draft-EIP712.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 18 of 21 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @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, so we distribute.
        return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 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 / b + (a % b == 0 ? 0 : 1);
    }
}

File 19 of 21 : SafeCast.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128) {
        require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits");
        return int128(value);
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64) {
        require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits");
        return int64(value);
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32) {
        require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits");
        return int32(value);
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16) {
        require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits");
        return int16(value);
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8) {
        require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 20 of 21 : SimpleGovernance.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.6;

import "@openzeppelin/contracts/utils/Context.sol";

abstract contract SimpleGovernance is Context {
    address public governance;
    address public pendingGovernance;

    event SetGovernance(address indexed governance);

    /**
     * @notice Changes governance of this contract
     */
    modifier onlyGovernance() {
        require(
            _msgSender() == governance,
            "only governance can perform this action"
        );
        _;
    }

    /**
     * @notice Changes governance of this contract
     * @dev Only governance can call this function. The new governance must call `acceptGovernance` after.
     * @param newGovernance new address to become the governance
     */
    function changeGovernance(address newGovernance) external onlyGovernance {
        require(
            newGovernance != governance,
            "governance must be different from current one"
        );
        require(newGovernance != address(0), "governance cannot be empty");
        pendingGovernance = newGovernance;
    }

    /**
     * @notice Accept the new role of governance
     * @dev `changeGovernance` must be called first to set `pendingGovernance`
     */
    function acceptGovernance() external {
        address _pendingGovernance = pendingGovernance;
        require(
            _pendingGovernance != address(0),
            "changeGovernance must be called first"
        );
        require(
            _msgSender() == _pendingGovernance,
            "only pendingGovernance can accept this role"
        );
        pendingGovernance = address(0);
        governance = _msgSender();
        emit SetGovernance(_msgSender());
    }
}

File 21 of 21 : Vesting.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "./SimpleGovernance.sol";

/**
 * @title Vesting
 * @dev A token holder contract that can release its token balance gradually like a
 * typical vesting scheme, with a cliff and vesting period. Owner has the power
 * to change the beneficiary who receives the vested tokens.
 */
contract Vesting is Initializable, Context {
    using SafeERC20 for IERC20;

    event Released(uint256 amount);
    event VestingInitialized(
        address indexed beneficiary,
        uint256 startTimestamp,
        uint256 cliff,
        uint256 duration
    );
    event SetBeneficiary(address indexed beneficiary);

    // beneficiary of tokens after they are released
    address public beneficiary;
    IERC20 public token;

    uint256 public cliffInSeconds;
    uint256 public durationInSeconds;
    uint256 public startTimestamp;
    uint256 public released;

    /**
     * @dev Sets the beneficiary to _msgSender() on deploying this contract. This prevents others from
     * initializing the logic contract.
     */
    constructor() public {
        beneficiary = _msgSender();
    }

    /**
     * @dev Limits certain functions to be called by governance
     */
    modifier onlyGovernance() {
        require(
            _msgSender() == governance(),
            "only governance can perform this action"
        );
        _;
    }

    /**
     * @dev Initializes a vesting contract that vests its balance of any ERC20 token to the
     * _beneficiary, monthly in a linear fashion until duration has passed. By then all
     * of the balance will have vested.
     * @param _token address of the token that is subject to vesting
     * @param _beneficiary address of the beneficiary to whom vested tokens are transferred
     * @param _cliffInSeconds duration in months of the cliff in which tokens will begin to vest
     * @param _durationInSeconds duration in months of the period in which the tokens will vest
     * @param _startTimestamp start timestamp when the cliff and vesting should start to count
     */
    function initialize(
        address _token,
        address _beneficiary,
        uint256 _startTimestamp,
        uint256 _cliffInSeconds,
        uint256 _durationInSeconds
    ) external initializer {
        require(_token != address(0), "_token cannot be empty");
        // dev: beneficiary is set to msg.sender on logic contracts during deployment
        require(beneficiary == address(0), "cannot initialize logic contract");
        require(_beneficiary != address(0), "_beneficiary cannot be empty");
        require(_startTimestamp != 0, "startTimestamp cannot be 0");
        require(
            _startTimestamp <= block.timestamp,
            "startTimestamp cannot be from the future"
        );
        require(_durationInSeconds != 0, "duration cannot be 0");
        require(
            _cliffInSeconds <= _durationInSeconds,
            "cliff is greater than duration"
        );

        token = IERC20(_token);
        beneficiary = _beneficiary;
        startTimestamp = _startTimestamp;
        durationInSeconds = _durationInSeconds;
        cliffInSeconds = _cliffInSeconds;

        emit VestingInitialized(
            _beneficiary,
            _startTimestamp,
            _cliffInSeconds,
            _durationInSeconds
        );
    }

    /**
     * @notice Transfers vested tokens to beneficiary.
     */
    function release() external {
        uint256 vested = vestedAmount();
        require(vested > 0, "No tokens to release");

        released = released + vested;
        emit Released(vested);
        token.safeTransfer(beneficiary, vested);
    }

    /**
     * @notice Calculates the amount that has already vested but hasn't been released yet.
     */
    function vestedAmount() public view returns (uint256) {
        uint256 blockTimestamp = block.timestamp;
        uint256 _durationInSeconds = durationInSeconds;

        uint256 elapsedTime = blockTimestamp - startTimestamp; // @dev startTimestamp is always less than blockTimestamp

        if (elapsedTime < cliffInSeconds) {
            return 0;
        }

        // If over vesting duration, all tokens vested
        if (elapsedTime >= _durationInSeconds) {
            return token.balanceOf(address(this));
        } else {
            uint256 currentBalance = token.balanceOf(address(this));

            // If there are no tokens in this contract yet, return 0.
            if (currentBalance == 0) {
                return 0;
            }

            uint256 totalBalance = currentBalance + released;
            uint256 vested = (totalBalance * elapsedTime) / _durationInSeconds;
            uint256 unreleased = vested - released;

            return unreleased;
        }
    }

    /**
     * @notice Changes beneficiary who receives the vested token.
     * @dev Only governance can call this function. This is to be used in case the target address
     * needs to be updated. If the previous beneficiary has any unclaimed tokens, the new beneficiary
     * will be able to claim them and the rest of the vested tokens.
     * @param newBeneficiary new address to become the beneficiary
     */
    function changeBeneficiary(address newBeneficiary) external onlyGovernance {
        require(
            newBeneficiary != beneficiary,
            "beneficiary must be different from current one"
        );
        require(newBeneficiary != address(0), "beneficiary cannot be empty");
        beneficiary = newBeneficiary;
        emit SetBeneficiary(newBeneficiary);
    }

    /**
     * @notice Governance who owns this contract.
     * @dev Governance of the token contract also owns this vesting contract.
     */
    function governance() public view returns (address) {
        return SimpleGovernance(address(token)).governance();
    }
}

Settings
{
  "evmVersion": "berlin",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"governance_","type":"address"},{"internalType":"uint256","name":"pausePeriod_","type":"uint256"},{"internalType":"address","name":"vestingContractTarget_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"}],"name":"Allowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"}],"name":"Disallowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"governance","type":"address"}],"name":"SetGovernance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"address","name":"vestingContract","type":"address"}],"name":"VestingContractDeployed","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"targets","type":"address[]"}],"name":"addToAllowedList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedTransferee","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"anyoneCanUnpauseAfter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newGovernance","type":"address"}],"name":"changeGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"cliffPeriod","type":"uint256"},{"internalType":"uint256","name":"durationPeriod","type":"uint256"}],"internalType":"struct SDL.Recipient","name":"recipient","type":"tuple"}],"name":"deployNewVestingContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"govCanUnpauseAfter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingGovernance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"targets","type":"address[]"}],"name":"removeFromAllowedList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"rescueTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vestingContractTarget","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101a06040527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9610120523480156200003757600080fd5b5060405162002f3338038062002f338339810160408190526200005a91620006fe565b6040518060400160405280600a815260200169536164646c652044414f60b01b81525080604051806040016040528060018152602001603160f81b8152506040518060400160405280600a815260200169536164646c652044414f60b01b8152506040518060400160405280600381526020016214d11360ea1b8152508160039080519060200190620000ef9291906200063b565b508051620001059060049060208401906200063b565b5050825160209384012082519284019290922060c083815260e08290524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818a018190528183019890985260608101959095526080808601939093523085830152805180860390920182529390920190925280519401939093209092526101005250506006805460ff191690556001600160a01b038316620001f85760405162461bcd60e51b815260206004820152601f60248201527f53444c3a20676f7665726e616e63652063616e6e6f7420626520656d7074790060448201526064015b60405180910390fd5b6001600160a01b038116620002655760405162461bcd60e51b815260206004820152602c60248201527f53444c3a2076657374696e6720636f6e7472616374207461726765742063616e60448201526b6e6f7420626520656d70747960a01b6064820152608401620001ef565b6000821180156200027a57506301dfe2008211155b620002e35760405162461bcd60e51b815260206004820152603260248201527f53444c3a207061757365506572696f64206d75737420626520696e206265747760448201527165656e203020616e64203532207765656b7360701b6064820152608401620001ef565b606081901b6001600160601b0319166101805260068054610100600160a81b0319166101006001600160a01b038616021790556200032282426200073f565b6101405262000336426301dfe2006200073f565b610160526001600160a01b038084166000908152600860205260409020805460ff191660011790556006546200038091610100909104166b033b2e3c9fd0803ce8000000620003ce565b8115620003915762000391620004c1565b6040516001600160a01b038416907f24a8c4807b324a269a51827c3446b8ac1cc13810d7d0c0ca1efafabddd7b621990600090a2505050620007a3565b6001600160a01b038216620004265760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401620001ef565b62000434600083836200055c565b80600260008282546200044891906200073f565b90915550506001600160a01b03821660009081526020819052604081208054839290620004779084906200073f565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60065460ff1615620005095760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401620001ef565b6006805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586200053f3390565b6040516001600160a01b03909116815260200160405180910390a1565b620005748383836200063660201b620012b71760201c565b60065460ff1615806200059f57506001600160a01b03831660009081526008602052604090205460ff165b620005db5760405162461bcd60e51b815260206004820152600b60248201526a14d1130e881c185d5cd95960aa1b6044820152606401620001ef565b6001600160a01b038216301415620006365760405162461bcd60e51b815260206004820152601660248201527f53444c3a20696e76616c696420726563697069656e74000000000000000000006044820152606401620001ef565b505050565b828054620006499062000766565b90600052602060002090601f0160209004810192826200066d5760008555620006b8565b82601f106200068857805160ff1916838001178555620006b8565b82800160010185558215620006b8579182015b82811115620006b85782518255916020019190600101906200069b565b50620006c6929150620006ca565b5090565b5b80821115620006c65760008155600101620006cb565b80516001600160a01b0381168114620006f957600080fd5b919050565b6000806000606084860312156200071457600080fd5b6200071f84620006e1565b9250602084015191506200073660408501620006e1565b90509250925092565b600082198211156200076157634e487b7160e01b600052601160045260246000fd5b500190565b600181811c908216806200077b57607f821691505b602082108114156200079d57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e051610100516101205161014051610160516101805160601c6127076200082c6000396000818161040e0152610e10015260008181610299015261148e01526000818161036d01526114b401526000611310015260006119000152600061194f0152600061192a015260006118ae015260006118d701526127076000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c806370a0823111610104578063a9059cbb116100a2578063d5dbfbd711610071578063d5dbfbd714610409578063dd62ed3e14610430578063f1b50c1d14610469578063f39c38a01461047157600080fd5b8063a9059cbb146103bd578063c643b577146103d0578063cea9d26f146103e3578063d505accf146103f657600080fd5b806392e7c85e116100de57806392e7c85e1461036857806395d89b411461038f57806399572d6f14610397578063a457c2d7146103aa57600080fd5b806370a08231146103195780637ecebe0014610342578063885ad0cf1461035557600080fd5b80633644e5151161017157806359baed071161014b57806359baed07146102945780635aa6e675146102bb5780635c975abb146102eb5780635d4545a0146102f657600080fd5b80633644e51514610266578063395093511461026e5780633c8d76d11461028157600080fd5b8063238efcbc116101ad578063238efcbc1461022757806323b872dd14610231578063313ce5671461024457806332cb6b0c1461025357600080fd5b806306fdde03146101d4578063095ea7b3146101f257806318160ddd14610215575b600080fd5b6101dc610484565b6040516101e991906124c4565b60405180910390f35b61020561020036600461230f565b610516565b60405190151581526020016101e9565b6002545b6040519081526020016101e9565b61022f61052c565b005b61020561023f366004612257565b6106b6565b604051601281526020016101e9565b6102196b033b2e3c9fd0803ce800000081565b610219610777565b61020561027c36600461230f565b610786565b61022f61028f36600461233b565b6107c2565b6102197f000000000000000000000000000000000000000000000000000000000000000081565b6006546102d39061010090046001600160a01b031681565b6040516001600160a01b0390911681526020016101e9565b60065460ff16610205565b610205610304366004612201565b60086020526000908152604090205460ff1681565b610219610327366004612201565b6001600160a01b031660009081526020819052604090205490565b610219610350366004612201565b610918565b61022f61036336600461233b565b610938565b6102197f000000000000000000000000000000000000000000000000000000000000000081565b6101dc610a8a565b61022f6103a5366004612201565b610a99565b6102056103b836600461230f565b610c40565b6102056103cb36600461230f565b610cf1565b6102d36103de366004612416565b610cfe565b61022f6103f1366004612257565b610f9d565b61022f610404366004612298565b6112bc565b6102d37f000000000000000000000000000000000000000000000000000000000000000081565b61021961043e36600461221e565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61022f611420565b6007546102d3906001600160a01b031681565b606060038054610493906125a8565b80601f01602080910402602001604051908101604052809291908181526020018280546104bf906125a8565b801561050c5780601f106104e15761010080835404028352916020019161050c565b820191906000526020600020905b8154815290600101906020018083116104ef57829003601f168201915b5050505050905090565b6000610523338484611530565b50600192915050565b6007546001600160a01b0316806105b05760405162461bcd60e51b815260206004820152602560248201527f6368616e6765476f7665726e616e6365206d7573742062652063616c6c65642060448201527f666972737400000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161461062e5760405162461bcd60e51b815260206004820152602b60248201527f6f6e6c792070656e64696e67476f7665726e616e63652063616e20616363657060448201527f74207468697320726f6c6500000000000000000000000000000000000000000060648201526084016105a7565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055600680547fffffffffffffffffffffff0000000000000000000000000000000000000000ff1661010033908102919091179091556040517f24a8c4807b324a269a51827c3446b8ac1cc13810d7d0c0ca1efafabddd7b621990600090a250565b60006106c3848484611688565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561075d5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e636500000000000000000000000000000000000000000000000060648201526084016105a7565b61076a8533858403611530565b60019150505b9392505050565b60006107816118aa565b905090565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916105239185906107bd908690612564565b611530565b60065461010090046001600160a01b0316336001600160a01b0316146108505760405162461bcd60e51b815260206004820152602760248201527f6f6e6c7920676f7665726e616e63652063616e20706572666f726d207468697360448201527f20616374696f6e0000000000000000000000000000000000000000000000000060648201526084016105a7565b60005b8151811015610914576000600860008484815181106108745761087461265e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055508181815181106108c5576108c561265e565b60200260200101516001600160a01b03167f9ef90a89b00db1a1891a357dc96b2a273add9d883e378c350d22bad87a9d7d3060405160405180910390a28061090c816125f6565b915050610853565b5050565b6001600160a01b0381166000908152600560205260408120545b92915050565b60065461010090046001600160a01b0316336001600160a01b0316146109c65760405162461bcd60e51b815260206004820152602760248201527f6f6e6c7920676f7665726e616e63652063616e20706572666f726d207468697360448201527f20616374696f6e0000000000000000000000000000000000000000000000000060648201526084016105a7565b60005b8151811015610914576001600860008484815181106109ea576109ea61265e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550818181518110610a3b57610a3b61265e565b60200260200101516001600160a01b03167f77a7dbc6ad97703ad411a8d5edfcd1df382fb34b076a90898b11884f7ebdcc0560405160405180910390a280610a82816125f6565b9150506109c9565b606060048054610493906125a8565b60065461010090046001600160a01b0316336001600160a01b031614610b275760405162461bcd60e51b815260206004820152602760248201527f6f6e6c7920676f7665726e616e63652063616e20706572666f726d207468697360448201527f20616374696f6e0000000000000000000000000000000000000000000000000060648201526084016105a7565b6006546001600160a01b03828116610100909204161415610bb05760405162461bcd60e51b815260206004820152602d60248201527f676f7665726e616e6365206d75737420626520646966666572656e742066726f60448201527f6d2063757272656e74206f6e650000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b038116610c065760405162461bcd60e51b815260206004820152601a60248201527f676f7665726e616e63652063616e6e6f7420626520656d70747900000000000060448201526064016105a7565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b3360009081526001602090815260408083206001600160a01b038616845290915281205482811015610cda5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016105a7565b610ce73385858403611530565b5060019392505050565b6000610523338484611688565b60065460009061010090046001600160a01b0316336001600160a01b031614610d8f5760405162461bcd60e51b815260206004820152602760248201527f6f6e6c7920676f7665726e616e63652063616e20706572666f726d207468697360448201527f20616374696f6e0000000000000000000000000000000000000000000000000060648201526084016105a7565b6000826080015111610e095760405162461bcd60e51b815260206004820152602560248201527f53444c3a206475726174696f6e20666f722076657374696e672063616e6e6f7460448201527f206265203000000000000000000000000000000000000000000000000000000060648201526084016105a7565b6000610e347f000000000000000000000000000000000000000000000000000000000000000061199d565b83516040808601516060870151608088015192517fd13f90b40000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03948516602482015260448101929092526064820152608481019190915291925082169063d13f90b49060a401600060405180830381600087803b158015610ebf57600080fd5b505af1158015610ed3573d6000803e3d6000fd5b5050506020840151610eeb9150309033908490611a53565b6001600160a01b03811660008181526008602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517f77a7dbc6ad97703ad411a8d5edfcd1df382fb34b076a90898b11884f7ebdcc059190a282516040516001600160a01b038381168252909116907f739fe22b8edefd6ce1fe32460f9cd54bf8e66fc7447f4c8a8131ce078a1988af9060200160405180910390a290505b919050565b60065461010090046001600160a01b0316336001600160a01b03161461102b5760405162461bcd60e51b815260206004820152602760248201527f6f6e6c7920676f7665726e616e63652063616e20706572666f726d207468697360448201527f20616374696f6e0000000000000000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b0382166110815760405162461bcd60e51b815260206004820152601660248201527f53444c3a20696e76616c696420726563697069656e740000000000000000000060448201526064016105a7565b6001600160a01b0383166111a3574781156110a5576110a08183611b22565b6110a7565b805b9150600082116110f95760405162461bcd60e51b815260206004820152601960248201527f53444c3a20747279696e6720746f2073656e642030204554480000000000000060448201526064016105a7565b6000836001600160a01b03168360405160006040518083038185875af1925050503d8060008114611146576040519150601f19603f3d011682016040523d82523d6000602084013e61114b565b606091505b505090508061119c5760405162461bcd60e51b815260206004820152601860248201527f53444c3a20455448207472616e73666572206661696c6564000000000000000060448201526064016105a7565b5050505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038516906370a082319060240160206040518083038186803b1580156111fe57600080fd5b505afa158015611212573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611236919061248f565b9050811561124d576112488183611b22565b61124f565b805b9150600082116112a15760405162461bcd60e51b815260206004820152601d60248201527f53444c3a20747279696e6720746f2073656e6420302062616c616e636500000060448201526064016105a7565b6112b56001600160a01b0385168484611b38565b505b505050565b8342111561130c5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016105a7565b60007f000000000000000000000000000000000000000000000000000000000000000088888861133b8c611b81565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061139682611ba9565b905060006113a682878787611c12565b9050896001600160a01b0316816001600160a01b0316146114095760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016105a7565b6114148a8a8a611530565b50505050505050505050565b60065460ff166114725760405162461bcd60e51b815260206004820152601860248201527f53444c3a207472616e7366657220697320656e61626c6564000000000000000060448201526064016105a7565b60065460009061010090046001600160a01b031633146114b2577f00000000000000000000000000000000000000000000000000000000000000006114d4565b7f00000000000000000000000000000000000000000000000000000000000000005b90508042116115255760405162461bcd60e51b815260206004820152601f60248201527f53444c3a2063616e6e6f7420656e61626c65207472616e73666572207965740060448201526064016105a7565b61152d611e0f565b50565b6001600160a01b0383166115ab5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b0382166116275760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166117045760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b0382166117805760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016105a7565b61178b838383611ebe565b6001600160a01b0383166000908152602081905260409020548181101561181a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290611851908490612564565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161189d91815260200190565b60405180910390a36112b5565b60007f00000000000000000000000000000000000000000000000000000000000000004614156118f957507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060288201526037816000f09150506001600160a01b038116610f985760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c65640000000000000000000060448201526064016105a7565b6040516001600160a01b03808516602483015283166044820152606481018290526112b59085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611f8d565b6000818310611b315781610770565b5090919050565b6040516001600160a01b0383166024820152604481018290526112b79084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611aa0565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b6000610932611bb66118aa565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0821115611caa5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016105a7565b8360ff16601b1480611cbf57508360ff16601c145b611d315760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016105a7565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015611d85573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001519150506001600160a01b038116611e065760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016105a7565b95945050505050565b60065460ff16611e615760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016105a7565b600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040805133815290517f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9181900360200190a1565b60065460ff161580611ee857506001600160a01b03831660009081526008602052604090205460ff165b611f345760405162461bcd60e51b815260206004820152600b60248201527f53444c3a2070617573656400000000000000000000000000000000000000000060448201526064016105a7565b6001600160a01b0382163014156112b75760405162461bcd60e51b815260206004820152601660248201527f53444c3a20696e76616c696420726563697069656e740000000000000000000060448201526064016105a7565b6000611fe2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120729092919063ffffffff16565b8051909150156112b7578080602001905181019061200091906123f4565b6112b75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105a7565b60606120818484600085612089565b949350505050565b6060824710156121015760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016105a7565b843b61214f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105a7565b600080866001600160a01b0316858760405161216b91906124a8565b60006040518083038185875af1925050503d80600081146121a8576040519150601f19603f3d011682016040523d82523d6000602084013e6121ad565b606091505b50915091506121bd8282866121c8565b979650505050505050565b606083156121d7575081610770565b8251156121e75782518084602001fd5b8160405162461bcd60e51b81526004016105a791906124c4565b60006020828403121561221357600080fd5b8135610770816126bc565b6000806040838503121561223157600080fd5b823561223c816126bc565b9150602083013561224c816126bc565b809150509250929050565b60008060006060848603121561226c57600080fd5b8335612277816126bc565b92506020840135612287816126bc565b929592945050506040919091013590565b600080600080600080600060e0888a0312156122b357600080fd5b87356122be816126bc565b965060208801356122ce816126bc565b95506040880135945060608801359350608088013560ff811681146122f257600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561232257600080fd5b823561232d816126bc565b946020939093013593505050565b6000602080838503121561234e57600080fd5b823567ffffffffffffffff8082111561236657600080fd5b818501915085601f83011261237a57600080fd5b81358181111561238c5761238c61268d565b8060051b915061239d848301612515565b8181528481019084860184860187018a10156123b857600080fd5b600095505b838610156123e757803594506123d2856126bc565b848352600195909501949186019186016123bd565b5098975050505050505050565b60006020828403121561240657600080fd5b8151801515811461077057600080fd5b600060a0828403121561242857600080fd5b60405160a0810181811067ffffffffffffffff8211171561244b5761244b61268d565b6040528235612459816126bc565b80825250602083013560208201526040830135604082015260608301356060820152608083013560808201528091505092915050565b6000602082840312156124a157600080fd5b5051919050565b600082516124ba81846020870161257c565b9190910192915050565b60208152600082518060208401526124e381604085016020870161257c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561255c5761255c61268d565b604052919050565b600082198211156125775761257761262f565b500190565b60005b8381101561259757818101518382015260200161257f565b838111156112b55750506000910152565b600181811c908216806125bc57607f821691505b60208210811415611ba3577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156126285761262861262f565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6001600160a01b038116811461152d57600080fdfea264697066735822122045aa76bc4f5106cb053e3dc1f3dbc3b38e547c4279890480784224f37b03273f64736f6c634300080600330000000000000000000000005bdb37d0ddea3a90f233c7b7f6b9394b6b2eef340000000000000000000000000000000000000000000000000000000000786450000000000000000000000000f8504e92428d65e56e495684a38f679c1b1dc30b

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c806370a0823111610104578063a9059cbb116100a2578063d5dbfbd711610071578063d5dbfbd714610409578063dd62ed3e14610430578063f1b50c1d14610469578063f39c38a01461047157600080fd5b8063a9059cbb146103bd578063c643b577146103d0578063cea9d26f146103e3578063d505accf146103f657600080fd5b806392e7c85e116100de57806392e7c85e1461036857806395d89b411461038f57806399572d6f14610397578063a457c2d7146103aa57600080fd5b806370a08231146103195780637ecebe0014610342578063885ad0cf1461035557600080fd5b80633644e5151161017157806359baed071161014b57806359baed07146102945780635aa6e675146102bb5780635c975abb146102eb5780635d4545a0146102f657600080fd5b80633644e51514610266578063395093511461026e5780633c8d76d11461028157600080fd5b8063238efcbc116101ad578063238efcbc1461022757806323b872dd14610231578063313ce5671461024457806332cb6b0c1461025357600080fd5b806306fdde03146101d4578063095ea7b3146101f257806318160ddd14610215575b600080fd5b6101dc610484565b6040516101e991906124c4565b60405180910390f35b61020561020036600461230f565b610516565b60405190151581526020016101e9565b6002545b6040519081526020016101e9565b61022f61052c565b005b61020561023f366004612257565b6106b6565b604051601281526020016101e9565b6102196b033b2e3c9fd0803ce800000081565b610219610777565b61020561027c36600461230f565b610786565b61022f61028f36600461233b565b6107c2565b6102197f0000000000000000000000000000000000000000000000000000000063732f6b81565b6006546102d39061010090046001600160a01b031681565b6040516001600160a01b0390911681526020016101e9565b60065460ff16610205565b610205610304366004612201565b60086020526000908152604090205460ff1681565b610219610327366004612201565b6001600160a01b031660009081526020819052604090205490565b610219610350366004612201565b610918565b61022f61036336600461233b565b610938565b6102197f00000000000000000000000000000000000000000000000000000000620bb1bb81565b6101dc610a8a565b61022f6103a5366004612201565b610a99565b6102056103b836600461230f565b610c40565b6102056103cb36600461230f565b610cf1565b6102d36103de366004612416565b610cfe565b61022f6103f1366004612257565b610f9d565b61022f610404366004612298565b6112bc565b6102d37f000000000000000000000000f8504e92428d65e56e495684a38f679c1b1dc30b81565b61021961043e36600461221e565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61022f611420565b6007546102d3906001600160a01b031681565b606060038054610493906125a8565b80601f01602080910402602001604051908101604052809291908181526020018280546104bf906125a8565b801561050c5780601f106104e15761010080835404028352916020019161050c565b820191906000526020600020905b8154815290600101906020018083116104ef57829003601f168201915b5050505050905090565b6000610523338484611530565b50600192915050565b6007546001600160a01b0316806105b05760405162461bcd60e51b815260206004820152602560248201527f6368616e6765476f7665726e616e6365206d7573742062652063616c6c65642060448201527f666972737400000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161461062e5760405162461bcd60e51b815260206004820152602b60248201527f6f6e6c792070656e64696e67476f7665726e616e63652063616e20616363657060448201527f74207468697320726f6c6500000000000000000000000000000000000000000060648201526084016105a7565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055600680547fffffffffffffffffffffff0000000000000000000000000000000000000000ff1661010033908102919091179091556040517f24a8c4807b324a269a51827c3446b8ac1cc13810d7d0c0ca1efafabddd7b621990600090a250565b60006106c3848484611688565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561075d5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e636500000000000000000000000000000000000000000000000060648201526084016105a7565b61076a8533858403611530565b60019150505b9392505050565b60006107816118aa565b905090565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916105239185906107bd908690612564565b611530565b60065461010090046001600160a01b0316336001600160a01b0316146108505760405162461bcd60e51b815260206004820152602760248201527f6f6e6c7920676f7665726e616e63652063616e20706572666f726d207468697360448201527f20616374696f6e0000000000000000000000000000000000000000000000000060648201526084016105a7565b60005b8151811015610914576000600860008484815181106108745761087461265e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055508181815181106108c5576108c561265e565b60200260200101516001600160a01b03167f9ef90a89b00db1a1891a357dc96b2a273add9d883e378c350d22bad87a9d7d3060405160405180910390a28061090c816125f6565b915050610853565b5050565b6001600160a01b0381166000908152600560205260408120545b92915050565b60065461010090046001600160a01b0316336001600160a01b0316146109c65760405162461bcd60e51b815260206004820152602760248201527f6f6e6c7920676f7665726e616e63652063616e20706572666f726d207468697360448201527f20616374696f6e0000000000000000000000000000000000000000000000000060648201526084016105a7565b60005b8151811015610914576001600860008484815181106109ea576109ea61265e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550818181518110610a3b57610a3b61265e565b60200260200101516001600160a01b03167f77a7dbc6ad97703ad411a8d5edfcd1df382fb34b076a90898b11884f7ebdcc0560405160405180910390a280610a82816125f6565b9150506109c9565b606060048054610493906125a8565b60065461010090046001600160a01b0316336001600160a01b031614610b275760405162461bcd60e51b815260206004820152602760248201527f6f6e6c7920676f7665726e616e63652063616e20706572666f726d207468697360448201527f20616374696f6e0000000000000000000000000000000000000000000000000060648201526084016105a7565b6006546001600160a01b03828116610100909204161415610bb05760405162461bcd60e51b815260206004820152602d60248201527f676f7665726e616e6365206d75737420626520646966666572656e742066726f60448201527f6d2063757272656e74206f6e650000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b038116610c065760405162461bcd60e51b815260206004820152601a60248201527f676f7665726e616e63652063616e6e6f7420626520656d70747900000000000060448201526064016105a7565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b3360009081526001602090815260408083206001600160a01b038616845290915281205482811015610cda5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016105a7565b610ce73385858403611530565b5060019392505050565b6000610523338484611688565b60065460009061010090046001600160a01b0316336001600160a01b031614610d8f5760405162461bcd60e51b815260206004820152602760248201527f6f6e6c7920676f7665726e616e63652063616e20706572666f726d207468697360448201527f20616374696f6e0000000000000000000000000000000000000000000000000060648201526084016105a7565b6000826080015111610e095760405162461bcd60e51b815260206004820152602560248201527f53444c3a206475726174696f6e20666f722076657374696e672063616e6e6f7460448201527f206265203000000000000000000000000000000000000000000000000000000060648201526084016105a7565b6000610e347f000000000000000000000000f8504e92428d65e56e495684a38f679c1b1dc30b61199d565b83516040808601516060870151608088015192517fd13f90b40000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03948516602482015260448101929092526064820152608481019190915291925082169063d13f90b49060a401600060405180830381600087803b158015610ebf57600080fd5b505af1158015610ed3573d6000803e3d6000fd5b5050506020840151610eeb9150309033908490611a53565b6001600160a01b03811660008181526008602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517f77a7dbc6ad97703ad411a8d5edfcd1df382fb34b076a90898b11884f7ebdcc059190a282516040516001600160a01b038381168252909116907f739fe22b8edefd6ce1fe32460f9cd54bf8e66fc7447f4c8a8131ce078a1988af9060200160405180910390a290505b919050565b60065461010090046001600160a01b0316336001600160a01b03161461102b5760405162461bcd60e51b815260206004820152602760248201527f6f6e6c7920676f7665726e616e63652063616e20706572666f726d207468697360448201527f20616374696f6e0000000000000000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b0382166110815760405162461bcd60e51b815260206004820152601660248201527f53444c3a20696e76616c696420726563697069656e740000000000000000000060448201526064016105a7565b6001600160a01b0383166111a3574781156110a5576110a08183611b22565b6110a7565b805b9150600082116110f95760405162461bcd60e51b815260206004820152601960248201527f53444c3a20747279696e6720746f2073656e642030204554480000000000000060448201526064016105a7565b6000836001600160a01b03168360405160006040518083038185875af1925050503d8060008114611146576040519150601f19603f3d011682016040523d82523d6000602084013e61114b565b606091505b505090508061119c5760405162461bcd60e51b815260206004820152601860248201527f53444c3a20455448207472616e73666572206661696c6564000000000000000060448201526064016105a7565b5050505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038516906370a082319060240160206040518083038186803b1580156111fe57600080fd5b505afa158015611212573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611236919061248f565b9050811561124d576112488183611b22565b61124f565b805b9150600082116112a15760405162461bcd60e51b815260206004820152601d60248201527f53444c3a20747279696e6720746f2073656e6420302062616c616e636500000060448201526064016105a7565b6112b56001600160a01b0385168484611b38565b505b505050565b8342111561130c5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016105a7565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c988888861133b8c611b81565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061139682611ba9565b905060006113a682878787611c12565b9050896001600160a01b0316816001600160a01b0316146114095760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016105a7565b6114148a8a8a611530565b50505050505050505050565b60065460ff166114725760405162461bcd60e51b815260206004820152601860248201527f53444c3a207472616e7366657220697320656e61626c6564000000000000000060448201526064016105a7565b60065460009061010090046001600160a01b031633146114b2577f0000000000000000000000000000000000000000000000000000000063732f6b6114d4565b7f00000000000000000000000000000000000000000000000000000000620bb1bb5b90508042116115255760405162461bcd60e51b815260206004820152601f60248201527f53444c3a2063616e6e6f7420656e61626c65207472616e73666572207965740060448201526064016105a7565b61152d611e0f565b50565b6001600160a01b0383166115ab5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b0382166116275760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166117045760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b0382166117805760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016105a7565b61178b838383611ebe565b6001600160a01b0383166000908152602081905260409020548181101561181a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016105a7565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290611851908490612564565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161189d91815260200190565b60405180910390a36112b5565b60007f00000000000000000000000000000000000000000000000000000000000000014614156118f957507f1cb181da94a689090c7cbf8ad9bf3fafe7f24280b1335ea361187c66c3f3181490565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f3f54831db6e6336fe67b6c69a0bd4bd514c3c550f8d7ff46f987b869dabc986a828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060288201526037816000f09150506001600160a01b038116610f985760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c65640000000000000000000060448201526064016105a7565b6040516001600160a01b03808516602483015283166044820152606481018290526112b59085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611f8d565b6000818310611b315781610770565b5090919050565b6040516001600160a01b0383166024820152604481018290526112b79084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611aa0565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b6000610932611bb66118aa565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0821115611caa5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016105a7565b8360ff16601b1480611cbf57508360ff16601c145b611d315760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016105a7565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015611d85573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001519150506001600160a01b038116611e065760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016105a7565b95945050505050565b60065460ff16611e615760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016105a7565b600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040805133815290517f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9181900360200190a1565b60065460ff161580611ee857506001600160a01b03831660009081526008602052604090205460ff165b611f345760405162461bcd60e51b815260206004820152600b60248201527f53444c3a2070617573656400000000000000000000000000000000000000000060448201526064016105a7565b6001600160a01b0382163014156112b75760405162461bcd60e51b815260206004820152601660248201527f53444c3a20696e76616c696420726563697069656e740000000000000000000060448201526064016105a7565b6000611fe2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120729092919063ffffffff16565b8051909150156112b7578080602001905181019061200091906123f4565b6112b75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105a7565b60606120818484600085612089565b949350505050565b6060824710156121015760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016105a7565b843b61214f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105a7565b600080866001600160a01b0316858760405161216b91906124a8565b60006040518083038185875af1925050503d80600081146121a8576040519150601f19603f3d011682016040523d82523d6000602084013e6121ad565b606091505b50915091506121bd8282866121c8565b979650505050505050565b606083156121d7575081610770565b8251156121e75782518084602001fd5b8160405162461bcd60e51b81526004016105a791906124c4565b60006020828403121561221357600080fd5b8135610770816126bc565b6000806040838503121561223157600080fd5b823561223c816126bc565b9150602083013561224c816126bc565b809150509250929050565b60008060006060848603121561226c57600080fd5b8335612277816126bc565b92506020840135612287816126bc565b929592945050506040919091013590565b600080600080600080600060e0888a0312156122b357600080fd5b87356122be816126bc565b965060208801356122ce816126bc565b95506040880135945060608801359350608088013560ff811681146122f257600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561232257600080fd5b823561232d816126bc565b946020939093013593505050565b6000602080838503121561234e57600080fd5b823567ffffffffffffffff8082111561236657600080fd5b818501915085601f83011261237a57600080fd5b81358181111561238c5761238c61268d565b8060051b915061239d848301612515565b8181528481019084860184860187018a10156123b857600080fd5b600095505b838610156123e757803594506123d2856126bc565b848352600195909501949186019186016123bd565b5098975050505050505050565b60006020828403121561240657600080fd5b8151801515811461077057600080fd5b600060a0828403121561242857600080fd5b60405160a0810181811067ffffffffffffffff8211171561244b5761244b61268d565b6040528235612459816126bc565b80825250602083013560208201526040830135604082015260608301356060820152608083013560808201528091505092915050565b6000602082840312156124a157600080fd5b5051919050565b600082516124ba81846020870161257c565b9190910192915050565b60208152600082518060208401526124e381604085016020870161257c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561255c5761255c61268d565b604052919050565b600082198211156125775761257761262f565b500190565b60005b8381101561259757818101518382015260200161257f565b838111156112b55750506000910152565b600181811c908216806125bc57607f821691505b60208210811415611ba3577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156126285761262861262f565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6001600160a01b038116811461152d57600080fdfea264697066735822122045aa76bc4f5106cb053e3dc1f3dbc3b38e547c4279890480784224f37b03273f64736f6c63430008060033

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

0000000000000000000000005bdb37d0ddea3a90f233c7b7f6b9394b6b2eef340000000000000000000000000000000000000000000000000000000000786450000000000000000000000000f8504e92428d65e56e495684a38f679c1b1dc30b

-----Decoded View---------------
Arg [0] : governance_ (address): 0x5BDb37d0Ddea3A90F233c7B7F6b9394B6b2eef34
Arg [1] : pausePeriod_ (uint256): 7890000
Arg [2] : vestingContractTarget_ (address): 0xf8504e92428d65E56e495684A38f679C1B1DC30b

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000005bdb37d0ddea3a90f233c7b7f6b9394b6b2eef34
Arg [1] : 0000000000000000000000000000000000000000000000000000000000786450
Arg [2] : 000000000000000000000000f8504e92428d65e56e495684a38f679c1b1dc30b


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

Saddle is a decentralized automated market maker on the Ethereum blockchain, optimized for pegged value crypto assets such as stablecoins and wrapped BTC.

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.