ETH Price: $2,279.47 (+8.96%)
Gas: 0.3 Gwei

Contract

0xC7714Bfc33cd5ffd0DA17AC8197E1ADF4D06Db1E
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Swap To Exact In...171574812023-04-30 7:48:591051 days ago1682840939IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0082210333.10300351
Swap From Exact ...171574662023-04-30 7:45:591051 days ago1682840759IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0091453931.54673221
Swap From Exact ...171145602023-04-24 7:07:351057 days ago1682320055IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0086359339.36410274
Swap To Exact In...170172062023-04-10 10:27:351071 days ago1681122455IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0044701918
Swap To Exact In...170103682023-04-09 11:12:351072 days ago1681038755IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0045950518
Swap To Exact In...170017522023-04-08 5:53:351073 days ago1680933215IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0044700418
Swap To Exact In...169958792023-04-07 9:58:231074 days ago1680861503IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0045942118.5
Swap To Exact In...169811172023-04-05 7:30:351076 days ago1680679835IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0075410228.7813128
Swap From Exact ...169745332023-04-04 9:05:111077 days ago1680599111IN
0xC7714Bfc...F4D06Db1E
0 ETH0.005223818.95348777
Swap From Exact ...169617382023-04-02 13:35:231079 days ago1680442523IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0048388120.76618485
Swap From Exact ...169509482023-04-01 1:09:351080 days ago1680311375IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0052225818.90917096
Swap To Exact In...169498602023-03-31 21:30:111080 days ago1680298211IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0068779226.25
Swap From Exact ...169330032023-03-29 12:38:471083 days ago1680093527IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0081204129.46161318
Swap To Exact In...169182532023-03-27 10:54:471085 days ago1679914487IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0045203317.25291358
Swap From Exact ...169105102023-03-26 8:48:111086 days ago1679820491IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0043801215.89253482
Swap From Exact ...169104182023-03-26 8:29:231086 days ago1679819363IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0042543515.43558375
Swap From Exact ...169104072023-03-26 8:27:111086 days ago1679819231IN
0xC7714Bfc...F4D06Db1E
0 ETH0.003920214.22239614
Swap From Exact ...169103992023-03-26 8:25:351086 days ago1679819135IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0038115913.86962481
Swap To Exact In...169096102023-03-26 5:46:231086 days ago1679809583IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0031709512.42243479
Swap To Exact In...169090472023-03-26 3:52:351086 days ago1679802755IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0015999111.76539718
Swap To Exact In...169087082023-03-26 2:44:111086 days ago1679798651IN
0xC7714Bfc...F4D06Db1E
0 ETH0.003435213.45841344
Swap To Exact In...169086692023-03-26 2:36:111086 days ago1679798171IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0033083812.62739035
Set Trade Size L...169061752023-03-25 18:12:111086 days ago1679767931IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0009016624.37861456
Swap To Exact In...168811682023-03-22 5:50:351090 days ago1679464235IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0030845812.46125928
Swap To Exact In...168811612023-03-22 5:49:111090 days ago1679464151IN
0xC7714Bfc...F4D06Db1E
0 ETH0.0029972411.77828712
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SwapRouterV1

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

import "./import/GPO.sol";
import "./utils/SwapData.sol";
import "./GPOReserve.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
import "@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol";

contract SwapRouterV1 is Ownable {
    GPO public gpo;
    GPOReserve public gpoReserve;

    event SwapStateChanged(
        bool swapEnabled,
        address gpoReserve
    );

    bool public swapEnabled = true;
    uint256 public maxBuyTradeSize;
    uint256 public maxSellTradeSize;
    uint256 public maxSellPerTx;

    constructor(address _gpo) {
        gpo = GPO(_gpo);
    }

    function toggleSwap() public onlyOwner {
        swapEnabled = !swapEnabled;
        emit SwapStateChanged(swapEnabled, address(gpoReserve));
    }

    function setGPOReserve(address _gpoRes) public onlyOwner {
        gpoReserve = GPOReserve(_gpoRes);
        emit SwapStateChanged(swapEnabled, address(gpoReserve));
    }

    function swapToExactOutput(uint256 amountInMaximum, uint256 amountOut, uint256 deadline) external returns (uint256 amountIn) {
        require(amountInMaximum > 0 && amountOut > 0);
        require(swapEnabled);

        address _usdc = gpo.addrUSDC();
        address _gpo = address(gpo);
        address _from = msg.sender;

        TransferHelper.safeTransferFrom(_gpo, _from, address(this), amountInMaximum);

        if (maxSellTradeSize >= amountInMaximum && amountInMaximum <= maxSellPerTx) {
            TransferHelper.safeApprove(_gpo, _gpo, amountInMaximum);
            amountIn = gpo.swapToExactOutput(amountInMaximum, amountOut, deadline);
            maxSellTradeSize -= amountIn;
            TransferHelper.safeTransfer(_gpo, _from, amountInMaximum - amountIn);
            TransferHelper.safeTransfer(_usdc, _from, amountOut);
        } else
            revert("GP-SR: Order above sell trade size");
    }

    function swapToExactInput(uint256 amountIn, uint256 amountOutMinimum, uint256 deadline) external returns (uint256 amountOut) {
        require(amountIn > 0 && amountOutMinimum > 0);
        require(swapEnabled);

        address _usdc = gpo.addrUSDC();
        address _gpo = address(gpo);
        address _from = msg.sender;

        TransferHelper.safeTransferFrom(_gpo, _from, address(this), amountIn);

        if (maxSellTradeSize >= amountIn && amountIn <= maxSellPerTx) {
            TransferHelper.safeApprove(_gpo, _gpo, amountIn);
            amountOut = gpo.swapToExactInput(amountIn, amountOutMinimum, deadline);
            maxSellTradeSize -= amountIn;
            TransferHelper.safeTransfer(_usdc, _from, amountOut);
        } else
            revert("GP-SR: Order above sell trade size");
    }

    function swapFromExactOutput(uint256 amountInMaximum, uint256 amountOut, uint256 deadline) external returns (uint256 amountIn) {
        require(amountInMaximum > 0 && amountOut > 0);
        require(swapEnabled);

        address _usdc = gpo.addrUSDC();
        address _gpo = address(gpo);
        address _from = msg.sender;


        if (maxBuyTradeSize >= amountInMaximum) {
            TransferHelper.safeTransferFrom(_usdc, _from, address(this), amountInMaximum);

            TransferHelper.safeApprove(_usdc, _gpo, amountInMaximum);
            amountIn = gpo.swapFromExactOutput(amountInMaximum, amountOut, deadline);
            maxBuyTradeSize -= amountIn;
            TransferHelper.safeTransfer(_usdc, _from, amountInMaximum - amountIn);
            TransferHelper.safeTransfer(_gpo, _from, amountOut);
        }
    }

    function swapFromExactInput(uint256 amountIn, uint256 amountOutMinimum, uint256 deadline) external returns (uint256 amountOut) {
        require(amountIn > 0 && amountOutMinimum > 0);
        require(swapEnabled);

        address _usdc = gpo.addrUSDC();
        address _gpo = address(gpo);
        address _from = msg.sender;

        TransferHelper.safeTransferFrom(_usdc, _from, address(this), amountIn);

        if (maxBuyTradeSize >= amountIn) {
            TransferHelper.safeApprove(_usdc, _gpo, amountIn);
            amountOut = gpo.swapFromExactInput(amountIn, amountOutMinimum, deadline);
            maxBuyTradeSize -= amountIn;
            TransferHelper.safeTransfer(_gpo, _from, amountOut);
        } else {
            uint256 amountMinusFee = amountIn - (amountIn * gpo.feeOnSwap() / 100);
            uint256 fee = amountIn - amountMinusFee;

            amountOut = calculateGPOOut(amountMinusFee);
            
            TransferHelper.safeApprove(_usdc, address(gpoReserve), amountMinusFee);
            gpoReserve.buyGPOx(address(this), amountOut, amountMinusFee);

            TransferHelper.safeTransfer(_gpo, _from, amountOut);

            sendFeeSplit(fee);
        }
    }

    function sendFeeSplit(uint256 amount) internal {
        uint256 grandTotal = 0;
        uint256 len = gpo.feeSplitsLength();
        address addrUSDC = gpo.addrUSDC();

        for (uint256 i = 0; i < len; i++) {
            (address recipient, uint16 fee) = gpo.feeSplits(i);
            uint256 distributeAmount = amount * fee / 100;
            TransferHelper.safeTransfer(addrUSDC, recipient, distributeAmount);
            grandTotal += distributeAmount;
        }

        if (grandTotal != amount && len > 0) {
            (address recipient,) =  gpo.feeSplits(0);
            TransferHelper.safeTransfer(addrUSDC, recipient, amount - grandTotal);
        }
    }


    function canPerformSwap(bool sell, uint256 amount) public view returns(bool) {
        if (sell && amount > maxSellTradeSize && amount <= maxSellPerTx) 
            return false;
        return true;
    }

    function setTradeSizeLimitations(uint256 maxBuy, uint256 maxSell, uint256 maxSellTx) public onlyOwner {
        maxBuyTradeSize = maxBuy;
        maxSellTradeSize = maxSell;
        maxSellPerTx = maxSellTx;
    }

    function calculateGPOOut(uint256 usdc) public view returns (uint256 amountOut) {
        (int24 tick, ) = OracleLibrary.consult(gpo.authorizedPool(), 60);
        amountOut = OracleLibrary.getQuoteAtTick(
            tick,
            uint128(usdc),
            gpo.addrUSDC(),
            address(gpo)
        );
    }

}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

import "./ServiceLocator.sol";
import "./utils/GLPFunctions.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";


contract GPOReserve is Ownable, AccessControl {
    bytes32 public constant AUTHORIZED_BUYX  =
        keccak256("CAN_BUY_GPO_FREEPRICE");
    modifier authorizedBuyx() {
        require(hasRole(AUTHORIZED_BUYX, _msgSender()));
        _;
    }

    constructor(address _svcLoc) {
        $ = ServiceLocator(_svcLoc);
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
    }

    ServiceLocator private $;
    using GLPFunctions for ServiceLocator;

    uint256 public gpoTotalSupply;

    function buyGPOx(
        address buyer,
        uint256 gpoAmount,
        uint256 usdcAmount
    ) public authorizedBuyx {
        require(
            gpoAmount <= $.balance(CryptoToken.GPO, address(this)),
            "GR: not enough GPO"
        );

        $.transferFrom(CryptoToken.USDC, buyer, $.usdcReserve(), usdcAmount);
        $.transfer(CryptoToken.GPO, buyer, gpoAmount);
        gpoTotalSupply += gpoAmount;
    }

    function transferRemainingTokens() public onlyOwner {
        $.transfer(CryptoToken.GPO, owner(), $.balance(CryptoToken.GPO, address(this)));
    }
    
}

File 3 of 37 : SwapData.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

enum SwapOrder {
    SELL,
    BUY
}

enum SwapDirection {
    INPUT,
    OUTPUT
}

