ETH Price: $2,491.31 (+2.91%)

Contract

0x501AcEe83a6f269B77c167c6701843D454E2EFA0
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw Eth171257252023-04-25 20:43:59530 days ago1682455439IN
0x501AcEe8...454E2EFA0
0 ETH0.0017322939.38369899
Withdraw Eth156765032022-10-04 18:17:23733 days ago1664907443IN
0x501AcEe8...454E2EFA0
0 ETH0.000849816.76240535
Start Cooldown156764972022-10-04 18:16:11733 days ago1664907371IN
0x501AcEe8...454E2EFA0
0 ETH0.0006846215.37067504
Withdraw Eth148953552022-06-03 5:34:04856 days ago1654234444IN
0x501AcEe8...454E2EFA0
0 ETH0.0033724266.55278805
Withdraw Eth147673092022-05-13 12:14:51877 days ago1652444091IN
0x501AcEe8...454E2EFA0
0 ETH0.0019696538.84226775
Start Cooldown141187412022-02-01 7:09:24978 days ago1643699364IN
0x501AcEe8...454E2EFA0
0 ETH0.0038686586.85608561
Withdraw Eth141187002022-02-01 6:59:54978 days ago1643698794IN
0x501AcEe8...454E2EFA0
0 ETH0.0040663380.20858264
Withdraw Eth141186982022-02-01 6:59:44978 days ago1643698784IN
0x501AcEe8...454E2EFA0
0 ETH0.0045191889.12
Start Cooldown141186672022-02-01 6:51:52978 days ago1643698312IN
0x501AcEe8...454E2EFA0
0 ETH0.0034174576.72605476
Start Cooldown141186652022-02-01 6:51:37978 days ago1643698297IN
0x501AcEe8...454E2EFA0
0 ETH0.0040497390.92144183
Withdraw Eth141186072022-02-01 6:38:33978 days ago1643697513IN
0x501AcEe8...454E2EFA0
0 ETH0.0042822584.46763133
Start Cooldown141185972022-02-01 6:37:10978 days ago1643697430IN
0x501AcEe8...454E2EFA0
0 ETH0.0044233899.31043242
Approve141118322022-01-31 5:48:23979 days ago1643608103IN
0x501AcEe8...454E2EFA0
0 ETH0.0042070690.88290873
Withdraw Eth140774252022-01-25 22:19:14985 days ago1643149154IN
0x501AcEe8...454E2EFA0
0 ETH0.00737958145.56248909
Start Cooldown140774062022-01-25 22:14:11985 days ago1643148851IN
0x501AcEe8...454E2EFA0
0 ETH0.00585042131.34927105
Withdraw Eth140432032022-01-20 15:19:22990 days ago1642691962IN
0x501AcEe8...454E2EFA0
0 ETH0.0050207499.01094205
Start Cooldown140431982022-01-20 15:18:37990 days ago1642691917IN
0x501AcEe8...454E2EFA0
0 ETH0.004191794.10902069
Withdraw Eth140292172022-01-18 11:27:28992 days ago1642505248IN
0x501AcEe8...454E2EFA0
0 ETH0.0037515774
Start Cooldown140291322022-01-18 11:10:05992 days ago1642504205IN
0x501AcEe8...454E2EFA0
0 ETH0.01030515231.36324139
Withdraw Eth138061672021-12-14 23:11:271027 days ago1639523487IN
0x501AcEe8...454E2EFA0
0 ETH0.0037644374.25355733
Start Cooldown138061592021-12-14 23:09:231027 days ago1639523363IN
0x501AcEe8...454E2EFA0
0 ETH0.0030171367.73841819
Withdraw Eth138007332021-12-14 2:41:511027 days ago1639449711IN
0x501AcEe8...454E2EFA0
0 ETH0.0031834662.79387083
Start Cooldown138007272021-12-14 2:40:501027 days ago1639449650IN
0x501AcEe8...454E2EFA0
0 ETH0.003196571.76550498
Withdraw Eth138007092021-12-14 2:36:471027 days ago1639449407IN
0x501AcEe8...454E2EFA0
0 ETH0.0033265265.61587255
Start Cooldown138007032021-12-14 2:36:061027 days ago1639449366IN
0x501AcEe8...454E2EFA0
0 ETH0.0033485175.17837202
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
164766252023-01-24 12:19:59621 days ago1674562799
0x501AcEe8...454E2EFA0
0.72612165 ETH
164765792023-01-24 12:10:47621 days ago1674562247
0x501AcEe8...454E2EFA0
25 ETH
156765032022-10-04 18:17:23733 days ago1664907443
0x501AcEe8...454E2EFA0
6.80253877 ETH
151535852022-07-16 11:52:32813 days ago1657972352
0x501AcEe8...454E2EFA0
0.03 ETH
151535852022-07-16 11:52:32813 days ago1657972352
0x501AcEe8...454E2EFA0
0.01 ETH
148953552022-06-03 5:34:04856 days ago1654234444
0x501AcEe8...454E2EFA0
1.00065714 ETH
147673092022-05-13 12:14:51877 days ago1652444091
0x501AcEe8...454E2EFA0
21.25751036 ETH
141187002022-02-01 6:59:54978 days ago1643698794
0x501AcEe8...454E2EFA0
5.50194385 ETH
141186982022-02-01 6:59:44978 days ago1643698784
0x501AcEe8...454E2EFA0
25.00883572 ETH
141186072022-02-01 6:38:33978 days ago1643697513
0x501AcEe8...454E2EFA0
9.00328776 ETH
140774252022-01-25 22:19:14985 days ago1643149154
0x501AcEe8...454E2EFA0
8.00282743 ETH
140432032022-01-20 15:19:22990 days ago1642691962
0x501AcEe8...454E2EFA0
27.23651177 ETH
140292172022-01-18 11:27:28992 days ago1642505248
0x501AcEe8...454E2EFA0
1.00037718 ETH
138108892021-12-15 16:47:321026 days ago1639586852
0x501AcEe8...454E2EFA0
0.03519697 ETH
138061672021-12-14 23:11:271027 days ago1639523487
0x501AcEe8...454E2EFA0
1.0000837 ETH
138007332021-12-14 2:41:511027 days ago1639449711
0x501AcEe8...454E2EFA0
3.00025112 ETH
138007092021-12-14 2:36:471027 days ago1639449407
0x501AcEe8...454E2EFA0
3.00025112 ETH
137950682021-12-13 5:59:451028 days ago1639375185
0x501AcEe8...454E2EFA0
0.98080628 ETH
137889712021-12-12 7:34:441029 days ago1639294484
0x501AcEe8...454E2EFA0
1.00010754 ETH
137760912021-12-10 7:44:401031 days ago1639122280
0x501AcEe8...454E2EFA0
1.20010045 ETH
137732912021-12-09 20:58:171032 days ago1639083497
0x501AcEe8...454E2EFA0
0.49013663 ETH
137618832021-12-08 1:14:491033 days ago1638926089
0x501AcEe8...454E2EFA0
0.0116103 ETH
137500442021-12-06 4:01:581035 days ago1638763318
0x501AcEe8...454E2EFA0
2.50006302 ETH
137471072021-12-05 16:31:121036 days ago1638721872
0x501AcEe8...454E2EFA0
1.00000146 ETH
137460402021-12-05 12:19:311036 days ago1638706771
0x501AcEe8...454E2EFA0
22.10145477 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vault

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 25 : Vault.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./Governable.sol";
import "./interface/IRegistry.sol";
import "./interface/IPolicyManager.sol";
import "./interface/IRiskManager.sol";
import "./interface/IVault.sol";

/**
 * @title Vault
 * @author solace.fi
 * @notice The risk-backing capital pool.
 *
 * [**Capital Providers**](/docs/user-guides/capital-provider/cp-role-guide) can deposit **ETH** or **WETH** into the `Vault` to mint shares. Shares are represented as **CP tokens** aka **SCP** and extend `ERC20`. [**Capital Providers**](/docs/user-guides/capital-provider/cp-role-guide) should use [`depositEth()`](#depositeth) or [`depositWeth()`](#depositweth), not regular **ETH** or **WETH** transfer.
 *
 * As [**Policyholders**](/docs/protocol/policy-holder) purchase coverage, premiums will flow into the capital pool and are split amongst the [**Capital Providers**](/docs/user-guides/capital-provider/cp-role-guide). If a loss event occurs in an active policy, some funds will be used to payout the claim. These events will affect the price per share but not the number or distribution of shares.
 *
 * By minting shares of the `Vault`, [**Capital Providers**](/docs/user-guides/capital-provider/cp-role-guide) willingly accept the risk that the whole or a part of their funds may be used payout claims. A malicious [**capital provider**](/docs/user-guides/capital-provider/cp-role-guide) could detect a loss event and try to withdraw their funds before claims are paid out. To prevent this, the `Vault` uses a cooldown mechanic such that while the [**capital provider**](/docs/user-guides/capital-provider/cp-role-guide) is not in cooldown mode (default) they can mint, send, and receive **SCP** but not withdraw **ETH**. To withdraw their **ETH**, the [**capital provider**](/docs/user-guides/capital-provider/cp-role-guide) must [`startCooldown()`](#startcooldown), wait no less than [`cooldownMin()`](#cooldownmin) and no more than [`cooldownMax()`](#cooldownmax), then call [`withdrawEth()`](#withdraweth) or [`withdrawWeth()`](#withdrawweth). While in cooldown mode users cannot send or receive **SCP** and minting shares will take them out of cooldown.
 */
