ETH Price: $3,254.28 (-2.34%)
 

Overview

Max Total Supply

2,415.930189984301723142 brahTOPG

Holders

6

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Balance
0 brahTOPG

Value
$0.00
0x3f9c5f2aad00247be0e79f332c5016bc2e2be5c1
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
Vault

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

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

import "openzeppelin-contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
import "openzeppelin-contracts/token/ERC20/IERC20.sol";
import "openzeppelin-contracts/token/ERC20/utils/SafeERC20.sol";
import "openzeppelin-contracts/security/ReentrancyGuard.sol";

import "./libraries/AddArrayLib.sol";

import "./interfaces/ITradeExecutor.sol";
import "./interfaces/IVault.sol";
import "./interfaces/ISlippageAccounter.sol";

/// @title vault (Brahma Vault)
/// @author 0xAd1 and Bapireddy
/// @notice Minimal vault contract to support trades across different protocols.
contract Vault is IVault, ERC20Permit, ReentrancyGuard {
    using AddrArrayLib for AddrArrayLib.Addresses;
    using SafeERC20 for IERC20;
    /*///////////////////////////////////////////////////////////////
                                 CONSTANTS
    //////////////////////////////////////////////////////////////*/
    /// @notice The maximum number of blocks for latest update to be valid.
    /// @dev Needed for processing deposits/withdrawals.

    uint256 constant BLOCK_LIMIT = 50;
    /// @dev minimum balance used to check when executor is removed.
    uint256 constant DUST_LIMIT = 10**6;
    /// @dev The max basis points used as normalizing factor.
    uint256 constant MAX_BPS = 1e4;
    /// @dev The max amount of seconds in year.
    /// accounting for leap years there are 365.25 days in year.
    ///  365.25 * 86400 = 31557600.0
    uint256 constant MAX_SECONDS = 31557600;

    /*///////////////////////////////////////////////////////////////
                                IMMUTABLES
    //////////////////////////////////////////////////////////////*/
    /// @notice The underlying token the vault accepts.
    address public immutable override wantToken;
    uint8 private immutable tokenDecimals;

    /*///////////////////////////////////////////////////////////////
                            MUTABLE ACCESS MODFIERS
    //////////////////////////////////////////////////////////////*/
    /// @notice boolean for enabling deposit/withdraw solely via batcher.
    bool public batcherOnlyDeposit;

    /// @notice boolean for enabling emergency mode to halt new withdrawal/deposits into vault.
    bool public emergencyMode;

    /// @notice address of batcher used for batching user deposits/withdrawals.
    address public override batcher;

    /// @notice address of zapper authorised to withdraw and deposit funds on behalf of user
    address public override zapper;
    /// @notice keeper address to move funds between executors.
    address public override keeper;
    /// @notice Governance address to add/remove  executors.
    address public override governance;
    address public pendingGovernance;

    /// @notice address of slippage accounting contract
    address public slippageAccounter;

    /// @notice Creates a new Vault that accepts a specific underlying token.
    /// @param _wantToken The ERC20 compliant token the vault should accept.
    /// @param _name The name of the vault token.
    /// @param _symbol The symbol of the vault token.
    /// @param _keeper The address of the keeper to move funds between executors.
    /// @param _governance The address of the governance to perform governance functions.
    constructor(
        string memory _name,
        string memory _symbol,
        address _wantToken,
        address _keeper,
        address _governance,
        address _slippageAccounter,
        uint256 _depositCap
    ) ERC20(_name, _symbol) ERC20Permit(_name) {
        tokenDecimals = IERC20Metadata(_wantToken).decimals();
        wantToken = _wantToken;
        keeper = _keeper;
        governance = _governance;
        // to prevent any front running deposits
        batcherOnlyDeposit = true;
        slippageAccounter = _slippageAccounter;
        depositCap = _depositCap;
    }

    function decimals() public view override returns (uint8) {
        return tokenDecimals;
    }

    /*///////////////////////////////////////////////////////////////
                       USER DEPOSIT/WITHDRAWAL LOGIC
    //////////////////////////////////////////////////////////////*/

    uint256 public depositCap;

    /// @notice Initiates a deposit of want tokens to the vault.
    /// @param amountIn The amount of want tokens to deposit.
    /// @param receiver The address to receive vault tokens.
    function deposit(uint256 amountIn, address receiver)
        external 
        override
        nonReentrant
        returns (uint256 shares)
    {
        /// checks for only batcher deposit
        // onlyBatcher();
        isValidAddress(receiver);
        require(amountIn > 0, "ZERO_AMOUNT");
        uint256 amountWithSlippage = ISlippageAccounter(slippageAccounter)
            .getSlippageAccountedAmount(amountIn);
        // calculate the shares based on the amount.
        shares = totalSupply() > 0
            ? (totalSupply() * amountWithSlippage) / totalVaultFunds()
            : amountWithSlippage;
        require(shares != 0, "ZERO_SHARES");
        IERC20(wantToken).safeTransferFrom(msg.sender, address(this), amountIn);
        _mint(receiver, shares);
        require(totalSupply() <= depositCap, "MAX_DEPOSIT_BREACHED");
    }

    /// @notice Initiates a withdrawal of vault tokens to the user.
    /// @param sharesIn The amount of vault tokens to withdraw.
    /// @param receiver The address to receive the vault tokens.
    function withdraw(uint256 sharesIn, address receiver)
        external
        override
        nonReentrant
        returns (uint256 amountOut)
    {
        /// checks for only batcher withdrawal
        onlyBatcher();
        isValidAddress(receiver);
        require(sharesIn > 0, "ZERO_SHARES");
        // calculate the amount based on the shares.
        amountOut = (sharesIn * totalVaultFunds()) / totalSupply();
        // burn shares of msg.sender
        _burn(msg.sender, sharesIn);
        /// charging executionFee
        if (executionFee > 0) {
            uint256 fee = (amountOut * executionFee) / MAX_BPS;
            amountOut = amountOut - fee;
        }
        IERC20(wantToken).safeTransfer(receiver, amountOut);
    }

    /// @notice Calculates the total amount of underlying tokens the vault holds.
    /// @return The total amount of underlying tokens the vault holds.
    function totalVaultFunds() public view returns (uint256) {
        return
            IERC20(wantToken).balanceOf(address(this)) +
            totalExecutorFunds() -
            feesCollected;
    }

    /*///////////////////////////////////////////////////////////////
                    EXECUTOR DEPOSIT/WITHDRAWAL LOGIC
    //////////////////////////////////////////////////////////////*/

    /// @notice list of trade executors connected to vault.
    AddrArrayLib.Addresses tradeExecutorsList;

    /// @notice Emitted after the vault deposits into a executor contract.
    /// @param executor The executor that was deposited into.
    /// @param underlyingAmount The amount of underlying tokens that were deposited.
    event ExecutorDeposit(address indexed executor, uint256 underlyingAmount);

    /// @notice Emitted after the vault withdraws funds from a executor contract.
    /// @param executor The executor that was withdrawn from.
    /// @param underlyingAmount The amount of underlying tokens that were withdrawn.
    event ExecutorWithdrawal(
        address indexed executor,
        uint256 underlyingAmount
    );

    /// @notice Deposit given amount of want tokens into valid executor.
    /// @param _executor The executor to deposit into.
    /// @param _amount The amount of want tokens to deposit.
    function depositIntoExecutor(address _executor, uint256 _amount)
        external
        nonReentrant
        ensureFeesAreCollected
    {
        isActiveExecutor(_executor);
        onlyKeeper();
        require(_amount > 0, "ZERO_AMOUNT");
        IERC20(wantToken).safeTransfer(_executor, _amount);
        emit ExecutorDeposit(_executor, _amount);
    }

    /// @notice Withdraw given amount of want tokens into valid executor.
    /// @param _executor The executor to withdraw tokens from.
    /// @param _amount The amount of want tokens to withdraw.

    function withdrawFromExecutor(address _executor, uint256 _amount)
        external
        nonReentrant
        ensureFeesAreCollected
    {
        isActiveExecutor(_executor);
        onlyKeeper();
        require(_amount > 0, "ZERO_AMOUNT");
        IERC20(wantToken).safeTransferFrom(_executor, address(this), _amount);
        emit ExecutorWithdrawal(_executor, _amount);
    }

    /*///////////////////////////////////////////////////////////////
                           FEE CONFIGURATION
    //////////////////////////////////////////////////////////////*/
    /// @notice lagging value of vault total funds.
    /// @dev value intialized to max to prevent slashing on first deposit.
    uint256 public prevVaultFunds = type(uint256).max;
    /// @dev value intialized to max to prevent slashing on first deposit.
    uint256 public lastReportedTime = type(uint256).max;
    /// @dev Perfomance fee for the vault.
    uint256 public performanceFee;
    /// @notice Fee denominated in MAX_BPS charged during exit.
    uint256 public executionFee;
    /// @notice Mangement fee for operating the vault.
    uint256 public managementFee;

    uint256 public feesCollected;

    /// @notice Emitted after perfomance fee updation.
    /// @param oldFee The old performance fee on vault.
    /// @param newFee The new performance fee on vault.
    event UpdatePerformanceFee(uint256 oldFee, uint256 newFee);

    /// @notice Updates the performance fee on the vault.
    /// @param _fee The new performance fee on the vault.
    /// @dev The new fee must be always less than 50% of yield.
    function setPerformanceFee(uint256 _fee) external {
        onlyGovernance();
        require(_fee < MAX_BPS / 2, "FEE_TOO_HIGH");
        emit UpdatePerformanceFee(performanceFee, _fee);
        performanceFee = _fee;
    }

    /// @notice Emitted after exit fee updation.
    /// @param oldFee The old exit fee on vault.
    /// @param newFee The new exit fee on vault.
    event UpdateexecutionFee(uint256 oldFee, uint256 newFee);

    /// @notice Function to set exit fee on the vault, can only be called by governance
    /// @param _fee Address of fee
    function setExecutionFee(uint256 _fee) external {
        onlyGovernance();
        require(_fee < MAX_BPS / 2, "EXIT_FEE_TOO_HIGH");
        emit UpdateexecutionFee(executionFee, _fee);
        executionFee = _fee;
    }

    /// @notice Emitted after management fee updation.
    /// @param oldFee The old management fee on vault.
    /// @param newFee The new management fee on vault.
    event UpdateManagementFee(uint256 oldFee, uint256 newFee);

    /// @notice Function to set exit fee on the vault, can only be called by governance
    /// @param _fee Address of fee
    function setManagementFee(uint256 _fee) external {
        onlyGovernance();
        require(_fee < MAX_BPS / 2, "EXIT_FEE_TOO_HIGH");
        emit UpdateManagementFee(managementFee, _fee);
        managementFee = _fee;
    }

    /// @notice Emitted when a fees are collected.
    /// @param collectedFees The amount of fees collected.
    event FeesCollected(uint256 collectedFees);

    /// @notice Calculates and collects the fees from the vault.
    /// @dev This function stores fees to be collected in state
    /// checks the yield made since previous harvest and
    /// calculates the fee based on it. Also note: this function
    /// should be called before processing any new deposits/withdrawals.
    function collectFees() internal {
        uint256 currentFunds = totalVaultFunds();
        uint256 fees = 0;
        // collect fees only when profit is made.
        if ((performanceFee > 0) && (currentFunds > prevVaultFunds)) {
            uint256 yieldEarned = (currentFunds - prevVaultFunds);
            // normalization by MAX_BPS
            fees += ((yieldEarned * performanceFee) / MAX_BPS);
        }
        if ((managementFee > 0) && (lastReportedTime < block.timestamp)) {
            uint256 duration = block.timestamp - lastReportedTime;
            fees +=
                ((duration * managementFee * currentFunds) / MAX_SECONDS) /
                MAX_BPS;
        }

        feesCollected += fees;
    }

    modifier ensureFeesAreCollected() {
        collectFees();
        _;
        // update vault funds after fees are collected.
        prevVaultFunds = totalVaultFunds();
        // update lastReportedTime after fees are collected.
        lastReportedTime = block.timestamp;
    }

    /// @notice Sends collected fees to governance
    function claimFees() external {
        onlyKeeper();
        if (feesCollected > 0) {
            uint256 amount = feesCollected;
            feesCollected = 0;
            IERC20(wantToken).safeTransfer(governance, amount);
            emit FeesCollected(amount);
        }
    }

    /*///////////////////////////////////////////////////////////////
                    EXECUTOR ADDITION/REMOVAL LOGIC
    //////////////////////////////////////////////////////////////*/
    /// @notice Emitted when executor is added to vault.
    /// @param executor The address of added executor.
    event ExecutorAdded(address indexed executor);

    /// @notice Emitted when executor is removed from vault.
    /// @param executor The address of removed executor.
    event ExecutorRemoved(address indexed executor);

    /// @notice Adds a trade executor, enabling it to execute trades.
    /// @param _tradeExecutor The address of _tradeExecutor contract.
    function addExecutor(address _tradeExecutor) external {
        onlyGovernance();
        isValidAddress(_tradeExecutor);
        require(
            ITradeExecutor(_tradeExecutor).vault() == address(this),
            "INVALID_VAULT"
        );
        require(
            IERC20(wantToken).allowance(_tradeExecutor, address(this)) > 0,
            "NO_ALLOWANCE"
        );
        tradeExecutorsList.pushAddress(_tradeExecutor);
        emit ExecutorAdded(_tradeExecutor);
    }

    /// @notice Adds a trade executor, enabling it to execute trades.
    /// @param _tradeExecutor The address of _tradeExecutor contract.
    /// @dev make sure all funds are withdrawn from executor before removing.
    function removeExecutor(address _tradeExecutor) external {
        onlyGovernance();
        isValidAddress(_tradeExecutor);
        // check if executor attached to vault.
        isActiveExecutor(_tradeExecutor);

        (uint256 executorFunds, uint256 blockUpdated) = ITradeExecutor(
            _tradeExecutor
        ).totalFunds();
        areFundsUpdated(blockUpdated);
        require(executorFunds < DUST_LIMIT, "FUNDS_TOO_HIGH");
        tradeExecutorsList.removeAddress(_tradeExecutor);
        emit ExecutorRemoved(_tradeExecutor);
    }

    /// @notice gives the number of trade executors.
    /// @return The number of trade executors.
    function totalExecutors() public view returns (uint256) {
        return tradeExecutorsList.size();
    }

    /// @notice Returns trade executor at given index.
    /// @return The executor address at given valid index.
    function executorByIndex(uint256 _index) public view returns (address) {
        return tradeExecutorsList.getAddressAtIndex(_index);
    }

    /// @notice Calculates funds held by all executors in want token.
    /// @return Sum of all funds held by executors.
    function totalExecutorFunds() public view returns (uint256) {
        uint256 totalFunds = 0;
        for (uint256 i = 0; i < totalExecutors(); i++) {
            address executor = executorByIndex(i);
            (uint256 executorFunds, uint256 blockUpdated) = ITradeExecutor(
                executor
            ).totalFunds();
            areFundsUpdated(blockUpdated);
            totalFunds += executorFunds;
        }
        return totalFunds;
    }

    /*///////////////////////////////////////////////////////////////
                    GOVERNANCE ACTIONS
    //////////////////////////////////////////////////////////////*/

    function setDepositCap(uint256 _depositCap) external {
        onlyGovernance();
        depositCap = _depositCap;
    }

    /// @notice Emitted when a batcher is updated.
    /// @param oldBatcher The address of the current batcher.
    /// @param newBatcher The  address of new batcher.
    event UpdatedBatcher(
        address indexed oldBatcher,
        address indexed newBatcher
    );

    /// @notice Changes the batcher address.
    /// @dev  This can only be called by governance.
    /// @param _batcher The address to for new batcher.
    function setBatcher(address _batcher) external {
        onlyGovernance();
        emit UpdatedBatcher(batcher, _batcher);
        batcher = _batcher;
    }

    /// @notice Emitted when a zapper is updated.
    /// @param oldZapper The address of the current zapper.
    /// @param newZapper The  address of new zapper.
    event UpdatedZapper(address indexed oldZapper, address indexed newZapper);

    /// @notice Changes the zapper address.
    /// @dev  This can only be called by governance.
    /// @param _zapper The address to for new zapper.
    function setZapper(address _zapper) external {
        onlyGovernance();
        emit UpdatedZapper(zapper, _zapper);
        zapper = _zapper;
    }

    /// @notice Emitted batcherOnlyDeposit is enabled.
    /// @param state The state of depositing only via batcher.
    event UpdatedBatcherOnlyDeposit(bool state);

    /// @notice Enables/disables deposits with batcher only.
    /// @dev  This can only be called by governance.
    /// @param _batcherOnlyDeposit if true vault can accept deposit via batcher only or else anyone can deposit.
    function setBatcherOnlyDeposit(bool _batcherOnlyDeposit) external {
        onlyGovernance();
        batcherOnlyDeposit = _batcherOnlyDeposit;
        emit UpdatedBatcherOnlyDeposit(_batcherOnlyDeposit);
    }

    /// @notice Nominates new governance address.
    /// @dev  Governance will only be changed if the new governance accepts it. It will be pending till then.
    /// @param _governance The address of new governance.
    function setGovernance(address _governance) external {
        onlyGovernance();
        pendingGovernance = _governance;
    }

    /// @notice Emitted when governance is updated.
    /// @param oldGovernance The address of the current governance.
    /// @param newGovernance The address of new governance.
    event UpdatedGovernance(
        address indexed oldGovernance,
        address indexed newGovernance
    );

    /// @notice The nomine of new governance address proposed by `setGovernance` function can accept the governance.
    /// @dev  This can only be called by address of pendingGovernance.
    function acceptGovernance() public {
        require(msg.sender == pendingGovernance, "INVALID_ADDRESS");
        emit UpdatedGovernance(governance, pendingGovernance);
        governance = pendingGovernance;
    }

    /// @notice Emitted when keeper is updated.
    /// @param oldKeeper The address of the old keeper.
    /// @param newKeeper The address of the new keeper.
    event UpdatedKeeper(address indexed oldKeeper, address indexed newKeeper);

    /// @notice Sets new keeper address.
    /// @dev  This can only be called by governance.
    /// @param _keeper The address of new keeper.
    function setKeeper(address _keeper) public {
        onlyGovernance();
        emit UpdatedKeeper(keeper, _keeper);
        keeper = _keeper;
    }

    /// @notice Emitted when emergencyMode status is updated.
    /// @param emergencyMode boolean indicating state of emergency.
    event EmergencyModeStatus(bool emergencyMode);

    /// @notice sets emergencyMode.
    /// @dev  This can only be called by governance.
    /// @param _emergencyMode if true, vault will be in emergency mode.
    function setEmergencyMode(bool _emergencyMode) public {
        onlyGovernance();
        emergencyMode = _emergencyMode;
        batcherOnlyDeposit = true;
        batcher = address(0);
        emit EmergencyModeStatus(_emergencyMode);
    }

    /// @notice Emitted when accounter is updated.
    /// @param oldAccounter The address of the old accounter.
    /// @param newAccounter The address of the new accounter.
    event UpdatedSlippageAccounter(
        address indexed oldAccounter,
        address indexed newAccounter
    );

    /// @notice sets SlippageAccounter.
    /// @dev  This can only be called by governance.
    /// @param _slippageAccounter if true, vault will be in emergency mode.
    function setSlippageAccounter(address _slippageAccounter) public {
        onlyGovernance();
        emit UpdatedKeeper(slippageAccounter, _slippageAccounter);
        slippageAccounter = _slippageAccounter;
    }

    /// @notice Removes invalid tokens from the vault.
    /// @dev  This is used as fail safe to remove want tokens from the vault during emergency mode
    /// can be called by anyone to send funds to governance.
    /// @param _token The address of token to be removed.
    function sweep(address _token) public {
        isEmergencyMode();
        IERC20(_token).safeTransfer(
            governance,
            IERC20(_token).balanceOf(address(this))
        );
    }

    /*///////////////////////////////////////////////////////////////
                    ACCESS MODIFERS
    //////////////////////////////////////////////////////////////*/
    /// @dev Checks if the sender is the governance.
    function onlyGovernance() internal view {
        require(msg.sender == governance, "ONLY_GOV");
    }

    /// @dev Checks if the sender is the keeper.
    function onlyKeeper() internal view {
        require(msg.sender == keeper, "ONLY_KEEPER");
    }

    /// @dev Checks if the sender is the batcher.
    function onlyBatcher() internal view {
        if (batcherOnlyDeposit) {
            require(msg.sender == batcher, "ONLY_BATCHER");
        }
    }

    /// @dev Checks if emergency mode is enabled.
    function isEmergencyMode() internal view {
        require(emergencyMode == true, "EMERGENCY_MODE");
    }

    /// @dev Checks if the address is valid.
    function isValidAddress(address _addr) internal pure {
        require(_addr != address(0), "NULL_ADDRESS");
    }

    /// @dev Checks if the tradeExecutor is valid.
    function isActiveExecutor(address _tradeExecutor) internal view {
        require(tradeExecutorsList.exists(_tradeExecutor), "INVALID_EXECUTOR");
    }

    /// @dev Checks if funds are updated.
    function areFundsUpdated(uint256 _blockUpdated) internal view {
        require(
            block.number <= _blockUpdated + BLOCK_LIMIT,
            "FUNDS_NOT_UPDATED"
        );
    }
}