struct SwapResult {
    bool isSwapped;
    uint256 amountIn;
    uint256 amountOut;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

/**
____________________________
Description:
GoldPesa Option Contract (GPO) - 1 GPO represents the option to purchase 1 GPX at spot gold price + 1 %.
__________________________________
 */
contract GPO is ERC20PresetFixedSupply, Pausable, Ownable, AccessControl {
    
    // TokenSwaped event is emitted anytime there is a swap between GPO and USDC on the GoldPesa.com decentralized exchange powered by Uniswap
    event TokensSwaped(
        address indexed purchaser,
        uint256 amountIn,
        uint256 amountOut,
        bool direction // false: GPO-X, true: X-GPO
    );

    event ReserveTokenTransfer(
        address indexed to,
        uint256 amount
    );

    event WalletWhitelistChanged(
        address indexed wallet,
        bool whitelist
    );

    event PoolParametersChanged(
        address token,
        uint24 poolFee
    );

    event FreeTradeChanged(
        bool freeTrade
    );

    event SwapPermChanged(
        bool swapPerm
    );

    event FeeSplitsChanged(
        uint256 length,
        FeeSplit[] feeSplitsArray
    );

    event WalletLockChanged(
        address indexed wallet,
        uint256 lockValue
    );

    // FeeSplit stores the "recipient" wallet address and the respective percentage of the feeOnSwap which are to be sent to it.  
    struct FeeSplit {
        address recipient;
        uint16 fee;
    }

    // Token Name
    string public constant _name = "GoldPesa Option";
    // Token Symbol
    string public constant _symbol = "GPO";
    // GPO Hard Cap
    uint256 public constant fixedSupply = 100_000_000;
    // Wallet Hard Cap
    uint256 public constant capOnWallet = 100_000;
    // GoldPesa fee on swap percentage
    uint256 public feeOnSwap = 10;
    // Uniswap Router Address
    ISwapRouter public immutable swapRouter;
    // USDC ERC20 token Address
    address public addrUSDC;
    // Uniswap V3 Pool Fee * 10000 = 1 %
    uint24 private swapPoolFee = 10000;
    // Uniswap V3 GPO/USDC liquidity pool address
    address public authorizedPool;
    // Time when Pre-Sale and Sale tokens will be unlocked (Unix Time)
    uint256 public walletsTimelockedUntil;
    // When freeTrade is true the token bypasses the hard cap on wallet and can be traded freely on any exchange
    bool public freeTrade = false;
    // The feeOnSwap percentage is distributed to the addresses and their respective percentage which are held in the feeSplits array
    FeeSplit[] public feeSplits;
    // Keeps a record of the number of addresses in the feeSplits array 
    uint256 public feeSplitsLength;

    // Defines an Access Control role called "CAN_LOCK" which is granted to addresses which are allowed to lock wallet addresses during the Sale and Pre-Sale phase
    bytes32 public constant AUTHORIZED_LOCK =
        keccak256("CAN_LOCK");
    modifier authorizedLocker() {
        require(hasRole(AUTHORIZED_LOCK, _msgSender()));
        _;
    }
    // Mapping which holds information of the wallet addresses which are locked (true) /unlocked (false)
    mapping(address => bool) public lockedWallets;
    // Mapping which holds details of the wallet addresses which bypass the wallet hard cap and are able to swap with the Uniswap GPO/USDC liquidity pool
    mapping(address => bool) public whitelistedWallets;
    // Mapping which holds details of the amount of GPO tokens are locked in the lockedWallets mapping 
    mapping(address => uint256) public lockedWalletsAmount;
    bool public swapEnabled = false;

    // Upon deployment, the constructor is only executed once
    constructor(
        ISwapRouter _swapRouter,
        uint256 _walletsTimelockedUntil
    ) ERC20PresetFixedSupply(_name, _symbol, hardCapOnToken(), address(this)) {
        swapRouter = _swapRouter;
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
        walletsTimelockedUntil = _walletsTimelockedUntil;
        whitelistedWallets[address(0x0)] = true;
        whitelistedWallets[address(this)] = true;
    }

    // Enables GoldPesa to manually transfer GPO tokens from the GPO contract to another wallet address
    function transferTokensTo(address _to, uint256 amount) external onlyOwner {
        _transfer(address(this), _to, amount);
        emit ReserveTokenTransfer(_to, amount);
    }
    // Enables GoldPesa to manually add or remove wallet addresses from the whitelistedWallets mapping
    function changeWalletWhitelist(address _addr, bool yesOrNo) external onlyOwner {
        whitelistedWallets[_addr] = yesOrNo;
        emit WalletWhitelistChanged(_addr, yesOrNo);
    }
    // Sets the USDC contract address, the Uniswap pool fee and accordingly includes the derived Uniswap liquidity pool address to the whitelistedWallets mapping
    function setPoolParameters(address USDC, uint24 poolFee) external onlyOwner {
        require(USDC != address(0x0));

        addrUSDC = USDC;
        swapPoolFee = poolFee;
        whitelistedWallets[authorizedPool] = false;

        // taken from @uniswap/v3-periphery/contracts/libraries/PoolAddress.sol
        address token0 = address(this);
        address token1 = USDC;
        if (token0 > token1) (token0, token1) = (token1, token0);

        authorizedPool = address(
            uint160(
                uint256(
                    keccak256(
                        abi.encodePacked(
                            hex'ff',
                            0x1F98431c8aD98523631AE4a59f267346ea31F984,
                            keccak256(abi.encode(token0, token1, poolFee)),
                            bytes32(0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54)
                        )
                    )
                )
            )
        );
        whitelistedWallets[authorizedPool] = true;
        emit PoolParametersChanged(USDC, poolFee);
    }
    // Enables GoldPesa to set the state of the contract to "freeTrade" 
    function switchFreeTrade() external onlyOwner {
        freeTrade = !freeTrade;
    }

    function switchSwapEnabled() external onlyOwner {
        swapEnabled = !swapEnabled;
    }

    // Enables GoldPesa to set the feeOnSwap 
    function setFeeOnSwap(uint24 _feeOnSwap) external onlyOwner {
        feeOnSwap = _feeOnSwap;
    }
    // Enables GoldPesa to set the "feeOnSwap" distribution details 
    // Only GoldPesa executes this
    function setFeeSplits(FeeSplit[] memory _feeSplits) external onlyOwner {
        uint256 grandTotal = 0;
        for (uint256 i = 0; i < _feeSplits.length; i++) {
            FeeSplit memory f = _feeSplits[i];
            grandTotal += f.fee;
        }
        require(grandTotal == 100);
        delete feeSplits;
        for (uint256 i = 0; i < _feeSplits.length; i++) {
            feeSplits.push(_feeSplits[i]);
        }
        feeSplitsLength = _feeSplits.length;
        emit FeeSplitsChanged(feeSplitsLength, feeSplits);
    }
    // Distributes the feeOnSwap amount collected during any swap transaction to the addresses defined in the "feeSplits" array
    function distributeFee(uint256 amount) internal {
        uint256 grandTotal = 0;
        for (uint256 i = 0; i < feeSplits.length; i++) {
            FeeSplit storage f = feeSplits[i];
            uint256 distributeAmount = amount * f.fee / 100;
            TransferHelper.safeTransfer(addrUSDC, f.recipient, distributeAmount);
            grandTotal += distributeAmount;
        }
        if (grandTotal != amount && feeSplits.length > 0) {
            FeeSplit storage f = feeSplits[0];
            TransferHelper.safeTransfer(addrUSDC, f.recipient, amount - grandTotal);
        }
    }
    // Defines the rules that must be satisfied before GPO can be transferred
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, amount);
        // Ensures that GPO token holders cannot burn their own tokens, unless rhzy     ez <hirzliqrzs
        require(to != address(0x0) || whitelistedWallets[from], "GPO_ERR: Cannot burn");
        // Ensures that GPO token holders cannot execute a swap directly with the GPO/USDC liquidity pool on Uniswap. All swaps must be executed on the GoldPesa DEX unless 
        // "freeTrade" has be enabled
        if (authorizedPool != address(0x0) && (from == authorizedPool || to == authorizedPool)) 
            require(freeTrade || (whitelistedWallets[to] && whitelistedWallets[from]), "GPO_ERR: UniswapV3 functionality is only allowed through GPO's protocol"); 
        // Unless "freeTrade" has been enabled this require statement rejects any transfers to wallets which will break the 100,000 GPO wallet hard cap unless the 
        // receiving wallet address is a "whitelistedWallet"
        require(
            freeTrade || 
            from == address(0x0) ||
            whitelistedWallets[to] || 
            balanceOf(to) + amount <= hardCapOnWallet(),
            "GPO_ERR: Hard cap on wallet reached"
        );
        // Disables all GPO transfers if the token has been paused by GoldPesa
        require(!paused(), "ERC20Pausable: token transfer while paused");
        // Rejects transfers made from locked wallets which are greater than the wallet's "lockedWalletsAmount" until the date where all tokens are unlocked
        require(block.timestamp >= walletsTimelockedUntil || 
            !lockedWallets[from] || 
            (lockedWallets[from] && amount <= (balanceOf(from) - lockedWalletsAmount[from])), "Cannot transfer token as the wallet is locked");
    }
    // Internal mint function which cannot be called externally after the GPO contract is deployed ensuring that the GPO token hard cap of 100,000,000 is not breached
    function _mint(address account, uint256 amount) internal virtual override {
        // Ensures that GPO token hard cap of 100,000,000 is not breached even if the mint function is called internally
        require(
            ERC20.totalSupply() + amount <= hardCapOnToken(),
            "ERC20Capped: cap exceeded"
        );
        super._mint(account, amount);
    }

    // Returns the GPO token hard cap ("fixedSupply") in wei
    function hardCapOnToken() public view returns (uint256) {
        return fixedSupply * (10**(uint256(decimals())));
    }
    // Returns the GPO token wallet hard cap ("capOnWallet") in wei
    function hardCapOnWallet() public view returns (uint256) {
        return capOnWallet * (10**(uint256(decimals())));
    }
    // Returns the GoldPesa feeOnSwap in USDC which is used in the swap functions
    function calculateFeeOnSwap(uint256 amount)
        internal
        view
        returns (uint256)
    {
        return amount * feeOnSwap / 100;
    }
    // Enables GoldPesa to lock and unlock wallet address manually 
    function lockUnlockWallet(address account, bool yesOrNo, uint256 amount) external authorizedLocker {
        lockedWallets[account] = yesOrNo;
        if (yesOrNo) {
            uint256 lockedValue = lockedWalletsAmount[account] + amount;
            require(lockedValue <= balanceOf(account), "Cannot lock more than what the wallet has");
            lockedWalletsAmount[account] = lockedValue;
            
            emit WalletLockChanged(account, lockedValue);
        } else {
            lockedWalletsAmount[account] = 0;
            
            emit WalletLockChanged(account, 0);
        }
    }

    // Pause the GPO token transfers
    function pause() external onlyOwner {
        _pause();
    }

    // Unpause the GPO token transfer
    function unpause() external onlyOwner {
        _unpause();
    }

    // User defines the exact amount of USDC they would like to receive while swaping GPO for USDC using the GPO/USDC Uniswap V3 liquidity pool.
    // Any extra GPO tokens not used in the Swap are returned back to the user.
    function swapToExactOutput(uint256 amountInMaximum, uint256 amountOut, uint256 deadline) external returns (uint256 amountIn) {
        require(amountInMaximum > 0 && amountOut > 0);
        require(swapEnabled || whitelistedWallets[_msgSender()]);
        
        _transfer(_msgSender(), address(this), amountInMaximum);
        _approve(address(this), address(swapRouter), amountInMaximum);

        if (deadline == 0)
            deadline = block.timestamp + 30*60;
        
        ISwapRouter.ExactOutputSingleParams memory params =
            ISwapRouter.ExactOutputSingleParams({
                tokenIn: address(this),
                tokenOut: addrUSDC,
                fee: swapPoolFee,
                recipient: address(this),
                deadline: deadline,
                amountOut: amountOut,
                amountInMaximum: amountInMaximum,
                sqrtPriceLimitX96: 0
            });
        amountIn = swapRouter.exactOutputSingle(params);
        uint256 fee = calculateFeeOnSwap(amountOut);
        uint256 amountSwap = amountOut - fee;
        
        TransferHelper.safeTransfer(addrUSDC, _msgSender(), amountSwap);
        distributeFee(fee); 

        if (amountIn < amountInMaximum) {
            _transfer(address(this), _msgSender(), amountInMaximum - amountIn);
        } 
        emit TokensSwaped(_msgSender(), amountIn, amountOut, false);
    }

    // User defines the exact amount of GPO they would like to spend while swaping GPO for USDC using the GPO/USDC Uniswap V3 liquidity pool.
    function swapToExactInput(uint256 amountIn, uint256 amountOutMinimum, uint256 deadline ) external returns (uint256 amountOut) {
        require(amountIn > 0);
        require(swapEnabled || whitelistedWallets[_msgSender()]);

        _transfer(_msgSender(), address(this), amountIn);
        _approve(address(this), address(swapRouter), amountIn);

        if (deadline == 0)
            deadline = block.timestamp + 30*60;

        ISwapRouter.ExactInputSingleParams memory params = ISwapRouter
            .ExactInputSingleParams({
                tokenIn: address(this),
                tokenOut: addrUSDC,
                fee: swapPoolFee,
                recipient: address(this),
                deadline: deadline,
                amountIn: amountIn,
                amountOutMinimum: amountOutMinimum,
                sqrtPriceLimitX96: 0
            });

        amountOut = swapRouter.exactInputSingle(params);

        uint256 fee = calculateFeeOnSwap(amountOut);
        uint256 amountSwap = amountOut - fee;

        TransferHelper.safeTransfer(addrUSDC, _msgSender(), amountSwap);
        distributeFee(fee);

        emit TokensSwaped(_msgSender(), amountIn, amountOut, false);

        return amountSwap;
    }
    // User defines the exact amount of GPO they would like to receive while swaping USDC for GPO using the GPO/USDC Uniswap V3 liquidity pool.
    // Any extra USDC tokens not used in the Swap are returned back to the user.
    function swapFromExactOutput(uint256 amountInMaximum, uint256 amountOut, uint256 deadline) external returns (uint256 amountIn) {
        require(swapEnabled || whitelistedWallets[_msgSender()]);
        require(amountInMaximum > 0 && amountOut > 0);

        TransferHelper.safeTransferFrom(addrUSDC, _msgSender(), address(this), amountInMaximum);
        uint256 fee = calculateFeeOnSwap(amountInMaximum);
        uint256 amountSwap = amountInMaximum - fee;
        distributeFee(fee);

        
        if (deadline == 0)
            deadline = block.timestamp + 30*60;
        
        TransferHelper.safeApprove(addrUSDC, address(swapRouter), amountSwap);
        ISwapRouter.ExactOutputSingleParams memory params = ISwapRouter.ExactOutputSingleParams({
                tokenIn: addrUSDC,
                tokenOut: address(this),
                fee: swapPoolFee,
                recipient: address(this),
                deadline: deadline,
                amountOut: amountOut,
                amountInMaximum: amountSwap,
                sqrtPriceLimitX96: 0
        });
        amountIn = swapRouter.exactOutputSingle(params);
        
        _transfer(address(this), _msgSender(), amountOut);

        if (amountIn < amountSwap) {
            TransferHelper.safeTransfer(addrUSDC, _msgSender(), amountSwap - amountIn);
        } 

        emit TokensSwaped(_msgSender(), amountIn, amountOut, true);
    }
    // User defines the exact amount of USDC they would like to spend while swaping USDC for GPO using the GPO/USDC Uniswap V3 liquidity pool.
    function swapFromExactInput(uint256 amountIn, uint256 amountOutMinimum, uint256 deadline) external returns (uint256 amountOut) {
        require(swapEnabled || whitelistedWallets[_msgSender()]);
        require(amountIn > 0 && amountOutMinimum > 0);

        uint256 fee = calculateFeeOnSwap(amountIn);
        TransferHelper.safeTransferFrom(addrUSDC, _msgSender(), address(this), amountIn);
        uint256 amountSwap = amountIn - fee;
        distributeFee(fee);
        TransferHelper.safeApprove(addrUSDC, address(swapRouter), amountSwap);

        if (deadline == 0)
            deadline = block.timestamp + 30*60;

        ISwapRouter.ExactInputSingleParams memory params = ISwapRouter
            .ExactInputSingleParams({
                tokenIn: addrUSDC,
                tokenOut: address(this),
                fee: swapPoolFee,
                recipient: address(this),
                deadline: deadline,
                amountIn: amountSwap,
                amountOutMinimum: amountOutMinimum,
                sqrtPriceLimitX96: 0
            });
        amountOut = swapRouter.exactInputSingle(params);
        _transfer(address(this), _msgSender(), amountOut);

        emit TokensSwaped(_msgSender(), amountIn, amountOut, true);
    }


}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.0;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';