contract Vault is ERC20Permit, IVault, ReentrancyGuard, Governable {
    using SafeERC20 for IERC20;
    using Address for address;

    /***************************************
    GLOBAL VARIABLES
    ***************************************/

    // pauses deposits
    bool internal _paused;

    // WETH
    IWETH9 internal _weth;

    /// Registry of protocol contract addresses
    IRegistry internal _registry;

    // capital providers must wait some time in this range in order to withdraw
    // used to prevent withdraw before claim payout
    /// @notice The minimum amount of time a user must wait to withdraw funds.
    uint40 internal _cooldownMin = 7 days;

    /// @notice The maximum amount of time a user must wait to withdraw funds.
    uint40 internal _cooldownMax = 35 days;

    // The timestamp that a depositor's cooldown started.
    mapping(address => uint40) internal _cooldownStart;

    // Returns true if the destination is authorized to request ETH.
    mapping(address => bool) internal _isRequestor;

    /**
     * Constructs the Vault.
     * @param governance_ The address of the [governor](/docs/protocol/governance).
     * @param registry_ Address of the [`Registry`](./Registry) contract.
     */
    constructor (address governance_, address registry_) ERC20("Solace CP Token", "SCP") ERC20Permit("Solace CP Token") Governable(governance_) {
        // set registry
        require(registry_ != address(0x0), "zero address registry");
        _registry = IRegistry(registry_);
        // set weth
        address weth_ = _registry.weth();
        require(weth_ != address(0x0), "zero address weth");
        _weth = IWETH9(payable(weth_));
    }

    /***************************************
    CAPITAL PROVIDER FUNCTIONS
    ***************************************/

    /**
     * @notice Allows a user to deposit **ETH** into the `Vault`(becoming a [**Capital Provider**](/docs/user-guides/capital-provider/cp-role-guide)).
     * Shares of the `Vault` (CP tokens) are minted to caller.
     * It is called when `Vault` receives **ETH**.
     * It issues the amount of token share respected to the deposit to the `recipient`.
     * Reverts if `Vault` is paused.
     * @return shares The number of shares minted.
     */
    function depositEth() external payable override nonReentrant returns (uint256 shares) {
        // mint
        return _deposit(msg.value);
    }

    /**
     * @notice Allows a user to deposit **WETH** into the `Vault`(becoming a [**Capital Provider**](/docs/user-guides/capital-provider/cp-role-guide)).
     * Shares of the Vault (CP tokens) are minted to caller.
     * It issues the amount of token share respected to the deposit to the `recipient`.
     * Reverts if `Vault` is in paused.
     * @param amount Amount of weth to deposit.
     * @return shares The number of shares minted.
     */
    function depositWeth(uint256 amount) external override nonReentrant returns (uint256 shares) {
        // pull weth
        SafeERC20.safeTransferFrom(_weth, msg.sender, address(this), amount);
        // mint
        return _deposit(amount);
    }

    /**
     * @notice Starts the **cooldown** period for the user.
     */
    function startCooldown() external override {
        _cooldownStart[msg.sender] = uint40(block.timestamp);
        emit CooldownStarted(msg.sender);
    }

    /**
     * @notice Stops the **cooldown** period for the user.
     */
    function stopCooldown() external override {
        _cooldownStart[msg.sender] = 0;
        emit CooldownStopped(msg.sender);
    }

    /**
     * @notice Allows a user to redeem shares for **ETH**.
     * Burns **SCP** and transfers **ETH** to the [**Capital Provider**](/docs/user-guides/capital-provider/cp-role-guide).
     * @param shares Amount of shares to redeem.
     * @return value The amount in **ETH** that the shares where redeemed for.
     */
    function withdrawEth(uint256 shares) external override nonReentrant returns (uint256 value) {
        value = _withdraw(shares);
        // unwrap weth
        if(value > address(this).balance) {
            _weth.withdraw(value - address(this).balance);
        }
        // transfer eth
        Address.sendValue(payable(msg.sender), value);
        emit WithdrawalMade(msg.sender, value);
        return value;
    }

    /**
     * @notice Allows a user to redeem shares for **WETH**.
     * Burns **SCP** tokens and transfers **WETH** to the [**Capital Provider**](/docs/user-guides/capital-provider/cp-role-guide).
     * @param shares amount of shares to redeem.
     * @return value The amount in **WETH** that the shares where redeemed for.
     */
    function withdrawWeth(uint256 shares) external override nonReentrant returns (uint256 value) {
        value = _withdraw(shares);
        // wrap eth
        uint256 balance = _weth.balanceOf(address(this));
        if(value > balance) {
            _weth.deposit{value: value - balance}();
        }
        // transfer weth
        SafeERC20.safeTransfer(_weth, msg.sender, value);
        emit WithdrawalMade(msg.sender, value);
        return value;
    }

    /***************************************
    CAPITAL PROVIDER VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice The price of one **SCP**.
     * @return price The price in **ETH**.
     */
    function pricePerShare() external view override returns (uint256 price) {
        return (totalSupply() == 0 || _totalAssets() == 0)
            ? 1 ether
            : ((1 ether * _totalAssets()) / totalSupply());
    }

    /**
     * @notice Returns the maximum redeemable shares by the `user` such that `Vault` does not go under **MCR**(Minimum Capital Requirement). May be less than their balance.
     * @param user The address of user to check.
     * @return shares The max redeemable shares by the user.
     */
    function maxRedeemableShares(address user) external view override returns (uint256 shares) {
        uint256 userBalance = balanceOf(user);
        uint256 vaultBalanceAfterWithdraw = _totalAssets() - _shareValue(userBalance);
        // if user's CP token balance takes Vault `totalAssets` below MCR,
        //... return the difference between totalAsset and MCR (in # shares)
        uint256 mcr = IRiskManager(_registry.riskManager()).minCapitalRequirement();
        if (vaultBalanceAfterWithdraw < mcr) {
            uint256 diff = _totalAssets() - mcr;
            return _sharesForAmount(_shareValue(diff));
        } else {
            // else, user can withdraw up to their balance of CP tokens
            return userBalance;
        }
    }

    /**
     * @notice Returns the total quantity of all assets held by the `Vault`.
     * @return assets The total assets under control of this vault.
    */
    function totalAssets() external view override returns (uint256 assets) {
        return _totalAssets();
    }

    /// @notice The minimum amount of time a user must wait to withdraw funds.
    function cooldownMin() external view override returns (uint40) {
        return _cooldownMin;
    }

    /// @notice The maximum amount of time a user must wait to withdraw funds.
    function cooldownMax() external view override returns (uint40) {
        return _cooldownMax;
    }

    /**
     * @notice The timestamp that a depositor's cooldown started.
     * @param user The depositor.
     * @return start The timestamp in seconds.
     */
    function cooldownStart(address user) external view override returns (uint40) {
        return _cooldownStart[user];
    }

    /**
     * @notice Returns true if the user is allowed to receive or send vault shares.
     * @param user User to query.
     * return status True if can transfer.
     */
    function canTransfer(address user) external view override returns (bool status) {
        uint40 start = _cooldownStart[user];
        uint40 elapsed = uint40(block.timestamp) - start;
        // cooldown timer not started or
        // past withdrawable period
        return start == 0 || elapsed >= _cooldownMax;
    }

    /**
     * @notice Returns true if the user is allowed to withdraw vault shares.
     * @param user User to query.
     * return status True if can withdraw.
     */
    function canWithdraw(address user) public view override returns (bool status) {
        // validate cooldown
        uint40 elapsed = uint40(block.timestamp) - _cooldownStart[user];
        // cooldownMin <= elapsed <= cooldownMax
        return _cooldownMin <= elapsed && elapsed <= _cooldownMax;
    }

    /// @notice Returns true if the vault is paused.
    function paused() external view override returns (bool paused_) {
        return _paused;
    }

    /***************************************
    REQUESTOR FUNCTIONS
    ***************************************/

    /**
     * @notice Sends **ETH** to other users or contracts. The users or contracts should be authorized requestors.
     * Can only be called by authorized `requestors`.
     * @param amount The amount of **ETH** wanted.
     */
    function requestEth(uint256 amount) external override nonReentrant {
        require(_isRequestor[msg.sender], "!requestor");
        // unwrap some WETH to make ETH available for claims payout
        if(amount > address(this).balance) {
            uint256 wanted = amount - address(this).balance;
            uint256 withdrawAmount = Math.min(_weth.balanceOf(address(this)), wanted);
            _weth.withdraw(withdrawAmount);
        }
        // transfer funds
        uint256 transferAmount = Math.min(amount, address(this).balance);
        Address.sendValue(payable(msg.sender), transferAmount);
        emit FundsSent(transferAmount);
    }

    /**
     * @notice Returns true if the destination is authorized to request **ETH**.
     * @param dst Account to check requestability.
     * @return status True if requestor, false if not.
     */
    function isRequestor(address dst) external view override returns (bool status) {
        return _isRequestor[dst];
    }

    /***************************************
    GOVERNANCE FUNCTIONS
    ***************************************/

    /**
     * @notice Pauses deposits.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * While paused:
     * 1. No users may deposit into the Vault.
     * 2. Withdrawls can bypass cooldown.
     * 3. Only Governance may unpause.
    */
    function pause() external override onlyGovernance {
        _paused = true;
        emit Paused();
    }

    /**
     * @notice Unpauses deposits.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
    */
    function unpause() external override onlyGovernance {
        _paused = false;
        emit Unpaused();
    }

    /**
     * @notice Sets the `minimum` and `maximum` amount of time in seconds that a user must wait to withdraw funds.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param cooldownMin_ Minimum time in seconds.
     * @param cooldownMax_ Maximum time in seconds.
     */
    function setCooldownWindow(uint40 cooldownMin_, uint40 cooldownMax_) external override onlyGovernance {
        require(cooldownMin_ <= cooldownMax_, "invalid window");
        _cooldownMin = cooldownMin_;
        _cooldownMax = cooldownMax_;
        emit CooldownWindowSet(cooldownMin_, cooldownMax_);
    }

    /**
     * @notice Adds requesting rights.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param requestor The requestor to grant rights.
     */
    function addRequestor(address requestor) external override onlyGovernance {
        require(requestor != address(0x0), "zero address requestor");
        _isRequestor[requestor] = true;
        emit RequestorAdded(requestor);
    }

    /**
     * @notice Removes requesting rights.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param requestor The requestor to revoke rights.
     */
    function removeRequestor(address requestor) external override onlyGovernance {
        require(requestor != address(0x0), "zero address requestor");
        _isRequestor[requestor] = false;
        emit RequestorRemoved(requestor);
    }

    /***************************************
    INTERNAL FUNCTIONS
    ***************************************/

    /**
     * @notice Handles minting of tokens during deposit.
     * Called by [`depositEth()`](#depositeth) and [`depositWeth()`](#depositweth).
     * @param amount Amount of **ETH** or **WETH** deposited.
     * @return tokens The number of shares minted.
     */
    function _deposit(uint256 amount) internal returns (uint256) {
        require(!_paused, "cannot deposit while paused");
        // stop cooldown
        if(_cooldownStart[msg.sender] != 0) _cooldownStart[msg.sender] = 0;
        // calculate and mint shares
        uint256 ts = totalSupply();
        uint256 ta = _totalAssets() - amount;
        uint256 shares = (ts == 0 || ta == 0)
          ? amount
          : (amount * ts / ta);
        _mint(msg.sender, shares);
        emit DepositMade(msg.sender, amount, shares);
        return shares;
    }

    /**
     * @notice Handles burning of shares during withdraw.
     * Called by [`withdrawEth()`](#withdraweth) and [`withdrawWeth()`](#withdrawweth).
     * @param shares amount of shares to redeem.
     * @return value The amount in **ETH** that the shares where redeemed for.
     */
    function _withdraw(uint256 shares) internal returns (uint256) {
        // validate shares to withdraw
        require(shares <= balanceOf(msg.sender), "insufficient scp balance");
        uint256 value = _shareValue(shares);
        // bypass some checks while paused
        if(!_paused) {
            // Stop withdrawal if process brings the Vault's `totalAssets` value below minimum capital requirement
            uint256 mcr = IRiskManager(_registry.riskManager()).minCapitalRequirement();
            require(_totalAssets() - value >= mcr, "insufficient assets");
            // validate cooldown
            require(canWithdraw(msg.sender), "not in cooldown window");
        }
        // burn shares
        _burn(msg.sender, shares);
        return value;
    }

    /***************************************
    INTERNAL VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice Internal function that returns quantity of all assets under control of this `Vault`.
     * Called by **totalAssets()** function.
     * @return totalAssets The total assets under control of this vault.
     */
    function _totalAssets() internal view returns (uint256) {
        return _weth.balanceOf(address(this)) + address(this).balance;
    }

    /**
     * @notice Internal function that determines the current value of given shares.
     * @param shares The amount of shares to calculate value for.
     * @return value The amount of value for given shares.
     */
    function _shareValue(uint256 shares) internal view returns (uint256) {
        return (totalSupply() == 0)
            ? 0
            : ((shares * _totalAssets()) / totalSupply());
    }

    /**
     * @notice Internal function that determines how many shares for given amount of token would receive.
     * @param amount of tokens to calculate number of shares for.
     * @return shares The amount of shares(tokens) for given amount.
     */
    function _sharesForAmount(uint256 amount) internal view returns (uint256) {
        return (_totalAssets() > 0)
            ? ((amount * totalSupply()) / _totalAssets())
            : 0;
    }

    /**
     * @notice Internal function that is called before token transfer in order to apply some security check.
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
        // only care about user->user transfers
        // mint and burn are validated in deposit and withdraw
        if(from != address(0x0) && to != address(0x0)) {
            // bypass check while deposits are paused
            // worded differently, easier withdraws
            if(!_paused) {
                uint40 cdm = _cooldownMax;
                uint40 start1 = _cooldownStart[from];
                uint40 start2 = _cooldownStart[to];
                uint40 timestamp = uint40(block.timestamp);
                uint40 elapsed1 = timestamp - start1;
                uint40 elapsed2 = timestamp - start2;
                require(
                    (start1 == 0 || elapsed1 >= cdm) &&
                    (start2 == 0 || elapsed2 >= cdm),
                    "cannot transfer during cooldown"
                );
            }
        }
        super._beforeTokenTransfer(from, to, amount);
    }

    /***************************************
    FALLBACK FUNCTIONS
    ***************************************/

    /**
     * @notice Fallback function to allow contract to receive *ETH*.
     * Does _not_ mint shares.
     */
    receive () external payable override { }

    /**
     * @notice Fallback function to allow contract to receive **ETH**.
     * Does _not_ mint shares.
     */
    fallback () external payable override { }
}

File 2 of 25 : 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 3 of 25 : 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 4 of 25 : 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 5 of 25 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 6 of 25 : 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 7 of 25 : Governable.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

import "./interface/IGovernable.sol";

/**
 * @title Governable
 * @author solace.fi
 * @notice Enforces access control for important functions to [**governor**](/docs/protocol/governance).
 *
 * Many contracts contain functionality that should only be accessible to a privileged user. The most common access control pattern is [OpenZeppelin's `Ownable`](https://docs.openzeppelin.com/contracts/4.x/access-control#ownership-and-ownable). We instead use `Governable` with a few key differences:
   * - Transferring the governance role is a two step process. The current governance must [`setPendingGovernance(pendingGovernance_)`](#setPendingGovernance) then the new governance must [`acceptGovernance()`](#acceptgovernance). This is to safeguard against accidentally setting ownership to the wrong address and locking yourself out of your contract.
 * - `governance` is a constructor argument instead of `msg.sender`. This is especially useful when deploying contracts via a [`SingletonFactory`](./interface/ISingletonFactory).
 * - We use `lockGovernance()` instead of `renounceOwnership()`. `renounceOwnership()` is a prerequisite for the reinitialization bug because it sets `owner = address(0x0)`. We also use the `governanceIsLocked()` flag.
 */
contract Governable is IGovernable {

    /***************************************
    GLOBAL VARIABLES
    ***************************************/

    // Governor.
    address private _governance;

    // governance to take over.
    address private _pendingGovernance;

    bool private _locked;

    /**
     * @notice Constructs the governable contract.
     * @param governance_ The address of the [governor](/docs/protocol/governance).
     */
    constructor(address governance_) {
        require(governance_ != address(0x0), "zero address governance");
        _governance = governance_;
        _pendingGovernance = address(0x0);
        _locked = false;
    }

    /***************************************
    MODIFIERS
    ***************************************/

    // can only be called by governor
    // can only be called while unlocked
    modifier onlyGovernance() {
        require(!_locked, "governance locked");
        require(msg.sender == _governance, "!governance");
        _;
    }

    // can only be called by pending governor
    // can only be called while unlocked
    modifier onlyPendingGovernance() {
        require(!_locked, "governance locked");
        require(msg.sender == _pendingGovernance, "!pending governance");
        _;
    }

    /***************************************
    VIEW FUNCTIONS
    ***************************************/

    /// @notice Address of the current governor.
    function governance() external view override returns (address) {
        return _governance;
    }

    /// @notice Address of the governor to take over.
    function pendingGovernance() external view override returns (address) {
        return _pendingGovernance;
    }

    /// @notice Returns true if governance is locked.
    function governanceIsLocked() external view override returns (bool) {
        return _locked;
    }

    /***************************************
    MUTATOR FUNCTIONS
    ***************************************/

    /**
     * @notice Initiates transfer of the governance role to a new governor.
     * Transfer is not complete until the new governor accepts the role.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param pendingGovernance_ The new governor.
     */
    function setPendingGovernance(address pendingGovernance_) external override onlyGovernance {
        _pendingGovernance = pendingGovernance_;
        emit GovernancePending(pendingGovernance_);
    }

    /**
     * @notice Accepts the governance role.
     * Can only be called by the pending governor.
     */
    function acceptGovernance() external override onlyPendingGovernance {
        // sanity check against transferring governance to the zero address
        // if someone figures out how to sign transactions from the zero address
        // consider the entirety of ethereum to be rekt
        require(_pendingGovernance != address(0x0), "zero governance");
        address oldGovernance = _governance;
        _governance = _pendingGovernance;
        _pendingGovernance = address(0x0);
        emit GovernanceTransferred(oldGovernance, _governance);
    }

    /**
     * @notice Permanently locks this contract's governance role and any of its functions that require the role.
     * This action cannot be reversed.
     * Before you call it, ask yourself:
     *   - Is the contract self-sustaining?
     *   - Is there a chance you will need governance privileges in the future?
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     */
    function lockGovernance() external override onlyGovernance {
        _locked = true;
        // intentionally not using address(0x0), see re-initialization exploit
        _governance = address(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF);
        _pendingGovernance = address(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF);
        emit GovernanceTransferred(msg.sender, address(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF));
        emit GovernanceLocked();
    }
}