File 2 of 19 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

File 3 of 19 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead 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:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, 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}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, 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}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, 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) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, 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) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * 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:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, 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;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _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;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _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 Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - 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 4 of 19 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 5 of 19 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

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 6 of 19 : draft-ERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol)

pragma solidity ^0.8.0;

import "./draft-IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/cryptography/EIP712.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 constant _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    /**
     * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.
     * However, to ensure consistency with the upgradeable transpiler, we will continue
     * to reserve a slot.
     * @custom:oz-renamed-from _PERMIT_TYPEHASH
     */
    // solhint-disable-next-line var-name-mixedcase
    bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;

    /**
     * @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 7 of 19 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 8 of 19 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 10 of 19 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 11 of 19 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

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 12 of 19 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

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

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

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

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

File 13 of 19 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 14 of 19 : 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;
    address private immutable _CACHED_THIS;

    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);
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _CACHED_THIS && 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 19 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 16 of 19 : ISlippageAccounter.sol
/// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

interface ISlippageAccounter {
    function getSlippageAccountedAmount(uint256 amountIn)
        external
        returns (uint256);
}

File 17 of 19 : ITradeExecutor.sol
/// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;

interface ITradeExecutor {
    function vault() external view returns (address);

    // function withdraw(bytes calldata _data) external;

    function totalFunds()
        external
        view
        returns (uint256 posValue, uint256 lastUpdatedBlock);
}

File 18 of 19 : IVault.sol
/// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

interface IVault {
    function keeper() external view returns (address);

    function governance() external view returns (address);

    function wantToken() external view returns (address);

    function deposit(uint256 amountIn, address receiver) external returns (uint256 shares);

    function withdraw(uint256 sharesIn, address receiver) external returns (uint256 amountOut);
    function batcher() external view returns (address);
    function zapper() external view returns (address);
}

File 19 of 19 : AddArrayLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library AddrArrayLib {
    using AddrArrayLib for Addresses;

    struct Addresses {
        address[] _items;
    }

    /**
     * @notice push an address to the array
     * @dev if the address already exists, it will not be added again
     * @param self Storage array containing address type variables
     * @param element the element to add in the array
     */
    function pushAddress(Addresses storage self, address element) internal {
        if (!exists(self, element)) {
            self._items.push(element);
        }
    }

    /**
     * @notice remove an address from the array
     * @dev finds the element, swaps it with the last element, and then deletes it;
     * @param self Storage array containing address type variables
     * @param element the element to remove from the array
     */
    function removeAddress(Addresses storage self, address element) internal {
        for (uint256 i = 0; i < self.size(); i++) {
            if (self._items[i] == element) {
                self._items[i] = self._items[self.size() - 1];
                self._items.pop();
            }
        }
    }

    /**
     * @notice get the address at a specific index from array
     * @dev revert if the index is out of bounds
     * @param self Storage array containing address type variables
     * @param index the index in the array
     */
    function getAddressAtIndex(Addresses memory self, uint256 index) internal view returns (address) {
        require(index < size(self), "INVALID_INDEX");
        return self._items[index];
    }

    /**
     * @notice get the size of the array
     * @param self Storage array containing address type variables
     */
    function size(Addresses memory self) internal view returns (uint256) {
        return self._items.length;
    }

    /**
     * @notice check if an element exist in the array
     * @param self Storage array containing address type variables
     * @param element the element to check if it exists in the array
     */
    function exists(Addresses memory self, address element) internal view returns (bool) {
        for (uint256 i = 0; i < self.size(); i++) {
            if (self._items[i] == element) {
                return true;
            }
        }
        return false;
    }

    /**
     * @notice get the array
     * @param self Storage array containing address type variables
     */
    function getAllAddresses(Addresses memory self) internal view returns (address[] memory) {
        return self._items;
    }
}