library TransferHelper {
    /// @notice Transfers tokens from the targeted address to the given destination
    /// @notice Errors with 'STF' if transfer fails
    /// @param token The contract address of the token to be transferred
    /// @param from The originating address from which the tokens will be transferred
    /// @param to The destination address of the transfer
    /// @param value The amount to be transferred
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
    }

    /// @notice Transfers tokens from msg.sender to a recipient
    /// @dev Errors with ST if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
    }

    /// @notice Approves the stipulated contract to spend the given allowance in the given token
    /// @dev Errors with 'SA' if transfer fails
    /// @param token The contract address of the token to be approved
    /// @param to The target of the approval
    /// @param value The amount of the given token the target will be allowed to spend
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');
    }

    /// @notice Transfers ETH to the recipient address
    /// @dev Fails with `STE`
    /// @param to The destination of the transfer
    /// @param value The value to be transferred
    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'STE');
    }
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0 <0.9.0;

import '@uniswap/v3-core/contracts/libraries/FullMath.sol';
import '@uniswap/v3-core/contracts/libraries/TickMath.sol';
import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';

/// @title Oracle library
/// @notice Provides functions to integrate with V3 pool oracle
library OracleLibrary {
    /// @notice Calculates time-weighted means of tick and liquidity for a given Uniswap V3 pool
    /// @param pool Address of the pool that we want to observe
    /// @param secondsAgo Number of seconds in the past from which to calculate the time-weighted means
    /// @return arithmeticMeanTick The arithmetic mean tick from (block.timestamp - secondsAgo) to block.timestamp
    /// @return harmonicMeanLiquidity The harmonic mean liquidity from (block.timestamp - secondsAgo) to block.timestamp
    function consult(address pool, uint32 secondsAgo)
        internal
        view
        returns (int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity)
    {
        require(secondsAgo != 0, 'BP');

        uint32[] memory secondsAgos = new uint32[](2);
        secondsAgos[0] = secondsAgo;
        secondsAgos[1] = 0;

        (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) = IUniswapV3Pool(pool)
            .observe(secondsAgos);

        int56 tickCumulativesDelta = tickCumulatives[1] - tickCumulatives[0];
        uint160 secondsPerLiquidityCumulativesDelta = secondsPerLiquidityCumulativeX128s[1] -
            secondsPerLiquidityCumulativeX128s[0];

        arithmeticMeanTick = int24(tickCumulativesDelta / int56(uint56(secondsAgo)));
        // Always round to negative infinity
        if (tickCumulativesDelta < 0 && (tickCumulativesDelta % int56(uint56(secondsAgo)) != 0)) arithmeticMeanTick--;

        // We are multiplying here instead of shifting to ensure that harmonicMeanLiquidity doesn't overflow uint128
        uint192 secondsAgoX160 = uint192(secondsAgo) * type(uint160).max;
        harmonicMeanLiquidity = uint128(secondsAgoX160 / (uint192(secondsPerLiquidityCumulativesDelta) << 32));
    }

    /// @notice Given a tick and a token amount, calculates the amount of token received in exchange
    /// @param tick Tick value used to calculate the quote
    /// @param baseAmount Amount of token to be converted
    /// @param baseToken Address of an ERC20 token contract used as the baseAmount denomination
    /// @param quoteToken Address of an ERC20 token contract used as the quoteAmount denomination
    /// @return quoteAmount Amount of quoteToken received for baseAmount of baseToken
    function getQuoteAtTick(
        int24 tick,
        uint128 baseAmount,
        address baseToken,
        address quoteToken
    ) internal pure returns (uint256 quoteAmount) {
        uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(tick);

        // Calculate quoteAmount with better precision if it doesn't overflow when multiplied by itself
        if (sqrtRatioX96 <= type(uint128).max) {
            uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;
            quoteAmount = baseToken < quoteToken
                ? FullMath.mulDiv(ratioX192, baseAmount, 1 << 192)
                : FullMath.mulDiv(1 << 192, baseAmount, ratioX192);
        } else {
            uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);
            quoteAmount = baseToken < quoteToken
                ? FullMath.mulDiv(ratioX128, baseAmount, 1 << 128)
                : FullMath.mulDiv(1 << 128, baseAmount, ratioX128);
        }
    }

    /// @notice Given a pool, it returns the number of seconds ago of the oldest stored observation
    /// @param pool Address of Uniswap V3 pool that we want to observe
    /// @return secondsAgo The number of seconds ago of the oldest observation stored for the pool
    function getOldestObservationSecondsAgo(address pool) internal view returns (uint32 secondsAgo) {
        (, , uint16 observationIndex, uint16 observationCardinality, , , ) = IUniswapV3Pool(pool).slot0();
        require(observationCardinality > 0, 'NI');

        (uint32 observationTimestamp, , , bool initialized) = IUniswapV3Pool(pool).observations(
            (observationIndex + 1) % observationCardinality
        );

        // The next index might not be initialized if the cardinality is in the process of increasing
        // In this case the oldest observation is always in index 0
        if (!initialized) {
            (observationTimestamp, , , ) = IUniswapV3Pool(pool).observations(0);
        }

        unchecked {
            secondsAgo = uint32(block.timestamp) - observationTimestamp;
        }
    }

    /// @notice Given a pool, it returns the tick value as of the start of the current block
    /// @param pool Address of Uniswap V3 pool
    /// @return The tick that the pool was in at the start of the current block
    function getBlockStartingTickAndLiquidity(address pool) internal view returns (int24, uint128) {
        (, int24 tick, uint16 observationIndex, uint16 observationCardinality, , , ) = IUniswapV3Pool(pool).slot0();

        // 2 observations are needed to reliably calculate the block starting tick
        require(observationCardinality > 1, 'NEO');

        // If the latest observation occurred in the past, then no tick-changing trades have happened in this block
        // therefore the tick in `slot0` is the same as at the beginning of the current block.
        // We don't need to check if this observation is initialized - it is guaranteed to be.
        (
            uint32 observationTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,

        ) = IUniswapV3Pool(pool).observations(observationIndex);
        if (observationTimestamp != uint32(block.timestamp)) {
            return (tick, IUniswapV3Pool(pool).liquidity());
        }

        uint256 prevIndex = (uint256(observationIndex) + observationCardinality - 1) % observationCardinality;
        (
            uint32 prevObservationTimestamp,
            int56 prevTickCumulative,
            uint160 prevSecondsPerLiquidityCumulativeX128,
            bool prevInitialized
        ) = IUniswapV3Pool(pool).observations(prevIndex);

        require(prevInitialized, 'ONI');

        uint32 delta = observationTimestamp - prevObservationTimestamp;
        tick = int24((tickCumulative - int56(uint56(prevTickCumulative))) / int56(uint56(delta)));
        uint128 liquidity = uint128(
            (uint192(delta) * type(uint160).max) /
                (uint192(secondsPerLiquidityCumulativeX128 - prevSecondsPerLiquidityCumulativeX128) << 32)
        );
        return (tick, liquidity);
    }

    /// @notice Information for calculating a weighted arithmetic mean tick
    struct WeightedTickData {
        int24 tick;
        uint128 weight;
    }

    /// @notice Given an array of ticks and weights, calculates the weighted arithmetic mean tick
    /// @param weightedTickData An array of ticks and weights
    /// @return weightedArithmeticMeanTick The weighted arithmetic mean tick
    /// @dev Each entry of `weightedTickData` should represents ticks from pools with the same underlying pool tokens. If they do not,
    /// extreme care must be taken to ensure that ticks are comparable (including decimal differences).
    /// @dev Note that the weighted arithmetic mean tick corresponds to the weighted geometric mean price.
    function getWeightedArithmeticMeanTick(WeightedTickData[] memory weightedTickData)
        internal
        pure
        returns (int24 weightedArithmeticMeanTick)
    {
        // Accumulates the sum of products between each tick and its weight
        int256 numerator;

        // Accumulates the sum of the weights
        uint256 denominator;

        // Products fit in 152 bits, so it would take an array of length ~2**104 to overflow this logic
        for (uint256 i; i < weightedTickData.length; i++) {
            numerator += weightedTickData[i].tick * int256(uint256(weightedTickData[i].weight));
            denominator += weightedTickData[i].weight;
        }

        weightedArithmeticMeanTick = int24(numerator / int256(denominator));
        // Always round to negative infinity
        if (numerator < 0 && (numerator % int256(denominator) != 0)) weightedArithmeticMeanTick--;
    }

    /// @notice Returns the "synthetic" tick which represents the price of the first entry in `tokens` in terms of the last
    /// @dev Useful for calculating relative prices along routes.
    /// @dev There must be one tick for each pairwise set of tokens.
    /// @param tokens The token contract addresses
    /// @param ticks The ticks, representing the price of each token pair in `tokens`
    /// @return syntheticTick The synthetic tick, representing the relative price of the outermost tokens in `tokens`
    function getChainedPrice(address[] memory tokens, int24[] memory ticks)
        internal
        pure
        returns (int256 syntheticTick)
    {
        require(tokens.length - 1 == ticks.length, 'DL');
        for (uint256 i = 1; i <= ticks.length; i++) {
            // check the tokens for address sort order, then accumulate the
            // ticks into the running synthetic tick, ensuring that intermediate tokens "cancel out"
            tokens[i - 1] < tokens[i] ? syntheticTick += ticks[i - 1] : syntheticTick -= ticks[i - 1];
        }
    }
}