File 8 of 25 : IRegistry.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

/**
 * @title IRegistry
 * @author solace.fi
 * @notice Tracks the contracts of the Solaverse.
 *
 * [**Governance**](/docs/protocol/governance) can set the contract addresses and anyone can look them up.
 *
 * Note that `Registry` doesn't track all Solace contracts. FarmController is tracked in [`OptionsFarming`](../OptionsFarming), farms are tracked in FarmController, Products are tracked in [`PolicyManager`](../PolicyManager), and the `Registry` is untracked.
 */
interface IRegistry {

    /***************************************
    EVENTS
    ***************************************/

    // Emitted when WETH is set.
    event WethSet(address weth);
    // Emitted when Vault is set.
    event VaultSet(address vault);
    // Emitted when ClaimsEscrow is set.
    event ClaimsEscrowSet(address claimsEscrow);
    // Emitted when Treasury is set.
    event TreasurySet(address treasury);
    // Emitted when PolicyManager is set.
    event PolicyManagerSet(address policyManager);
    // Emitted when RiskManager is set.
    event RiskManagerSet(address riskManager);
    // Emitted when Solace Token is set.
    event SolaceSet(address solace);
    // Emitted when OptionsFarming is set.
    event OptionsFarmingSet(address optionsFarming);
    // Emitted when FarmController is set.
    event FarmControllerSet(address farmController);
    // Emitted when Locker is set.
    event LockerSet(address locker);

    /***************************************
    VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice Gets the [**WETH**](../WETH9) contract.
     * @return weth_ The address of the [**WETH**](../WETH9) contract.
     */
    function weth() external view returns (address weth_);

    /**
     * @notice Gets the [`Vault`](../Vault) contract.
     * @return vault_ The address of the [`Vault`](../Vault) contract.
     */
    function vault() external view returns (address vault_);

    /**
     * @notice Gets the [`ClaimsEscrow`](../ClaimsEscrow) contract.
     * @return claimsEscrow_ The address of the [`ClaimsEscrow`](../ClaimsEscrow) contract.
     */
    function claimsEscrow() external view returns (address claimsEscrow_);

    /**
     * @notice Gets the [`Treasury`](../Treasury) contract.
     * @return treasury_ The address of the [`Treasury`](../Treasury) contract.
     */
    function treasury() external view returns (address treasury_);

    /**
     * @notice Gets the [`PolicyManager`](../PolicyManager) contract.
     * @return policyManager_ The address of the [`PolicyManager`](../PolicyManager) contract.
     */
    function policyManager() external view returns (address policyManager_);

    /**
     * @notice Gets the [`RiskManager`](../RiskManager) contract.
     * @return riskManager_ The address of the [`RiskManager`](../RiskManager) contract.
     */
    function riskManager() external view returns (address riskManager_);

    /**
     * @notice Gets the [**SOLACE**](../SOLACE) contract.
     * @return solace_ The address of the [**SOLACE**](../SOLACE) contract.
     */
    function solace() external view returns (address solace_);

    /**
     * @notice Gets the [`OptionsFarming`](../OptionsFarming) contract.
     * @return optionsFarming_ The address of the [`OptionsFarming`](../OptionsFarming) contract.
     */
    function optionsFarming() external view returns (address optionsFarming_);

    /**
     * @notice Gets the [`FarmController`](../FarmController) contract.
     * @return farmController_ The address of the [`FarmController`](../FarmController) contract.
     */
    function farmController() external view returns (address farmController_);

    /**
     * @notice Gets the [`Locker`](../Locker) contract.
     * @return locker_ The address of the [`Locker`](../Locker) contract.
     */
    function locker() external view returns (address locker_);

    /***************************************
    GOVERNANCE FUNCTIONS
    ***************************************/

    /**
     * @notice Sets the [**WETH**](../WETH9) contract.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param weth_ The address of the [**WETH**](../WETH9) contract.
     */
    function setWeth(address weth_) external;

    /**
     * @notice Sets the [`Vault`](../Vault) contract.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param vault_ The address of the [`Vault`](../Vault) contract.
     */
    function setVault(address vault_) external;

    /**
     * @notice Sets the [`Claims Escrow`](../ClaimsEscrow) contract.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param claimsEscrow_ The address of the [`Claims Escrow`](../ClaimsEscrow) contract.
     */
    function setClaimsEscrow(address claimsEscrow_) external;

    /**
     * @notice Sets the [`Treasury`](../Treasury) contract.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param treasury_ The address of the [`Treasury`](../Treasury) contract.
     */
    function setTreasury(address treasury_) external;

    /**
     * @notice Sets the [`Policy Manager`](../PolicyManager) contract.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param policyManager_ The address of the [`Policy Manager`](../PolicyManager) contract.
     */
    function setPolicyManager(address policyManager_) external;

    /**
     * @notice Sets the [`Risk Manager`](../RiskManager) contract.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param riskManager_ The address of the [`Risk Manager`](../RiskManager) contract.
     */
    function setRiskManager(address riskManager_) external;

    /**
     * @notice Sets the [**SOLACE**](../SOLACE) contract.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param solace_ The address of the [**SOLACE**](../SOLACE) contract.
     */
    function setSolace(address solace_) external;

    /**
     * @notice Sets the [`OptionsFarming`](../OptionsFarming) contract.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param optionsFarming_ The address of the [`OptionsFarming`](../OptionsFarming) contract.
     */
    function setOptionsFarming(address optionsFarming_) external;

    /**
     * @notice Sets the [`FarmController`](../FarmController) contract.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param farmController_ The address of the [`FarmController`](../FarmController) contract.
     */
    function setFarmController(address farmController_) external;

    /**
     * @notice Sets the [`Locker`](../Locker) contract.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param locker_ The address of the [`Locker`](../Locker) contract.
     */
    function setLocker(address locker_) external;

    /**
     * @notice Sets multiple contracts in one call.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param weth_ The address of the [**WETH**](../WETH9) contract.
     * @param vault_ The address of the [`Vault`](../Vault) contract.
     * @param claimsEscrow_ The address of the [`Claims Escrow`](../ClaimsEscrow) contract.
     * @param treasury_ The address of the [`Treasury`](../Treasury) contract.
     * @param policyManager_ The address of the [`Policy Manager`](../PolicyManager) contract.
     * @param riskManager_ The address of the [`Risk Manager`](../RiskManager) contract.
     * @param solace_ The address of the [**SOLACE**](../SOLACE) contract.
     * @param optionsFarming_ The address of the [`OptionsFarming`](./OptionsFarming) contract.
     * @param farmController_ The address of the [`FarmController`](./FarmController) contract.
     * @param locker_ The address of the [`Locker`](../Locker) contract.
     */
    function setMultiple(
        address weth_,
        address vault_,
        address claimsEscrow_,
        address treasury_,
        address policyManager_,
        address riskManager_,
        address solace_,
        address optionsFarming_,
        address farmController_,
        address locker_
    ) external;
}

File 9 of 25 : IPolicyManager.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

import "./IERC721Enhanced.sol";

/**
 * @title IPolicyManager
 * @author solace.fi
 * @notice The **PolicyManager** manages the creation of new policies and modification of existing policies.
 *
 * Most users will not interact with **PolicyManager** directly. To buy, modify, or cancel policies, users should use the respective [**product**](../products/BaseProduct) for the position they would like to cover. Use **PolicyManager** to view policies.
 *
 * Policies are [**ERC721s**](https://docs.openzeppelin.com/contracts/4.x/api/token/erc721#ERC721).
 */
interface IPolicyManager is IERC721Enhanced {

    /***************************************
    EVENTS
    ***************************************/

    /// @notice Emitted when a policy is created.
    event PolicyCreated(uint256 policyID);
    /// @notice Emitted when a policy is updated.
    event PolicyUpdated(uint256 indexed policyID);
    /// @notice Emitted when a policy is burned.
    event PolicyBurned(uint256 policyID);
    /// @notice Emitted when the policy descriptor is set.
    event PolicyDescriptorSet(address policyDescriptor);
    /// @notice Emitted when a new product is added.
    event ProductAdded(address product);
    /// @notice Emitted when a new product is removed.
    event ProductRemoved(address product);

    /***************************************
    POLICY VIEW FUNCTIONS
    ***************************************/

    /// @notice PolicyInfo struct.
    struct PolicyInfo {
        uint256 coverAmount;
        address product;
        uint40 expirationBlock;
        uint24 price;
        bytes positionDescription;
    }

    /**
     * @notice Information about a policy.
     * @param policyID The policy ID to return info.
     * @return info info in a struct.
     */
    function policyInfo(uint256 policyID) external view returns (PolicyInfo memory info);

    /**
     * @notice Information about a policy.
     * @param policyID The policy ID to return info.
     * @return policyholder The address of the policy holder.
     * @return product The product of the policy.
     * @return coverAmount The amount covered for the policy.
     * @return expirationBlock The expiration block of the policy.
     * @return price The price of the policy.
     * @return positionDescription The description of the covered position(s).
     */
    function getPolicyInfo(uint256 policyID) external view returns (address policyholder, address product, uint256 coverAmount, uint40 expirationBlock, uint24 price, bytes calldata positionDescription);

    /**
     * @notice The holder of the policy.
     * @param policyID The policy ID.
     * @return policyholder The address of the policy holder.
     */
    function getPolicyholder(uint256 policyID) external view returns (address policyholder);

    /**
     * @notice The product used to purchase the policy.
     * @param policyID The policy ID.
     * @return product The product of the policy.
     */
    function getPolicyProduct(uint256 policyID) external view returns (address product);

    /**
     * @notice The expiration block of the policy.
     * @param policyID The policy ID.
     * @return expirationBlock The expiration block of the policy.
     */
    function getPolicyExpirationBlock(uint256 policyID) external view returns (uint40 expirationBlock);

    /**
     * @notice The cover amount of the policy.
     * @param policyID The policy ID.
     * @return coverAmount The cover amount of the policy.
     */
    function getPolicyCoverAmount(uint256 policyID) external view returns (uint256 coverAmount);

    /**
     * @notice The cover price in wei per block per wei multiplied by 1e12.
     * @param policyID The policy ID.
     * @return price The price of the policy.
     */
    function getPolicyPrice(uint256 policyID) external view returns (uint24 price);

    /**
     * @notice The byte encoded description of the covered position(s).
     * Only makes sense in context of the product.
     * @param policyID The policy ID.
     * @return positionDescription The description of the covered position(s).
     */
    function getPositionDescription(uint256 policyID) external view returns (bytes calldata positionDescription);

    /*
     * @notice These functions can be used to check a policys stage in the lifecycle.
     * There are three major lifecycle events:
     *   1 - policy is bought (aka minted)
     *   2 - policy expires
     *   3 - policy is burnt (aka deleted)
     * There are four stages:
     *   A - pre-mint
     *   B - pre-expiration
     *   C - post-expiration
     *   D - post-burn
     * Truth table:
     *               A B C D
     *   exists      0 1 1 0
     *   isActive    0 1 0 0
     *   hasExpired  0 0 1 0

    /**
     * @notice Checks if a policy is active.
     * @param policyID The policy ID.
     * @return status True if the policy is active.
     */
    function policyIsActive(uint256 policyID) external view returns (bool);

    /**
     * @notice Checks whether a given policy is expired.
     * @param policyID The policy ID.
     * @return status True if the policy is expired.
     */
    function policyHasExpired(uint256 policyID) external view returns (bool);

    /// @notice The total number of policies ever created.
    function totalPolicyCount() external view returns (uint256 count);

    /// @notice The address of the [`PolicyDescriptor`](./PolicyDescriptor) contract.
    function policyDescriptor() external view returns (address);

    /***************************************
    POLICY MUTATIVE FUNCTIONS
    ***************************************/

    /**
     * @notice Creates a new policy.
     * Can only be called by **products**.
     * @param policyholder The receiver of new policy token.
     * @param coverAmount The policy coverage amount (in wei).
     * @param expirationBlock The policy expiration block number.
     * @param price The coverage price.
     * @param positionDescription The description of the covered position(s).
     * @return policyID The policy ID.
     */
    function createPolicy(
        address policyholder,
        uint256 coverAmount,
        uint40 expirationBlock,
        uint24 price,
        bytes calldata positionDescription
    ) external returns (uint256 policyID);