Settings
{
  "remappings": [
    "@chainlink/=lib/gearbox/node_modules/@chainlink/",
    "@ensdomains/=lib/gearbox/node_modules/@ensdomains/",
    "@gearbox-protocol/=lib/integrations-v2/node_modules/@gearbox-protocol/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@solbase/=lib/zolidity/lib/solbase/",
    "@std/=lib/zolidity/lib/forge-std/src/",
    "core-v2/=lib/core-v2/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "gearbox/=lib/gearbox/",
    "gearbox_core/=lib/core-v2/contracts/",
    "gearbox_integrations/=lib/integrations-v2/contracts/",
    "hardhat/=lib/gearbox/node_modules/hardhat/",
    "integrations-v2/=lib/integrations-v2/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "solbase/=lib/zolidity/lib/solbase/src/",
    "zolidity/=lib/zolidity/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_wantToken","type":"address"},{"internalType":"address","name":"_keeper","type":"address"},{"internalType":"address","name":"_governance","type":"address"},{"internalType":"address","name":"_slippageAccounter","type":"address"},{"internalType":"uint256","name":"_depositCap","type":"uint256"}],"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":"bool","name":"emergencyMode","type":"bool"}],"name":"EmergencyModeStatus","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"executor","type":"address"}],"name":"ExecutorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"executor","type":"address"},{"indexed":false,"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"name":"ExecutorDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"executor","type":"address"}],"name":"ExecutorRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"executor","type":"address"},{"indexed":false,"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"name":"ExecutorWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"collectedFees","type":"uint256"}],"name":"FeesCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"UpdateManagementFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"UpdatePerformanceFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldBatcher","type":"address"},{"indexed":true,"internalType":"address","name":"newBatcher","type":"address"}],"name":"UpdatedBatcher","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"state","type":"bool"}],"name":"UpdatedBatcherOnlyDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldGovernance","type":"address"},{"indexed":true,"internalType":"address","name":"newGovernance","type":"address"}],"name":"UpdatedGovernance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldKeeper","type":"address"},{"indexed":true,"internalType":"address","name":"newKeeper","type":"address"}],"name":"UpdatedKeeper","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldAccounter","type":"address"},{"indexed":true,"internalType":"address","name":"newAccounter","type":"address"}],"name":"UpdatedSlippageAccounter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldZapper","type":"address"},{"indexed":true,"internalType":"address","name":"newZapper","type":"address"}],"name":"UpdatedZapper","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"UpdateexecutionFee","type":"event"},{"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":"_tradeExecutor","type":"address"}],"name":"addExecutor","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":[],"name":"batcher","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"batcherOnlyDeposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_executor","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositIntoExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"executionFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"executorByIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feesCollected","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"keeper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastReportedTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"managementFee","outputs":[{"internalType":"uint256","name":"","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":"pendingGovernance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"prevVaultFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tradeExecutor","type":"address"}],"name":"removeExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_batcher","type":"address"}],"name":"setBatcher","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_batcherOnlyDeposit","type":"bool"}],"name":"setBatcherOnlyDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_depositCap","type":"uint256"}],"name":"setDepositCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_emergencyMode","type":"bool"}],"name":"setEmergencyMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setExecutionFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governance","type":"address"}],"name":"setGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_keeper","type":"address"}],"name":"setKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setManagementFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setPerformanceFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_slippageAccounter","type":"address"}],"name":"setSlippageAccounter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_zapper","type":"address"}],"name":"setZapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slippageAccounter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalExecutorFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalExecutors","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalVaultFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wantToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"sharesIn","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_executor","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawFromExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zapper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101806040526000196010556000196011553480156200001e57600080fd5b50604051620035f1380380620035f183398101604081905262000041916200038b565b8680604051806040016040528060018152602001603160f81b8152508989816003908051906020019062000077929190620001fb565b5080516200008d906004906020840190620001fb565b5050825160208085019190912083518483012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c0019052805194019390932091935091906080523060c052610120525050600160075550506040805163313ce56760e01b815290516001600160a01b038816925063313ce567916004808201926020929091908290030181865afa1580156200016e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000194919062000449565b60ff16610160526001600160a01b0394851661014052600a80549486166001600160a01b0319958616179055600b8054938616938516939093179092556008805460ff19166001179055600d805491909416921691909117909155600e5550620004b19050565b828054620002099062000475565b90600052602060002090601f0160209004810192826200022d576000855562000278565b82601f106200024857805160ff191683800117855562000278565b8280016001018555821562000278579182015b82811115620002785782518255916020019190600101906200025b565b50620002869291506200028a565b5090565b5b808211156200028657600081556001016200028b565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620002c957600080fd5b81516001600160401b0380821115620002e657620002e6620002a1565b604051601f8301601f19908116603f01168101908282118183101715620003115762000311620002a1565b816040528381526020925086838588010111156200032e57600080fd5b600091505b8382101562000352578582018301518183018401529082019062000333565b83821115620003645760008385830101525b9695505050505050565b80516001600160a01b03811681146200038657600080fd5b919050565b600080600080600080600060e0888a031215620003a757600080fd5b87516001600160401b0380821115620003bf57600080fd5b620003cd8b838c01620002b7565b985060208a0151915080821115620003e457600080fd5b50620003f38a828b01620002b7565b96505062000404604089016200036e565b945062000414606089016200036e565b935062000424608089016200036e565b92506200043460a089016200036e565b915060c0880151905092959891949750929550565b6000602082840312156200045c57600080fd5b815160ff811681146200046e57600080fd5b9392505050565b600181811c908216806200048a57607f821691505b602082108103620004ab57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e051610100516101205161014051610160516130a96200054860003960006104820152600081816106a0015281816107fb01528181610aba01528181610c31015281816111a7015281816113740152818161146801526117090152600061244c0152600061249b01526000612476015260006123cf015260006123f90152600061242301526130a96000f3fe608060405234801561001057600080fd5b50600436106103415760003560e01c80637b3d51b1116101b8578063ab73525511610104578063d505accf116100a2578063f071db5a1161007c578063f071db5a146106f9578063f39c38a014610702578063f621ff6014610715578063fe56e2321461071d57600080fd5b8063d505accf146106ca578063dbd5edc7146106dd578063dd62ed3e146106e657600080fd5b8063bc383bc5116100de578063bc383bc514610675578063be32b3f814610688578063d23e04801461069b578063d294f093146106c257600080fd5b8063ab73525514610642578063aced166114610655578063b1b3da511461066857600080fd5b80639cf46bc911610171578063a7a217121161014b578063a7a2171214610600578063a7a7a31c14610613578063a9059cbb1461061c578063ab033ea91461062f57600080fd5b80639cf46bc9146105d1578063a457c2d7146105e4578063a6f7f5d6146105f757600080fd5b80637b3d51b11461057e5780637ecebe00146105875780637f5883a21461059a57806386651203146105ad57806387788782146105c057806395d89b41146105c957600080fd5b80632478842911610292578063424351751161023057806370897b231161020a57806370897b231461051c57806370a082311461052f578063748747e614610558578063777f97661461056b57600080fd5b806342435175146104e35780635aa6e675146104f65780636e553f651461050957600080fd5b80633644e5151161026c5780633644e515146104ac57806337a063d2146104b457806339509351146104c757806340e9903b146104da57600080fd5b80632478842914610455578063303cff5314610468578063313ce5671461047b57600080fd5b8063095ea7b3116102ff57806318515a83116102d957806318515a831461041f5780631f5a0bbe14610427578063238efcbc1461043a57806323b872dd1461044257600080fd5b8063095ea7b3146103fc578063140ce45f1461040f57806318160ddd1461041757600080fd5b8062f714ce1461034657806301681a621461036c578063025a3a2914610381578063058a8e5f146103b257806306fdde03146103c55780630905f560146103da575b600080fd5b610359610354366004612c9d565b610730565b6040519081526020015b60405180910390f35b61037f61037a366004612ccd565b610832565b005b60085461039a906201000090046001600160a01b031681565b6040516001600160a01b039091168152602001610363565b61037f6103c0366004612ccd565b6108c2565b6103cd610934565b6040516103639190612d1d565b6008546103ec90610100900460ff1681565b6040519015158152602001610363565b6103ec61040a366004612d50565b6109c6565b6103596109de565b600254610359565b610359610a98565b61037f610435366004612ccd565b610b46565b61037f610d1c565b6103ec610450366004612d7c565b610dcb565b61037f610463366004612ccd565b610def565b61037f610476366004612dcb565b610f01565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610363565b610359610f51565b61037f6104c2366004612de8565b610f5b565b6103ec6104d5366004612d50565b610ff3565b61035960135481565b61037f6104f1366004612ccd565b611015565b600b5461039a906001600160a01b031681565b610359610517366004612c9d565b611079565b61037f61052a366004612de8565b61122f565b61035961053d366004612ccd565b6001600160a01b031660009081526020819052604090205490565b61037f610566366004612ccd565b6112c2565b61037f610579366004612d50565b611326565b61035960105481565b610359610595366004612ccd565b6113fc565b61037f6105a8366004612d50565b61141a565b61037f6105bb366004612de8565b6114ca565b61035960125481565b6103cd6114d7565b600d5461039a906001600160a01b031681565b6103ec6105f2366004612d50565b6114e6565b61035960145481565b60095461039a906001600160a01b031681565b61035960115481565b6103ec61062a366004612d50565b611561565b61037f61063d366004612ccd565b61156f565b61039a610650366004612de8565b611599565b600a5461039a906001600160a01b031681565b6008546103ec9060ff1681565b61037f610683366004612ccd565b611614565b61037f610696366004612dcb565b611678565b61039a7f000000000000000000000000000000000000000000000000000000000000000081565b61037f6116df565b61037f6106d8366004612e01565b611764565b610359600e5481565b6103596106f4366004612e78565b6118c8565b61035960155481565b600c5461039a906001600160a01b031681565b6103596118f3565b61037f61072b366004612de8565b611961565b600061073a6119f9565b610742611a52565b61074b82611aac565b6000831161078e5760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f53484152455360a81b60448201526064015b60405180910390fd5b600254610799610a98565b6107a39085612ebc565b6107ad9190612edb565b90506107b93384611af1565b601354156107ee576000612710601354836107d49190612ebc565b6107de9190612edb565b90506107ea8183612efd565b9150505b6108226001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383611c25565b61082c6001600755565b92915050565b61083a611c88565b600b546040516370a0823160e01b81523060048201526108bf916001600160a01b0390811691908416906370a0823190602401602060405180830381865afa15801561088a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ae9190612f14565b6001600160a01b0384169190611c25565b50565b6108ca611cd6565b6008546040516001600160a01b038084169262010000900416907f6d039a6d5f36163cbc30fe5c1a15856df293a5769543d5deca1fb7a9ab29bf7790600090a3600880546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60606003805461094390612f2d565b80601f016020809104026020016040519081016040528092919081815260200182805461096f90612f2d565b80156109bc5780601f10610991576101008083540402835291602001916109bc565b820191906000526020600020905b81548152906001019060200180831161099f57829003601f168201915b5050505050905090565b6000336109d4818585611d1b565b5060019392505050565b600080805b6109eb6118f3565b811015610a925760006109fd82611599565b9050600080826001600160a01b031663968ed6006040518163ffffffff1660e01b81526004016040805180830381865afa158015610a3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a639190612f61565b91509150610a7081611e37565b610a7a8286612f85565b94505050508080610a8a90612f9d565b9150506109e3565b50919050565b6000601554610aa56109de565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610b09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2d9190612f14565b610b379190612f85565b610b419190612efd565b905090565b610b4e611cd6565b610b5781611aac565b306001600160a01b0316816001600160a01b031663fbfa77cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190612fb6565b6001600160a01b031614610c095760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d590555315609a1b6044820152606401610785565b604051636eb1769f60e11b81526001600160a01b0382811660048301523060248301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063dd62ed3e90604401602060405180830381865afa158015610c7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9e9190612f14565b11610cda5760405162461bcd60e51b815260206004820152600c60248201526b4e4f5f414c4c4f57414e434560a01b6044820152606401610785565b610ce5600f82611e85565b6040516001600160a01b038216907fae5b7c3b000f575c241001dc9bcb3d8778376889353b07121115574eceff78c590600090a250565b600c546001600160a01b03163314610d685760405162461bcd60e51b815260206004820152600f60248201526e494e56414c49445f4144445245535360881b6044820152606401610785565b600c54600b546040516001600160a01b0392831692909116907fff0b32b909f3fb702fe6ac1f682adcca675b9dfaa03ad8f46b4b17c4058a93fc90600090a3600c54600b80546001600160a01b0319166001600160a01b03909216919091179055565b600033610dd9858285611f24565b610de4858585611f9e565b506001949350505050565b610df7611cd6565b610e0081611aac565b610e0981612142565b600080826001600160a01b031663968ed6006040518163ffffffff1660e01b81526004016040805180830381865afa158015610e49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6d9190612f61565b91509150610e7a81611e37565b620f42408210610ebd5760405162461bcd60e51b815260206004820152600e60248201526d08caa9c88a6bea89e9ebe90928e960931b6044820152606401610785565b610ec8600f846121f7565b6040516001600160a01b038416907f4a2cf608bfb427f53279ec7f0eadf48913b9346ccefc3af138dbdec14ea0907d90600090a2505050565b610f09611cd6565b6008805460ff19168215159081179091556040519081527faffd159acb2f0eec86675a846365f4908afe82bcb6f2e273e2703ead071a2617906020015b60405180910390a150565b6000610b416123c2565b610f63611cd6565b610f706002612710612edb565b8110610fb25760405162461bcd60e51b815260206004820152601160248201527008ab092a8be8c8a8abea89e9ebe90928e9607b1b6044820152606401610785565b60135460408051918252602082018390527ff381bb752db332774ae373d793ee53c3b08b44a3d91427779b4b92d2f1fa9e5c910160405180910390a1601355565b6000336109d481858561100683836118c8565b6110109190612f85565b611d1b565b61101d611cd6565b6009546040516001600160a01b038084169216907f37a41cdba90d4506e998ac22dac49054fc03f2815555d49ad4d2e65204bc205290600090a3600980546001600160a01b0319166001600160a01b0392909216919091179055565b60006110836119f9565b61108c82611aac565b600083116110ac5760405162461bcd60e51b815260040161078590612fd3565b600d5460405163bc1c353560e01b8152600481018590526000916001600160a01b03169063bc1c3535906024016020604051808303816000875af11580156110f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111c9190612f14565b9050600061112960025490565b11611134578061115a565b61113c610a98565b8161114660025490565b6111509190612ebc565b61115a9190612edb565b91508160000361119a5760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f53484152455360a81b6044820152606401610785565b6111cf6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330876124e9565b6111d98383612521565b600e5460025411156112245760405162461bcd60e51b815260206004820152601460248201527313505617d1115413d4d25517d094915050d2115160621b6044820152606401610785565b5061082c6001600755565b611237611cd6565b6112446002612710612edb565b81106112815760405162461bcd60e51b815260206004820152600c60248201526b08c8a8abea89e9ebe90928e960a31b6044820152606401610785565b60125460408051918252602082018390527f17519bd6596326e94ff406f9632728407b34e99c6ee45960b15bba05d67874c4910160405180910390a1601255565b6112ca611cd6565b600a546040516001600160a01b038084169216907f60ed9ffad04b70bf58c43b18d1f0e54642250116c1137ac1cc4831449124350890600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b61132e6119f9565b6113366125e0565b61133f82612142565b6113476126c8565b600081116113675760405162461bcd60e51b815260040161078590612fd3565b61139c6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168330846124e9565b816001600160a01b03167f2331b9a387a0c1b9069a5b1a48cd8c566440a10c1e58654d04d03fad21055196826040516113d791815260200190565b60405180910390a26113e7610a98565b601055426011556113f86001600755565b5050565b6001600160a01b03811660009081526005602052604081205461082c565b6114226119f9565b61142a6125e0565b61143382612142565b61143b6126c8565b6000811161145b5760405162461bcd60e51b815260040161078590612fd3565b61148f6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383611c25565b816001600160a01b03167f2f40f96629e48b44c1173c05df5811e217b0cce3bc7aef3dde4a4625be7c844b826040516113d791815260200190565b6114d2611cd6565b600e55565b60606004805461094390612f2d565b600033816114f482866118c8565b9050838110156115545760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610785565b610de48286868403611d1b565b6000336109d4818585611f9e565b611577611cd6565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b60408051600f80546020818102840185018552830181815260009461082c948794909390928492909184918401828280156115fd57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115df575b50505050508152505061271090919063ffffffff16565b61161c611cd6565b600d546040516001600160a01b038084169216907f60ed9ffad04b70bf58c43b18d1f0e54642250116c1137ac1cc4831449124350890600090a3600d80546001600160a01b0319166001600160a01b0392909216919091179055565b611680611cd6565b6008805462010000600160b01b031960ff19841515610100021661ffff19909216919091176001171690556040517fcc6bda015b6cb89b378ac6dc0294b882c1d0d41b117a7c7a0adb80d8ea7076cb90610f4690831515815260200190565b6116e76126c8565b6015541561176257601580546000909155600b54611732906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911683611c25565b6040518181527f860c0aa5520013080c2f65981705fcdea474d9f7c3daf954656ed5e65d692d1f90602001610f46565b565b834211156117b45760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610785565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886117e38c61277d565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061183e826127a3565b9050600061184e828787876127f1565b9050896001600160a01b0316816001600160a01b0316146118b15760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610785565b6118bc8a8a8a611d1b565b50505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60408051600f805460208181028401850185528301818152600094610b4194939284929184919084018282801561195357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611935575b505050505081525050515190565b611969611cd6565b6119766002612710612edb565b81106119b85760405162461bcd60e51b815260206004820152601160248201527008ab092a8be8c8a8abea89e9ebe90928e9607b1b6044820152606401610785565b60145460408051918252602082018390527f29b9d7a7d8a7a3ac22c295e4517723bc4e386eea60173e59e6da1dbd460cb409910160405180910390a1601455565b600260075403611a4b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610785565b6002600755565b60085460ff1615611762576008546201000090046001600160a01b031633146117625760405162461bcd60e51b815260206004820152600c60248201526b27a7262cafa120aa21a422a960a11b6044820152606401610785565b6001600160a01b0381166108bf5760405162461bcd60e51b815260206004820152600c60248201526b4e554c4c5f4144445245535360a01b6044820152606401610785565b6001600160a01b038216611b515760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610785565b6001600160a01b03821660009081526020819052604090205481811015611bc55760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610785565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91015b60405180910390a35b505050565b6040516001600160a01b038316602482015260448101829052611c2090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261281b565b60085460ff6101009091041615156001146117625760405162461bcd60e51b815260206004820152600e60248201526d454d455247454e43595f4d4f444560901b6044820152606401610785565b600b546001600160a01b031633146117625760405162461bcd60e51b815260206004820152600860248201526727a7262cafa3a7ab60c11b6044820152606401610785565b6001600160a01b038316611d7d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610785565b6001600160a01b038216611dde5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610785565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259101611c17565b611e42603282612f85565b4311156108bf5760405162461bcd60e51b81526020600482015260116024820152701195539114d7d393d517d5541110551151607a1b6044820152606401610785565b60408051835460208181028301840184528201818152611eef938692849291849190840182828015611ee057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611ec2575b505050505081525050826128ed565b6113f85781546001810183556000838152602090200180546001600160a01b0383166001600160a01b03199091161790555050565b6000611f3084846118c8565b90506000198114611f985781811015611f8b5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610785565b611f988484848403611d1b565b50505050565b6001600160a01b0383166120025760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610785565b6001600160a01b0382166120645760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610785565b6001600160a01b038316600090815260208190526040902054818110156120dc5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610785565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611f98565b60408051600f8054602081810284018501855283018181526121b894869493928492918491908401828280156121a157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612183575b5050505050815250506128ed90919063ffffffff16565b6108bf5760405162461bcd60e51b815260206004820152601060248201526f24a72b20a624a22fa2ac22a1aaaa27a960811b6044820152606401610785565b60005b60408051845460208181028301840184528201818152612261938792849291849190840182828015611953576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161193557505050505081525050515190565b811015611c2057816001600160a01b031683600001828154811061228757612287612ff8565b6000918252602090912001546001600160a01b0316036123b05760408051845460208181028301840184528201818152869360019361230d939092869284928491840182828015611953576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161193557505050505081525050515190565b6123179190612efd565b8154811061232757612327612ff8565b60009182526020909120015483546001600160a01b039091169084908390811061235357612353612ff8565b600091825260209091200180546001600160a01b0319166001600160a01b0392909216919091179055825483908061238d5761238d61300e565b600082815260209020810160001990810180546001600160a01b03191690550190555b806123ba81612f9d565b9150506121fa565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561241b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561244557507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6040516001600160a01b0380851660248301528316604482015260648101829052611f989085906323b872dd60e01b90608401611c51565b6001600160a01b0382166125775760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610785565b80600260008282546125899190612f85565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b60006125ea610a98565b9050600080601254118015612600575060105482115b15612640576000601054836126159190612efd565b9050612710601254826126289190612ebc565b6126329190612edb565b61263c9083612f85565b9150505b6000601454118015612653575042601154105b156126ad576000601154426126689190612efd565b90506127106301e187e084601454846126819190612ebc565b61268b9190612ebc565b6126959190612edb565b61269f9190612edb565b6126a99083612f85565b9150505b80601560008282546126bf9190612f85565b90915550505050565b600a546001600160a01b031633146117625760405162461bcd60e51b815260206004820152600b60248201526a27a7262cafa5a2a2a822a960a91b6044820152606401610785565b600061271b83515190565b82106127595760405162461bcd60e51b815260206004820152600d60248201526c0929cac82989288be929c888ab609b1b6044820152606401610785565b825180518390811061276d5761276d612ff8565b6020026020010151905092915050565b6001600160a01b0381166000908152600560205260409020805460018101825590610a92565b600061082c6127b06123c2565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061280287878787612957565b9150915061280f81612a1b565b5090505b949350505050565b6000612870826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612b659092919063ffffffff16565b805190915015611c20578080602001905181019061288e9190613024565b611c205760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610785565b6000805b83515181101561294d57826001600160a01b03168460000151828151811061291b5761291b612ff8565b60200260200101516001600160a01b03160361293b57600191505061082c565b8061294581612f9d565b9150506128f1565b5060009392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561298e5750600090506003612a12565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156129e2573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612a0b57600060019250925050612a12565b9150600090505b94509492505050565b6000816004811115612a2f57612a2f613041565b03612a375750565b6001816004811115612a4b57612a4b613041565b03612a985760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610785565b6002816004811115612aac57612aac613041565b03612af95760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610785565b6003816004811115612b0d57612b0d613041565b036108bf5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610785565b6060612813848460008585600080866001600160a01b03168587604051612b8c9190613057565b60006040518083038185875af1925050503d8060008114612bc9576040519150601f19603f3d011682016040523d82523d6000602084013e612bce565b606091505b5091509150612bdf87838387612bea565b979650505050505050565b60608315612c59578251600003612c52576001600160a01b0385163b612c525760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610785565b5081612813565b6128138383815115612c6e5781518083602001fd5b8060405162461bcd60e51b81526004016107859190612d1d565b6001600160a01b03811681146108bf57600080fd5b60008060408385031215612cb057600080fd5b823591506020830135612cc281612c88565b809150509250929050565b600060208284031215612cdf57600080fd5b8135612cea81612c88565b9392505050565b60005b83811015612d0c578181015183820152602001612cf4565b83811115611f985750506000910152565b6020815260008251806020840152612d3c816040850160208701612cf1565b601f01601f19169190910160400192915050565b60008060408385031215612d6357600080fd5b8235612d6e81612c88565b946020939093013593505050565b600080600060608486031215612d9157600080fd5b8335612d9c81612c88565b92506020840135612dac81612c88565b929592945050506040919091013590565b80151581146108bf57600080fd5b600060208284031215612ddd57600080fd5b8135612cea81612dbd565b600060208284031215612dfa57600080fd5b5035919050565b600080600080600080600060e0888a031215612e1c57600080fd5b8735612e2781612c88565b96506020880135612e3781612c88565b95506040880135945060608801359350608088013560ff81168114612e5b57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215612e8b57600080fd5b8235612e9681612c88565b91506020830135612cc281612c88565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612ed657612ed6612ea6565b500290565b600082612ef857634e487b7160e01b600052601260045260246000fd5b500490565b600082821015612f0f57612f0f612ea6565b500390565b600060208284031215612f2657600080fd5b5051919050565b600181811c90821680612f4157607f821691505b602082108103610a9257634e487b7160e01b600052602260045260246000fd5b60008060408385031215612f7457600080fd5b505080516020909101519092909150565b60008219821115612f9857612f98612ea6565b500190565b600060018201612faf57612faf612ea6565b5060010190565b600060208284031215612fc857600080fd5b8151612cea81612c88565b6020808252600b908201526a16915493d7d05353d5539560aa1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b60006020828403121561303657600080fd5b8151612cea81612dbd565b634e487b7160e01b600052602160045260246000fd5b60008251613069818460208701612cf1565b919091019291505056fea2646970667358221220e9ba89344e0e9e63ea6c01c212d7b499565085269ac35acd752e8a36a1f5b73664736f6c634300080d003300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000853d955acef822db058eb8505911ed77f175b99e0000000000000000000000005262691ccf2c816e6c3d819fb99d8f1a3dad04d80000000000000000000000006b29610d6c6a9e47812be40f1335918bd63321bf000000000000000000000000d2a0b3b0cef4f4dcdd9f41dc2802010987d8d2e7000000000000000000000000000000000000000000004c3ba39c5e4111000000000000000000000000000000000000000000000000000000000000000000000e427261686d6120546f7047656172000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000862726168544f5047000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103415760003560e01c80637b3d51b1116101b8578063ab73525511610104578063d505accf116100a2578063f071db5a1161007c578063f071db5a146106f9578063f39c38a014610702578063f621ff6014610715578063fe56e2321461071d57600080fd5b8063d505accf146106ca578063dbd5edc7146106dd578063dd62ed3e146106e657600080fd5b8063bc383bc5116100de578063bc383bc514610675578063be32b3f814610688578063d23e04801461069b578063d294f093146106c257600080fd5b8063ab73525514610642578063aced166114610655578063b1b3da511461066857600080fd5b80639cf46bc911610171578063a7a217121161014b578063a7a2171214610600578063a7a7a31c14610613578063a9059cbb1461061c578063ab033ea91461062f57600080fd5b80639cf46bc9146105d1578063a457c2d7146105e4578063a6f7f5d6146105f757600080fd5b80637b3d51b11461057e5780637ecebe00146105875780637f5883a21461059a57806386651203146105ad57806387788782146105c057806395d89b41146105c957600080fd5b80632478842911610292578063424351751161023057806370897b231161020a57806370897b231461051c57806370a082311461052f578063748747e614610558578063777f97661461056b57600080fd5b806342435175146104e35780635aa6e675146104f65780636e553f651461050957600080fd5b80633644e5151161026c5780633644e515146104ac57806337a063d2146104b457806339509351146104c757806340e9903b146104da57600080fd5b80632478842914610455578063303cff5314610468578063313ce5671461047b57600080fd5b8063095ea7b3116102ff57806318515a83116102d957806318515a831461041f5780631f5a0bbe14610427578063238efcbc1461043a57806323b872dd1461044257600080fd5b8063095ea7b3146103fc578063140ce45f1461040f57806318160ddd1461041757600080fd5b8062f714ce1461034657806301681a621461036c578063025a3a2914610381578063058a8e5f146103b257806306fdde03146103c55780630905f560146103da575b600080fd5b610359610354366004612c9d565b610730565b6040519081526020015b60405180910390f35b61037f61037a366004612ccd565b610832565b005b60085461039a906201000090046001600160a01b031681565b6040516001600160a01b039091168152602001610363565b61037f6103c0366004612ccd565b6108c2565b6103cd610934565b6040516103639190612d1d565b6008546103ec90610100900460ff1681565b6040519015158152602001610363565b6103ec61040a366004612d50565b6109c6565b6103596109de565b600254610359565b610359610a98565b61037f610435366004612ccd565b610b46565b61037f610d1c565b6103ec610450366004612d7c565b610dcb565b61037f610463366004612ccd565b610def565b61037f610476366004612dcb565b610f01565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000012168152602001610363565b610359610f51565b61037f6104c2366004612de8565b610f5b565b6103ec6104d5366004612d50565b610ff3565b61035960135481565b61037f6104f1366004612ccd565b611015565b600b5461039a906001600160a01b031681565b610359610517366004612c9d565b611079565b61037f61052a366004612de8565b61122f565b61035961053d366004612ccd565b6001600160a01b031660009081526020819052604090205490565b61037f610566366004612ccd565b6112c2565b61037f610579366004612d50565b611326565b61035960105481565b610359610595366004612ccd565b6113fc565b61037f6105a8366004612d50565b61141a565b61037f6105bb366004612de8565b6114ca565b61035960125481565b6103cd6114d7565b600d5461039a906001600160a01b031681565b6103ec6105f2366004612d50565b6114e6565b61035960145481565b60095461039a906001600160a01b031681565b61035960115481565b6103ec61062a366004612d50565b611561565b61037f61063d366004612ccd565b61156f565b61039a610650366004612de8565b611599565b600a5461039a906001600160a01b031681565b6008546103ec9060ff1681565b61037f610683366004612ccd565b611614565b61037f610696366004612dcb565b611678565b61039a7f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e81565b61037f6116df565b61037f6106d8366004612e01565b611764565b610359600e5481565b6103596106f4366004612e78565b6118c8565b61035960155481565b600c5461039a906001600160a01b031681565b6103596118f3565b61037f61072b366004612de8565b611961565b600061073a6119f9565b610742611a52565b61074b82611aac565b6000831161078e5760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f53484152455360a81b60448201526064015b60405180910390fd5b600254610799610a98565b6107a39085612ebc565b6107ad9190612edb565b90506107b93384611af1565b601354156107ee576000612710601354836107d49190612ebc565b6107de9190612edb565b90506107ea8183612efd565b9150505b6108226001600160a01b037f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e168383611c25565b61082c6001600755565b92915050565b61083a611c88565b600b546040516370a0823160e01b81523060048201526108bf916001600160a01b0390811691908416906370a0823190602401602060405180830381865afa15801561088a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ae9190612f14565b6001600160a01b0384169190611c25565b50565b6108ca611cd6565b6008546040516001600160a01b038084169262010000900416907f6d039a6d5f36163cbc30fe5c1a15856df293a5769543d5deca1fb7a9ab29bf7790600090a3600880546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60606003805461094390612f2d565b80601f016020809104026020016040519081016040528092919081815260200182805461096f90612f2d565b80156109bc5780601f10610991576101008083540402835291602001916109bc565b820191906000526020600020905b81548152906001019060200180831161099f57829003601f168201915b5050505050905090565b6000336109d4818585611d1b565b5060019392505050565b600080805b6109eb6118f3565b811015610a925760006109fd82611599565b9050600080826001600160a01b031663968ed6006040518163ffffffff1660e01b81526004016040805180830381865afa158015610a3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a639190612f61565b91509150610a7081611e37565b610a7a8286612f85565b94505050508080610a8a90612f9d565b9150506109e3565b50919050565b6000601554610aa56109de565b6040516370a0823160e01b81523060048201527f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e6001600160a01b0316906370a0823190602401602060405180830381865afa158015610b09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2d9190612f14565b610b379190612f85565b610b419190612efd565b905090565b610b4e611cd6565b610b5781611aac565b306001600160a01b0316816001600160a01b031663fbfa77cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190612fb6565b6001600160a01b031614610c095760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d590555315609a1b6044820152606401610785565b604051636eb1769f60e11b81526001600160a01b0382811660048301523060248301526000917f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e9091169063dd62ed3e90604401602060405180830381865afa158015610c7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9e9190612f14565b11610cda5760405162461bcd60e51b815260206004820152600c60248201526b4e4f5f414c4c4f57414e434560a01b6044820152606401610785565b610ce5600f82611e85565b6040516001600160a01b038216907fae5b7c3b000f575c241001dc9bcb3d8778376889353b07121115574eceff78c590600090a250565b600c546001600160a01b03163314610d685760405162461bcd60e51b815260206004820152600f60248201526e494e56414c49445f4144445245535360881b6044820152606401610785565b600c54600b546040516001600160a01b0392831692909116907fff0b32b909f3fb702fe6ac1f682adcca675b9dfaa03ad8f46b4b17c4058a93fc90600090a3600c54600b80546001600160a01b0319166001600160a01b03909216919091179055565b600033610dd9858285611f24565b610de4858585611f9e565b506001949350505050565b610df7611cd6565b610e0081611aac565b610e0981612142565b600080826001600160a01b031663968ed6006040518163ffffffff1660e01b81526004016040805180830381865afa158015610e49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6d9190612f61565b91509150610e7a81611e37565b620f42408210610ebd5760405162461bcd60e51b815260206004820152600e60248201526d08caa9c88a6bea89e9ebe90928e960931b6044820152606401610785565b610ec8600f846121f7565b6040516001600160a01b038416907f4a2cf608bfb427f53279ec7f0eadf48913b9346ccefc3af138dbdec14ea0907d90600090a2505050565b610f09611cd6565b6008805460ff19168215159081179091556040519081527faffd159acb2f0eec86675a846365f4908afe82bcb6f2e273e2703ead071a2617906020015b60405180910390a150565b6000610b416123c2565b610f63611cd6565b610f706002612710612edb565b8110610fb25760405162461bcd60e51b815260206004820152601160248201527008ab092a8be8c8a8abea89e9ebe90928e9607b1b6044820152606401610785565b60135460408051918252602082018390527ff381bb752db332774ae373d793ee53c3b08b44a3d91427779b4b92d2f1fa9e5c910160405180910390a1601355565b6000336109d481858561100683836118c8565b6110109190612f85565b611d1b565b61101d611cd6565b6009546040516001600160a01b038084169216907f37a41cdba90d4506e998ac22dac49054fc03f2815555d49ad4d2e65204bc205290600090a3600980546001600160a01b0319166001600160a01b0392909216919091179055565b60006110836119f9565b61108c82611aac565b600083116110ac5760405162461bcd60e51b815260040161078590612fd3565b600d5460405163bc1c353560e01b8152600481018590526000916001600160a01b03169063bc1c3535906024016020604051808303816000875af11580156110f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111c9190612f14565b9050600061112960025490565b11611134578061115a565b61113c610a98565b8161114660025490565b6111509190612ebc565b61115a9190612edb565b91508160000361119a5760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f53484152455360a81b6044820152606401610785565b6111cf6001600160a01b037f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e163330876124e9565b6111d98383612521565b600e5460025411156112245760405162461bcd60e51b815260206004820152601460248201527313505617d1115413d4d25517d094915050d2115160621b6044820152606401610785565b5061082c6001600755565b611237611cd6565b6112446002612710612edb565b81106112815760405162461bcd60e51b815260206004820152600c60248201526b08c8a8abea89e9ebe90928e960a31b6044820152606401610785565b60125460408051918252602082018390527f17519bd6596326e94ff406f9632728407b34e99c6ee45960b15bba05d67874c4910160405180910390a1601255565b6112ca611cd6565b600a546040516001600160a01b038084169216907f60ed9ffad04b70bf58c43b18d1f0e54642250116c1137ac1cc4831449124350890600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b61132e6119f9565b6113366125e0565b61133f82612142565b6113476126c8565b600081116113675760405162461bcd60e51b815260040161078590612fd3565b61139c6001600160a01b037f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e168330846124e9565b816001600160a01b03167f2331b9a387a0c1b9069a5b1a48cd8c566440a10c1e58654d04d03fad21055196826040516113d791815260200190565b60405180910390a26113e7610a98565b601055426011556113f86001600755565b5050565b6001600160a01b03811660009081526005602052604081205461082c565b6114226119f9565b61142a6125e0565b61143382612142565b61143b6126c8565b6000811161145b5760405162461bcd60e51b815260040161078590612fd3565b61148f6001600160a01b037f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e168383611c25565b816001600160a01b03167f2f40f96629e48b44c1173c05df5811e217b0cce3bc7aef3dde4a4625be7c844b826040516113d791815260200190565b6114d2611cd6565b600e55565b60606004805461094390612f2d565b600033816114f482866118c8565b9050838110156115545760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610785565b610de48286868403611d1b565b6000336109d4818585611f9e565b611577611cd6565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b60408051600f80546020818102840185018552830181815260009461082c948794909390928492909184918401828280156115fd57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115df575b50505050508152505061271090919063ffffffff16565b61161c611cd6565b600d546040516001600160a01b038084169216907f60ed9ffad04b70bf58c43b18d1f0e54642250116c1137ac1cc4831449124350890600090a3600d80546001600160a01b0319166001600160a01b0392909216919091179055565b611680611cd6565b6008805462010000600160b01b031960ff19841515610100021661ffff19909216919091176001171690556040517fcc6bda015b6cb89b378ac6dc0294b882c1d0d41b117a7c7a0adb80d8ea7076cb90610f4690831515815260200190565b6116e76126c8565b6015541561176257601580546000909155600b54611732906001600160a01b037f000000000000000000000000853d955acef822db058eb8505911ed77f175b99e8116911683611c25565b6040518181527f860c0aa5520013080c2f65981705fcdea474d9f7c3daf954656ed5e65d692d1f90602001610f46565b565b834211156117b45760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610785565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886117e38c61277d565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061183e826127a3565b9050600061184e828787876127f1565b9050896001600160a01b0316816001600160a01b0316146118b15760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610785565b6118bc8a8a8a611d1b565b50505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60408051600f805460208181028401850185528301818152600094610b4194939284929184919084018282801561195357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611935575b505050505081525050515190565b611969611cd6565b6119766002612710612edb565b81106119b85760405162461bcd60e51b815260206004820152601160248201527008ab092a8be8c8a8abea89e9ebe90928e9607b1b6044820152606401610785565b60145460408051918252602082018390527f29b9d7a7d8a7a3ac22c295e4517723bc4e386eea60173e59e6da1dbd460cb409910160405180910390a1601455565b600260075403611a4b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610785565b6002600755565b60085460ff1615611762576008546201000090046001600160a01b031633146117625760405162461bcd60e51b815260206004820152600c60248201526b27a7262cafa120aa21a422a960a11b6044820152606401610785565b6001600160a01b0381166108bf5760405162461bcd60e51b815260206004820152600c60248201526b4e554c4c5f4144445245535360a01b6044820152606401610785565b6001600160a01b038216611b515760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610785565b6001600160a01b03821660009081526020819052604090205481811015611bc55760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610785565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91015b60405180910390a35b505050565b6040516001600160a01b038316602482015260448101829052611c2090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261281b565b60085460ff6101009091041615156001146117625760405162461bcd60e51b815260206004820152600e60248201526d454d455247454e43595f4d4f444560901b6044820152606401610785565b600b546001600160a01b031633146117625760405162461bcd60e51b815260206004820152600860248201526727a7262cafa3a7ab60c11b6044820152606401610785565b6001600160a01b038316611d7d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610785565b6001600160a01b038216611dde5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610785565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259101611c17565b611e42603282612f85565b4311156108bf5760405162461bcd60e51b81526020600482015260116024820152701195539114d7d393d517d5541110551151607a1b6044820152606401610785565b60408051835460208181028301840184528201818152611eef938692849291849190840182828015611ee057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611ec2575b505050505081525050826128ed565b6113f85781546001810183556000838152602090200180546001600160a01b0383166001600160a01b03199091161790555050565b6000611f3084846118c8565b90506000198114611f985781811015611f8b5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610785565b611f988484848403611d1b565b50505050565b6001600160a01b0383166120025760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610785565b6001600160a01b0382166120645760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610785565b6001600160a01b038316600090815260208190526040902054818110156120dc5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610785565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611f98565b60408051600f8054602081810284018501855283018181526121b894869493928492918491908401828280156121a157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612183575b5050505050815250506128ed90919063ffffffff16565b6108bf5760405162461bcd60e51b815260206004820152601060248201526f24a72b20a624a22fa2ac22a1aaaa27a960811b6044820152606401610785565b60005b60408051845460208181028301840184528201818152612261938792849291849190840182828015611953576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161193557505050505081525050515190565b811015611c2057816001600160a01b031683600001828154811061228757612287612ff8565b6000918252602090912001546001600160a01b0316036123b05760408051845460208181028301840184528201818152869360019361230d939092869284928491840182828015611953576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161193557505050505081525050515190565b6123179190612efd565b8154811061232757612327612ff8565b60009182526020909120015483546001600160a01b039091169084908390811061235357612353612ff8565b600091825260209091200180546001600160a01b0319166001600160a01b0392909216919091179055825483908061238d5761238d61300e565b600082815260209020810160001990810180546001600160a01b03191690550190555b806123ba81612f9d565b9150506121fa565b6000306001600160a01b037f000000000000000000000000b3da8d6da3ede239ccbf576ca0eaa74d86f0e9d31614801561241b57507f000000000000000000000000000000000000000000000000000000000000000146145b1561244557507f5fa4495b24bb90f995b7b19c20fee0da8d1c8ae31635cdff7e3578da23af461690565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527fb2d628c0028db28ae5a8184ee99b76f59760e36b3966a554e74c802dceed87a8828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6040516001600160a01b0380851660248301528316604482015260648101829052611f989085906323b872dd60e01b90608401611c51565b6001600160a01b0382166125775760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610785565b80600260008282546125899190612f85565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b60006125ea610a98565b9050600080601254118015612600575060105482115b15612640576000601054836126159190612efd565b9050612710601254826126289190612ebc565b6126329190612edb565b61263c9083612f85565b9150505b6000601454118015612653575042601154105b156126ad576000601154426126689190612efd565b90506127106301e187e084601454846126819190612ebc565b61268b9190612ebc565b6126959190612edb565b61269f9190612edb565b6126a99083612f85565b9150505b80601560008282546126bf9190612f85565b90915550505050565b600a546001600160a01b031633146117625760405162461bcd60e51b815260206004820152600b60248201526a27a7262cafa5a2a2a822a960a91b6044820152606401610785565b600061271b83515190565b82106127595760405162461bcd60e51b815260206004820152600d60248201526c0929cac82989288be929c888ab609b1b6044820152606401610785565b825180518390811061276d5761276d612ff8565b6020026020010151905092915050565b6001600160a01b0381166000908152600560205260409020805460018101825590610a92565b600061082c6127b06123c2565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061280287878787612957565b9150915061280f81612a1b565b5090505b949350505050565b6000612870826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612b659092919063ffffffff16565b805190915015611c20578080602001905181019061288e9190613024565b611c205760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610785565b6000805b83515181101561294d57826001600160a01b03168460000151828151811061291b5761291b612ff8565b60200260200101516001600160a01b03160361293b57600191505061082c565b8061294581612f9d565b9150506128f1565b5060009392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561298e5750600090506003612a12565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156129e2573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612a0b57600060019250925050612a12565b9150600090505b94509492505050565b6000816004811115612a2f57612a2f613041565b03612a375750565b6001816004811115612a4b57612a4b613041565b03612a985760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610785565b6002816004811115612aac57612aac613041565b03612af95760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610785565b6003816004811115612b0d57612b0d613041565b036108bf5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610785565b6060612813848460008585600080866001600160a01b03168587604051612b8c9190613057565b60006040518083038185875af1925050503d8060008114612bc9576040519150601f19603f3d011682016040523d82523d6000602084013e612bce565b606091505b5091509150612bdf87838387612bea565b979650505050505050565b60608315612c59578251600003612c52576001600160a01b0385163b612c525760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610785565b5081612813565b6128138383815115612c6e5781518083602001fd5b8060405162461bcd60e51b81526004016107859190612d1d565b6001600160a01b03811681146108bf57600080fd5b60008060408385031215612cb057600080fd5b823591506020830135612cc281612c88565b809150509250929050565b600060208284031215612cdf57600080fd5b8135612cea81612c88565b9392505050565b60005b83811015612d0c578181015183820152602001612cf4565b83811115611f985750506000910152565b6020815260008251806020840152612d3c816040850160208701612cf1565b601f01601f19169190910160400192915050565b60008060408385031215612d6357600080fd5b8235612d6e81612c88565b946020939093013593505050565b600080600060608486031215612d9157600080fd5b8335612d9c81612c88565b92506020840135612dac81612c88565b929592945050506040919091013590565b80151581146108bf57600080fd5b600060208284031215612ddd57600080fd5b8135612cea81612dbd565b600060208284031215612dfa57600080fd5b5035919050565b600080600080600080600060e0888a031215612e1c57600080fd5b8735612e2781612c88565b96506020880135612e3781612c88565b95506040880135945060608801359350608088013560ff81168114612e5b57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215612e8b57600080fd5b8235612e9681612c88565b91506020830135612cc281612c88565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612ed657612ed6612ea6565b500290565b600082612ef857634e487b7160e01b600052601260045260246000fd5b500490565b600082821015612f0f57612f0f612ea6565b500390565b600060208284031215612f2657600080fd5b5051919050565b600181811c90821680612f4157607f821691505b602082108103610a9257634e487b7160e01b600052602260045260246000fd5b60008060408385031215612f7457600080fd5b505080516020909101519092909150565b60008219821115612f9857612f98612ea6565b500190565b600060018201612faf57612faf612ea6565b5060010190565b600060208284031215612fc857600080fd5b8151612cea81612c88565b6020808252600b908201526a16915493d7d05353d5539560aa1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b60006020828403121561303657600080fd5b8151612cea81612dbd565b634e487b7160e01b600052602160045260246000fd5b60008251613069818460208701612cf1565b919091019291505056fea2646970667358221220e9ba89344e0e9e63ea6c01c212d7b499565085269ac35acd752e8a36a1f5b73664736f6c634300080d0033

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

00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000853d955acef822db058eb8505911ed77f175b99e0000000000000000000000005262691ccf2c816e6c3d819fb99d8f1a3dad04d80000000000000000000000006b29610d6c6a9e47812be40f1335918bd63321bf000000000000000000000000d2a0b3b0cef4f4dcdd9f41dc2802010987d8d2e7000000000000000000000000000000000000000000004c3ba39c5e4111000000000000000000000000000000000000000000000000000000000000000000000e427261686d6120546f7047656172000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000862726168544f5047000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): Brahma TopGear
Arg [1] : _symbol (string): brahTOPG
Arg [2] : _wantToken (address): 0x853d955aCEf822Db058eb8505911ED77F175b99e
Arg [3] : _keeper (address): 0x5262691CCF2C816e6c3d819fb99d8F1a3Dad04d8
Arg [4] : _governance (address): 0x6b29610D6c6a9E47812bE40F1335918bd63321bf
Arg [5] : _slippageAccounter (address): 0xD2A0B3B0cEf4F4dCdd9F41dc2802010987D8d2e7
Arg [6] : _depositCap (uint256): 360000000000000000000000

-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [2] : 000000000000000000000000853d955acef822db058eb8505911ed77f175b99e
Arg [3] : 0000000000000000000000005262691ccf2c816e6c3d819fb99d8f1a3dad04d8
Arg [4] : 0000000000000000000000006b29610d6c6a9e47812be40f1335918bd63321bf
Arg [5] : 000000000000000000000000d2a0b3b0cef4f4dcdd9f41dc2802010987d8d2e7
Arg [6] : 000000000000000000000000000000000000000000004c3ba39c5e4111000000
Arg [7] : 000000000000000000000000000000000000000000000000000000000000000e
Arg [8] : 427261686d6120546f7047656172000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [10] : 62726168544f5047000000000000000000000000000000000000000000000000


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.