File 8 of 37 : ServiceLocator.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

contract ServiceLocator {
    constructor() {}

    address public usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
    address public origSwapRouter;
    address public nonfungiblePositionManager;
    address public gpoPool; 

    address public gpo = 0x4ad7a056191F4c9519fAcd6D75FA94CA26003aCE;
    address public swapRouter;
    address public gpoReserve;
    address public usdcReserve = 0x33E0EC5226D7175d024a7D6B066d0beE3F8aC9C0;

    address public mmRobot;
    address public staking;
    address public liqMgmt;
    address public fundsOrg; 
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

import "../ServiceLocator.sol";
import "./CryptoToken.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

library GLPFunctions {
    using SafeERC20 for IERC20;

    function _getToken(ServiceLocator svcLoc, CryptoToken token)
        public
        view
        returns (IERC20)
    {
        IERC20 ierc20;
        if (token == CryptoToken.USDC) {
            ierc20 = IERC20(svcLoc.usdc());
        } else if (token == CryptoToken.GPO) {
            ierc20 = IERC20(svcLoc.gpo());
        } else if (token == CryptoToken.LP) {
            ierc20 = IERC20(svcLoc.staking());
        } else {
            return IERC20(address(0x0));
        }
        return ierc20;
    }

    function balance(
        ServiceLocator svcLoc,
        CryptoToken token,
        address owner
    ) public view returns (uint256) {
        if (token == CryptoToken.NATIVE) return owner.balance;
        return _getToken(svcLoc, token).balanceOf(owner);
    }

    function transferFrom(
        ServiceLocator svcLoc,
        CryptoToken token,
        address from,
        address to,
        uint256 amount
    ) public {
        require(token != CryptoToken.NATIVE, "GF: cannot transfer from native");
        _getToken(svcLoc, token).safeTransferFrom(from, to, amount);
    }

    function transfer(
        ServiceLocator svcLoc,
        CryptoToken token,
        address to,
        uint256 amount
    ) public {
        if (token == CryptoToken.NATIVE) {
            payable(to).transfer(amount);
        } else {
            _getToken(svcLoc, token).safeTransfer(to, amount);
        }
    }

    function increaseAllowance(
        ServiceLocator svcLoc,
        CryptoToken token,
        address spender,
        uint256 amount
    ) public {
        require(token != CryptoToken.NATIVE, "GF: cannot approve native");
        _getToken(svcLoc, token).safeIncreaseAllowance(spender, amount);
    }

}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

File 11 of 37 : CryptoToken.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

enum CryptoToken {
    NATIVE,
    GPO,
    USDC,
    LP
}

// 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);
}

// 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");
        }
    }
}

// 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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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);
            }
        }
    }
}

// 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);
}

// 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;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_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) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @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] = _HEX_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);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

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

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

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';

/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface ISwapRouter is IUniswapV3SwapCallback {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);

    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}

File 23 of 37 : ERC20PresetFixedSupply.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetFixedSupply.sol)
pragma solidity ^0.8.0;

import "../extensions/ERC20Burnable.sol";

/**
 * @dev {ERC20} token, including:
 *
 *  - Preminted initial supply
 *  - Ability for holders to burn (destroy) their tokens
 *  - No access control mechanism (for minting/pausing) and hence no governance
 *
 * This contract uses {ERC20Burnable} to include burn capabilities - head to
 * its documentation for details.
 *
 * _Available since v3.4._
 *
 * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._
 */
contract ERC20PresetFixedSupply is ERC20Burnable {
    /**
     * @dev Mints `initialSupply` amount of token and transfers them to `owner`.
     *
     * See {ERC20-constructor}.
     */
    constructor(
        string memory name,
        string memory symbol,
        uint256 initialSupply,
        address owner
    ) ERC20(name, symbol) {
        _mint(owner, initialSupply);
    }
}

File 24 of 37 : IUniswapV3SwapCallback.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback {
    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
    /// @dev In the implementation you must pay the pool tokens owed for the swap.
    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        _spendAllowance(account, _msgSender(), amount);
        _burn(account, amount);
    }
}