    /**
     * @notice Modifies a policy.
     * Can only be called by **products**.
     * @param policyID The policy ID.
     * @param coverAmount The policy coverage amount (in wei).
     * @param expirationBlock The policy expiration block number.
     * @param price The coverage price.
     * @param positionDescription The description of the covered position(s).
     */
    function setPolicyInfo(uint256 policyID, uint256 coverAmount, uint40 expirationBlock, uint24 price, bytes calldata positionDescription) external;

    /**
     * @notice Burns expired or cancelled policies.
     * Can only be called by **products**.
     * @param policyID The ID of the policy to burn.
     */
    function burn(uint256 policyID) external;

    /**
     * @notice Burns expired policies.
     * @param policyIDs The list of expired policies.
     */
    function updateActivePolicies(uint256[] calldata policyIDs) external;

    /***************************************
    PRODUCT VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice Checks is an address is an active product.
     * @param product The product to check.
     * @return status True if the product is active.
     */
    function productIsActive(address product) external view returns (bool status);

    /**
     * @notice Returns the number of products.
     * @return count The number of products.
     */
    function numProducts() external view returns (uint256 count);

    /**
     * @notice Returns the product at the given index.
     * @param productNum The index to query.
     * @return product The address of the product.
     */
    function getProduct(uint256 productNum) external view returns (address product);

    /***************************************
    OTHER VIEW FUNCTIONS
    ***************************************/

    function activeCoverAmount() external view returns (uint256);

    /***************************************
    GOVERNANCE FUNCTIONS
    ***************************************/

    /**
     * @notice Adds a new product.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param product the new product
     */
    function addProduct(address product) external;

    /**
     * @notice Removes a product.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param product the product to remove
     */
    function removeProduct(address product) external;


    /**
     * @notice Set the token descriptor.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param policyDescriptor The new token descriptor address.
     */
    function setPolicyDescriptor(address policyDescriptor) external;
}

File 10 of 25 : IRiskManager.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;


/**
 * @title IRiskManager
 * @author solace.fi
 * @notice Calculates the acceptable risk, sellable cover, and capital requirements of Solace products and capital pool.
 *
 * The total amount of sellable coverage is proportional to the assets in the [**risk backing capital pool**](../Vault). The max cover is split amongst products in a weighting system. [**Governance**](/docs/protocol/governance). can change these weights and with it each product's sellable cover.
 *
 * The minimum capital requirement is proportional to the amount of cover sold to [active policies](../PolicyManager).
 *
 * Solace can use leverage to sell more cover than the available capital. The amount of leverage is stored as [`partialReservesFactor`](#partialreservesfactor) and is settable by [**governance**](/docs/protocol/governance).
 */
interface IRiskManager {

    /***************************************
    EVENTS
    ***************************************/

    /// @notice Emitted when a product's risk parameters are set.
    /// Includes adding and removing products.
    event ProductParamsSet(address product, uint32 weight, uint24 price, uint16 divisor);
    /// @notice Emitted when the partial reserves factor is set.
    event PartialReservesFactorSet(uint16 partialReservesFactor);

    /***************************************
    MAX COVER VIEW FUNCTIONS
    ***************************************/

    /// @notice Struct for a product's risk parameters.
    struct ProductRiskParams {
        uint32 weight;  // The weighted allocation of this product vs other products.
        uint24 price;   // The price in wei per 1e12 wei of coverage per block.
        uint16 divisor; // The max cover per policy divisor. (maxCoverPerProduct / divisor = maxCoverPerPolicy)
    }

    /**
     * @notice Given a request for coverage, determines if that risk is acceptable and if so at what price.
     * @param product The product that wants to sell coverage.
     * @param currentCover If updating an existing policy's cover amount, the current cover amount, otherwise 0.
     * @param newCover The cover amount requested.
     * @return acceptable True if risk of the new cover is acceptable, false otherwise.
     * @return price The price in wei per 1e12 wei of coverage per block.
     */
    function assessRisk(address product, uint256 currentCover, uint256 newCover) external view returns (bool acceptable, uint24 price);

    /**
     * @notice The maximum amount of cover that Solace as a whole can sell.
     * @return cover The max amount of cover in wei.
     */
    function maxCover() external view returns (uint256 cover);

    /**
     * @notice The maximum amount of cover that a product can sell in total.
     * @param prod The product that wants to sell cover.
     * @return cover The max amount of cover in wei.
     */
    function maxCoverPerProduct(address prod) external view returns (uint256 cover);

    /**
     * @notice The amount of cover that a product can still sell.
     * @param prod The product that wants to sell cover.
     * @return cover The max amount of cover in wei.
     */
    function sellableCoverPerProduct(address prod) external view returns (uint256 cover);

    /**
     * @notice The maximum amount of cover that a product can sell in a single policy.
     * @param prod The product that wants to sell cover.
     * @return cover The max amount of cover in wei.
     */
    function maxCoverPerPolicy(address prod) external view returns (uint256 cover);

    /**
     * @notice Checks is an address is an active product.
     * @param prod The product to check.
     * @return status True if the product is active.
     */
    function productIsActive(address prod) external view returns (bool status);

    /**
     * @notice Return the number of registered products.
     * @return count Number of products.
     */
    function numProducts() external view returns (uint256 count);

    /**
     * @notice Return the product at an index.
     * @dev Enumerable `[1, numProducts]`.
     * @param index Index to query.
     * @return prod The product address.
     */
    function product(uint256 index) external view returns (address prod);

    /**
     * @notice Returns a product's risk parameters.
     * The product must be active.
     * @param prod The product to get parameters for.
     * @return weight The weighted allocation of this product vs other products.
     * @return price The price in wei per 1e12 wei of coverage per block.
     * @return divisor The max cover per policy divisor.
     */
    function productRiskParams(address prod) external view returns (uint32 weight, uint24 price, uint16 divisor);

    /**
     * @notice Returns the sum of weights.
     * @return sum WeightSum.
     */
    function weightSum() external view returns (uint32 sum);

    /***************************************
    MIN CAPITAL VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice The minimum amount of capital required to safely cover all policies.
     * @return mcr The minimum capital requirement.
     */
    function minCapitalRequirement() external view returns (uint256 mcr);

    /**
     * @notice Multiplier for minimum capital requirement.
     * @return factor Partial reserves factor in BPS.
     */
    function partialReservesFactor() external view returns (uint16 factor);

    /***************************************
    GOVERNANCE FUNCTIONS
    ***************************************/

    /**
     * @notice Adds a product.
     * If the product is already added, sets its parameters.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param product_ Address of the product.
     * @param weight_ The products weight.
     * @param price_ The products price in wei per 1e12 wei of coverage per block.
     * @param divisor_ The max cover per policy divisor.
     */
    function addProduct(address product_, uint32 weight_, uint24 price_, uint16 divisor_) external;

    /**
     * @notice Removes a product.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param product_ Address of the product to remove.
     */
    function removeProduct(address product_) external;

    /**
     * @notice Sets the products and their parameters.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param products_ The products.
     * @param weights_ The product weights.
     * @param prices_ The product prices.
     * @param divisors_ The max cover per policy divisors.
     */
    function setProductParams(address[] calldata products_, uint32[] calldata weights_, uint24[] calldata prices_, uint16[] calldata divisors_) external;

    /**
     * @notice Sets the partial reserves factor.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param partialReservesFactor_ New partial reserves factor in BPS.
     */
    function setPartialReservesFactor(uint16 partialReservesFactor_) external;
}

File 11 of 25 : IVault.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity 0.8.6;

import "./IWETH9.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";

/**
 * @title IVault
 * @author solace.fi
 * @notice The risk-backing capital pool.
 *
 * [**Capital Providers**](/docs/user-guides/capital-provider/cp-role-guide) can deposit **ETH** or **WETH** into the `Vault` to mint shares. Shares are represented as **CP tokens** aka **SCP** and extend `ERC20`. [**Capital Providers**](/docs/user-guides/capital-provider/cp-role-guide) should use [`depositEth()`](#depositeth) or [`depositWeth()`](#depositweth), not regular **ETH** or **WETH** transfer.
 *
 * As [**Policyholders**](/docs/protocol/policy-holder) purchase coverage, premiums will flow into the capital pool and are split amongst the [**Capital Providers**](/docs/user-guides/capital-provider/cp-role-guide). If a loss event occurs in an active policy, some funds will be used to payout the claim. These events will affect the price per share but not the number or distribution of shares.
 *
 * By minting shares of the `Vault`, [**Capital Providers**](/docs/user-guides/capital-provider/cp-role-guide) willingly accept the risk that the whole or a part of their funds may be used payout claims. A malicious [**Capital Providers**](/docs/user-guides/capital-provider/cp-role-guide) could detect a loss event and try to withdraw their funds before claims are paid out. To prevent this, the `Vault` uses a cooldown mechanic such that while the [**capital provider**](/docs/user-guides/capital-provider/cp-role-guide) is not in cooldown mode (default) they can mint, send, and receive **SCP** but not withdraw **ETH**. To withdraw their **ETH**, the [**capital provider**](/docs/user-guides/capital-provider/cp-role-guide) must `startCooldown()`(#startcooldown), wait no less than `cooldownMin()`(#cooldownmin) and no more than `cooldownMax()`(#cooldownmax), then call `withdrawEth()`(#withdraweth) or `withdrawWeth()`(#withdrawweth). While in cooldown mode users cannot send or receive **SCP** and minting shares will take them out of cooldown.
 */
interface IVault is IERC20Metadata, IERC20Permit {

    /***************************************
    EVENTS
    ***************************************/

    /// @notice Emitted when a user deposits funds.
    event DepositMade(address indexed depositor, uint256 indexed amount, uint256 indexed shares);
    /// @notice Emitted when a user withdraws funds.
    event WithdrawalMade(address indexed withdrawer, uint256 indexed value);
    /// @notice Emitted when funds are sent to a requestor.
    event FundsSent(uint256 value);
    /// @notice Emitted when deposits are paused.
    event Paused();
    /// @notice Emitted when deposits are unpaused.
    event Unpaused();
    /// @notice Emitted when a user enters cooldown mode.
    event CooldownStarted(address user);
    /// @notice Emitted when a user leaves cooldown mode.
    event CooldownStopped(address user);
    /// @notice Emitted when the cooldown window is set.
    event CooldownWindowSet(uint40 cooldownMin, uint40 cooldownMax);
    /// @notice Emitted when a requestor is added.
    event RequestorAdded(address requestor);
    /// @notice Emitted when a requestor is removed.
    event RequestorRemoved(address requestor);

    /***************************************
    CAPITAL PROVIDER FUNCTIONS
    ***************************************/

    /**
     * @notice Allows a user to deposit **ETH** into the `Vault`(becoming a **Capital Provider**).
     * Shares of the `Vault` (CP tokens) are minted to caller.
     * It is called when `Vault` receives **ETH**.
     * It issues the amount of token share respected to the deposit to the `recipient`.
     * Reverts if `Vault` is paused.
     * @return shares The number of shares minted.
     */
    function depositEth() external payable returns (uint256 shares);

    /**
     * @notice Allows a user to deposit **WETH** into the `Vault`(becoming a **Capital Provider**).
     * Shares of the Vault (CP tokens) are minted to caller.
     * It issues the amount of token share respected to the deposit to the `recipient`.
     * Reverts if `Vault` is paused.
     * @param amount Amount of weth to deposit.
     * @return shares The number of shares minted.
     */
    function depositWeth(uint256 amount) external returns (uint256);

    /**
     * @notice Starts the cooldown.
     */
    function startCooldown() external;

    /**
     * @notice Stops the cooldown.
     */
    function stopCooldown() external;

    /**
     * @notice Allows a user to redeem shares for **ETH**.
     * Burns **SCP** and transfers **ETH** to the [**Capital Provider**](/docs/user-guides/capital-provider/cp-role-guide).
     * @param shares Amount of shares to redeem.
     * @return value The amount in **ETH** that the shares where redeemed for.
     */
    function withdrawEth(uint256 shares) external returns (uint256 value);

    /**
     * @notice Allows a user to redeem shares for **WETH**.
     * Burns **SCP** tokens and transfers **WETH** to the [**Capital Provider**](/docs/user-guides/capital-provider/cp-role-guide).
     * @param shares amount of shares to redeem.
     * @return value The amount in **WETH** that the shares where redeemed for.
     */
    function withdrawWeth(uint256 shares) external returns (uint256 value);

    /***************************************
    CAPITAL PROVIDER VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice The price of one **SCP**.
     * @return price The price in **ETH**.
     */
    function pricePerShare() external view returns (uint256 price);

    /**
     * @notice Returns the maximum redeemable shares by the `user` such that `Vault` does not go under **MCR**(Minimum Capital Requirement). May be less than their balance.
     * @param user The address of user to check.
     * @return shares The max redeemable shares by the user.
     */
    function maxRedeemableShares(address user) external view returns (uint256 shares);

    /**
     * @notice Returns the total quantity of all assets held by the `Vault`.
     * @return assets The total assets under control of this vault.
    */
    function totalAssets() external view returns (uint256 assets);

    /// @notice The minimum amount of time a user must wait to withdraw funds.
    function cooldownMin() external view returns (uint40);

    /// @notice The maximum amount of time a user must wait to withdraw funds.
    function cooldownMax() external view returns (uint40);