// 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.zeppelin.solutions/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;
        }
        _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;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

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

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

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

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

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

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

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

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

    /**
     * @dev 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 {}
}

// 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);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @title Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath {
    /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
    function mulDiv(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = a * b
            // Compute the product mod 2**256 and mod 2**256 - 1
            // then 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(a, b, not(0))
                prod0 := mul(a, b)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division
            if (prod1 == 0) {
                require(denominator > 0);
                assembly {
                    result := div(prod0, denominator)
                }
                return result;
            }

            // 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]
            // Compute remainder using mulmod
            uint256 remainder;
            assembly {
                remainder := mulmod(a, b, denominator)
            }
            // Subtract 256 bit number from 512 bit number
            assembly {
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator
            // Compute largest power of two divisor of denominator.
            // Always >= 1.
            uint256 twos = (0 - denominator) & denominator;
            // Divide denominator by power of two
            assembly {
                denominator := div(denominator, twos)
            }

            // Divide [prod1 prod0] by the factors of two
            assembly {
                prod0 := div(prod0, twos)
            }
            // Shift in bits from prod1 into prod0. For this we need
            // to flip `twos` such that it is 2**256 / twos.
            // If twos is zero, then it becomes one
            assembly {
                twos := add(div(sub(0, twos), twos), 1)
            }
            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
            // correct for four bits. That is, denominator * inv = 1 mod 2**4
            uint256 inv = (3 * denominator) ^ 2;
            // Now use 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.
            inv *= 2 - denominator * inv; // inverse mod 2**8
            inv *= 2 - denominator * inv; // inverse mod 2**16
            inv *= 2 - denominator * inv; // inverse mod 2**32
            inv *= 2 - denominator * inv; // inverse mod 2**64
            inv *= 2 - denominator * inv; // inverse mod 2**128
            inv *= 2 - denominator * inv; // 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 precoditions 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 * inv;
            return result;
        }
    }

    /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    function mulDivRoundingUp(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            result = mulDiv(a, b, denominator);
            if (mulmod(a, b, denominator) > 0) {
                require(result < type(uint256).max);
                result++;
            }
        }
    }
}

File 29 of 37 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import {IUniswapV3PoolImmutables} from './pool/IUniswapV3PoolImmutables.sol';
import {IUniswapV3PoolState} from './pool/IUniswapV3PoolState.sol';
import {IUniswapV3PoolDerivedState} from './pool/IUniswapV3PoolDerivedState.sol';
import {IUniswapV3PoolActions} from './pool/IUniswapV3PoolActions.sol';
import {IUniswapV3PoolOwnerActions} from './pool/IUniswapV3PoolOwnerActions.sol';
import {IUniswapV3PoolErrors} from './pool/IUniswapV3PoolErrors.sol';
import {IUniswapV3PoolEvents} from './pool/IUniswapV3PoolEvents.sol';

/// @title The interface for a Uniswap V3 Pool
/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool is
    IUniswapV3PoolImmutables,
    IUniswapV3PoolState,
    IUniswapV3PoolDerivedState,
    IUniswapV3PoolActions,
    IUniswapV3PoolOwnerActions,
    IUniswapV3PoolErrors,
    IUniswapV3PoolEvents
{

}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

/// @title Math library for computing sqrt prices from ticks and vice versa
/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
library TickMath {
    error T();
    error R();

    /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
    int24 internal constant MIN_TICK = -887272;
    /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
    int24 internal constant MAX_TICK = -MIN_TICK;

    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;
    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

    /// @notice Calculates sqrt(1.0001^tick) * 2^96
    /// @dev Throws if |tick| > max tick
    /// @param tick The input tick for the above formula
    /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
    /// at the given tick
    function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
        unchecked {
            uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
            if (absTick > uint256(int256(MAX_TICK))) revert T();

            uint256 ratio = absTick & 0x1 != 0
                ? 0xfffcb933bd6fad37aa2d162d1a594001
                : 0x100000000000000000000000000000000;
            if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
            if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
            if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
            if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
            if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
            if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
            if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
            if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
            if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
            if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
            if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
            if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
            if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
            if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
            if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
            if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
            if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
            if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
            if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;

            if (tick > 0) ratio = type(uint256).max / ratio;

            // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
            // we then downcast because we know the result always fits within 160 bits due to our tick input constraint
            // we round up in the division so getTickAtSqrtRatio of the output price is always consistent
            sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
        }
    }

    /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
    /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
    /// ever return.
    /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
    /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
    function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
        unchecked {
            // second inequality must be < because the price can never reach the price at the max tick
            if (!(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO)) revert R();
            uint256 ratio = uint256(sqrtPriceX96) << 32;

            uint256 r = ratio;
            uint256 msb = 0;

            assembly {
                let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(5, gt(r, 0xFFFFFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(4, gt(r, 0xFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(3, gt(r, 0xFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(2, gt(r, 0xF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(1, gt(r, 0x3))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := gt(r, 0x1)
                msb := or(msb, f)
            }

            if (msb >= 128) r = ratio >> (msb - 127);
            else r = ratio << (127 - msb);

            int256 log_2 = (int256(msb) - 128) << 64;

            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(63, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(62, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(61, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(60, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(59, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(58, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(57, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(56, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(55, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(54, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(53, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(52, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(51, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(50, f))
            }

            int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number

            int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);
            int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);

            tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
        }
    }
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IUniswapV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount,
        bytes calldata data
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(
        int24 tickLower,
        int24 tickUpper,
        uint128 amount
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// @return tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// @return observationIndex The index of the last oracle observation that was written,
    /// @return observationCardinality The current maximum number of observations stored in the pool,
    /// @return observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// @return feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all ticks
    /// @return The liquidity at the current price of the pool
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper
    /// @return liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// @return feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// @return feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// @return tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// @return secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// @return initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(int24 tick)
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return liquidity The amount of liquidity in the position,
    /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// @return tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// @return tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(bytes32 key)
        external
        view
        returns (
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// @return tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// @return secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// @return initialized whether the observation has been initialized and the values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IUniswapV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;

    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(
        address recipient,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IUniswapV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
        external
        view
        returns (
            int56 tickCumulativeInside,
            uint160 secondsPerLiquidityInsideX128,
            uint32 secondsInside
        );
}

File 36 of 37 : IUniswapV3PoolErrors.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Errors emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolErrors {
    error LOK();
    error TLU();
    error TLM();
    error TUM();
    error AI();
    error M0();
    error M1();
    error AS();
    error IIA();
    error L();
    error F0();
    error F1();
}

File 37 of 37 : IUniswapV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the tokens from flash
    /// @param amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld,
        uint16 observationCardinalityNextNew
    );

    /// @notice Emitted when the protocol fee is changed by the pool
    /// @param feeProtocol0Old The previous value of the token0 protocol fee
    /// @param feeProtocol1Old The previous value of the token1 protocol fee
    /// @param feeProtocol0New The updated value of the token0 protocol fee
    /// @param feeProtocol1New The updated value of the token1 protocol fee
    event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_gpo","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"T","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"swapEnabled","type":"bool"},{"indexed":false,"internalType":"address","name":"gpoReserve","type":"address"}],"name":"SwapStateChanged","type":"event"},{"inputs":[{"internalType":"uint256","name":"usdc","type":"uint256"}],"name":"calculateGPOOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"sell","type":"bool"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"canPerformSwap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gpo","outputs":[{"internalType":"contract GPO","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gpoReserve","outputs":[{"internalType":"contract GPOReserve","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBuyTradeSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSellPerTx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSellTradeSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gpoRes","type":"address"}],"name":"setGPOReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxBuy","type":"uint256"},{"internalType":"uint256","name":"maxSell","type":"uint256"},{"internalType":"uint256","name":"maxSellTx","type":"uint256"}],"name":"setTradeSizeLimitations","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapFromExactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapFromExactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapToExactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapToExactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526001600260146101000a81548160ff0219169083151502179055503480156200002c57600080fd5b5060405162003770380380620037708339818101604052810190620000529190620001f0565b6200007262000066620000ba60201b60201c565b620000c260201b60201c565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505062000222565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001b8826200018b565b9050919050565b620001ca81620001ab565b8114620001d657600080fd5b50565b600081519050620001ea81620001bf565b92915050565b60006020828403121562000209576200020862000186565b5b60006200021984828501620001d9565b91505092915050565b61353e80620002326000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80637b578d85116100a2578063acd0ef8311610071578063acd0ef8314610299578063b0b399f8146102c9578063b200059d146102f9578063deed129714610329578063f2fde38b1461035957610116565b80637b578d85146102115780638da5cb5b1461022f5780638f10f9511461024d5780639bf8e4ff1461026957610116565b80633c0582d9116100e95780633c0582d91461017d57806342a621d6146101ad5780634482b20b146101cb5780636ddd1713146101e9578063715018a61461020757610116565b80631a1d0aca1461011b5780631ff8d507146101395780632e40ead314610143578063330c96bc1461015f575b600080fd5b610123610375565b6040516101309190612459565b60405180910390f35b61014161039b565b005b61015d600480360381019061015891906124c6565b610439565b005b6101676104ef565b604051610174919061250c565b60405180910390f35b61019760048036038101906101929190612553565b6104f5565b6040516101a4919061250c565b60405180910390f35b6101b561065c565b6040516101c291906125a1565b60405180910390f35b6101d3610682565b6040516101e0919061250c565b60405180910390f35b6101f1610688565b6040516101fe91906125d7565b60405180910390f35b61020f61069b565b005b6102196106af565b604051610226919061250c565b60405180910390f35b6102376106b5565b6040516102449190612601565b60405180910390f35b6102676004803603810190610262919061261c565b6106de565b005b610283600480360381019061027e919061261c565b610700565b604051610290919061250c565b60405180910390f35b6102b360048036038101906102ae919061269b565b61094c565b6040516102c091906125d7565b60405180910390f35b6102e360048036038101906102de919061261c565b610983565b6040516102f0919061250c565b60405180910390f35b610313600480360381019061030e919061261c565b610d15565b604051610320919061250c565b60405180910390f35b610343600480360381019061033e919061261c565b610f4b565b604051610350919061250c565b60405180910390f35b610373600480360381019061036e91906124c6565b611148565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6103a36111cb565b600260149054906101000a900460ff1615600260146101000a81548160ff0219169083151502179055507f8517ebfff3a7f52cc2806b1efc29157c61e27d627467b6ef7485a420f17bc179600260149054906101000a900460ff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405161042f9291906126db565b60405180910390a1565b6104416111cb565b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f8517ebfff3a7f52cc2806b1efc29157c61e27d627467b6ef7485a420f17bc179600260149054906101000a900460ff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516104e49291906126db565b60405180910390a150565b60035481565b600080610593600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632a337c266040518163ffffffff1660e01b8152600401602060405180830381865afa158015610568573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058c9190612719565b603c611249565b5090506106548184600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610608573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062c9190612719565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661151f565b915050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b600260149054906101000a900460ff1681565b6106a36111cb565b6106ad600061172b565b565b60045481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6106e66111cb565b826003819055508160048190555080600581905550505050565b600080841180156107115750600083115b61071a57600080fd5b600260149054906101000a900460ff1661073357600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c69190612719565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060003390506108008282308a6117ef565b866004541015801561081457506005548711155b1561090757610824828389611947565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639bf8e4ff8888886040518463ffffffff1660e01b815260040161088393929190612746565b6020604051808303816000875af11580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c69190612792565b935083600460008282546108da91906127ee565b925050819055506108f78282868a6108f291906127ee565b611a9c565b610902838288611a9c565b610942565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610939906128a5565b60405180910390fd5b5050509392505050565b600082801561095c575060045482115b801561096a57506005548211155b15610978576000905061097d565b600190505b92915050565b600080841180156109945750600083115b61099d57600080fd5b600260149054906101000a900460ff166109b657600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a499190612719565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000339050610a838382308a6117ef565b8660035410610b6457610a97838389611947565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b0b399f88888886040518463ffffffff1660e01b8152600401610af693929190612746565b6020604051808303816000875af1158015610b15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b399190612792565b93508660036000828254610b4d91906127ee565b92505081905550610b5f828286611a9c565b610d0b565b60006064600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663014300e56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf99190612792565b89610c0491906128c5565b610c0e9190612936565b88610c1991906127ee565b905060008189610c2991906127ee565b9050610c34826104f5565b9550610c6385600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611947565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d1fbe4913088856040518463ffffffff1660e01b8152600401610cc293929190612967565b600060405180830381600087803b158015610cdc57600080fd5b505af1158015610cf0573d6000803e3d6000fd5b50505050610cff848488611a9c565b610d0881611bf1565b50505b5050509392505050565b60008084118015610d265750600083115b610d2f57600080fd5b600260149054906101000a900460ff16610d4857600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddb9190612719565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000339050610e158282308a6117ef565b8660045410158015610e2957506005548711155b15610f0657610e39828389611947565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b200059d8888886040518463ffffffff1660e01b8152600401610e9893929190612746565b6020604051808303816000875af1158015610eb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edb9190612792565b93508660046000828254610eef91906127ee565b92505081905550610f01838286611a9c565b610f41565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f38906128a5565b60405180910390fd5b5050509392505050565b60008084118015610f5c5750600083115b610f6557600080fd5b600260149054906101000a900460ff16610f7e57600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110119190612719565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000339050866003541061113e576110548382308a6117ef565b61105f838389611947565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663deed12978888886040518463ffffffff1660e01b81526004016110be93929190612746565b6020604051808303816000875af11580156110dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111019190612792565b9350836003600082825461111591906127ee565b925050819055506111328382868a61112d91906127ee565b611a9c565b61113d828288611a9c565b5b5050509392505050565b6111506111cb565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036111bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b690612a10565b60405180910390fd5b6111c88161172b565b50565b6111d3611eed565b73ffffffffffffffffffffffffffffffffffffffff166111f16106b5565b73ffffffffffffffffffffffffffffffffffffffff1614611247576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123e90612a7c565b60405180910390fd5b565b60008060008363ffffffff1603611295576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128c90612ae8565b60405180910390fd5b6000600267ffffffffffffffff8111156112b2576112b1612b08565b5b6040519080825280602002602001820160405280156112e05781602001602082028036833780820191505090505b50905083816000815181106112f8576112f7612b37565b5b602002602001019063ffffffff16908163ffffffff168152505060008160018151811061132857611327612b37565b5b602002602001019063ffffffff16908163ffffffff16815250506000808673ffffffffffffffffffffffffffffffffffffffff1663883bdbfd846040518263ffffffff1660e01b815260040161137e9190612c34565b600060405180830381865afa15801561139b573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906113c49190612ea8565b915091506000826000815181106113de576113dd612b37565b5b6020026020010151836001815181106113fa576113f9612b37565b5b602002602001015161140c9190612f20565b905060008260008151811061142457611423612b37565b5b6020026020010151836001815181106114405761143f612b37565b5b60200260200101516114529190612f7f565b90508763ffffffff16826114669190612fc7565b965060008260060b128015611490575060008863ffffffff168361148a9190613031565b60060b14155b156114a45786806114a09061306f565b9750505b600073ffffffffffffffffffffffffffffffffffffffff80168963ffffffff166114ce91906130db565b905060208273ffffffffffffffffffffffffffffffffffffffff1677ffffffffffffffffffffffffffffffffffffffffffffffff16901b81611510919061311d565b96505050505050509250929050565b60008061152b86611ef5565b90506fffffffffffffffffffffffffffffffff80168173ffffffffffffffffffffffffffffffffffffffff16116116455760008173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1661159691906128c5565b90508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1610611606576116017801000000000000000000000000000000000000000000000000876fffffffffffffffffffffffffffffffff1683612301565b61163d565b61163c81876fffffffffffffffffffffffffffffffff167801000000000000000000000000000000000000000000000000612301565b5b925050611722565b60006116878273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1668010000000000000000612301565b90508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16106116ef576116ea700100000000000000000000000000000000876fffffffffffffffffffffffffffffffff1683612301565b61171e565b61171d81876fffffffffffffffffffffffffffffffff16700100000000000000000000000000000000612301565b5b9250505b50949350505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000808573ffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b8686866040516024016118269392919061314e565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161189091906131f6565b6000604051808303816000865af19150503d80600081146118cd576040519150601f19603f3d011682016040523d82523d6000602084013e6118d2565b606091505b509150915081801561190057506000815114806118ff5750808060200190518101906118fe9190613222565b5b5b61193f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119369061329b565b60405180910390fd5b505050505050565b6000808473ffffffffffffffffffffffffffffffffffffffff1663095ea7b360e01b858560405160240161197c9291906132bb565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516119e691906131f6565b6000604051808303816000865af19150503d8060008114611a23576040519150601f19603f3d011682016040523d82523d6000602084013e611a28565b606091505b5091509150818015611a565750600081511480611a55575080806020019051810190611a549190613222565b5b5b611a95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8c90613330565b60405180910390fd5b5050505050565b6000808473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b8585604051602401611ad19291906132bb565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611b3b91906131f6565b6000604051808303816000865af19150503d8060008114611b78576040519150601f19603f3d011682016040523d82523d6000602084013e611b7d565b606091505b5091509150818015611bab5750600081511480611baa575080806020019051810190611ba99190613222565b5b5b611bea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611be19061339c565b60405180910390fd5b5050505050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663420286446040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c859190612792565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d1a9190612719565b905060005b82811015611e1857600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c4a1116846040518263ffffffff1660e01b8152600401611d85919061250c565b6040805180830381865afa158015611da1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc591906133f6565b91509150600060648261ffff1689611ddd91906128c5565b611de79190612936565b9050611df4858483611a9c565b8087611e009190613436565b96505050508080611e109061346a565b915050611d1f565b50838314158015611e295750600082115b15611ee7576000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c4a111660006040518263ffffffff1660e01b8152600401611e8c91906134ed565b6040805180830381865afa158015611ea8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ecc91906133f6565b509050611ee582828688611ee091906127ee565b611a9c565b505b50505050565b600033905090565b60008060008360020b12611f0c578260020b611f14565b8260020b6000035b90507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2761860000360020b811115611f76576040517f2bc80f3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806001831603611f9957700100000000000000000000000000000000611fab565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff16905060006002831614611fe55760806ffff97272373d413259a46990580e213a8202901c90505b6000600483161461200a5760806ffff2e50f5f656932ef12357cf3c7fdcc8202901c90505b6000600883161461202f5760806fffe5caca7e10e4e61c3624eaa0941cd08202901c90505b600060108316146120545760806fffcb9843d60f6159c9db58835c9266448202901c90505b600060208316146120795760806fff973b41fa98c081472e6896dfb254c08202901c90505b6000604083161461209e5760806fff2ea16466c96a3843ec78b326b528618202901c90505b600060808316146120c35760806ffe5dee046a99a2a811c461f1969c30538202901c90505b60006101008316146120e95760806ffcbe86c7900a88aedcffc83b479aa3a48202901c90505b600061020083161461210f5760806ff987a7253ac413176f2b074cf7815e548202901c90505b60006104008316146121355760806ff3392b0822b70005940c7a398e4b70f38202901c90505b600061080083161461215b5760806fe7159475a2c29b7443b29c7fa6e889d98202901c90505b60006110008316146121815760806fd097f3bdfd2022b8845ad8f792aa58258202901c90505b60006120008316146121a75760806fa9f746462d870fdf8a65dc1f90e061e58202901c90505b60006140008316146121cd5760806f70d869a156d2a1b890bb3df62baf32f78202901c90505b60006180008316146121f35760806f31be135f97d08fd981231505542fcfa68202901c90505b60006201000083161461221a5760806f09aa508b5b7a84e1c677de54f3e99bc98202901c90505b6000620200008316146122405760806e5d6af8dedb81196699c329225ee6048202901c90505b6000620400008316146122655760806d2216e584f5fa1ea926041bedfe988202901c90505b6000620800008316146122885760806b048a170391f7dc42444e8fa28202901c90505b60008460020b13156122c857807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff816122c4576122c3612907565b5b0490505b600064010000000082816122df576122de612907565b5b06146122ec5760016122ef565b60005b60ff16602082901c0192505050919050565b600080600080198587098587029250828110838203039150506000810361233b576000841161232f57600080fd5b838204925050506123d3565b80841161234757600080fd5b600084868809905082811182039150808303925060008586600003169050808604955080840493506001818260000304019050808302841793506000600287600302189050808702600203810290508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808502955050505050505b9392505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061241f61241a612415846123da565b6123fa565b6123da565b9050919050565b600061243182612404565b9050919050565b600061244382612426565b9050919050565b61245381612438565b82525050565b600060208201905061246e600083018461244a565b92915050565b6000604051905090565b600080fd5b600080fd5b6000612493826123da565b9050919050565b6124a381612488565b81146124ae57600080fd5b50565b6000813590506124c08161249a565b92915050565b6000602082840312156124dc576124db61247e565b5b60006124ea848285016124b1565b91505092915050565b6000819050919050565b612506816124f3565b82525050565b600060208201905061252160008301846124fd565b92915050565b612530816124f3565b811461253b57600080fd5b50565b60008135905061254d81612527565b92915050565b6000602082840312156125695761256861247e565b5b60006125778482850161253e565b91505092915050565b600061258b82612426565b9050919050565b61259b81612580565b82525050565b60006020820190506125b66000830184612592565b92915050565b60008115159050919050565b6125d1816125bc565b82525050565b60006020820190506125ec60008301846125c8565b92915050565b6125fb81612488565b82525050565b600060208201905061261660008301846125f2565b92915050565b6000806000606084860312156126355761263461247e565b5b60006126438682870161253e565b93505060206126548682870161253e565b92505060406126658682870161253e565b9150509250925092565b612678816125bc565b811461268357600080fd5b50565b6000813590506126958161266f565b92915050565b600080604083850312156126b2576126b161247e565b5b60006126c085828601612686565b92505060206126d18582860161253e565b9150509250929050565b60006040820190506126f060008301856125c8565b6126fd60208301846125f2565b9392505050565b6000815190506127138161249a565b92915050565b60006020828403121561272f5761272e61247e565b5b600061273d84828501612704565b91505092915050565b600060608201905061275b60008301866124fd565b61276860208301856124fd565b61277560408301846124fd565b949350505050565b60008151905061278c81612527565b92915050565b6000602082840312156127a8576127a761247e565b5b60006127b68482850161277d565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006127f9826124f3565b9150612804836124f3565b925082820390508181111561281c5761281b6127bf565b5b92915050565b600082825260208201905092915050565b7f47502d53523a204f726465722061626f76652073656c6c20747261646520736960008201527f7a65000000000000000000000000000000000000000000000000000000000000602082015250565b600061288f602283612822565b915061289a82612833565b604082019050919050565b600060208201905081810360008301526128be81612882565b9050919050565b60006128d0826124f3565b91506128db836124f3565b92508282026128e9816124f3565b91508282048414831517612900576128ff6127bf565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612941826124f3565b915061294c836124f3565b92508261295c5761295b612907565b5b828204905092915050565b600060608201905061297c60008301866125f2565b61298960208301856124fd565b61299660408301846124fd565b949350505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006129fa602683612822565b9150612a058261299e565b604082019050919050565b60006020820190508181036000830152612a29816129ed565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612a66602083612822565b9150612a7182612a30565b602082019050919050565b60006020820190508181036000830152612a9581612a59565b9050919050565b7f4250000000000000000000000000000000000000000000000000000000000000600082015250565b6000612ad2600283612822565b9150612add82612a9c565b602082019050919050565b60006020820190508181036000830152612b0181612ac5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600063ffffffff82169050919050565b612bab81612b92565b82525050565b6000612bbd8383612ba2565b60208301905092915050565b6000602082019050919050565b6000612be182612b66565b612beb8185612b71565b9350612bf683612b82565b8060005b83811015612c27578151612c0e8882612bb1565b9750612c1983612bc9565b925050600181019050612bfa565b5085935050505092915050565b60006020820190508181036000830152612c4e8184612bd6565b905092915050565b600080fd5b6000601f19601f8301169050919050565b612c7582612c5b565b810181811067ffffffffffffffff82111715612c9457612c93612b08565b5b80604052505050565b6000612ca7612474565b9050612cb38282612c6c565b919050565b600067ffffffffffffffff821115612cd357612cd2612b08565b5b602082029050602081019050919050565b600080fd5b60008160060b9050919050565b612cff81612ce9565b8114612d0a57600080fd5b50565b600081519050612d1c81612cf6565b92915050565b6000612d35612d3084612cb8565b612c9d565b90508083825260208201905060208402830185811115612d5857612d57612ce4565b5b835b81811015612d815780612d6d8882612d0d565b845260208401935050602081019050612d5a565b5050509392505050565b600082601f830112612da057612d9f612c56565b5b8151612db0848260208601612d22565b91505092915050565b600067ffffffffffffffff821115612dd457612dd3612b08565b5b602082029050602081019050919050565b612dee816123da565b8114612df957600080fd5b50565b600081519050612e0b81612de5565b92915050565b6000612e24612e1f84612db9565b612c9d565b90508083825260208201905060208402830185811115612e4757612e46612ce4565b5b835b81811015612e705780612e5c8882612dfc565b845260208401935050602081019050612e49565b5050509392505050565b600082601f830112612e8f57612e8e612c56565b5b8151612e9f848260208601612e11565b91505092915050565b60008060408385031215612ebf57612ebe61247e565b5b600083015167ffffffffffffffff811115612edd57612edc612483565b5b612ee985828601612d8b565b925050602083015167ffffffffffffffff811115612f0a57612f09612483565b5b612f1685828601612e7a565b9150509250929050565b6000612f2b82612ce9565b9150612f3683612ce9565b92508282039050667fffffffffffff81137fffffffffffffffffffffffffffffffffffffffffffffffffff8000000000000082121715612f7957612f786127bf565b5b92915050565b6000612f8a826123da565b9150612f95836123da565b9250828203905073ffffffffffffffffffffffffffffffffffffffff811115612fc157612fc06127bf565b5b92915050565b6000612fd282612ce9565b9150612fdd83612ce9565b925082612fed57612fec612907565b5b600160000383147fffffffffffffffffffffffffffffffffffffffffffffffffff8000000000000083141615613026576130256127bf565b5b828205905092915050565b600061303c82612ce9565b915061304783612ce9565b92508261305757613056612907565b5b828207905092915050565b60008160020b9050919050565b600061307a82613062565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80000082036130ac576130ab6127bf565b5b600182039050919050565b600077ffffffffffffffffffffffffffffffffffffffffffffffff82169050919050565b60006130e6826130b7565b91506130f1836130b7565b92508282026130ff816130b7565b91508282048414831517613116576131156127bf565b5b5092915050565b6000613128826130b7565b9150613133836130b7565b92508261314357613142612907565b5b828204905092915050565b600060608201905061316360008301866125f2565b61317060208301856125f2565b61317d60408301846124fd565b949350505050565b600081519050919050565b600081905092915050565b60005b838110156131b957808201518184015260208101905061319e565b60008484015250505050565b60006131d082613185565b6131da8185613190565b93506131ea81856020860161319b565b80840191505092915050565b600061320282846131c5565b915081905092915050565b60008151905061321c8161266f565b92915050565b6000602082840312156132385761323761247e565b5b60006132468482850161320d565b91505092915050565b7f5354460000000000000000000000000000000000000000000000000000000000600082015250565b6000613285600383612822565b91506132908261324f565b602082019050919050565b600060208201905081810360008301526132b481613278565b9050919050565b60006040820190506132d060008301856125f2565b6132dd60208301846124fd565b9392505050565b7f5341000000000000000000000000000000000000000000000000000000000000600082015250565b600061331a600283612822565b9150613325826132e4565b602082019050919050565b600060208201905081810360008301526133498161330d565b9050919050565b7f5354000000000000000000000000000000000000000000000000000000000000600082015250565b6000613386600283612822565b915061339182613350565b602082019050919050565b600060208201905081810360008301526133b581613379565b9050919050565b600061ffff82169050919050565b6133d3816133bc565b81146133de57600080fd5b50565b6000815190506133f0816133ca565b92915050565b6000806040838503121561340d5761340c61247e565b5b600061341b85828601612704565b925050602061342c858286016133e1565b9150509250929050565b6000613441826124f3565b915061344c836124f3565b9250828201905080821115613464576134636127bf565b5b92915050565b6000613475826124f3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036134a7576134a66127bf565b5b600182019050919050565b6000819050919050565b60006134d76134d26134cd846134b2565b6123fa565b6124f3565b9050919050565b6134e7816134bc565b82525050565b600060208201905061350260008301846134de565b9291505056fea264697066735822122001665df3c08c02aac0bfb6913130d76362882fbeac8293b75f65c870273eeec564736f6c634300081100330000000000000000000000004ad7a056191f4c9519facd6d75fa94ca26003ace

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101165760003560e01c80637b578d85116100a2578063acd0ef8311610071578063acd0ef8314610299578063b0b399f8146102c9578063b200059d146102f9578063deed129714610329578063f2fde38b1461035957610116565b80637b578d85146102115780638da5cb5b1461022f5780638f10f9511461024d5780639bf8e4ff1461026957610116565b80633c0582d9116100e95780633c0582d91461017d57806342a621d6146101ad5780634482b20b146101cb5780636ddd1713146101e9578063715018a61461020757610116565b80631a1d0aca1461011b5780631ff8d507146101395780632e40ead314610143578063330c96bc1461015f575b600080fd5b610123610375565b6040516101309190612459565b60405180910390f35b61014161039b565b005b61015d600480360381019061015891906124c6565b610439565b005b6101676104ef565b604051610174919061250c565b60405180910390f35b61019760048036038101906101929190612553565b6104f5565b6040516101a4919061250c565b60405180910390f35b6101b561065c565b6040516101c291906125a1565b60405180910390f35b6101d3610682565b6040516101e0919061250c565b60405180910390f35b6101f1610688565b6040516101fe91906125d7565b60405180910390f35b61020f61069b565b005b6102196106af565b604051610226919061250c565b60405180910390f35b6102376106b5565b6040516102449190612601565b60405180910390f35b6102676004803603810190610262919061261c565b6106de565b005b610283600480360381019061027e919061261c565b610700565b604051610290919061250c565b60405180910390f35b6102b360048036038101906102ae919061269b565b61094c565b6040516102c091906125d7565b60405180910390f35b6102e360048036038101906102de919061261c565b610983565b6040516102f0919061250c565b60405180910390f35b610313600480360381019061030e919061261c565b610d15565b604051610320919061250c565b60405180910390f35b610343600480360381019061033e919061261c565b610f4b565b604051610350919061250c565b60405180910390f35b610373600480360381019061036e91906124c6565b611148565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6103a36111cb565b600260149054906101000a900460ff1615600260146101000a81548160ff0219169083151502179055507f8517ebfff3a7f52cc2806b1efc29157c61e27d627467b6ef7485a420f17bc179600260149054906101000a900460ff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405161042f9291906126db565b60405180910390a1565b6104416111cb565b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f8517ebfff3a7f52cc2806b1efc29157c61e27d627467b6ef7485a420f17bc179600260149054906101000a900460ff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516104e49291906126db565b60405180910390a150565b60035481565b600080610593600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632a337c266040518163ffffffff1660e01b8152600401602060405180830381865afa158015610568573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058c9190612719565b603c611249565b5090506106548184600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610608573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062c9190612719565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661151f565b915050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b600260149054906101000a900460ff1681565b6106a36111cb565b6106ad600061172b565b565b60045481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6106e66111cb565b826003819055508160048190555080600581905550505050565b600080841180156107115750600083115b61071a57600080fd5b600260149054906101000a900460ff1661073357600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c69190612719565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060003390506108008282308a6117ef565b866004541015801561081457506005548711155b1561090757610824828389611947565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639bf8e4ff8888886040518463ffffffff1660e01b815260040161088393929190612746565b6020604051808303816000875af11580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c69190612792565b935083600460008282546108da91906127ee565b925050819055506108f78282868a6108f291906127ee565b611a9c565b610902838288611a9c565b610942565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610939906128a5565b60405180910390fd5b5050509392505050565b600082801561095c575060045482115b801561096a57506005548211155b15610978576000905061097d565b600190505b92915050565b600080841180156109945750600083115b61099d57600080fd5b600260149054906101000a900460ff166109b657600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a499190612719565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000339050610a838382308a6117ef565b8660035410610b6457610a97838389611947565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b0b399f88888886040518463ffffffff1660e01b8152600401610af693929190612746565b6020604051808303816000875af1158015610b15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b399190612792565b93508660036000828254610b4d91906127ee565b92505081905550610b5f828286611a9c565b610d0b565b60006064600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663014300e56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf99190612792565b89610c0491906128c5565b610c0e9190612936565b88610c1991906127ee565b905060008189610c2991906127ee565b9050610c34826104f5565b9550610c6385600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611947565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d1fbe4913088856040518463ffffffff1660e01b8152600401610cc293929190612967565b600060405180830381600087803b158015610cdc57600080fd5b505af1158015610cf0573d6000803e3d6000fd5b50505050610cff848488611a9c565b610d0881611bf1565b50505b5050509392505050565b60008084118015610d265750600083115b610d2f57600080fd5b600260149054906101000a900460ff16610d4857600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddb9190612719565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000339050610e158282308a6117ef565b8660045410158015610e2957506005548711155b15610f0657610e39828389611947565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b200059d8888886040518463ffffffff1660e01b8152600401610e9893929190612746565b6020604051808303816000875af1158015610eb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edb9190612792565b93508660046000828254610eef91906127ee565b92505081905550610f01838286611a9c565b610f41565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f38906128a5565b60405180910390fd5b5050509392505050565b60008084118015610f5c5750600083115b610f6557600080fd5b600260149054906101000a900460ff16610f7e57600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110119190612719565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000339050866003541061113e576110548382308a6117ef565b61105f838389611947565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663deed12978888886040518463ffffffff1660e01b81526004016110be93929190612746565b6020604051808303816000875af11580156110dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111019190612792565b9350836003600082825461111591906127ee565b925050819055506111328382868a61112d91906127ee565b611a9c565b61113d828288611a9c565b5b5050509392505050565b6111506111cb565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036111bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b690612a10565b60405180910390fd5b6111c88161172b565b50565b6111d3611eed565b73ffffffffffffffffffffffffffffffffffffffff166111f16106b5565b73ffffffffffffffffffffffffffffffffffffffff1614611247576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123e90612a7c565b60405180910390fd5b565b60008060008363ffffffff1603611295576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128c90612ae8565b60405180910390fd5b6000600267ffffffffffffffff8111156112b2576112b1612b08565b5b6040519080825280602002602001820160405280156112e05781602001602082028036833780820191505090505b50905083816000815181106112f8576112f7612b37565b5b602002602001019063ffffffff16908163ffffffff168152505060008160018151811061132857611327612b37565b5b602002602001019063ffffffff16908163ffffffff16815250506000808673ffffffffffffffffffffffffffffffffffffffff1663883bdbfd846040518263ffffffff1660e01b815260040161137e9190612c34565b600060405180830381865afa15801561139b573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906113c49190612ea8565b915091506000826000815181106113de576113dd612b37565b5b6020026020010151836001815181106113fa576113f9612b37565b5b602002602001015161140c9190612f20565b905060008260008151811061142457611423612b37565b5b6020026020010151836001815181106114405761143f612b37565b5b60200260200101516114529190612f7f565b90508763ffffffff16826114669190612fc7565b965060008260060b128015611490575060008863ffffffff168361148a9190613031565b60060b14155b156114a45786806114a09061306f565b9750505b600073ffffffffffffffffffffffffffffffffffffffff80168963ffffffff166114ce91906130db565b905060208273ffffffffffffffffffffffffffffffffffffffff1677ffffffffffffffffffffffffffffffffffffffffffffffff16901b81611510919061311d565b96505050505050509250929050565b60008061152b86611ef5565b90506fffffffffffffffffffffffffffffffff80168173ffffffffffffffffffffffffffffffffffffffff16116116455760008173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1661159691906128c5565b90508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1610611606576116017801000000000000000000000000000000000000000000000000876fffffffffffffffffffffffffffffffff1683612301565b61163d565b61163c81876fffffffffffffffffffffffffffffffff167801000000000000000000000000000000000000000000000000612301565b5b925050611722565b60006116878273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1668010000000000000000612301565b90508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16106116ef576116ea700100000000000000000000000000000000876fffffffffffffffffffffffffffffffff1683612301565b61171e565b61171d81876fffffffffffffffffffffffffffffffff16700100000000000000000000000000000000612301565b5b9250505b50949350505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000808573ffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b8686866040516024016118269392919061314e565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161189091906131f6565b6000604051808303816000865af19150503d80600081146118cd576040519150601f19603f3d011682016040523d82523d6000602084013e6118d2565b606091505b509150915081801561190057506000815114806118ff5750808060200190518101906118fe9190613222565b5b5b61193f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119369061329b565b60405180910390fd5b505050505050565b6000808473ffffffffffffffffffffffffffffffffffffffff1663095ea7b360e01b858560405160240161197c9291906132bb565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516119e691906131f6565b6000604051808303816000865af19150503d8060008114611a23576040519150601f19603f3d011682016040523d82523d6000602084013e611a28565b606091505b5091509150818015611a565750600081511480611a55575080806020019051810190611a549190613222565b5b5b611a95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8c90613330565b60405180910390fd5b5050505050565b6000808473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b8585604051602401611ad19291906132bb565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611b3b91906131f6565b6000604051808303816000865af19150503d8060008114611b78576040519150601f19603f3d011682016040523d82523d6000602084013e611b7d565b606091505b5091509150818015611bab5750600081511480611baa575080806020019051810190611ba99190613222565b5b5b611bea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611be19061339c565b60405180910390fd5b5050505050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663420286446040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c859190612792565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166334c05dd66040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d1a9190612719565b905060005b82811015611e1857600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c4a1116846040518263ffffffff1660e01b8152600401611d85919061250c565b6040805180830381865afa158015611da1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc591906133f6565b91509150600060648261ffff1689611ddd91906128c5565b611de79190612936565b9050611df4858483611a9c565b8087611e009190613436565b96505050508080611e109061346a565b915050611d1f565b50838314158015611e295750600082115b15611ee7576000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c4a111660006040518263ffffffff1660e01b8152600401611e8c91906134ed565b6040805180830381865afa158015611ea8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ecc91906133f6565b509050611ee582828688611ee091906127ee565b611a9c565b505b50505050565b600033905090565b60008060008360020b12611f0c578260020b611f14565b8260020b6000035b90507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2761860000360020b811115611f76576040517f2bc80f3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806001831603611f9957700100000000000000000000000000000000611fab565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff16905060006002831614611fe55760806ffff97272373d413259a46990580e213a8202901c90505b6000600483161461200a5760806ffff2e50f5f656932ef12357cf3c7fdcc8202901c90505b6000600883161461202f5760806fffe5caca7e10e4e61c3624eaa0941cd08202901c90505b600060108316146120545760806fffcb9843d60f6159c9db58835c9266448202901c90505b600060208316146120795760806fff973b41fa98c081472e6896dfb254c08202901c90505b6000604083161461209e5760806fff2ea16466c96a3843ec78b326b528618202901c90505b600060808316146120c35760806ffe5dee046a99a2a811c461f1969c30538202901c90505b60006101008316146120e95760806ffcbe86c7900a88aedcffc83b479aa3a48202901c90505b600061020083161461210f5760806ff987a7253ac413176f2b074cf7815e548202901c90505b60006104008316146121355760806ff3392b0822b70005940c7a398e4b70f38202901c90505b600061080083161461215b5760806fe7159475a2c29b7443b29c7fa6e889d98202901c90505b60006110008316146121815760806fd097f3bdfd2022b8845ad8f792aa58258202901c90505b60006120008316146121a75760806fa9f746462d870fdf8a65dc1f90e061e58202901c90505b60006140008316146121cd5760806f70d869a156d2a1b890bb3df62baf32f78202901c90505b60006180008316146121f35760806f31be135f97d08fd981231505542fcfa68202901c90505b60006201000083161461221a5760806f09aa508b5b7a84e1c677de54f3e99bc98202901c90505b6000620200008316146122405760806e5d6af8dedb81196699c329225ee6048202901c90505b6000620400008316146122655760806d2216e584f5fa1ea926041bedfe988202901c90505b6000620800008316146122885760806b048a170391f7dc42444e8fa28202901c90505b60008460020b13156122c857807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff816122c4576122c3612907565b5b0490505b600064010000000082816122df576122de612907565b5b06146122ec5760016122ef565b60005b60ff16602082901c0192505050919050565b600080600080198587098587029250828110838203039150506000810361233b576000841161232f57600080fd5b838204925050506123d3565b80841161234757600080fd5b600084868809905082811182039150808303925060008586600003169050808604955080840493506001818260000304019050808302841793506000600287600302189050808702600203810290508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808502955050505050505b9392505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061241f61241a612415846123da565b6123fa565b6123da565b9050919050565b600061243182612404565b9050919050565b600061244382612426565b9050919050565b61245381612438565b82525050565b600060208201905061246e600083018461244a565b92915050565b6000604051905090565b600080fd5b600080fd5b6000612493826123da565b9050919050565b6124a381612488565b81146124ae57600080fd5b50565b6000813590506124c08161249a565b92915050565b6000602082840312156124dc576124db61247e565b5b60006124ea848285016124b1565b91505092915050565b6000819050919050565b612506816124f3565b82525050565b600060208201905061252160008301846124fd565b92915050565b612530816124f3565b811461253b57600080fd5b50565b60008135905061254d81612527565b92915050565b6000602082840312156125695761256861247e565b5b60006125778482850161253e565b91505092915050565b600061258b82612426565b9050919050565b61259b81612580565b82525050565b60006020820190506125b66000830184612592565b92915050565b60008115159050919050565b6125d1816125bc565b82525050565b60006020820190506125ec60008301846125c8565b92915050565b6125fb81612488565b82525050565b600060208201905061261660008301846125f2565b92915050565b6000806000606084860312156126355761263461247e565b5b60006126438682870161253e565b93505060206126548682870161253e565b92505060406126658682870161253e565b9150509250925092565b612678816125bc565b811461268357600080fd5b50565b6000813590506126958161266f565b92915050565b600080604083850312156126b2576126b161247e565b5b60006126c085828601612686565b92505060206126d18582860161253e565b9150509250929050565b60006040820190506126f060008301856125c8565b6126fd60208301846125f2565b9392505050565b6000815190506127138161249a565b92915050565b60006020828403121561272f5761272e61247e565b5b600061273d84828501612704565b91505092915050565b600060608201905061275b60008301866124fd565b61276860208301856124fd565b61277560408301846124fd565b949350505050565b60008151905061278c81612527565b92915050565b6000602082840312156127a8576127a761247e565b5b60006127b68482850161277d565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006127f9826124f3565b9150612804836124f3565b925082820390508181111561281c5761281b6127bf565b5b92915050565b600082825260208201905092915050565b7f47502d53523a204f726465722061626f76652073656c6c20747261646520736960008201527f7a65000000000000000000000000000000000000000000000000000000000000602082015250565b600061288f602283612822565b915061289a82612833565b604082019050919050565b600060208201905081810360008301526128be81612882565b9050919050565b60006128d0826124f3565b91506128db836124f3565b92508282026128e9816124f3565b91508282048414831517612900576128ff6127bf565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612941826124f3565b915061294c836124f3565b92508261295c5761295b612907565b5b828204905092915050565b600060608201905061297c60008301866125f2565b61298960208301856124fd565b61299660408301846124fd565b949350505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006129fa602683612822565b9150612a058261299e565b604082019050919050565b60006020820190508181036000830152612a29816129ed565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612a66602083612822565b9150612a7182612a30565b602082019050919050565b60006020820190508181036000830152612a9581612a59565b9050919050565b7f4250000000000000000000000000000000000000000000000000000000000000600082015250565b6000612ad2600283612822565b9150612add82612a9c565b602082019050919050565b60006020820190508181036000830152612b0181612ac5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600063ffffffff82169050919050565b612bab81612b92565b82525050565b6000612bbd8383612ba2565b60208301905092915050565b6000602082019050919050565b6000612be182612b66565b612beb8185612b71565b9350612bf683612b82565b8060005b83811015612c27578151612c0e8882612bb1565b9750612c1983612bc9565b925050600181019050612bfa565b5085935050505092915050565b60006020820190508181036000830152612c4e8184612bd6565b905092915050565b600080fd5b6000601f19601f8301169050919050565b612c7582612c5b565b810181811067ffffffffffffffff82111715612c9457612c93612b08565b5b80604052505050565b6000612ca7612474565b9050612cb38282612c6c565b919050565b600067ffffffffffffffff821115612cd357612cd2612b08565b5b602082029050602081019050919050565b600080fd5b60008160060b9050919050565b612cff81612ce9565b8114612d0a57600080fd5b50565b600081519050612d1c81612cf6565b92915050565b6000612d35612d3084612cb8565b612c9d565b90508083825260208201905060208402830185811115612d5857612d57612ce4565b5b835b81811015612d815780612d6d8882612d0d565b845260208401935050602081019050612d5a565b5050509392505050565b600082601f830112612da057612d9f612c56565b5b8151612db0848260208601612d22565b91505092915050565b600067ffffffffffffffff821115612dd457612dd3612b08565b5b602082029050602081019050919050565b612dee816123da565b8114612df957600080fd5b50565b600081519050612e0b81612de5565b92915050565b6000612e24612e1f84612db9565b612c9d565b90508083825260208201905060208402830185811115612e4757612e46612ce4565b5b835b81811015612e705780612e5c8882612dfc565b845260208401935050602081019050612e49565b5050509392505050565b600082601f830112612e8f57612e8e612c56565b5b8151612e9f848260208601612e11565b91505092915050565b60008060408385031215612ebf57612ebe61247e565b5b600083015167ffffffffffffffff811115612edd57612edc612483565b5b612ee985828601612d8b565b925050602083015167ffffffffffffffff811115612f0a57612f09612483565b5b612f1685828601612e7a565b9150509250929050565b6000612f2b82612ce9565b9150612f3683612ce9565b92508282039050667fffffffffffff81137fffffffffffffffffffffffffffffffffffffffffffffffffff8000000000000082121715612f7957612f786127bf565b5b92915050565b6000612f8a826123da565b9150612f95836123da565b9250828203905073ffffffffffffffffffffffffffffffffffffffff811115612fc157612fc06127bf565b5b92915050565b6000612fd282612ce9565b9150612fdd83612ce9565b925082612fed57612fec612907565b5b600160000383147fffffffffffffffffffffffffffffffffffffffffffffffffff8000000000000083141615613026576130256127bf565b5b828205905092915050565b600061303c82612ce9565b915061304783612ce9565b92508261305757613056612907565b5b828207905092915050565b60008160020b9050919050565b600061307a82613062565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80000082036130ac576130ab6127bf565b5b600182039050919050565b600077ffffffffffffffffffffffffffffffffffffffffffffffff82169050919050565b60006130e6826130b7565b91506130f1836130b7565b92508282026130ff816130b7565b91508282048414831517613116576131156127bf565b5b5092915050565b6000613128826130b7565b9150613133836130b7565b92508261314357613142612907565b5b828204905092915050565b600060608201905061316360008301866125f2565b61317060208301856125f2565b61317d60408301846124fd565b949350505050565b600081519050919050565b600081905092915050565b60005b838110156131b957808201518184015260208101905061319e565b60008484015250505050565b60006131d082613185565b6131da8185613190565b93506131ea81856020860161319b565b80840191505092915050565b600061320282846131c5565b915081905092915050565b60008151905061321c8161266f565b92915050565b6000602082840312156132385761323761247e565b5b60006132468482850161320d565b91505092915050565b7f5354460000000000000000000000000000000000000000000000000000000000600082015250565b6000613285600383612822565b91506132908261324f565b602082019050919050565b600060208201905081810360008301526132b481613278565b9050919050565b60006040820190506132d060008301856125f2565b6132dd60208301846124fd565b9392505050565b7f5341000000000000000000000000000000000000000000000000000000000000600082015250565b600061331a600283612822565b9150613325826132e4565b602082019050919050565b600060208201905081810360008301526133498161330d565b9050919050565b7f5354000000000000000000000000000000000000000000000000000000000000600082015250565b6000613386600283612822565b915061339182613350565b602082019050919050565b600060208201905081810360008301526133b581613379565b9050919050565b600061ffff82169050919050565b6133d3816133bc565b81146133de57600080fd5b50565b6000815190506133f0816133ca565b92915050565b6000806040838503121561340d5761340c61247e565b5b600061341b85828601612704565b925050602061342c858286016133e1565b9150509250929050565b6000613441826124f3565b915061344c836124f3565b9250828201905080821115613464576134636127bf565b5b92915050565b6000613475826124f3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036134a7576134a66127bf565b5b600182019050919050565b6000819050919050565b60006134d76134d26134cd846134b2565b6123fa565b6124f3565b9050919050565b6134e7816134bc565b82525050565b600060208201905061350260008301846134de565b9291505056fea264697066735822122001665df3c08c02aac0bfb6913130d76362882fbeac8293b75f65c870273eeec564736f6c63430008110033

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

0000000000000000000000004ad7a056191f4c9519facd6d75fa94ca26003ace

-----Decoded View---------------
Arg [0] : _gpo (address): 0x4ad7a056191F4c9519fAcd6D75FA94CA26003aCE

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000004ad7a056191f4c9519facd6d75fa94ca26003ace


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

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