    /**
     * @notice The timestamp that a depositor's cooldown started.
     * @param user The depositor.
     * @return start The timestamp in seconds.
     */
    function cooldownStart(address user) external view returns (uint40 start);

    /**
     * @notice Returns true if the user is allowed to receive or send vault shares.
     * @param user User to query.
     * return status True if can transfer.
     */
    function canTransfer(address user) external view returns (bool status);

    /**
     * @notice Returns true if the user is allowed to withdraw vault shares.
     * @param user User to query.
     * return status True if can withdraw.
     */
    function canWithdraw(address user) external view returns (bool status);

    /// @notice Returns true if the vault is paused.
    function paused() external view returns (bool paused_);

    /***************************************
    REQUESTOR FUNCTIONS
    ***************************************/

    /**
     * @notice Sends **ETH** to other users or contracts.
     * Can only be called by authorized requestors.
     * @param amount Amount of **ETH** wanted.
     */
    function requestEth(uint256 amount) external;

    /**
     * @notice Returns true if the destination is authorized to request **ETH**.
     * @param dst Account to check requestability.
     * @return status True if requestor, false if not.
     */
    function isRequestor(address dst) external view returns (bool status);

    /***************************************
    GOVERNANCE FUNCTIONS
    ***************************************/

    /**
     * @notice Pauses deposits.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * While paused:
     * 1. No users may deposit into the Vault.
     * 2. Withdrawls can bypass cooldown.
     * 3. Only Governance may unpause.
    */
    function pause() external;

    /**
     * @notice Unpauses deposits.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
    */
    function unpause() external;

    /**
     * @notice Sets the `minimum` and `maximum` amount of time in seconds that a user must wait to withdraw funds.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param cooldownMin_ Minimum time in seconds.
     * @param cooldownMax_ Maximum time in seconds.
     */
    function setCooldownWindow(uint40 cooldownMin_, uint40 cooldownMax_) external;

    /**
     * @notice Adds requesting rights.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param requestor The requestor to grant rights.
     */
    function addRequestor(address requestor) external;

    /**
     * @notice Removes requesting rights.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param requestor The requestor to revoke rights.
     */
    function removeRequestor(address requestor) external;

    /***************************************
    FALLBACK FUNCTIONS
    ***************************************/

    /**
     * @notice Fallback function to allow contract to receive *ETH*.
     * Does _not_ mint shares.
     */
    receive () external payable;

    /**
     * @notice Fallback function to allow contract to receive **ETH**.
     * Does _not_ mint shares.
     */
    fallback () external payable;
}

File 12 of 25 : 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 13 of 25 : 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 14 of 25 : 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 15 of 25 : 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 16 of 25 : 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 17 of 25 : 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 18 of 25 : 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 19 of 25 : 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 20 of 25 : IGovernable.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

/**
 * @title IGovernable
 * @author solace.fi
 * @notice Enforces access control for important functions to [**governor**](/docs/protocol/governance).
 *
 * Many contracts contain functionality that should only be accessible to a privileged user. The most common access control pattern is [OpenZeppelin's `Ownable`](https://docs.openzeppelin.com/contracts/4.x/access-control#ownership-and-ownable). We instead use `Governable` with a few key differences:
 * - Transferring the governance role is a two step process. The current governance must [`setPendingGovernance(pendingGovernance_)`](#setPendingGovernance) then the new governance must [`acceptGovernance()`](#acceptgovernance). This is to safeguard against accidentally setting ownership to the wrong address and locking yourself out of your contract.
 * - `governance` is a constructor argument instead of `msg.sender`. This is especially useful when deploying contracts via a [`SingletonFactory`](./ISingletonFactory).
 * - We use `lockGovernance()` instead of `renounceOwnership()`. `renounceOwnership()` is a prerequisite for the reinitialization bug because it sets `owner = address(0x0)`. We also use the `governanceIsLocked()` flag.
 */
interface IGovernable {

    /***************************************
    EVENTS
    ***************************************/

    /// @notice Emitted when pending Governance is set.
    event GovernancePending(address pendingGovernance);
    /// @notice Emitted when Governance is set.
    event GovernanceTransferred(address oldGovernance, address newGovernance);
    /// @notice Emitted when Governance is locked.
    event GovernanceLocked();

    /***************************************
    VIEW FUNCTIONS
    ***************************************/

    /// @notice Address of the current governor.
    function governance() external view returns (address);

    /// @notice Address of the governor to take over.
    function pendingGovernance() external view returns (address);

    /// @notice Returns true if governance is locked.
    function governanceIsLocked() external view returns (bool);

    /***************************************
    MUTATORS
    ***************************************/

    /**
     * @notice Initiates transfer of the governance role to a new governor.
     * Transfer is not complete until the new governor accepts the role.
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     * @param pendingGovernance_ The new governor.
     */
    function setPendingGovernance(address pendingGovernance_) external;

    /**
     * @notice Accepts the governance role.
     * Can only be called by the new governor.
     */
    function acceptGovernance() external;

    /**
     * @notice Permanently locks this contract's governance role and any of its functions that require the role.
     * This action cannot be reversed.
     * Before you call it, ask yourself:
     *   - Is the contract self-sustaining?
     *   - Is there a chance you will need governance privileges in the future?
     * Can only be called by the current [**governor**](/docs/protocol/governance).
     */
    function lockGovernance() external;
}

File 21 of 25 : IERC721Enhanced.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// code borrowed from OpenZeppelin and @uniswap/v3-periphery
pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";

/**
 * @title ERC721Enhanced
 * @author solace.fi
 * @notice An extension of `ERC721`.
 *
 * The base is OpenZeppelin's `ERC721Enumerable` which also includes the `Metadata` extension. This extension includes simpler transfers, gasless approvals, and better enumeration.
 */
interface IERC721Enhanced is IERC721Enumerable {

    /***************************************
    SIMPLER TRANSFERS
    ***************************************/

    /**
     * @notice Transfers `tokenID` from `msg.sender` to `to`.
     * @dev This was excluded from the official `ERC721` standard in favor of `transferFrom(address from, address to, uint256 tokenID)`. We elect to include it.
     * @param to The receipient of the token.
     * @param tokenID The token to transfer.
     */
    function transfer(address to, uint256 tokenID) external;

    /**
     * @notice Safely transfers `tokenID` from `msg.sender` to `to`.
     * @dev This was excluded from the official `ERC721` standard in favor of `safeTransferFrom(address from, address to, uint256 tokenID)`. We elect to include it.
     * @param to The receipient of the token.
     * @param tokenID The token to transfer.
     */
    function safeTransfer(address to, uint256 tokenID) external;

    /***************************************
    GASLESS APPROVALS
    ***************************************/

    /**
     * @notice Approve of a specific `tokenID` for spending by `spender` via signature.
     * @param spender The account that is being approved.
     * @param tokenID The ID of the token that is being approved for spending.
     * @param deadline The deadline timestamp by which the call must be mined for the approve to work.
     * @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`.
     * @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`.
     * @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`.
     */
    function permit(
        address spender,
        uint256 tokenID,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @notice Returns the current nonce for `tokenID`. This value must be
     * included whenever a signature is generated for `permit`.
     * Every successful call to `permit` increases ``tokenID``'s nonce by one. This
     * prevents a signature from being used multiple times.
     * @param tokenID ID of the token to request nonce.
     * @return nonce Nonce of the token.
     */
    function nonces(uint256 tokenID) external view returns (uint256 nonce);

    /**
     * @notice The permit typehash used in the `permit` signature.
     * @return typehash The typehash for the `permit`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function PERMIT_TYPEHASH() external view returns (bytes32 typehash);

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

    /***************************************
    BETTER ENUMERATION
    ***************************************/

    /**
     * @notice Lists all tokens.
     * Order not specified.
     * @dev This function is more useful off chain than on chain.
     * @return tokenIDs The list of token IDs.
     */
    function listTokens() external view returns (uint256[] memory tokenIDs);

    /**
     * @notice Lists the tokens owned by `owner`.
     * Order not specified.
     * @dev This function is more useful off chain than on chain.
     * @return tokenIDs The list of token IDs.
     */
    function listTokensOfOwner(address owner) external view returns (uint256[] memory tokenIDs);

    /**
     * @notice Determines if a token exists or not.
     * @param tokenID The ID of the token to query.
     * @return status True if the token exists, false if it doesn't.
     */
    function exists(uint256 tokenID) external view returns (bool status);
}

File 22 of 25 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 23 of 25 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 24 of 25 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 25 of 25 : IWETH9.sol
// SPDX-License-Identifier: NONE
// code borrowed from https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#code

// Copyright (C) 2015, 2016, 2017 Dapphub

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";


/**
 * @title IWETH9
 * @author Dapphub
 * @notice [Wrapped Ether](https://weth.io/) smart contract. Extends **ERC20**.
 */
interface IWETH9 is IERC20Metadata {

    /// @notice Emitted when **ETH** is wrapped.
    event Deposit(address indexed dst, uint wad);
    /// @notice Emitted when **ETH** is unwrapped.
    event Withdrawal(address indexed src, uint wad);

    /**
     * @notice Wraps Ether. **WETH** will be minted to the sender at 1 **ETH** : 1 **WETH**.
     */
    receive() external payable;

    /**
     * @notice Wraps Ether. **WETH** will be minted to the sender at 1 **ETH** : 1 **WETH**.
     */
    fallback () external payable;

    /**
     * @notice Wraps Ether. **WETH** will be minted to the sender at 1 **ETH** : 1 **WETH**.
     */
    function deposit() external payable;

    /**
     * @notice Unwraps Ether. **ETH** will be returned to the sender at 1 **ETH** : 1 **WETH**.
     * @param wad Amount to unwrap.
     */
    function withdraw(uint wad) external;
}


/*
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

*/

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"governance_","type":"address"},{"internalType":"address","name":"registry_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":false,"internalType":"address","name":"user","type":"address"}],"name":"CooldownStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"}],"name":"CooldownStopped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint40","name":"cooldownMin","type":"uint40"},{"indexed":false,"internalType":"uint40","name":"cooldownMax","type":"uint40"}],"name":"CooldownWindowSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositor","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"DepositMade","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"FundsSent","type":"event"},{"anonymous":false,"inputs":[],"name":"GovernanceLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pendingGovernance","type":"address"}],"name":"GovernancePending","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldGovernance","type":"address"},{"indexed":false,"internalType":"address","name":"newGovernance","type":"address"}],"name":"GovernanceTransferred","type":"event"},{"anonymous":false,"inputs":[],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"requestor","type":"address"}],"name":"RequestorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"requestor","type":"address"}],"name":"RequestorRemoved","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":[],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"withdrawer","type":"address"},{"indexed":true,"internalType":"uint256","name":"value","type":"uint256"}],"name":"WithdrawalMade","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"requestor","type":"address"}],"name":"addRequestor","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":"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":"user","type":"address"}],"name":"canTransfer","outputs":[{"internalType":"bool","name":"status","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"canWithdraw","outputs":[{"internalType":"bool","name":"status","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cooldownMax","outputs":[{"internalType":"uint40","name":"","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cooldownMin","outputs":[{"internalType":"uint40","name":"","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"cooldownStart","outputs":[{"internalType":"uint40","name":"","type":"uint40"}],"stateMutability":"view","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":[],"name":"depositEth","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositWeth","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governanceIsLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[{"internalType":"address","name":"dst","type":"address"}],"name":"isRequestor","outputs":[{"internalType":"bool","name":"status","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"maxRedeemableShares","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","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":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"paused_","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":[],"name":"pricePerShare","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"requestor","type":"address"}],"name":"removeRequestor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"requestEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint40","name":"cooldownMin_","type":"uint40"},{"internalType":"uint40","name":"cooldownMax_","type":"uint40"}],"name":"setCooldownWindow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingGovernance_","type":"address"}],"name":"setPendingGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startCooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stopCooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"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":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"withdrawEth","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"withdrawWeth","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101406040527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961012052600a8054600160a01b600160f01b031916665c49000000127560a71b1790553480156200005657600080fd5b50604051620039923803806200399283398101604081905262000079916200048b565b816040518060400160405280600f81526020016e29b7b630b1b29021a8102a37b5b2b760891b81525080604051806040016040528060018152602001603160f81b8152506040518060400160405280600f81526020016e29b7b630b1b29021a8102a37b5b2b760891b8152506040518060400160405280600381526020016205343560ec1b815250816003908051906020019062000119929190620003a3565b5080516200012f906004906020840190620003a3565b5050825160209384012082519284019290922060c083815260e08290524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818a0181905281830198909852606081019590955260808086019390935230858301528051808603909201825293909201909252805194019390932090925261010052505060016006556001600160a01b0381166200021d5760405162461bcd60e51b815260206004820152601760248201527f7a65726f206164647265737320676f7665726e616e636500000000000000000060448201526064015b60405180910390fd5b600780546001600160a01b0319166001600160a01b03928316179055600880546001600160a81b03191690558116620002995760405162461bcd60e51b815260206004820152601560248201527f7a65726f20616464726573732072656769737472790000000000000000000000604482015260640162000214565b600a80546001600160a01b0319166001600160a01b03831690811790915560408051633fc8cef360e01b8152905160009291633fc8cef3916004808301926020929190829003018186803b158015620002f157600080fd5b505afa15801562000306573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200032c919062000466565b90506001600160a01b0381166200037a5760405162461bcd60e51b81526020600482015260116024820152700f4cae4de40c2c8c8e4cae6e640eecae8d607b1b604482015260640162000214565b600980546001600160a01b0319166001600160a01b039290921691909117905550620005009050565b828054620003b190620004c3565b90600052602060002090601f016020900481019282620003d5576000855562000420565b82601f10620003f057805160ff191683800117855562000420565b8280016001018555821562000420579182015b828111156200042057825182559160200191906001019062000403565b506200042e92915062000432565b5090565b5b808211156200042e576000815560010162000433565b80516001600160a01b03811681146200046157600080fd5b919050565b6000602082840312156200047957600080fd5b620004848262000449565b9392505050565b600080604083850312156200049f57600080fd5b620004aa8362000449565b9150620004ba6020840162000449565b90509250929050565b600181811c90821680620004d857607f821691505b60208210811415620004fa57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e0516101005161012051613442620005506000396000611bfc015260006123eb0152600061243a0152600061241501526000612399015260006123c201526134426000f3fe6080604052600436106102a55760003560e01c8063680ff45811610161578063a457c2d7116100ca578063cfc99d6911610084578063dd62ed3e11610061578063dd62ed3e1461077d578063f39c38a0146107c3578063ffa2e783146107e157005b8063cfc99d691461071d578063d505accf1461073d578063dd0bea131461075d57005b8063abbf4b17116100b2578063abbf4b17146106d3578063bb5ec9e2146106e8578063c311d049146106fd57005b8063a457c2d714610693578063a9059cbb146106b357005b80638456cb591161011b5780639605dc6f116101035780639605dc6f1461063e57806399530b061461065e5780639cdc56c51461067357005b80638456cb591461061457806395d89b411461062957005b806370a082311161014957806370a082311461059e57806378fc3cb3146105d45780637ecebe00146105f457005b8063680ff45814610569578063690e0dda1461057e57005b80632440d81c1161020e5780633e322e77116101c8578063521b18bd116101a5578063521b18bd146104f55780635aa6e675146105185780635c975abb1461054a57005b80633e322e77146104b85780633f4ba83a146104d8578063439370b1146104ed57005b8063313ce567116101f6578063313ce567146104675780633644e51514610483578063395093511461049857005b80632440d81c146103f1578063307b178e1461044457005b806318160ddd1161025f5780631c930221116102475780631c9302211461039d578063238efcbc146103bc57806323b872dd146103d157005b806318160ddd1461036857806319262d301461037d57005b8063095ea7b31161028d578063095ea7b3146102f85780630abb6035146103285780631260b97e1461034857005b806301e1d114146102ae57806306fdde03146102d657005b366102ac57005b005b3480156102ba57600080fd5b506102c361081a565b6040519081526020015b60405180910390f35b3480156102e257600080fd5b506102eb610829565b6040516102cd91906132b4565b34801561030457600080fd5b506103186103133660046131e5565b6108bb565b60405190151581526020016102cd565b34801561033457600080fd5b506102ac6103433660046130ba565b6108d1565b34801561035457600080fd5b506102ac610363366004613233565b6109ce565b34801561037457600080fd5b506002546102c3565b34801561038957600080fd5b506103186103983660046130ba565b610bd8565b3480156103a957600080fd5b50600854600160a01b900460ff16610318565b3480156103c857600080fd5b506102ac610c45565b3480156103dd57600080fd5b506103186103ec36600461312d565b610db8565b3480156103fd57600080fd5b5061042e61040c3660046130ba565b6001600160a01b03166000908152600b602052604090205464ffffffffff1690565b60405164ffffffffff90911681526020016102cd565b34801561045057600080fd5b50600a54600160a01b900464ffffffffff1661042e565b34801561047357600080fd5b50604051601281526020016102cd565b34801561048f57600080fd5b506102c3610e77565b3480156104a457600080fd5b506103186104b33660046131e5565b610e81565b3480156104c457600080fd5b506102ac6104d33660046130ba565b610ebd565b3480156104e457600080fd5b506102ac610ffa565b6102c36110c8565b34801561050157600080fd5b50600a54600160c81b900464ffffffffff1661042e565b34801561052457600080fd5b506007546001600160a01b03165b6040516001600160a01b0390911681526020016102cd565b34801561055657600080fd5b50600854600160a81b900460ff16610318565b34801561057557600080fd5b506102ac611135565b34801561058a57600080fd5b506102c3610599366004613233565b611190565b3480156105aa57600080fd5b506102c36105b93660046130ba565b6001600160a01b031660009081526020819052604090205490565b3480156105e057600080fd5b506103186105ef3660046130ba565b611216565b34801561060057600080fd5b506102c361060f3660046130ba565b611273565b34801561062057600080fd5b506102ac611293565b34801561063557600080fd5b506102eb611367565b34801561064a57600080fd5b506102ac6106593660046130ba565b611376565b34801561066a57600080fd5b506102c36114b6565b34801561067f57600080fd5b506102c361068e3660046130ba565b61150a565b34801561069f57600080fd5b506103186106ae3660046131e5565b61167f565b3480156106bf57600080fd5b506103186106ce3660046131e5565b611730565b3480156106df57600080fd5b506102ac61173d565b3480156106f457600080fd5b506102ac6118a4565b34801561070957600080fd5b506102c3610718366004613233565b6118f0565b34801561072957600080fd5b506102ac610738366004613265565b611a0a565b34801561074957600080fd5b506102ac61075836600461316e565b611ba8565b34801561076957600080fd5b506102c3610778366004613233565b611d0c565b34801561078957600080fd5b506102c36107983660046130f4565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156107cf57600080fd5b506008546001600160a01b0316610532565b3480156107ed57600080fd5b506103186107fc3660046130ba565b6001600160a01b03166000908152600c602052604090205460ff1690565b6000610824611ea9565b905090565b606060038054610838906133a9565b80601f0160208091040260200160405190810160405280929190818152602001828054610864906133a9565b80156108b15780601f10610886576101008083540402835291602001916108b1565b820191906000526020600020905b81548152906001019060200180831161089457829003601f168201915b5050505050905090565b60006108c8338484611f33565b50600192915050565b600854600160a01b900460ff16156109245760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b60448201526064015b60405180910390fd5b6007546001600160a01b0316331461096c5760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b6008805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527fd61ed858909d3cb796547804c47dc1550d27455f8a0037b6b487e46212392396906020015b60405180910390a150565b60026006541415610a215760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161091b565b6002600655336000908152600c602052604090205460ff16610a855760405162461bcd60e51b815260206004820152600a60248201527f21726571756573746f7200000000000000000000000000000000000000000000604482015260640161091b565b47811115610b84576000610a994783613340565b6009546040516370a0823160e01b8152306004820152919250600091610b22916001600160a01b0316906370a082319060240160206040518083038186803b158015610ae457600080fd5b505afa158015610af8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1c919061324c565b83612057565b600954604051632e1a7d4d60e01b8152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610b6957600080fd5b505af1158015610b7d573d6000803e3d6000fd5b5050505050505b6000610b908247612057565b9050610b9c338261206d565b6040518181527f8ff98a7f9bedb57df86769d07998b067fba595272053e3690d3412aff560a82c9060200160405180910390a150506001600655565b6001600160a01b0381166000908152600b60205260408120548190610c049064ffffffffff1642613357565b600a5490915064ffffffffff808316600160a01b9092041611801590610c3e5750600a5464ffffffffff600160c81b909104811690821611155b9392505050565b600854600160a01b900460ff1615610c935760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6008546001600160a01b03163314610ced5760405162461bcd60e51b815260206004820152601360248201527f2170656e64696e6720676f7665726e616e636500000000000000000000000000604482015260640161091b565b6008546001600160a01b0316610d455760405162461bcd60e51b815260206004820152600f60248201527f7a65726f20676f7665726e616e63650000000000000000000000000000000000604482015260640161091b565b60078054600880546001600160a01b0380821673ffffffffffffffffffffffffffffffffffffffff19808616821790965594909116909155604080519190921680825260208201939093527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce8091016109c3565b6000610dc584848461218b565b6001600160a01b038416600090815260016020908152604080832033845290915290205482811015610e5f5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606482015260840161091b565b610e6c8533858403611f33565b506001949350505050565b6000610824612395565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916108c8918590610eb89086906132e7565b611f33565b600854600160a01b900460ff1615610f0b5760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b03163314610f535760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b6001600160a01b038116610fa95760405162461bcd60e51b815260206004820152601660248201527f7a65726f206164647265737320726571756573746f7200000000000000000000604482015260640161091b565b6001600160a01b0381166000818152600c6020908152604091829020805460ff1916905590519182527fe929e480acbe5b02d892b64d129148a619a08b62b99f3b10cd1de6afa4e677cf91016109c3565b600854600160a01b900460ff16156110485760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b031633146110905760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b6008805460ff60a81b191690556040517fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d1693390600090a1565b60006002600654141561111d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161091b565b600260065561112b34612488565b9050600160065590565b336000818152600b6020908152604091829020805464ffffffffff19164264ffffffffff1617905590519182527f12fb46651b751f578108fdcf975602a5e366bf56deb8a96660591fe0868c8ebb91015b60405180910390a1565b6000600260065414156111e55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161091b565b6002600655600954611202906001600160a01b03163330856125b1565b61120b82612488565b600160065592915050565b6001600160a01b0381166000908152600b602052604081205464ffffffffff16816112418242613357565b905064ffffffffff8216158061126b5750600a5464ffffffffff600160c81b909104811690821610155b949350505050565b6001600160a01b0381166000908152600560205260408120545b92915050565b600854600160a01b900460ff16156112e15760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b031633146113295760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b6008805460ff60a81b1916600160a81b1790556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75290600090a1565b606060048054610838906133a9565b600854600160a01b900460ff16156113c45760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b0316331461140c5760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b6001600160a01b0381166114625760405162461bcd60e51b815260206004820152601660248201527f7a65726f206164647265737320726571756573746f7200000000000000000000604482015260640161091b565b6001600160a01b0381166000818152600c6020908152604091829020805460ff1916600117905590519182527f4279aa72d7a23ea11304d52d5c6f695e96adf7490e3a124f6c82ce8ba491d57f91016109c3565b60006114c160025490565b15806114d257506114d0611ea9565b155b6114fd576002546114e1611ea9565b6114f390670de0b6b3a7640000613321565b61082491906132ff565b50670de0b6b3a764000090565b6001600160a01b038116600090815260208190526040812054600061152e82612649565b611536611ea9565b6115409190613340565b90506000600a60009054906101000a90046001600160a01b03166001600160a01b031663478426636040518163ffffffff1660e01b815260040160206040518083038186803b15801561159257600080fd5b505afa1580156115a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ca91906130d7565b6001600160a01b0316635b36de5f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561160257600080fd5b505afa158015611616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163a919061324c565b9050808210156116765760008161164f611ea9565b6116599190613340565b905061166c61166782612649565b612685565b9695505050505050565b50909392505050565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156117195760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161091b565b6117263385858403611f33565b5060019392505050565b60006108c833848461218b565b600854600160a01b900460ff161561178b5760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b031633146117d35760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b60088054600780546001600160a01b0373ffffffffffffffffffffffffffffffffffffffff1990911681179091557fffffffffffffffffffffff0000000000000000000000000000000000000000009091167401ffffffffffffffffffffffffffffffffffffffff179091556040805133815260208101929092527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80910160405180910390a16040517fd572292b9e5d684b0719ae2d0e210513b477e303c975ed1c63b6fcac1607672790600090a1565b336000818152600b6020908152604091829020805464ffffffffff1916905590519182527fd21500b99c287ae81ef15bd2c01f4f13f539dbe938ad36ef3ac896fbe7ddae989101611186565b6000600260065414156119455760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161091b565b6002600655611953826126bb565b9050478111156119c9576009546001600160a01b0316632e1a7d4d6119784784613340565b6040518263ffffffff1660e01b815260040161199691815260200190565b600060405180830381600087803b1580156119b057600080fd5b505af11580156119c4573d6000803e3d6000fd5b505050505b6119d3338261206d565b604051819033907fbc158bb64f05d6383aea69bbb0b20c1bbf4b7a18f63359c5649b7c39e29d388490600090a36001600655919050565b600854600160a01b900460ff1615611a585760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b03163314611aa05760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b8064ffffffffff168264ffffffffff161115611afe5760405162461bcd60e51b815260206004820152600e60248201527f696e76616c69642077696e646f77000000000000000000000000000000000000604482015260640161091b565b600a80547fffff00000000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b64ffffffffff8581169182027fffff0000000000ffffffffffffffffffffffffffffffffffffffffffffffffff1692909217600160c81b928516928302179092556040805192835260208301919091527fd8a6e0794cb304389d471d1a6eac591e432e867c44dd1ba69aad2841717bd30b910160405180910390a15050565b83421115611bf85760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161091b565b60007f0000000000000000000000000000000000000000000000000000000000000000888888611c278c6128eb565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000611c8282612913565b90506000611c9282878787612961565b9050896001600160a01b0316816001600160a01b031614611cf55760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161091b565b611d008a8a8a611f33565b50505050505050505050565b600060026006541415611d615760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161091b565b6002600655611d6f826126bb565b6009546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a082319060240160206040518083038186803b158015611db857600080fd5b505afa158015611dcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df0919061324c565b905080821115611e5a576009546001600160a01b031663d0e30db0611e158385613340565b6040518263ffffffff1660e01b81526004016000604051808303818588803b158015611e4057600080fd5b505af1158015611e54573d6000803e3d6000fd5b50505050505b600954611e71906001600160a01b03163384612b0a565b604051829033907fbc158bb64f05d6383aea69bbb0b20c1bbf4b7a18f63359c5649b7c39e29d388490600090a3506001600655919050565b6009546040516370a0823160e01b815230600482015260009147916001600160a01b03909116906370a082319060240160206040518083038186803b158015611ef157600080fd5b505afa158015611f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f29919061324c565b61082491906132e7565b6001600160a01b038316611f955760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161091b565b6001600160a01b038216611ff65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161091b565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008183106120665781610c3e565b5090919050565b804710156120bd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161091b565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461210a576040519150601f19603f3d011682016040523d82523d6000602084013e61210f565b606091505b50509050806121865760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161091b565b505050565b6001600160a01b0383166122075760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161091b565b6001600160a01b0382166122695760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161091b565b612274838383612b3a565b6001600160a01b038316600090815260208190526040902054818110156123035760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161091b565b6001600160a01b0380851660009081526020819052604080822085850390559185168152908120805484929061233a9084906132e7565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161238691815260200190565b60405180910390a35b50505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614156123e457507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600854600090600160a81b900460ff16156124e55760405162461bcd60e51b815260206004820152601b60248201527f63616e6e6f74206465706f736974207768696c65207061757365640000000000604482015260640161091b565b336000908152600b602052604090205464ffffffffff161561251d57336000908152600b60205260409020805464ffffffffff191690555b600061252860025490565b9050600083612535611ea9565b61253f9190613340565b9050600082158061254e575081155b61256c578161255d8487613321565b61256791906132ff565b61256e565b845b905061257a3382612c6b565b6040518190869033907f0b05f0d1cd0819f155b8a61f60baf7767c1ee49d04aeaab701df236140eb93f990600090a4949350505050565b6040516001600160a01b038085166024830152831660448201526064810182905261238f9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612d56565b600061265460025490565b1561267d57600254612664611ea9565b61266e9084613321565b61267891906132ff565b61128d565b600092915050565b600080612690611ea9565b1161269c57600061128d565b6126a4611ea9565b6002546126b19084613321565b61128d91906132ff565b3360009081526020819052604081205482111561271a5760405162461bcd60e51b815260206004820152601860248201527f696e73756666696369656e74207363702062616c616e63650000000000000000604482015260640161091b565b600061272583612649565b600854909150600160a81b900460ff166128e157600a5460408051634784266360e01b815290516000926001600160a01b0316916347842663916004808301926020929190829003018186803b15801561277e57600080fd5b505afa158015612792573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127b691906130d7565b6001600160a01b0316635b36de5f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156127ee57600080fd5b505afa158015612802573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612826919061324c565b90508082612832611ea9565b61283c9190613340565b101561288a5760405162461bcd60e51b815260206004820152601360248201527f696e73756666696369656e742061737365747300000000000000000000000000604482015260640161091b565b61289333610bd8565b6128df5760405162461bcd60e51b815260206004820152601660248201527f6e6f7420696e20636f6f6c646f776e2077696e646f7700000000000000000000604482015260640161091b565b505b61128d3384612e3b565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b600061128d612920612395565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156129de5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161091b565b8360ff16601b14806129f357508360ff16601c145b612a4a5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161091b565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015612a9e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612b015760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161091b565b95945050505050565b6040516001600160a01b03831660248201526044810182905261218690849063a9059cbb60e01b906064016125e5565b6001600160a01b03831615801590612b5a57506001600160a01b03821615155b1561218657600854600160a81b900460ff1661218657600a546001600160a01b038085166000908152600b602052604080822054928616825281205464ffffffffff600160c81b9094048416939283169216904290612bb98483613357565b90506000612bc78484613357565b905064ffffffffff85161580612beb57508564ffffffffff168264ffffffffff1610155b8015612c14575064ffffffffff84161580612c1457508564ffffffffff168164ffffffffff1610155b612c605760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f74207472616e7366657220647572696e6720636f6f6c646f776e00604482015260640161091b565b505050505050505050565b6001600160a01b038216612cc15760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161091b565b612ccd60008383612b3a565b8060026000828254612cdf91906132e7565b90915550506001600160a01b03821660009081526020819052604081208054839290612d0c9084906132e7565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6000612dab826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612f959092919063ffffffff16565b8051909150156121865780806020019051810190612dc99190613211565b6121865760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161091b565b6001600160a01b038216612e9b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161091b565b612ea782600083612b3a565b6001600160a01b03821660009081526020819052604090205481811015612f1b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161091b565b6001600160a01b0383166000908152602081905260408120838303905560028054849290612f4a908490613340565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b606061126b848460008585843b612fee5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161091b565b600080866001600160a01b0316858760405161300a9190613298565b60006040518083038185875af1925050503d8060008114613047576040519150601f19603f3d011682016040523d82523d6000602084013e61304c565b606091505b509150915061305c828286613067565b979650505050505050565b60608315613076575081610c3e565b8251156130865782518084602001fd5b8160405162461bcd60e51b815260040161091b91906132b4565b803564ffffffffff811681146130b557600080fd5b919050565b6000602082840312156130cc57600080fd5b8135610c3e816133f4565b6000602082840312156130e957600080fd5b8151610c3e816133f4565b6000806040838503121561310757600080fd5b8235613112816133f4565b91506020830135613122816133f4565b809150509250929050565b60008060006060848603121561314257600080fd5b833561314d816133f4565b9250602084013561315d816133f4565b929592945050506040919091013590565b600080600080600080600060e0888a03121561318957600080fd5b8735613194816133f4565b965060208801356131a4816133f4565b95506040880135945060608801359350608088013560ff811681146131c857600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156131f857600080fd5b8235613203816133f4565b946020939093013593505050565b60006020828403121561322357600080fd5b81518015158114610c3e57600080fd5b60006020828403121561324557600080fd5b5035919050565b60006020828403121561325e57600080fd5b5051919050565b6000806040838503121561327857600080fd5b613281836130a0565b915061328f602084016130a0565b90509250929050565b600082516132aa81846020870161337d565b9190910192915050565b60208152600082518060208401526132d381604085016020870161337d565b601f01601f19169190910160400192915050565b600082198211156132fa576132fa6133de565b500190565b60008261331c57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561333b5761333b6133de565b500290565b600082821015613352576133526133de565b500390565b600064ffffffffff83811690831681811015613375576133756133de565b039392505050565b60005b83811015613398578181015183820152602001613380565b8381111561238f5750506000910152565b600181811c908216806133bd57607f821691505b6020821081141561290d57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461340957600080fd5b5056fea2646970667358221220e6c73291bb51e0d624774e2775cf8de098a6f1b287078866fcadc09964a96a7564736f6c63430008060033000000000000000000000000501ace0e8d16b92236763e2ded7ae3bc2dffa276000000000000000000000000501acee3310d98881c827d4357c970f23a30ad29

Deployed Bytecode

0x6080604052600436106102a55760003560e01c8063680ff45811610161578063a457c2d7116100ca578063cfc99d6911610084578063dd62ed3e11610061578063dd62ed3e1461077d578063f39c38a0146107c3578063ffa2e783146107e157005b8063cfc99d691461071d578063d505accf1461073d578063dd0bea131461075d57005b8063abbf4b17116100b2578063abbf4b17146106d3578063bb5ec9e2146106e8578063c311d049146106fd57005b8063a457c2d714610693578063a9059cbb146106b357005b80638456cb591161011b5780639605dc6f116101035780639605dc6f1461063e57806399530b061461065e5780639cdc56c51461067357005b80638456cb591461061457806395d89b411461062957005b806370a082311161014957806370a082311461059e57806378fc3cb3146105d45780637ecebe00146105f457005b8063680ff45814610569578063690e0dda1461057e57005b80632440d81c1161020e5780633e322e77116101c8578063521b18bd116101a5578063521b18bd146104f55780635aa6e675146105185780635c975abb1461054a57005b80633e322e77146104b85780633f4ba83a146104d8578063439370b1146104ed57005b8063313ce567116101f6578063313ce567146104675780633644e51514610483578063395093511461049857005b80632440d81c146103f1578063307b178e1461044457005b806318160ddd1161025f5780631c930221116102475780631c9302211461039d578063238efcbc146103bc57806323b872dd146103d157005b806318160ddd1461036857806319262d301461037d57005b8063095ea7b31161028d578063095ea7b3146102f85780630abb6035146103285780631260b97e1461034857005b806301e1d114146102ae57806306fdde03146102d657005b366102ac57005b005b3480156102ba57600080fd5b506102c361081a565b6040519081526020015b60405180910390f35b3480156102e257600080fd5b506102eb610829565b6040516102cd91906132b4565b34801561030457600080fd5b506103186103133660046131e5565b6108bb565b60405190151581526020016102cd565b34801561033457600080fd5b506102ac6103433660046130ba565b6108d1565b34801561035457600080fd5b506102ac610363366004613233565b6109ce565b34801561037457600080fd5b506002546102c3565b34801561038957600080fd5b506103186103983660046130ba565b610bd8565b3480156103a957600080fd5b50600854600160a01b900460ff16610318565b3480156103c857600080fd5b506102ac610c45565b3480156103dd57600080fd5b506103186103ec36600461312d565b610db8565b3480156103fd57600080fd5b5061042e61040c3660046130ba565b6001600160a01b03166000908152600b602052604090205464ffffffffff1690565b60405164ffffffffff90911681526020016102cd565b34801561045057600080fd5b50600a54600160a01b900464ffffffffff1661042e565b34801561047357600080fd5b50604051601281526020016102cd565b34801561048f57600080fd5b506102c3610e77565b3480156104a457600080fd5b506103186104b33660046131e5565b610e81565b3480156104c457600080fd5b506102ac6104d33660046130ba565b610ebd565b3480156104e457600080fd5b506102ac610ffa565b6102c36110c8565b34801561050157600080fd5b50600a54600160c81b900464ffffffffff1661042e565b34801561052457600080fd5b506007546001600160a01b03165b6040516001600160a01b0390911681526020016102cd565b34801561055657600080fd5b50600854600160a81b900460ff16610318565b34801561057557600080fd5b506102ac611135565b34801561058a57600080fd5b506102c3610599366004613233565b611190565b3480156105aa57600080fd5b506102c36105b93660046130ba565b6001600160a01b031660009081526020819052604090205490565b3480156105e057600080fd5b506103186105ef3660046130ba565b611216565b34801561060057600080fd5b506102c361060f3660046130ba565b611273565b34801561062057600080fd5b506102ac611293565b34801561063557600080fd5b506102eb611367565b34801561064a57600080fd5b506102ac6106593660046130ba565b611376565b34801561066a57600080fd5b506102c36114b6565b34801561067f57600080fd5b506102c361068e3660046130ba565b61150a565b34801561069f57600080fd5b506103186106ae3660046131e5565b61167f565b3480156106bf57600080fd5b506103186106ce3660046131e5565b611730565b3480156106df57600080fd5b506102ac61173d565b3480156106f457600080fd5b506102ac6118a4565b34801561070957600080fd5b506102c3610718366004613233565b6118f0565b34801561072957600080fd5b506102ac610738366004613265565b611a0a565b34801561074957600080fd5b506102ac61075836600461316e565b611ba8565b34801561076957600080fd5b506102c3610778366004613233565b611d0c565b34801561078957600080fd5b506102c36107983660046130f4565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156107cf57600080fd5b506008546001600160a01b0316610532565b3480156107ed57600080fd5b506103186107fc3660046130ba565b6001600160a01b03166000908152600c602052604090205460ff1690565b6000610824611ea9565b905090565b606060038054610838906133a9565b80601f0160208091040260200160405190810160405280929190818152602001828054610864906133a9565b80156108b15780601f10610886576101008083540402835291602001916108b1565b820191906000526020600020905b81548152906001019060200180831161089457829003601f168201915b5050505050905090565b60006108c8338484611f33565b50600192915050565b600854600160a01b900460ff16156109245760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b60448201526064015b60405180910390fd5b6007546001600160a01b0316331461096c5760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b6008805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527fd61ed858909d3cb796547804c47dc1550d27455f8a0037b6b487e46212392396906020015b60405180910390a150565b60026006541415610a215760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161091b565b6002600655336000908152600c602052604090205460ff16610a855760405162461bcd60e51b815260206004820152600a60248201527f21726571756573746f7200000000000000000000000000000000000000000000604482015260640161091b565b47811115610b84576000610a994783613340565b6009546040516370a0823160e01b8152306004820152919250600091610b22916001600160a01b0316906370a082319060240160206040518083038186803b158015610ae457600080fd5b505afa158015610af8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1c919061324c565b83612057565b600954604051632e1a7d4d60e01b8152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610b6957600080fd5b505af1158015610b7d573d6000803e3d6000fd5b5050505050505b6000610b908247612057565b9050610b9c338261206d565b6040518181527f8ff98a7f9bedb57df86769d07998b067fba595272053e3690d3412aff560a82c9060200160405180910390a150506001600655565b6001600160a01b0381166000908152600b60205260408120548190610c049064ffffffffff1642613357565b600a5490915064ffffffffff808316600160a01b9092041611801590610c3e5750600a5464ffffffffff600160c81b909104811690821611155b9392505050565b600854600160a01b900460ff1615610c935760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6008546001600160a01b03163314610ced5760405162461bcd60e51b815260206004820152601360248201527f2170656e64696e6720676f7665726e616e636500000000000000000000000000604482015260640161091b565b6008546001600160a01b0316610d455760405162461bcd60e51b815260206004820152600f60248201527f7a65726f20676f7665726e616e63650000000000000000000000000000000000604482015260640161091b565b60078054600880546001600160a01b0380821673ffffffffffffffffffffffffffffffffffffffff19808616821790965594909116909155604080519190921680825260208201939093527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce8091016109c3565b6000610dc584848461218b565b6001600160a01b038416600090815260016020908152604080832033845290915290205482811015610e5f5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606482015260840161091b565b610e6c8533858403611f33565b506001949350505050565b6000610824612395565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916108c8918590610eb89086906132e7565b611f33565b600854600160a01b900460ff1615610f0b5760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b03163314610f535760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b6001600160a01b038116610fa95760405162461bcd60e51b815260206004820152601660248201527f7a65726f206164647265737320726571756573746f7200000000000000000000604482015260640161091b565b6001600160a01b0381166000818152600c6020908152604091829020805460ff1916905590519182527fe929e480acbe5b02d892b64d129148a619a08b62b99f3b10cd1de6afa4e677cf91016109c3565b600854600160a01b900460ff16156110485760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b031633146110905760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b6008805460ff60a81b191690556040517fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d1693390600090a1565b60006002600654141561111d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161091b565b600260065561112b34612488565b9050600160065590565b336000818152600b6020908152604091829020805464ffffffffff19164264ffffffffff1617905590519182527f12fb46651b751f578108fdcf975602a5e366bf56deb8a96660591fe0868c8ebb91015b60405180910390a1565b6000600260065414156111e55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161091b565b6002600655600954611202906001600160a01b03163330856125b1565b61120b82612488565b600160065592915050565b6001600160a01b0381166000908152600b602052604081205464ffffffffff16816112418242613357565b905064ffffffffff8216158061126b5750600a5464ffffffffff600160c81b909104811690821610155b949350505050565b6001600160a01b0381166000908152600560205260408120545b92915050565b600854600160a01b900460ff16156112e15760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b031633146113295760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b6008805460ff60a81b1916600160a81b1790556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75290600090a1565b606060048054610838906133a9565b600854600160a01b900460ff16156113c45760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b0316331461140c5760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b6001600160a01b0381166114625760405162461bcd60e51b815260206004820152601660248201527f7a65726f206164647265737320726571756573746f7200000000000000000000604482015260640161091b565b6001600160a01b0381166000818152600c6020908152604091829020805460ff1916600117905590519182527f4279aa72d7a23ea11304d52d5c6f695e96adf7490e3a124f6c82ce8ba491d57f91016109c3565b60006114c160025490565b15806114d257506114d0611ea9565b155b6114fd576002546114e1611ea9565b6114f390670de0b6b3a7640000613321565b61082491906132ff565b50670de0b6b3a764000090565b6001600160a01b038116600090815260208190526040812054600061152e82612649565b611536611ea9565b6115409190613340565b90506000600a60009054906101000a90046001600160a01b03166001600160a01b031663478426636040518163ffffffff1660e01b815260040160206040518083038186803b15801561159257600080fd5b505afa1580156115a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ca91906130d7565b6001600160a01b0316635b36de5f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561160257600080fd5b505afa158015611616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163a919061324c565b9050808210156116765760008161164f611ea9565b6116599190613340565b905061166c61166782612649565b612685565b9695505050505050565b50909392505050565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156117195760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161091b565b6117263385858403611f33565b5060019392505050565b60006108c833848461218b565b600854600160a01b900460ff161561178b5760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b031633146117d35760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b60088054600780546001600160a01b0373ffffffffffffffffffffffffffffffffffffffff1990911681179091557fffffffffffffffffffffff0000000000000000000000000000000000000000009091167401ffffffffffffffffffffffffffffffffffffffff179091556040805133815260208101929092527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80910160405180910390a16040517fd572292b9e5d684b0719ae2d0e210513b477e303c975ed1c63b6fcac1607672790600090a1565b336000818152600b6020908152604091829020805464ffffffffff1916905590519182527fd21500b99c287ae81ef15bd2c01f4f13f539dbe938ad36ef3ac896fbe7ddae989101611186565b6000600260065414156119455760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161091b565b6002600655611953826126bb565b9050478111156119c9576009546001600160a01b0316632e1a7d4d6119784784613340565b6040518263ffffffff1660e01b815260040161199691815260200190565b600060405180830381600087803b1580156119b057600080fd5b505af11580156119c4573d6000803e3d6000fd5b505050505b6119d3338261206d565b604051819033907fbc158bb64f05d6383aea69bbb0b20c1bbf4b7a18f63359c5649b7c39e29d388490600090a36001600655919050565b600854600160a01b900460ff1615611a585760405162461bcd60e51b815260206004820152601160248201527019dbdd995c9b985b98d9481b1bd8dad959607a1b604482015260640161091b565b6007546001600160a01b03163314611aa05760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015260640161091b565b8064ffffffffff168264ffffffffff161115611afe5760405162461bcd60e51b815260206004820152600e60248201527f696e76616c69642077696e646f77000000000000000000000000000000000000604482015260640161091b565b600a80547fffff00000000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b64ffffffffff8581169182027fffff0000000000ffffffffffffffffffffffffffffffffffffffffffffffffff1692909217600160c81b928516928302179092556040805192835260208301919091527fd8a6e0794cb304389d471d1a6eac591e432e867c44dd1ba69aad2841717bd30b910160405180910390a15050565b83421115611bf85760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161091b565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888611c278c6128eb565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000611c8282612913565b90506000611c9282878787612961565b9050896001600160a01b0316816001600160a01b031614611cf55760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161091b565b611d008a8a8a611f33565b50505050505050505050565b600060026006541415611d615760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161091b565b6002600655611d6f826126bb565b6009546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a082319060240160206040518083038186803b158015611db857600080fd5b505afa158015611dcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df0919061324c565b905080821115611e5a576009546001600160a01b031663d0e30db0611e158385613340565b6040518263ffffffff1660e01b81526004016000604051808303818588803b158015611e4057600080fd5b505af1158015611e54573d6000803e3d6000fd5b50505050505b600954611e71906001600160a01b03163384612b0a565b604051829033907fbc158bb64f05d6383aea69bbb0b20c1bbf4b7a18f63359c5649b7c39e29d388490600090a3506001600655919050565b6009546040516370a0823160e01b815230600482015260009147916001600160a01b03909116906370a082319060240160206040518083038186803b158015611ef157600080fd5b505afa158015611f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f29919061324c565b61082491906132e7565b6001600160a01b038316611f955760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161091b565b6001600160a01b038216611ff65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161091b565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008183106120665781610c3e565b5090919050565b804710156120bd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161091b565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461210a576040519150601f19603f3d011682016040523d82523d6000602084013e61210f565b606091505b50509050806121865760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161091b565b505050565b6001600160a01b0383166122075760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161091b565b6001600160a01b0382166122695760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161091b565b612274838383612b3a565b6001600160a01b038316600090815260208190526040902054818110156123035760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161091b565b6001600160a01b0380851660009081526020819052604080822085850390559185168152908120805484929061233a9084906132e7565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161238691815260200190565b60405180910390a35b50505050565b60007f00000000000000000000000000000000000000000000000000000000000000014614156123e457507faf31643530437448f8d0cdaf61439e17fe56a332b1780963f09a7b2a685b36e990565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f7d7344af8dc6a296dedb6679f2a556bc4a38a7295f84db2e4cf8980a424df8ea828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600854600090600160a81b900460ff16156124e55760405162461bcd60e51b815260206004820152601b60248201527f63616e6e6f74206465706f736974207768696c65207061757365640000000000604482015260640161091b565b336000908152600b602052604090205464ffffffffff161561251d57336000908152600b60205260409020805464ffffffffff191690555b600061252860025490565b9050600083612535611ea9565b61253f9190613340565b9050600082158061254e575081155b61256c578161255d8487613321565b61256791906132ff565b61256e565b845b905061257a3382612c6b565b6040518190869033907f0b05f0d1cd0819f155b8a61f60baf7767c1ee49d04aeaab701df236140eb93f990600090a4949350505050565b6040516001600160a01b038085166024830152831660448201526064810182905261238f9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612d56565b600061265460025490565b1561267d57600254612664611ea9565b61266e9084613321565b61267891906132ff565b61128d565b600092915050565b600080612690611ea9565b1161269c57600061128d565b6126a4611ea9565b6002546126b19084613321565b61128d91906132ff565b3360009081526020819052604081205482111561271a5760405162461bcd60e51b815260206004820152601860248201527f696e73756666696369656e74207363702062616c616e63650000000000000000604482015260640161091b565b600061272583612649565b600854909150600160a81b900460ff166128e157600a5460408051634784266360e01b815290516000926001600160a01b0316916347842663916004808301926020929190829003018186803b15801561277e57600080fd5b505afa158015612792573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127b691906130d7565b6001600160a01b0316635b36de5f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156127ee57600080fd5b505afa158015612802573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612826919061324c565b90508082612832611ea9565b61283c9190613340565b101561288a5760405162461bcd60e51b815260206004820152601360248201527f696e73756666696369656e742061737365747300000000000000000000000000604482015260640161091b565b61289333610bd8565b6128df5760405162461bcd60e51b815260206004820152601660248201527f6e6f7420696e20636f6f6c646f776e2077696e646f7700000000000000000000604482015260640161091b565b505b61128d3384612e3b565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b600061128d612920612395565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156129de5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161091b565b8360ff16601b14806129f357508360ff16601c145b612a4a5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161091b565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015612a9e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612b015760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161091b565b95945050505050565b6040516001600160a01b03831660248201526044810182905261218690849063a9059cbb60e01b906064016125e5565b6001600160a01b03831615801590612b5a57506001600160a01b03821615155b1561218657600854600160a81b900460ff1661218657600a546001600160a01b038085166000908152600b602052604080822054928616825281205464ffffffffff600160c81b9094048416939283169216904290612bb98483613357565b90506000612bc78484613357565b905064ffffffffff85161580612beb57508564ffffffffff168264ffffffffff1610155b8015612c14575064ffffffffff84161580612c1457508564ffffffffff168164ffffffffff1610155b612c605760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f74207472616e7366657220647572696e6720636f6f6c646f776e00604482015260640161091b565b505050505050505050565b6001600160a01b038216612cc15760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161091b565b612ccd60008383612b3a565b8060026000828254612cdf91906132e7565b90915550506001600160a01b03821660009081526020819052604081208054839290612d0c9084906132e7565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6000612dab826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612f959092919063ffffffff16565b8051909150156121865780806020019051810190612dc99190613211565b6121865760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161091b565b6001600160a01b038216612e9b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161091b565b612ea782600083612b3a565b6001600160a01b03821660009081526020819052604090205481811015612f1b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161091b565b6001600160a01b0383166000908152602081905260408120838303905560028054849290612f4a908490613340565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b606061126b848460008585843b612fee5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161091b565b600080866001600160a01b0316858760405161300a9190613298565b60006040518083038185875af1925050503d8060008114613047576040519150601f19603f3d011682016040523d82523d6000602084013e61304c565b606091505b509150915061305c828286613067565b979650505050505050565b60608315613076575081610c3e565b8251156130865782518084602001fd5b8160405162461bcd60e51b815260040161091b91906132b4565b803564ffffffffff811681146130b557600080fd5b919050565b6000602082840312156130cc57600080fd5b8135610c3e816133f4565b6000602082840312156130e957600080fd5b8151610c3e816133f4565b6000806040838503121561310757600080fd5b8235613112816133f4565b91506020830135613122816133f4565b809150509250929050565b60008060006060848603121561314257600080fd5b833561314d816133f4565b9250602084013561315d816133f4565b929592945050506040919091013590565b600080600080600080600060e0888a03121561318957600080fd5b8735613194816133f4565b965060208801356131a4816133f4565b95506040880135945060608801359350608088013560ff811681146131c857600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156131f857600080fd5b8235613203816133f4565b946020939093013593505050565b60006020828403121561322357600080fd5b81518015158114610c3e57600080fd5b60006020828403121561324557600080fd5b5035919050565b60006020828403121561325e57600080fd5b5051919050565b6000806040838503121561327857600080fd5b613281836130a0565b915061328f602084016130a0565b90509250929050565b600082516132aa81846020870161337d565b9190910192915050565b60208152600082518060208401526132d381604085016020870161337d565b601f01601f19169190910160400192915050565b600082198211156132fa576132fa6133de565b500190565b60008261331c57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561333b5761333b6133de565b500290565b600082821015613352576133526133de565b500390565b600064ffffffffff83811690831681811015613375576133756133de565b039392505050565b60005b83811015613398578181015183820152602001613380565b8381111561238f5750506000910152565b600181811c908216806133bd57607f821691505b6020821081141561290d57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461340957600080fd5b5056fea2646970667358221220e6c73291bb51e0d624774e2775cf8de098a6f1b287078866fcadc09964a96a7564736f6c63430008060033

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

000000000000000000000000501ace0e8d16b92236763e2ded7ae3bc2dffa276000000000000000000000000501acee3310d98881c827d4357c970f23a30ad29

-----Decoded View---------------
Arg [0] : governance_ (address): 0x501AcE0e8D16B92236763E2dEd7aE3bc2DFfA276
Arg [1] : registry_ (address): 0x501aCEE3310d98881c827d4357C970F23a30AD29

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000501ace0e8d16b92236763e2ded7ae3bc2dffa276
Arg [1] : 000000000000000000000000501acee3310d98881c827d4357c970f23a30ad29


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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