ETH Price: $3,866.31 (-1.35%)
Gas: 0.16 GWei

Contract

0xAad094F6A75A14417d39f04E690fC216f080A41a
Transaction Hash
Method
Block
From
To
0x7faef0f829d6cf1c15f0c218aa9e8c0a3788cae8d9b139b3b8238c246dfea5c8 -(pending)2024-12-06 8:19:161 hr ago1733473156IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0xe61a8e692f74c37bdad5ac21f25c824fa4269ed3d823468f01936dfb72d28069 -(pending)2024-12-06 7:32:012 hrs ago1733470321IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x7f20f92c7d74f9df8ceb053478324cd687a2aaac16e4279661b2cbdf02db6707 -(pending)2024-12-06 7:16:012 hrs ago1733469361IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x6002c2bcb50f16481229e29e19145674c5858efceba879016c4b4ae29d19dbf5 -(pending)2024-12-06 7:16:012 hrs ago1733469361IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x4a01346d4401482daaa2aa6e7a632f6eadb7ae0abe29bef83893a0f8193f22bd -(pending)2024-12-06 7:16:012 hrs ago1733469361IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x988b985ae7539a8d5440db781cb535ccfe41d9db34141a4a8f72d5380e84002d -(pending)2024-12-06 7:16:012 hrs ago1733469361IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x1be287d5441f50b249bc5a608bbad0e0e40225e759d56eecc3b3cc203452862d -(pending)2024-12-06 7:16:012 hrs ago1733469361IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x733fec82e9396cc1ae5b7382500e08640373d34ddf1425a413322477c1a71c47 -(pending)2024-12-06 7:16:002 hrs ago1733469360IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x656cebc255234473e5dd41dfb782cb40fbd1f92af8ae1eabc8249469cd392343 -(pending)2024-12-06 7:16:002 hrs ago1733469360IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0xba0af383f57b57a94971316c8b0e2590c276b7833a589d91512a69886e8d4ead -(pending)2024-12-06 7:16:002 hrs ago1733469360IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x682643f4d5983d9d6a803432568c8abdba421f0d80d3366967f4510f6d296121 -(pending)2024-12-06 7:16:002 hrs ago1733469360IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x8358a4c9264feeb74e2e4e15932d90c7acded818e907d07fedaa6110024cadfb -(pending)2024-12-06 7:16:002 hrs ago1733469360IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0xcabd1caca2c62efd5ed0ca913d42ee2ecb5e414961ef4f6206730a0a83e7c1b0 -(pending)2024-12-06 7:14:542 hrs ago1733469294IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x402c3dc5ad809918c33baf1aac499798eb71b87fe1692575e0d0ef24b11b9c89 -(pending)2024-12-06 7:14:542 hrs ago1733469294IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x570ca3fd6d515398ea09a6c467402171f4071b316baae5e2863150337dc3647a -(pending)2024-12-06 5:07:055 hrs ago1733461625IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0xee8e83db41c64eec30b87eecb1d32ac7f5f80a83dda259b1c724112423326c20 -(pending)2024-12-06 3:41:336 hrs ago1733456493IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x8fec9be0db8dd090543a0d8955926d24f7e8c0655d26e11e6abf856276ffce9a -(pending)2024-12-06 2:31:227 hrs ago1733452282IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x127526e17affe8c3b1817022c295509ee9f5ef1ea4f09410a7fcfad94fc8c6cb -(pending)2024-12-06 2:26:477 hrs ago1733452007IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0xb8dc12cbb45f959d4e0be4236231bbf30843e8aecdb38286259fd569f200e099 -(pending)2024-12-05 17:37:3716 hrs ago1733420257IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x8a7111bd87cf9fc687bb7925141c2fc1c8359e2005c417f0d422bab7a3444145 -(pending)2024-12-05 12:44:1121 hrs ago1733402651IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0xc0186d5e396393c145dea1cab544d69011161d2b187680af8f536304f77f5c28 -(pending)2024-12-05 12:03:4822 hrs ago1733400228IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x436f7504ef0ac3cffc5561f32d2499c5388e9b219e7df22db8c51d5de22ccb72 -(pending)2024-12-05 11:58:1522 hrs ago1733399895IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x49f4b90383275a74d7e8124dbdab401f1b00f0588fb1a33d0ea355f8d5daaefe -(pending)2024-12-04 16:58:2541 hrs ago1733331505IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x4d1e076cce57aacc7dbb042827b8109721aa9da7358ad36ff4701e789dbc0f39 -(pending)2024-12-04 13:45:5244 hrs ago1733319952IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
0x6bb75b256d53eadcb6bafd915099deb42392cbcf8e25c12d9dc3b6393f343aa7 -(pending)2024-12-04 13:10:2644 hrs ago1733317826IN
Stargate Finance: S*SGETH Token
0 ETH(Pending)(Pending)
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
129670332024-12-06 10:07:0041 secs ago1733479620
Stargate Finance: S*SGETH Token
0 ETH
129670332024-12-06 10:07:0041 secs ago1733479620
Stargate Finance: S*SGETH Token
0 ETH
129670292024-12-06 10:06:5249 secs ago1733479612
Stargate Finance: S*SGETH Token
0 ETH
129670292024-12-06 10:06:5249 secs ago1733479612
Stargate Finance: S*SGETH Token
0 ETH
129670032024-12-06 10:05:581 min ago1733479558
Stargate Finance: S*SGETH Token
0 ETH
129670032024-12-06 10:05:581 min ago1733479558
Stargate Finance: S*SGETH Token
0 ETH
129669952024-12-06 10:05:392 mins ago1733479539
Stargate Finance: S*SGETH Token
0 ETH
129669952024-12-06 10:05:392 mins ago1733479539
Stargate Finance: S*SGETH Token
0 ETH
129669712024-12-06 10:04:472 mins ago1733479487
Stargate Finance: S*SGETH Token
0 ETH
129669712024-12-06 10:04:472 mins ago1733479487
Stargate Finance: S*SGETH Token
0 ETH
129669542024-12-06 10:04:093 mins ago1733479449
Stargate Finance: S*SGETH Token
0 ETH
129669542024-12-06 10:04:093 mins ago1733479449
Stargate Finance: S*SGETH Token
0 ETH
129669542024-12-06 10:04:093 mins ago1733479449
Stargate Finance: S*SGETH Token
0 ETH
129669432024-12-06 10:03:463 mins ago1733479426
Stargate Finance: S*SGETH Token
0 ETH
129669432024-12-06 10:03:463 mins ago1733479426
Stargate Finance: S*SGETH Token
0 ETH
129669342024-12-06 10:03:284 mins ago1733479408
Stargate Finance: S*SGETH Token
0 ETH
129669342024-12-06 10:03:284 mins ago1733479408
Stargate Finance: S*SGETH Token
0 ETH
129669342024-12-06 10:03:284 mins ago1733479408
Stargate Finance: S*SGETH Token
0 ETH
129669342024-12-06 10:03:284 mins ago1733479408
Stargate Finance: S*SGETH Token
0 ETH
129669342024-12-06 10:03:284 mins ago1733479408
Stargate Finance: S*SGETH Token
0 ETH
129669342024-12-06 10:03:284 mins ago1733479408
Stargate Finance: S*SGETH Token
0 ETH
129669342024-12-06 10:03:284 mins ago1733479408
Stargate Finance: S*SGETH Token
0 ETH
129669342024-12-06 10:03:284 mins ago1733479408
Stargate Finance: S*SGETH Token
0 ETH
129669342024-12-06 10:03:284 mins ago1733479408
Stargate Finance: S*SGETH Token
0 ETH
129669342024-12-06 10:03:284 mins ago1733479408
Stargate Finance: S*SGETH Token
0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Pool

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, BSL 1.1 license
File 1 of 8 : Pool.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;
pragma abicoder v2;

// imports
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./LPTokenERC20.sol";
import "./interfaces/IStargateFeeLibrary.sol";

// libraries
import "@openzeppelin/contracts/math/SafeMath.sol";

/// Pool contracts on other chains and managed by the Stargate protocol.
contract Pool is LPTokenERC20, ReentrancyGuard {
    using SafeMath for uint256;

    //---------------------------------------------------------------------------
    // CONSTANTS
    bytes4 private constant SELECTOR = bytes4(keccak256(bytes("transfer(address,uint256)")));
    uint256 public constant BP_DENOMINATOR = 10000;

    //---------------------------------------------------------------------------
    // STRUCTS
    struct ChainPath {
        bool ready; // indicate if the counter chainPath has been created.
        uint16 dstChainId;
        uint256 dstPoolId;
        uint256 weight;
        uint256 balance;
        uint256 lkb;
        uint256 credits;
        uint256 idealBalance;
    }

    struct SwapObj {
        uint256 amount;
        uint256 eqFee;
        uint256 eqReward;
        uint256 lpFee;
        uint256 protocolFee;
        uint256 lkbRemove;
    }

    struct CreditObj {
        uint256 credits;
        uint256 idealBalance;
    }

    //---------------------------------------------------------------------------
    // VARIABLES

    // chainPath
    ChainPath[] public chainPaths; // list of connected chains with shared pools
    mapping(uint16 => mapping(uint256 => uint256)) public chainPathIndexLookup; // lookup for chainPath by chainId => poolId =>index

    // metadata
    uint256 public immutable poolId; // shared id between chains to represent same pool
    uint256 public sharedDecimals; // the shared decimals (lowest common decimals between chains)
    uint256 public localDecimals; // the decimals for the token
    uint256 public immutable convertRate; // the decimals for the token
    address public immutable token; // the token for the pool
    address public immutable router; // the token for the pool

    bool public stopSwap; // flag to stop swapping in extreme cases

    // Fee and Liquidity
    uint256 public totalLiquidity; // the total amount of tokens added on this side of the chain (fees + deposits - withdrawals)
    uint256 public totalWeight; // total weight for pool percentages
    uint256 public mintFeeBP; // fee basis points for the mint/deposit
    uint256 public protocolFeeBalance; // fee balance created from dao fee
    uint256 public mintFeeBalance; // fee balance created from mint fee
    uint256 public eqFeePool; // pool rewards in Shared Decimal format. indicate the total budget for reverse swap incentive
    address public feeLibrary; // address for retrieving fee params for swaps

    // Delta related
    uint256 public deltaCredit; // credits accumulated from txn
    bool public batched; // flag to indicate if we want batch processing.
    bool public defaultSwapMode; // flag for the default mode for swap
    bool public defaultLPMode; // flag for the default mode for lp
    uint256 public swapDeltaBP; // basis points of poolCredits to activate Delta in swap
    uint256 public lpDeltaBP; // basis points of poolCredits to activate Delta in liquidity events

    //---------------------------------------------------------------------------
    // EVENTS
    event Mint(address to, uint256 amountLP, uint256 amountSD, uint256 mintFeeAmountSD);
    event Burn(address from, uint256 amountLP, uint256 amountSD);
    event RedeemLocalCallback(address _to, uint256 _amountSD, uint256 _amountToMintSD);
    event Swap(
        uint16 chainId,
        uint256 dstPoolId,
        address from,
        uint256 amountSD,
        uint256 eqReward,
        uint256 eqFee,
        uint256 protocolFee,
        uint256 lpFee
    );
    event SendCredits(uint16 dstChainId, uint256 dstPoolId, uint256 credits, uint256 idealBalance);
    event RedeemRemote(uint16 chainId, uint256 dstPoolId, address from, uint256 amountLP, uint256 amountSD);
    event RedeemLocal(address from, uint256 amountLP, uint256 amountSD, uint16 chainId, uint256 dstPoolId, bytes to);
    event InstantRedeemLocal(address from, uint256 amountLP, uint256 amountSD, address to);
    event CreditChainPath(uint16 chainId, uint256 srcPoolId, uint256 amountSD, uint256 idealBalance);
    event SwapRemote(address to, uint256 amountSD, uint256 protocolFee, uint256 dstFee);
    event WithdrawRemote(uint16 srcChainId, uint256 srcPoolId, uint256 swapAmount, uint256 mintAmount);
    event ChainPathUpdate(uint16 dstChainId, uint256 dstPoolId, uint256 weight);
    event FeesUpdated(uint256 mintFeeBP);
    event FeeLibraryUpdated(address feeLibraryAddr);
    event StopSwapUpdated(bool swapStop);
    event WithdrawProtocolFeeBalance(address to, uint256 amountSD);
    event WithdrawMintFeeBalance(address to, uint256 amountSD);
    event DeltaParamUpdated(bool batched, uint256 swapDeltaBP, uint256 lpDeltaBP, bool defaultSwapMode, bool defaultLPMode);

    //---------------------------------------------------------------------------
    // MODIFIERS
    modifier onlyRouter() {
        require(msg.sender == router, "Stargate: only the router can call this method");
        _;
    }

    constructor(
        uint256 _poolId,
        address _router,
        address _token,
        uint256 _sharedDecimals,
        uint256 _localDecimals,
        address _feeLibrary,
        string memory _name,
        string memory _symbol
    ) LPTokenERC20(_name, _symbol) {
        require(_token != address(0x0), "Stargate: _token cannot be 0x0");
        require(_router != address(0x0), "Stargate: _router cannot be 0x0");
        poolId = _poolId;
        router = _router;
        token = _token;
        sharedDecimals = _sharedDecimals;
        decimals = uint8(_sharedDecimals);
        localDecimals = _localDecimals;
        convertRate = 10**(uint256(localDecimals).sub(sharedDecimals));
        totalWeight = 0;
        feeLibrary = _feeLibrary;

        //delta algo related
        batched = false;
        defaultSwapMode = true;
        defaultLPMode = true;
    }

    function getChainPathsLength() public view returns (uint256) {
        return chainPaths.length;
    }

    //---------------------------------------------------------------------------
    // LOCAL CHAIN FUNCTIONS

    function mint(address _to, uint256 _amountLD) external nonReentrant onlyRouter returns (uint256) {
        return _mintLocal(_to, _amountLD, true, true);
    }

    // Local                                    Remote
    // -------                                  ---------
    // swap             ->                      swapRemote
    function swap(
        uint16 _dstChainId,
        uint256 _dstPoolId,
        address _from,
        uint256 _amountLD,
        uint256 _minAmountLD,
        bool newLiquidity
    ) external nonReentrant onlyRouter returns (SwapObj memory) {
        require(!stopSwap, "Stargate: swap func stopped");
        ChainPath storage cp = getAndCheckCP(_dstChainId, _dstPoolId);
        require(cp.ready == true, "Stargate: counter chainPath is not ready");

        uint256 amountSD = amountLDtoSD(_amountLD);
        uint256 minAmountSD = amountLDtoSD(_minAmountLD);

        // request fee params from library
        SwapObj memory s = IStargateFeeLibrary(feeLibrary).getFees(poolId, _dstPoolId, _dstChainId, _from, amountSD);

        // equilibrium fee and reward. note eqFee/eqReward are separated from swap liquidity
        eqFeePool = eqFeePool.sub(s.eqReward);
        // update the new amount the user gets minus the fees
        s.amount = amountSD.sub(s.eqFee).sub(s.protocolFee).sub(s.lpFee);
        // users will also get the eqReward
        require(s.amount.add(s.eqReward) >= minAmountSD, "Stargate: slippage too high");

        // behaviours
        //     - protocolFee: booked, stayed and withdrawn at remote.
        //     - eqFee: booked, stayed and withdrawn at remote.
        //     - lpFee: booked and stayed at remote, can be withdrawn anywhere

        s.lkbRemove = amountSD.sub(s.lpFee).add(s.eqReward);
        // check for transfer solvency.
        require(cp.balance >= s.lkbRemove, "Stargate: dst balance too low");
        cp.balance = cp.balance.sub(s.lkbRemove);

        if (newLiquidity) {
            deltaCredit = deltaCredit.add(amountSD).add(s.eqReward);
        } else if (s.eqReward > 0) {
            deltaCredit = deltaCredit.add(s.eqReward);
        }

        // distribute credits on condition.
        if (!batched || deltaCredit >= totalLiquidity.mul(swapDeltaBP).div(BP_DENOMINATOR)) {
            _delta(defaultSwapMode);
        }

        emit Swap(_dstChainId, _dstPoolId, _from, s.amount, s.eqReward, s.eqFee, s.protocolFee, s.lpFee);
        return s;
    }

    // Local                                    Remote
    // -------                                  ---------
    // sendCredits      ->                      creditChainPath
    function sendCredits(uint16 _dstChainId, uint256 _dstPoolId) external nonReentrant onlyRouter returns (CreditObj memory c) {
        ChainPath storage cp = getAndCheckCP(_dstChainId, _dstPoolId);
        require(cp.ready == true, "Stargate: counter chainPath is not ready");
        cp.lkb = cp.lkb.add(cp.credits);
        c.idealBalance = totalLiquidity.mul(cp.weight).div(totalWeight);
        c.credits = cp.credits;
        cp.credits = 0;
        emit SendCredits(_dstChainId, _dstPoolId, c.credits, c.idealBalance);
    }

    // Local                                    Remote
    // -------                                  ---------
    // redeemRemote   ->                        swapRemote
    function redeemRemote(
        uint16 _dstChainId,
        uint256 _dstPoolId,
        address _from,
        uint256 _amountLP
    ) external nonReentrant onlyRouter {
        require(_from != address(0x0), "Stargate: _from cannot be 0x0");
        uint256 amountSD = _burnLocal(_from, _amountLP);
        //run Delta
        if (!batched || deltaCredit > totalLiquidity.mul(lpDeltaBP).div(BP_DENOMINATOR)) {
            _delta(defaultLPMode);
        }
        uint256 amountLD = amountSDtoLD(amountSD);
        emit RedeemRemote(_dstChainId, _dstPoolId, _from, _amountLP, amountLD);
    }

    function instantRedeemLocal(
        address _from,
        uint256 _amountLP,
        address _to
    ) external nonReentrant onlyRouter returns (uint256 amountSD) {
        require(_from != address(0x0), "Stargate: _from cannot be 0x0");
        uint256 _deltaCredit = deltaCredit; // sload optimization.
        uint256 _capAmountLP = _amountSDtoLP(_deltaCredit);

        if (_amountLP > _capAmountLP) _amountLP = _capAmountLP;

        amountSD = _burnLocal(_from, _amountLP);
        deltaCredit = _deltaCredit.sub(amountSD);
        uint256 amountLD = amountSDtoLD(amountSD);
        _safeTransfer(token, _to, amountLD);
        emit InstantRedeemLocal(_from, _amountLP, amountSD, _to);
    }

    // Local                                    Remote
    // -------                                  ---------
    // redeemLocal   ->                         redeemLocalCheckOnRemote
    // redeemLocalCallback             <-
    function redeemLocal(
        address _from,
        uint256 _amountLP,
        uint16 _dstChainId,
        uint256 _dstPoolId,
        bytes calldata _to
    ) external nonReentrant onlyRouter returns (uint256 amountSD) {
        require(_from != address(0x0), "Stargate: _from cannot be 0x0");

        // safeguard.
        require(chainPaths[chainPathIndexLookup[_dstChainId][_dstPoolId]].ready == true, "Stargate: counter chainPath is not ready");
        amountSD = _burnLocal(_from, _amountLP);

        // run Delta
        if (!batched || deltaCredit > totalLiquidity.mul(lpDeltaBP).div(BP_DENOMINATOR)) {
            _delta(false);
        }
        emit RedeemLocal(_from, _amountLP, amountSD, _dstChainId, _dstPoolId, _to);
    }

    //---------------------------------------------------------------------------
    // REMOTE CHAIN FUNCTIONS

    // Local                                    Remote
    // -------                                  ---------
    // sendCredits      ->                      creditChainPath
    function creditChainPath(
        uint16 _dstChainId,
        uint256 _dstPoolId,
        CreditObj memory _c
    ) external nonReentrant onlyRouter {
        ChainPath storage cp = chainPaths[chainPathIndexLookup[_dstChainId][_dstPoolId]];
        cp.balance = cp.balance.add(_c.credits);
        if (cp.idealBalance != _c.idealBalance) {
            cp.idealBalance = _c.idealBalance;
        }
        emit CreditChainPath(_dstChainId, _dstPoolId, _c.credits, _c.idealBalance);
    }

    // Local                                    Remote
    // -------                                  ---------
    // swap             ->                      swapRemote
    function swapRemote(
        uint16 _srcChainId,
        uint256 _srcPoolId,
        address _to,
        SwapObj memory _s
    ) external nonReentrant onlyRouter returns (uint256 amountLD) {
        // booking lpFee
        totalLiquidity = totalLiquidity.add(_s.lpFee);
        // booking eqFee
        eqFeePool = eqFeePool.add(_s.eqFee);
        // booking stargateFee
        protocolFeeBalance = protocolFeeBalance.add(_s.protocolFee);

        // update LKB
        uint256 chainPathIndex = chainPathIndexLookup[_srcChainId][_srcPoolId];
        chainPaths[chainPathIndex].lkb = chainPaths[chainPathIndex].lkb.sub(_s.lkbRemove);

        // user receives the amount + the srcReward
        amountLD = amountSDtoLD(_s.amount.add(_s.eqReward));
        _safeTransfer(token, _to, amountLD);
        emit SwapRemote(_to, _s.amount.add(_s.eqReward), _s.protocolFee, _s.eqFee);
    }

    // Local                                    Remote
    // -------                                  ---------
    // redeemLocal   ->                         redeemLocalCheckOnRemote
    // redeemLocalCallback             <-
    function redeemLocalCallback(
        uint16 _srcChainId,
        uint256 _srcPoolId,
        address _to,
        uint256 _amountSD,
        uint256 _amountToMintSD
    ) external nonReentrant onlyRouter {
        if (_amountToMintSD > 0) {
            _mintLocal(_to, amountSDtoLD(_amountToMintSD), false, false);
        }

        ChainPath storage cp = getAndCheckCP(_srcChainId, _srcPoolId);
        cp.lkb = cp.lkb.sub(_amountSD);

        uint256 amountLD = amountSDtoLD(_amountSD);
        _safeTransfer(token, _to, amountLD);
        emit RedeemLocalCallback(_to, _amountSD, _amountToMintSD);
    }

    // Local                                    Remote
    // -------                                  ---------
    // redeemLocal(amount)   ->               redeemLocalCheckOnRemote
    // redeemLocalCallback             <-
    function redeemLocalCheckOnRemote(
        uint16 _srcChainId,
        uint256 _srcPoolId,
        uint256 _amountSD
    ) external nonReentrant onlyRouter returns (uint256 swapAmount, uint256 mintAmount) {
        ChainPath storage cp = getAndCheckCP(_srcChainId, _srcPoolId);
        if (_amountSD > cp.balance) {
            mintAmount = _amountSD - cp.balance;
            swapAmount = cp.balance;
            cp.balance = 0;
        } else {
            cp.balance = cp.balance.sub(_amountSD);
            swapAmount = _amountSD;
            mintAmount = 0;
        }
        emit WithdrawRemote(_srcChainId, _srcPoolId, swapAmount, mintAmount);
    }

    //---------------------------------------------------------------------------
    // DAO Calls
    function createChainPath(
        uint16 _dstChainId,
        uint256 _dstPoolId,
        uint256 _weight
    ) external onlyRouter {
        for (uint256 i = 0; i < chainPaths.length; ++i) {
            ChainPath memory cp = chainPaths[i];
            bool exists = cp.dstChainId == _dstChainId && cp.dstPoolId == _dstPoolId;
            require(!exists, "Stargate: cant createChainPath of existing dstChainId and _dstPoolId");
        }
        totalWeight = totalWeight.add(_weight);
        chainPathIndexLookup[_dstChainId][_dstPoolId] = chainPaths.length;
        chainPaths.push(ChainPath(false, _dstChainId, _dstPoolId, _weight, 0, 0, 0, 0));
        emit ChainPathUpdate(_dstChainId, _dstPoolId, _weight);
    }

    function setWeightForChainPath(
        uint16 _dstChainId,
        uint256 _dstPoolId,
        uint16 _weight
    ) external onlyRouter {
        ChainPath storage cp = getAndCheckCP(_dstChainId, _dstPoolId);
        totalWeight = totalWeight.sub(cp.weight).add(_weight);
        cp.weight = _weight;
        emit ChainPathUpdate(_dstChainId, _dstPoolId, _weight);
    }

    function setFee(uint256 _mintFeeBP) external onlyRouter {
        require(_mintFeeBP <= BP_DENOMINATOR, "Bridge: cum fees > 100%");
        mintFeeBP = _mintFeeBP;
        emit FeesUpdated(mintFeeBP);
    }

    function setFeeLibrary(address _feeLibraryAddr) external onlyRouter {
        require(_feeLibraryAddr != address(0x0), "Stargate: fee library cant be 0x0");
        feeLibrary = _feeLibraryAddr;
        emit FeeLibraryUpdated(_feeLibraryAddr);
    }

    function setSwapStop(bool _swapStop) external onlyRouter {
        stopSwap = _swapStop;
        emit StopSwapUpdated(_swapStop);
    }

    function setDeltaParam(
        bool _batched,
        uint256 _swapDeltaBP,
        uint256 _lpDeltaBP,
        bool _defaultSwapMode,
        bool _defaultLPMode
    ) external onlyRouter {
        require(_swapDeltaBP <= BP_DENOMINATOR && _lpDeltaBP <= BP_DENOMINATOR, "Stargate: wrong Delta param");
        batched = _batched;
        swapDeltaBP = _swapDeltaBP;
        lpDeltaBP = _lpDeltaBP;
        defaultSwapMode = _defaultSwapMode;
        defaultLPMode = _defaultLPMode;
        emit DeltaParamUpdated(_batched, _swapDeltaBP, _lpDeltaBP, _defaultSwapMode, _defaultLPMode);
    }

    function callDelta(bool _fullMode) external onlyRouter {
        _delta(_fullMode);
    }

    function activateChainPath(uint16 _dstChainId, uint256 _dstPoolId) external onlyRouter {
        ChainPath storage cp = getAndCheckCP(_dstChainId, _dstPoolId);
        require(cp.ready == false, "Stargate: chainPath is already active");
        // this func will only be called once
        cp.ready = true;
    }

    function withdrawProtocolFeeBalance(address _to) external onlyRouter {
        if (protocolFeeBalance > 0) {
            uint256 amountOfLD = amountSDtoLD(protocolFeeBalance);
            protocolFeeBalance = 0;
            _safeTransfer(token, _to, amountOfLD);
            emit WithdrawProtocolFeeBalance(_to, amountOfLD);
        }
    }

    function withdrawMintFeeBalance(address _to) external onlyRouter {
        if (mintFeeBalance > 0) {
            uint256 amountOfLD = amountSDtoLD(mintFeeBalance);
            mintFeeBalance = 0;
            _safeTransfer(token, _to, amountOfLD);
            emit WithdrawMintFeeBalance(_to, amountOfLD);
        }
    }

    //---------------------------------------------------------------------------
    // INTERNAL
    // Conversion Helpers
    //---------------------------------------------------------------------------
    function amountLPtoLD(uint256 _amountLP) external view returns (uint256) {
        return amountSDtoLD(_amountLPtoSD(_amountLP));
    }

    function _amountLPtoSD(uint256 _amountLP) internal view returns (uint256) {
        require(totalSupply > 0, "Stargate: cant convert LPtoSD when totalSupply == 0");
        return _amountLP.mul(totalLiquidity).div(totalSupply);
    }

    function _amountSDtoLP(uint256 _amountSD) internal view returns (uint256) {
        require(totalLiquidity > 0, "Stargate: cant convert SDtoLP when totalLiq == 0");
        return _amountSD.mul(totalSupply).div(totalLiquidity);
    }

    function amountSDtoLD(uint256 _amount) internal view returns (uint256) {
        return _amount.mul(convertRate);
    }

    function amountLDtoSD(uint256 _amount) internal view returns (uint256) {
        return _amount.div(convertRate);
    }

    function getAndCheckCP(uint16 _dstChainId, uint256 _dstPoolId) internal view returns (ChainPath storage) {
        require(chainPaths.length > 0, "Stargate: no chainpaths exist");
        ChainPath storage cp = chainPaths[chainPathIndexLookup[_dstChainId][_dstPoolId]];
        require(cp.dstChainId == _dstChainId && cp.dstPoolId == _dstPoolId, "Stargate: local chainPath does not exist");
        return cp;
    }

    function getChainPath(uint16 _dstChainId, uint256 _dstPoolId) external view returns (ChainPath memory) {
        ChainPath memory cp = chainPaths[chainPathIndexLookup[_dstChainId][_dstPoolId]];
        require(cp.dstChainId == _dstChainId && cp.dstPoolId == _dstPoolId, "Stargate: local chainPath does not exist");
        return cp;
    }

    function _burnLocal(address _from, uint256 _amountLP) internal returns (uint256) {
        require(totalSupply > 0, "Stargate: cant burn when totalSupply == 0");
        uint256 amountOfLPTokens = balanceOf[_from];
        require(amountOfLPTokens >= _amountLP, "Stargate: not enough LP tokens to burn");

        uint256 amountSD = _amountLP.mul(totalLiquidity).div(totalSupply);
        //subtract totalLiquidity accordingly
        totalLiquidity = totalLiquidity.sub(amountSD);

        _burn(_from, _amountLP);
        emit Burn(_from, _amountLP, amountSD);
        return amountSD;
    }

    function _delta(bool fullMode) internal {
        if (deltaCredit > 0 && totalWeight > 0) {
            uint256 cpLength = chainPaths.length;
            uint256[] memory deficit = new uint256[](cpLength);
            uint256 totalDeficit = 0;

            // algorithm steps 6-9: calculate the total and the amounts required to get to balance state
            for (uint256 i = 0; i < cpLength; ++i) {
                ChainPath storage cp = chainPaths[i];
                // (liquidity * (weight/totalWeight)) - (lkb+credits)
                uint256 balLiq = totalLiquidity.mul(cp.weight).div(totalWeight);
                uint256 currLiq = cp.lkb.add(cp.credits);
                if (balLiq > currLiq) {
                    // save gas since we know balLiq > currLiq and we know deficit[i] > 0
                    deficit[i] = balLiq - currLiq;
                    totalDeficit = totalDeficit.add(deficit[i]);
                }
            }

            // indicates how much delta credit is distributed
            uint256 spent;

            // handle credits with 2 tranches. the [ < totalDeficit] [excessCredit]
            // run full Delta, allocate all credits
            if (totalDeficit == 0) {
                // only fullMode delta will allocate excess credits
                if (fullMode && deltaCredit > 0) {
                    // credit ChainPath by weights
                    for (uint256 i = 0; i < cpLength; ++i) {
                        ChainPath storage cp = chainPaths[i];
                        // credits = credits + toBalanceChange + remaining allocation based on weight
                        uint256 amtToCredit = deltaCredit.mul(cp.weight).div(totalWeight);
                        spent = spent.add(amtToCredit);
                        cp.credits = cp.credits.add(amtToCredit);
                    }
                } // else do nth
            } else if (totalDeficit <= deltaCredit) {
                if (fullMode) {
                    // algorithm step 13: calculate amount to disperse to bring to balance state or as close as possible
                    uint256 excessCredit = deltaCredit - totalDeficit;
                    // algorithm steps 14-16: calculate credits
                    for (uint256 i = 0; i < cpLength; ++i) {
                        if (deficit[i] > 0) {
                            ChainPath storage cp = chainPaths[i];
                            // credits = credits + deficit + remaining allocation based on weight
                            uint256 amtToCredit = deficit[i].add(excessCredit.mul(cp.weight).div(totalWeight));
                            spent = spent.add(amtToCredit);
                            cp.credits = cp.credits.add(amtToCredit);
                        }
                    }
                } else {
                    // totalDeficit <= deltaCredit but not running fullMode
                    // credit chainPaths as is if any deficit, not using all deltaCredit
                    for (uint256 i = 0; i < cpLength; ++i) {
                        if (deficit[i] > 0) {
                            ChainPath storage cp = chainPaths[i];
                            uint256 amtToCredit = deficit[i];
                            spent = spent.add(amtToCredit);
                            cp.credits = cp.credits.add(amtToCredit);
                        }
                    }
                }
            } else {
                // totalDeficit > deltaCredit, fullMode or not, normalize the deficit by deltaCredit
                for (uint256 i = 0; i < cpLength; ++i) {
                    if (deficit[i] > 0) {
                        ChainPath storage cp = chainPaths[i];
                        uint256 proportionalDeficit = deficit[i].mul(deltaCredit).div(totalDeficit);
                        spent = spent.add(proportionalDeficit);
                        cp.credits = cp.credits.add(proportionalDeficit);
                    }
                }
            }

            // deduct the amount of credit sent
            deltaCredit = deltaCredit.sub(spent);
        }
    }

    function _mintLocal(
        address _to,
        uint256 _amountLD,
        bool _feesEnabled,
        bool _creditDelta
    ) internal returns (uint256 amountSD) {
        require(totalWeight > 0, "Stargate: No ChainPaths exist");
        amountSD = amountLDtoSD(_amountLD);

        uint256 mintFeeSD = 0;
        if (_feesEnabled) {
            mintFeeSD = amountSD.mul(mintFeeBP).div(BP_DENOMINATOR);
            amountSD = amountSD.sub(mintFeeSD);
            mintFeeBalance = mintFeeBalance.add(mintFeeSD);
        }

        if (_creditDelta) {
            deltaCredit = deltaCredit.add(amountSD);
        }

        uint256 amountLPTokens = amountSD;
        if (totalSupply != 0) {
            amountLPTokens = amountSD.mul(totalSupply).div(totalLiquidity);
        }
        totalLiquidity = totalLiquidity.add(amountSD);

        _mint(_to, amountLPTokens);
        emit Mint(_to, amountLPTokens, amountSD, mintFeeSD);

        // add to credits and call delta. short circuit to save gas
        if (!batched || deltaCredit > totalLiquidity.mul(lpDeltaBP).div(BP_DENOMINATOR)) {
            _delta(defaultLPMode);
        }
    }

    function _safeTransfer(
        address _token,
        address _to,
        uint256 _value
    ) private {
        (bool success, bytes memory data) = _token.call(abi.encodeWithSelector(SELECTOR, _to, _value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "Stargate: TRANSFER_FAILED");
    }
}

File 2 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 3 of 8 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 4 of 8 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 5 of 8 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

    uint256 private _status;

    constructor () {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 6 of 8 : Factory.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;
pragma abicoder v2;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Pool.sol";

contract Factory is Ownable {
    using SafeMath for uint256;

    //---------------------------------------------------------------------------
    // VARIABLES
    mapping(uint256 => Pool) public getPool; // poolId -> PoolInfo
    address[] public allPools;
    address public immutable router;
    address public defaultFeeLibrary; // address for retrieving fee params for swaps

    //---------------------------------------------------------------------------
    // MODIFIERS
    modifier onlyRouter() {
        require(msg.sender == router, "Stargate: caller must be Router.");
        _;
    }

    constructor(address _router) {
        require(_router != address(0x0), "Stargate: _router cant be 0x0"); // 1 time only
        router = _router;
    }

    function setDefaultFeeLibrary(address _defaultFeeLibrary) external onlyOwner {
        require(_defaultFeeLibrary != address(0x0), "Stargate: fee library cant be 0x0");
        defaultFeeLibrary = _defaultFeeLibrary;
    }

    function allPoolsLength() external view returns (uint256) {
        return allPools.length;
    }

    function createPool(
        uint256 _poolId,
        address _token,
        uint8 _sharedDecimals,
        uint8 _localDecimals,
        string memory _name,
        string memory _symbol
    ) public onlyRouter returns (address poolAddress) {
        require(address(getPool[_poolId]) == address(0x0), "Stargate: Pool already created");

        Pool pool = new Pool(_poolId, router, _token, _sharedDecimals, _localDecimals, defaultFeeLibrary, _name, _symbol);
        getPool[_poolId] = pool;
        poolAddress = address(pool);
        allPools.push(poolAddress);
    }

    function renounceOwnership() public override onlyOwner {}
}

File 7 of 8 : LPTokenERC20.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

// libraries
import "@openzeppelin/contracts/math/SafeMath.sol";

contract LPTokenERC20 {
    using SafeMath for uint256;

    //---------------------------------------------------------------------------
    // CONSTANTS
    string public name;
    string public symbol;
    bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
    // set in constructor
    bytes32 public DOMAIN_SEPARATOR;

    //---------------------------------------------------------------------------
    // VARIABLES
    uint256 public decimals;
    uint256 public totalSupply;
    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;
    mapping(address => uint256) public nonces;

    //---------------------------------------------------------------------------
    // EVENTS
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event Transfer(address indexed from, address indexed to, uint256 value);

    constructor(string memory _name, string memory _symbol) {
        name = _name;
        symbol = _symbol;
        uint256 chainId;
        assembly {
            chainId := chainid()
        }
        DOMAIN_SEPARATOR = keccak256(
            abi.encode(
                keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                keccak256(bytes(name)),
                keccak256(bytes("1")),
                chainId,
                address(this)
            )
        );
    }

    function _mint(address to, uint256 value) internal {
        totalSupply = totalSupply.add(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(address(0), to, value);
    }

    function _burn(address from, uint256 value) internal {
        balanceOf[from] = balanceOf[from].sub(value);
        totalSupply = totalSupply.sub(value);
        emit Transfer(from, address(0), value);
    }

    function _approve(
        address owner,
        address spender,
        uint256 value
    ) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(
        address from,
        address to,
        uint256 value
    ) private {
        balanceOf[from] = balanceOf[from].sub(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(from, to, value);
    }

    function approve(address spender, uint256 value) external returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint256 value) external returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool) {
        if (allowance[from][msg.sender] != uint256(-1)) {
            allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
        }
        _transfer(from, to, value);
        return true;
    }

    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(msg.sender, spender, allowance[msg.sender][spender].add(addedValue));
        return true;
    }

    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        _approve(msg.sender, spender, allowance[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        return true;
    }

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        require(deadline >= block.timestamp, "Bridge: EXPIRED");
        bytes32 digest = keccak256(
            abi.encodePacked(
                "\x19\x01",
                DOMAIN_SEPARATOR,
                keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
            )
        );
        address recoveredAddress = ecrecover(digest, v, r, s);
        require(recoveredAddress != address(0) && recoveredAddress == owner, "Bridge: INVALID_SIGNATURE");
        _approve(owner, spender, value);
    }
}

File 8 of 8 : IStargateFeeLibrary.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.7.6;
pragma abicoder v2;
import "../Pool.sol";

interface IStargateFeeLibrary {
    function getFees(
        uint256 _srcPoolId,
        uint256 _dstPoolId,
        uint16 _dstChainId,
        address _from,
        uint256 _amountSD
    ) external returns (Pool.SwapObj memory s);

    function getVersion() external view returns (string memory);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_poolId","type":"uint256"},{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_sharedDecimals","type":"uint256"},{"internalType":"uint256","name":"_localDecimals","type":"uint256"},{"internalType":"address","name":"_feeLibrary","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountLP","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountSD","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"dstPoolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"ChainPathUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"chainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"srcPoolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"idealBalance","type":"uint256"}],"name":"CreditChainPath","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"batched","type":"bool"},{"indexed":false,"internalType":"uint256","name":"swapDeltaBP","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpDeltaBP","type":"uint256"},{"indexed":false,"internalType":"bool","name":"defaultSwapMode","type":"bool"},{"indexed":false,"internalType":"bool","name":"defaultLPMode","type":"bool"}],"name":"DeltaParamUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeLibraryAddr","type":"address"}],"name":"FeeLibraryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintFeeBP","type":"uint256"}],"name":"FeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountLP","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountSD","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"InstantRedeemLocal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountLP","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintFeeAmountSD","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountLP","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountSD","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"chainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"dstPoolId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"to","type":"bytes"}],"name":"RedeemLocal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amountSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountToMintSD","type":"uint256"}],"name":"RedeemLocalCallback","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"chainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"dstPoolId","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountLP","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountSD","type":"uint256"}],"name":"RedeemRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"dstPoolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"credits","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"idealBalance","type":"uint256"}],"name":"SendCredits","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"swapStop","type":"bool"}],"name":"StopSwapUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"chainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"dstPoolId","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"eqReward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"eqFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"protocolFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpFee","type":"uint256"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"protocolFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstFee","type":"uint256"}],"name":"SwapRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSD","type":"uint256"}],"name":"WithdrawMintFeeBalance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSD","type":"uint256"}],"name":"WithdrawProtocolFeeBalance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"srcChainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"srcPoolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"swapAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"WithdrawRemote","type":"event"},{"inputs":[],"name":"BP_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstPoolId","type":"uint256"}],"name":"activateChainPath","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountLP","type":"uint256"}],"name":"amountLPtoLD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"batched","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_fullMode","type":"bool"}],"name":"callDelta","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"chainPathIndexLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"chainPaths","outputs":[{"internalType":"bool","name":"ready","type":"bool"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"dstPoolId","type":"uint256"},{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"lkb","type":"uint256"},{"internalType":"uint256","name":"credits","type":"uint256"},{"internalType":"uint256","name":"idealBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"convertRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstPoolId","type":"uint256"},{"internalType":"uint256","name":"_weight","type":"uint256"}],"name":"createChainPath","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstPoolId","type":"uint256"},{"components":[{"internalType":"uint256","name":"credits","type":"uint256"},{"internalType":"uint256","name":"idealBalance","type":"uint256"}],"internalType":"struct Pool.CreditObj","name":"_c","type":"tuple"}],"name":"creditChainPath","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultLPMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultSwapMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deltaCredit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eqFeePool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeLibrary","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstPoolId","type":"uint256"}],"name":"getChainPath","outputs":[{"components":[{"internalType":"bool","name":"ready","type":"bool"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"dstPoolId","type":"uint256"},{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"lkb","type":"uint256"},{"internalType":"uint256","name":"credits","type":"uint256"},{"internalType":"uint256","name":"idealBalance","type":"uint256"}],"internalType":"struct Pool.ChainPath","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainPathsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amountLP","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"instantRedeemLocal","outputs":[{"internalType":"uint256","name":"amountSD","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"localDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpDeltaBP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amountLD","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintFeeBP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintFeeBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"poolId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFeeBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amountLP","type":"uint256"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstPoolId","type":"uint256"},{"internalType":"bytes","name":"_to","type":"bytes"}],"name":"redeemLocal","outputs":[{"internalType":"uint256","name":"amountSD","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"uint256","name":"_srcPoolId","type":"uint256"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amountSD","type":"uint256"},{"internalType":"uint256","name":"_amountToMintSD","type":"uint256"}],"name":"redeemLocalCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"uint256","name":"_srcPoolId","type":"uint256"},{"internalType":"uint256","name":"_amountSD","type":"uint256"}],"name":"redeemLocalCheckOnRemote","outputs":[{"internalType":"uint256","name":"swapAmount","type":"uint256"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstPoolId","type":"uint256"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amountLP","type":"uint256"}],"name":"redeemRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstPoolId","type":"uint256"}],"name":"sendCredits","outputs":[{"components":[{"internalType":"uint256","name":"credits","type":"uint256"},{"internalType":"uint256","name":"idealBalance","type":"uint256"}],"internalType":"struct Pool.CreditObj","name":"c","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_batched","type":"bool"},{"internalType":"uint256","name":"_swapDeltaBP","type":"uint256"},{"internalType":"uint256","name":"_lpDeltaBP","type":"uint256"},{"internalType":"bool","name":"_defaultSwapMode","type":"bool"},{"internalType":"bool","name":"_defaultLPMode","type":"bool"}],"name":"setDeltaParam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintFeeBP","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeLibraryAddr","type":"address"}],"name":"setFeeLibrary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_swapStop","type":"bool"}],"name":"setSwapStop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstPoolId","type":"uint256"},{"internalType":"uint16","name":"_weight","type":"uint16"}],"name":"setWeightForChainPath","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sharedDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stopSwap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstPoolId","type":"uint256"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amountLD","type":"uint256"},{"internalType":"uint256","name":"_minAmountLD","type":"uint256"},{"internalType":"bool","name":"newLiquidity","type":"bool"}],"name":"swap","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"eqFee","type":"uint256"},{"internalType":"uint256","name":"eqReward","type":"uint256"},{"internalType":"uint256","name":"lpFee","type":"uint256"},{"internalType":"uint256","name":"protocolFee","type":"uint256"},{"internalType":"uint256","name":"lkbRemove","type":"uint256"}],"internalType":"struct Pool.SwapObj","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapDeltaBP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"uint256","name":"_srcPoolId","type":"uint256"},{"internalType":"address","name":"_to","type":"address"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"eqFee","type":"uint256"},{"internalType":"uint256","name":"eqReward","type":"uint256"},{"internalType":"uint256","name":"lpFee","type":"uint256"},{"internalType":"uint256","name":"protocolFee","type":"uint256"},{"internalType":"uint256","name":"lkbRemove","type":"uint256"}],"internalType":"struct Pool.SwapObj","name":"_s","type":"tuple"}],"name":"swapRemote","outputs":[{"internalType":"uint256","name":"amountLD","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawMintFeeBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawProtocolFeeBalance","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101006040523480156200001257600080fd5b5060405162004b0238038062004b02833981016040819052620000359162000435565b8151829082906200004e906000906020850190620002d1565b50805162000064906001906020840190620002d1565b5060004690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040518082805460018160011615610100020316600290048015620000ec5780601f10620000c9576101008083540402835291820191620000ec565b820191906000526020600020905b815481529060010190602001808311620000d7575b50506040805191829003822082820182526001808452603160f81b602094850152825180850197909752868301919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606087015260808601969096523060a0808701919091528151808703909101815260c090950190528351930192909220600255505060085550506001600160a01b038616620001aa5760405162461bcd60e51b8152600401620001a190620004f2565b60405180910390fd5b6001600160a01b038716620001d35760405162461bcd60e51b8152600401620001a19062000529565b6080889052606087811b6001600160601b031990811660e0529087901b1660c052600b85905560ff8516600355600c8490556200021d848662000273602090811b620027f617901c565b600a0a60a05250506000600f55601480546001600160a01b039092166001600160a01b031990921691909117905550506016805462ff00001961ffff199091166101001716620100001790555062000560915050565b600082821115620002cb576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928262000309576000855562000354565b82601f106200032457805160ff191683800117855562000354565b8280016001018555821562000354579182015b828111156200035457825182559160200191906001019062000337565b506200036292915062000366565b5090565b5b8082111562000362576000815560010162000367565b80516001600160a01b03811681146200039557600080fd5b919050565b600082601f830112620003ab578081fd5b81516001600160401b0380821115620003c057fe5b6040516020601f8401601f1916820181018381118382101715620003e057fe5b6040528382528584018101871015620003f7578485fd5b8492505b838310156200041a5785830181015182840182015291820191620003fb565b838311156200042b57848185840101525b5095945050505050565b600080600080600080600080610100898b03121562000452578384fd5b885197506200046460208a016200037d565b96506200047460408a016200037d565b955060608901519450608089015193506200049260a08a016200037d565b60c08a01519093506001600160401b0380821115620004af578384fd5b620004bd8c838d016200039a565b935060e08b0151915080821115620004d3578283fd5b50620004e28b828c016200039a565b9150509295985092959890939650565b6020808252601e908201527f53746172676174653a205f746f6b656e2063616e6e6f74206265203078300000604082015260600190565b6020808252601f908201527f53746172676174653a205f726f757465722063616e6e6f742062652030783000604082015260600190565b60805160a05160c05160601c60e05160601c6144da62000628600039806108895280610a075280610c7a5280610fd3528061146752806114c85280611595528061167c528061177852806118a9528061190052806119d55280611cab5280611d775280611e4a52806120035280612160528061226e528061255052806126975280612786525080610ab152806115265280611ae8528061209252806122cc52806127b05250806127d45280612b8b5280612cfb525080610d5152806113ed52506144da6000f3fe608060405234801561001057600080fd5b50600436106103ae5760003560e01c80637ecebe00116101f4578063b0fab0bc1161011a578063e065608b116100ad578063f887ea401161007c578063f887ea401461076e578063faa24f0714610776578063fc0c546a1461077e578063feb56b1514610786576103ae565b8063e065608b1461071f578063e46e705814610732578063ea89e2aa1461073a578063f6cd35ee1461075b576103ae565b8063be310294116100e9578063be310294146106de578063cdfed0ab146106f1578063d505accf146106f9578063dd62ed3e1461070c576103ae565b8063b0fab0bc1461069d578063b30daeac146106b0578063b633b364146106c3578063b6addec7146106cb576103ae565b806399a22d6811610192578063a9059cbb11610161578063a9059cbb1461065c578063a985565f1461066f578063abe685cd14610682578063ac2cc36b1461068a576103ae565b806399a22d68146106125780639bb811191461061a578063a138ed6b14610622578063a457c2d714610649576103ae565b80638bd86d0a116101ce5780638bd86d0a146105dc578063902b8ab7146105ef57806395d89b411461060257806396c82e571461060a576103ae565b80637ecebe00146105ae5780637fb65265146105c1578063857749b0146105d4576103ae565b806328f079c2116102d957806340c10f191161027757806365152f2b1161024657806365152f2b1461056d57806369fe0e2d1461057557806370a08231146105885780637298a5dc1461059b576103ae565b806340c10f1914610521578063476efe40146105345780634b5cacbc1461054757806364c5f02d1461055a576103ae565b806336448777116102b357806336448777146104f65780633644e515146104fe57806339509351146105065780633e0dc34e14610519576103ae565b806328f079c2146104de57806330adf81f146104e6578063313ce567146104ee576103ae565b8063159f6add116103515780631e8e51da116103205780631e8e51da146104a657806320d6bc75146104ae57806323b872dd146104c357806327f92376146104d6576103ae565b8063159f6add14610456578063163ef4901461047657806318160ddd1461047e5780631b7319b614610486576103ae565b8063095ea7b31161038d578063095ea7b3146104065780630986b61a146104265780630a22d68c1461044657806315770f921461044e576103ae565b80621edfab146103b357806306fdde03146103d157806308e9d8c2146103e6575b600080fd5b6103bb61078e565b6040516103c89190613b9e565b60405180910390f35b6103d961079d565b6040516103c89190613d14565b6103f96103f43660046138d4565b61082b565b6040516103c89190614295565b6104196104143660046136c6565b610998565b6040516103c89190613c9b565b6104396104343660046136ef565b6109af565b6040516103c89190613d0b565b610439610b23565b610439610b29565b6104696104643660046138d4565b610b2f565b6040516103c89190614236565b610439610c10565b610439610c16565b610499610494366004613a31565b610c1c565b6040516103c891906142ac565b610439610fc2565b6104c16104bc366004613b38565b610fc8565b005b6104196104d136600461361a565b6112ce565b610419611362565b61041961136b565b61043961137a565b61043961139e565b6104396113a4565b6104396113aa565b6104196105143660046136c6565b6113b0565b6104396113eb565b61043961052f3660046136c6565b61140f565b6104c16105423660046135ce565b6114bd565b6104c16105553660046135ce565b61158a565b6104396105683660046138d4565b61164e565b61043961166b565b6104c1610583366004613b6a565b611671565b6104396105963660046135ce565b611710565b6104c16105a93660046139a1565b611722565b6104396105bc3660046135ce565b61188c565b6104c16105cf3660046137cb565b61189e565b6104396118ef565b6104c16105ea3660046138d4565b6118f5565b6104396105fd3660046138ef565b61197d565b6103d9611b72565b610439611bcc565b610419611bd2565b610439611be0565b610635610630366004613b6a565b611be6565b6040516103c8989796959493929190613ca6565b6104196106573660046136c6565b611c44565b61041961066a3660046136c6565b611c93565b6104c161067d366004613b06565b611ca0565b610439611d66565b6104c16106983660046137cb565b611d6c565b6104396106ab36600461372a565b611df2565b6104c16106be3660046139e4565b611fad565b610419612101565b6104c16106d9366004613a93565b61210a565b6104c16106ec3660046135ce565b612263565b610439612323565b6104c1610707366004613655565b612329565b61043961071a3660046135e8565b612528565b6104c161072d366004613803565b612545565b610439612638565b61074d610748366004613b38565b61263e565b6040516103c89291906143c2565b610439610769366004613b6a565b61276e565b6103bb612784565b6104396127a8565b6103bb6127ae565b6104396127d2565b6014546001600160a01b031681565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108235780601f106107f857610100808354040283529160200191610823565b820191906000526020600020905b81548152906001019060200180831161080657829003601f168201915b505050505081565b61083361350a565b60026008541415610879576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108cf5760405162461bcd60e51b81526004016108c6906140c6565b60405180910390fd5b60006108db8484612853565b805490915060ff1615156001146109045760405162461bcd60e51b81526004016108c690613fc1565b60058101546004820154610917916128f0565b6004820155600f546002820154600e5461093c9291610936919061294a565b906129a3565b6020830181905260058201805480855260009091556040517f6939f93e3f21cf1362eb17155b740277de5687dae9a83a85909fd71da95944e7926109849288928892906143a1565b60405180910390a150600160085592915050565b60006109a5338484612a0a565b5060015b92915050565b6000600260085414156109f7576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a445760405162461bcd60e51b81526004016108c6906140c6565b6001600160a01b038416610a6a5760405162461bcd60e51b81526004016108c690613f8a565b6015546000610a7882612a6c565b905080851115610a86578094505b610a908686612aaa565b9250610a9c82846127f6565b6015556000610aaa84612b83565b9050610ad77f00000000000000000000000000000000000000000000000000000000000000008683612baf565b7f2125a70154569bd1686edd3cf981bb23dea7c1fa1637909dbb3c9a967cb0c2f287878688604051610b0c9493929190613bec565b60405180910390a150506001600855509392505050565b60115481565b600e5481565b610b37613524565b61ffff83166000908152600a60209081526040808320858452909152812054600980549091908110610b6557fe5b60009182526020918290206040805161010080820183526007909402909201805460ff81161515845261ffff94900484169483018590526001810154918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e082015292508516148015610bed5750828160400151145b610c095760405162461bcd60e51b81526004016108c690613d97565b9392505050565b60095490565b60045481565b610c2461356f565b60026008541415610c6a576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610cb75760405162461bcd60e51b81526004016108c6906140c6565b600d5460ff1615610cda5760405162461bcd60e51b81526004016108c6906141ff565b6000610ce68888612853565b805490915060ff161515600114610d0f5760405162461bcd60e51b81526004016108c690613fc1565b6000610d1a86612cf3565b90506000610d2786612cf3565b90506000601460009054906101000a90046001600160a01b03166001600160a01b0316631ab624307f00000000000000000000000000000000000000000000000000000000000000008c8e8d886040518663ffffffff1660e01b8152600401610d949594939291906143d0565b60c060405180830381600087803b158015610dae57600080fd5b505af1158015610dc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de69190613861565b9050610e0181604001516013546127f690919063ffffffff16565b601355606081015160808201516020830151610e2b9291610e2591829088906127f6565b906127f6565b80825260408201518391610e3e916128f0565b1015610e5c5760405162461bcd60e51b81526004016108c690614182565b610e818160400151610e7b8360600151866127f690919063ffffffff16565b906128f0565b60a0820181905260038501541015610eab5760405162461bcd60e51b81526004016108c69061414b565b60a08101516003850154610ebe916127f6565b60038501558515610eee57610ee68160400151610e7b856015546128f090919063ffffffff16565b601555610f0d565b604081015115610f0d576040810151601554610f09916128f0565b6015555b60165460ff161580610f3d5750610f37612710610936601754600e5461294a90919063ffffffff16565b60155410155b15610f5657601654610f5690610100900460ff16612d1f565b7f34660fc8af304464529f48a778e03d03e4d34bcd5f9b6f0cfbf3cd238c642f7f8b8b8b84600001518560400151866020015187608001518860600151604051610fa7989796959493929190614322565b60405180910390a160016008559a9950505050505050505050565b60155481565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146110105760405162461bcd60e51b81526004016108c6906140c6565b60005b6009548110156110de5760006009828154811061102c57fe5b600091825260208083206040805161010080820183526007909502909201805460ff81161515845261ffff95900485169383018490526001810154918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e082015293509087161480156110b45750848260400151145b905080156110d45760405162461bcd60e51b81526004016108c69061405c565b5050600101611013565b50600f546110ec90826128f0565b600f556009805461ffff8581166000818152600a602090815260408083208984528252808320869055805161010080820183528482529281019485528082018a8152606082018a81526080830186815260a0840187815260c0850188815260e0860189815260018d018e559c90985293517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af6007909b029a8b018054995160ff19909a169115159190911762ffff001916989099169095029690961790965594517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b087015592517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b1860155517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b285015591517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b384015590517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b483015591517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b590910155517f8fb3b21a941c2361df46475f9ae2f7b5dac5de7bd085fa22415ec0bb30c77e22906112c190859085908590614385565b60405180910390a1505050565b6001600160a01b03831660009081526006602090815260408083203384529091528120546000191461134d576001600160a01b038416600090815260066020908152604080832033845290915290205461132890836127f6565b6001600160a01b03851660009081526006602090815260408083203384529091529020555b611358848484613111565b5060019392505050565b60165460ff1681565b60165462010000900460ff1681565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60035481565b60185481565b60025481565b3360008181526006602090815260408083206001600160a01b038716845290915281205490916109a59185906113e690866128f0565b612a0a565b7f000000000000000000000000000000000000000000000000000000000000000081565b600060026008541415611457576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146114a45760405162461bcd60e51b81526004016108c6906140c6565b6114b183836001806131bf565b60016008559392505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146115055760405162461bcd60e51b81526004016108c6906140c6565b6012541561158757600061151a601254612b83565b6000601255905061154c7f00000000000000000000000000000000000000000000000000000000000000008383612baf565b7f87b3b2749102aa96f2d08396e34cd47673e57148af9cfff965d99bc0378a87dc828260405161157d929190613bb2565b60405180910390a1505b50565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146115d25760405162461bcd60e51b81526004016108c6906140c6565b6001600160a01b0381166115f85760405162461bcd60e51b81526004016108c690613f49565b601480546001600160a01b0319166001600160a01b0383161790556040517f5138b884a20454b6db937b9e11c8534e02e708750e0c465df6cd9701622952ce90611643908390613b9e565b60405180910390a150565b600a60209081526000928352604080842090915290825290205481565b60125481565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116b95760405162461bcd60e51b81526004016108c6906140c6565b6127108111156116db5760405162461bcd60e51b81526004016108c690613edb565b60108190556040517f9fe6eeb0f0541c644a56c67efeb872dbadd803a60b909d7dde1b35a3fe230b0e90611643908390613d0b565b60056020526000908152604090205481565b60026008541415611768576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146117b55760405162461bcd60e51b81526004016108c6906140c6565b6001600160a01b0382166117db5760405162461bcd60e51b81526004016108c690613f8a565b60006117e78383612aaa565b60165490915060ff1615806118195750611814612710610936601854600e5461294a90919063ffffffff16565b601554115b15611833576016546118339062010000900460ff16612d1f565b600061183e82612b83565b90507fa33f5c0b76f00f6737b1780a8a7f18e19c3fe8fe9ee01a6c1b8ce1eae5ed54f986868686856040516118779594939291906142f0565b60405180910390a15050600160085550505050565b60076020526000908152604090205481565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118e65760405162461bcd60e51b81526004016108c6906140c6565b61158781612d1f565b600b5481565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461193d5760405162461bcd60e51b81526004016108c6906140c6565b60006119498383612853565b805490915060ff161561196e5760405162461bcd60e51b81526004016108c690613e28565b805460ff191660011790555050565b6000600260085414156119c5576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611a125760405162461bcd60e51b81526004016108c6906140c6565b6060820151600e54611a23916128f0565b600e556020820151601354611a37916128f0565b6013556080820151601154611a4b916128f0565b60115561ffff85166000908152600a6020908152604080832087845290915290205460a083015160098054611aa692919084908110611a8657fe5b9060005260206000209060070201600401546127f690919063ffffffff16565b60098281548110611ab357fe5b600091825260209091206004600790920201015560408301518351611ae191611adc91906128f0565b612b83565b9150611b0e7f00000000000000000000000000000000000000000000000000000000000000008584612baf565b604083015183517ffb2b592367452f1c437675bed47f5e1e6c25188c17d7ba01a12eb030bc41ccef918691611b42916128f0565b85608001518660200151604051611b5c9493929190613c75565b60405180910390a1506001600855949350505050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108235780601f106107f857610100808354040283529160200191610823565b600f5481565b601654610100900460ff1681565b60135481565b60098181548110611bf657600080fd5b6000918252602090912060079091020180546001820154600283015460038401546004850154600586015460069096015460ff8616975061010090950461ffff169593949293919290919088565b60006109a533846113e685604051806060016040528060258152602001614480602591393360009081526006602090815260408083206001600160a01b038d1684529091529020549190613319565b60006109a5338484613111565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611ce85760405162461bcd60e51b81526004016108c6906140c6565b6000611cf48484612853565b9050611d178261ffff16610e7b8360020154600f546127f690919063ffffffff16565b600f5561ffff821660028201556040517f8fb3b21a941c2361df46475f9ae2f7b5dac5de7bd085fa22415ec0bb30c77e2290611d5890869086908690614367565b60405180910390a150505050565b61271081565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611db45760405162461bcd60e51b81526004016108c6906140c6565b600d805460ff19168215151790556040517f59a9350977452c5240699f57f18b5915cd0440a56f08820a38b9f2432a82ba3e90611643908390613c9b565b600060026008541415611e3a576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611e875760405162461bcd60e51b81526004016108c6906140c6565b6001600160a01b038716611ead5760405162461bcd60e51b81526004016108c690613f8a565b61ffff85166000908152600a60209081526040808320878452909152902054600980549091908110611edb57fe5b600091825260209091206007909102015460ff161515600114611f105760405162461bcd60e51b81526004016108c690613fc1565b611f1a8787612aaa565b60165490915060ff161580611f4c5750611f47612710610936601854600e5461294a90919063ffffffff16565b601554115b15611f5b57611f5b6000612d1f565b7f53c03ee0722b52efeb42444f48d90173854501b3de3c590fcb445743377115c287878388888888604051611f969796959493929190613c17565b60405180910390a160016008559695505050505050565b60026008541415611ff3576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146120405760405162461bcd60e51b81526004016108c6906140c6565b801561205d5761205b8361205383612b83565b6000806131bf565b505b60006120698686612853565b600481015490915061207b90846127f6565b6004820155600061208b84612b83565b90506120b87f00000000000000000000000000000000000000000000000000000000000000008683612baf565b7fa97166013ecf5305dd9a58d6d867f05e646d4275f52d2bd52a5c7f00a690ad1b8585856040516120eb93929190613bcb565b60405180910390a1505060016008555050505050565b600d5460ff1681565b60026008541415612150576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461219d5760405162461bcd60e51b81526004016108c6906140c6565b61ffff83166000908152600a602090815260408083208584529091528120546009805490919081106121cb57fe5b906000526020600020906007020190506121f6826000015182600301546128f090919063ffffffff16565b6003820155602082015160068201541461221557602082015160068201555b815160208301516040517fdbdd25248751feb2f3b66721dfdd11662a68bc155af3771e661aabec92fba81492612250928892889291906143a1565b60405180910390a1505060016008555050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146122ab5760405162461bcd60e51b81526004016108c6906140c6565b601154156115875760006122c0601154612b83565b600060115590506122f27f00000000000000000000000000000000000000000000000000000000000000008383612baf565b7f70dc5a44816033bea80f836440f4b1fe1b3bb06b568c8dc2301901f03bf237c7828260405161157d929190613bb2565b60175481565b42841015612370576040805162461bcd60e51b815260206004820152600f60248201526e109c9a5919d94e8811561412549151608a1b604482015290519081900360640190fd5b6002546001600160a01b0380891660008181526007602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e08501825280519083012061190160f01b6101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e280820193601f1981019281900390910190855afa15801561248b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906124c15750886001600160a01b0316816001600160a01b0316145b612512576040805162461bcd60e51b815260206004820152601960248201527f4272696467653a20494e56414c49445f5349474e415455524500000000000000604482015290519081900360640190fd5b61251d898989612a0a565b505050505050505050565b600660209081526000928352604080842090915290825290205481565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461258d5760405162461bcd60e51b81526004016108c6906140c6565b61271084111580156125a157506127108311155b6125bd5760405162461bcd60e51b81526004016108c690613f12565b601680546017869055601885905560ff19168615151761ff001916610100841515021762ff0000191662010000831515021790556040517f7cc11124872dc29ed41dd447ee7ab07d9eee5d8ebb55f65dd92bce19bb20224a906126299087908790879087908790613ce2565b60405180910390a15050505050565b600c5481565b60008060026008541415612687576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146126d45760405162461bcd60e51b81526004016108c6906140c6565b60006126e08686612853565b9050806003015484111561270557600381018054600090915592508284039150612721565b600381015461271490856127f6565b6003820155839250600091505b7f44d3575fd94f9e0a41d7ebbc7e952f9b615c3f8d1faf924e1e9e98c0edf0d3808686858560405161275694939291906143a1565b60405180910390a15060016008559094909350915050565b600061277c611adc836133b0565b90505b919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60105481565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008282111561284d576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6009546000906128755760405162461bcd60e51b81526004016108c690613ea4565b61ffff83166000908152600a602090815260408083208584529091528120546009805490919081106128a357fe5b60009182526020909120600790910201805490915061ffff85811661010090920416148015610bed575082816001015414610c095760405162461bcd60e51b81526004016108c690613d97565b600082820183811015610c09576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082612959575060006109a9565b8282028284828161296657fe5b0414610c095760405162461bcd60e51b815260040180806020018281038252602181526020018061445f6021913960400191505060405180910390fd5b60008082116129f9576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381612a0257fe5b049392505050565b6001600160a01b03808416600081815260066020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600080600e5411612a8f5760405162461bcd60e51b81526004016108c690613d47565b61277c600e546109366004548561294a90919063ffffffff16565b60008060045411612acd5760405162461bcd60e51b81526004016108c690613ddf565b6001600160a01b03831660009081526005602052604090205482811015612b065760405162461bcd60e51b81526004016108c6906141b9565b6000612b23600454610936600e548761294a90919063ffffffff16565b600e54909150612b3390826127f6565b600e55612b4085856133ee565b7f49995e5dd6158cf69ad3e9777c46755a1a826a446c6416992167462dad033b2a858583604051612b7393929190613bcb565b60405180910390a1949350505050565b600061277c827f000000000000000000000000000000000000000000000000000000000000000061294a565b604080518082018252601981527f7472616e7366657228616464726573732c75696e7432353629000000000000006020909101525160009081906001600160a01b038616907fa9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b90612c269087908790602401613bb2565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051612c649190613b82565b6000604051808303816000865af19150503d8060008114612ca1576040519150601f19603f3d011682016040523d82523d6000602084013e612ca6565b606091505b5091509150818015612cd0575080511580612cd0575080806020019051810190612cd091906137e7565b612cec5760405162461bcd60e51b81526004016108c690613e6d565b5050505050565b600061277c827f00000000000000000000000000000000000000000000000000000000000000006129a3565b6000601554118015612d3357506000600f54115b156115875760095460008167ffffffffffffffff81118015612d5457600080fd5b50604051908082528060200260200182016040528015612d7e578160200160208202803683370190505b5090506000805b83811015612e4857600060098281548110612d9c57fe5b906000526020600020906007020190506000612dcd600f546109368460020154600e5461294a90919063ffffffff16565b90506000612dec836005015484600401546128f090919063ffffffff16565b905080821115612e3a57808203868581518110612e0557fe5b602002602001018181525050612e37868581518110612e2057fe5b6020026020010151866128f090919063ffffffff16565b94505b505050806001019050612d85565b50600081612ee657848015612e5f57506000601554115b15612ee15760005b84811015612edf57600060098281548110612e7e57fe5b906000526020600020906007020190506000612eaf600f54610936846002015460155461294a90919063ffffffff16565b9050612ebb84826128f0565b6005830154909450612ecd90826128f0565b60059092019190915550600101612e67565b505b6130fa565b6015548211613053578415612fbd5760155482900360005b85811015612fb6576000858281518110612f1457fe5b60200260200101511115612fae57600060098281548110612f3157fe5b906000526020600020906007020190506000612f85612f63600f5461093685600201548861294a90919063ffffffff16565b888581518110612f6f57fe5b60200260200101516128f090919063ffffffff16565b9050612f9185826128f0565b6005830154909550612fa390826128f0565b826005018190555050505b600101612efe565b5050612ee1565b60005b84811015612edf576000848281518110612fd657fe5b6020026020010151111561304b57600060098281548110612ff357fe5b90600052602060002090600702019050600085838151811061301157fe5b6020026020010151905061302e81856128f090919063ffffffff16565b600583015490945061304090826128f0565b826005018190555050505b600101612fc0565b60005b848110156130f857600084828151811061306c57fe5b602002602001015111156130f05760006009828154811061308957fe5b9060005260206000209060070201905060006130c7856109366015548987815181106130b157fe5b602002602001015161294a90919063ffffffff16565b90506130d384826128f0565b60058301549094506130e590826128f0565b826005018190555050505b600101613056565b505b60155461310790826127f6565b6015555050505050565b6001600160a01b03831660009081526005602052604090205461313490826127f6565b6001600160a01b03808516600090815260056020526040808220939093559084168152205461316390826128f0565b6001600160a01b0380841660008181526005602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600f54116131e25760405162461bcd60e51b81526004016108c690614114565b6131eb84612cf3565b905060008315613230576132106127106109366010548561294a90919063ffffffff16565b905061321c82826127f6565b60125490925061322c90826128f0565b6012555b82156132475760155461324390836128f0565b6015555b60045482901561326f5761326c600e546109366004548661294a90919063ffffffff16565b90505b600e5461327c90846128f0565b600e55613289878261347f565b7fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb878285856040516132be9493929190613c75565b60405180910390a160165460ff1615806132f557506132f0612710610936601854600e5461294a90919063ffffffff16565b601554115b1561330f5760165461330f9062010000900460ff16612d1f565b5050949350505050565b600081848411156133a85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561336d578181015183820152602001613355565b50505050905090810190601f16801561339a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600080600454116133d35760405162461bcd60e51b81526004016108c690614009565b61277c600454610936600e548561294a90919063ffffffff16565b6001600160a01b03821660009081526005602052604090205461341190826127f6565b6001600160a01b03831660009081526005602052604090205560045461343790826127f6565b6004556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b60045461348c90826128f0565b6004556001600160a01b0382166000908152600560205260409020546134b290826128f0565b6001600160a01b03831660008181526005602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b604051806040016040528060008152602001600081525090565b604051806101000160405280600015158152602001600061ffff1681526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b80356001600160a01b038116811461277f57600080fd5b803561ffff8116811461277f57600080fd5b6000602082840312156135df578081fd5b610c09826135a5565b600080604083850312156135fa578081fd5b613603836135a5565b9150613611602084016135a5565b90509250929050565b60008060006060848603121561362e578081fd5b613637846135a5565b9250613645602085016135a5565b9150604084013590509250925092565b600080600080600080600060e0888a03121561366f578283fd5b613678886135a5565b9650613686602089016135a5565b95506040880135945060608801359350608088013560ff811681146136a9578384fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156136d8578182fd5b6136e1836135a5565b946020939093013593505050565b600080600060608486031215613703578283fd5b61370c846135a5565b925060208401359150613721604085016135a5565b90509250925092565b60008060008060008060a08789031215613742578182fd5b61374b876135a5565b955060208701359450613760604088016135bc565b935060608701359250608087013567ffffffffffffffff80821115613783578384fd5b818901915089601f830112613796578384fd5b8135818111156137a4578485fd5b8a60208285010111156137b5578485fd5b6020830194508093505050509295509295509295565b6000602082840312156137dc578081fd5b8135610c0981614430565b6000602082840312156137f8578081fd5b8151610c0981614430565b600080600080600060a0868803121561381a578283fd5b853561382581614430565b94506020860135935060408601359250606086013561384381614430565b9150608086013561385381614430565b809150509295509295909350565b600060c08284031215613872578081fd5b60405160c0810181811067ffffffffffffffff8211171561388f57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a08201528091505092915050565b600080604083850312156138e6578182fd5b6136e1836135bc565b600080600080848603610120811215613906578283fd5b61390f866135bc565b945060208601359350613924604087016135a5565b925060c0605f1982011215613937578182fd5b5060405160c0810181811067ffffffffffffffff8211171561395557fe5b8060405250606086013581526080860135602082015260a0860135604082015260c0860135606082015260e0860135608082015261010086013560a08201528091505092959194509250565b600080600080608085870312156139b6578182fd5b6139bf856135bc565b9350602085013592506139d4604086016135a5565b9396929550929360600135925050565b600080600080600060a086880312156139fb578283fd5b613a04866135bc565b945060208601359350613a19604087016135a5565b94979396509394606081013594506080013592915050565b60008060008060008060c08789031215613a49578384fd5b613a52876135bc565b955060208701359450613a67604088016135a5565b9350606087013592506080870135915060a0870135613a8581614430565b809150509295509295509295565b60008060008385036080811215613aa8578182fd5b613ab1856135bc565b9350602085013592506040603f1982011215613acb578182fd5b506040516040810181811067ffffffffffffffff82111715613ae957fe5b604090815285013581526060909401356020850152509093909250565b600080600060608486031215613b1a578081fd5b613b23846135bc565b925060208401359150613721604085016135bc565b600080600060608486031215613b4c578081fd5b613b55846135bc565b95602085013595506040909401359392505050565b600060208284031215613b7b578081fd5b5035919050565b60008251613b94818460208701614400565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b03948516815260208101939093526040830191909152909116606082015260800190565b600060018060a01b038916825287602083015286604083015261ffff8616606083015284608083015260c060a08301528260c0830152828460e084013781830160e090810191909152601f909201601f191601019695505050505050565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b901515815260200190565b971515885261ffff96909616602088015260408701949094526060860192909252608085015260a084015260c083015260e08201526101000190565b941515855260208501939093526040840191909152151560608301521515608082015260a00190565b90815260200190565b6000602082528251806020840152613d33816040850160208701614400565b601f01601f19169190910160400192915050565b60208082526030908201527f53746172676174653a2063616e7420636f6e76657274205344746f4c5020776860408201526f0656e20746f74616c4c6971203d3d20360841b606082015260800190565b60208082526028908201527f53746172676174653a206c6f63616c20636861696e5061746820646f6573206e6040820152671bdd08195e1a5cdd60c21b606082015260800190565b60208082526029908201527f53746172676174653a2063616e74206275726e207768656e20746f74616c5375604082015268070706c79203d3d20360bc1b606082015260800190565b60208082526025908201527f53746172676174653a20636861696e5061746820697320616c72656164792061604082015264637469766560d81b606082015260800190565b60208082526019908201527f53746172676174653a205452414e534645525f4641494c454400000000000000604082015260600190565b6020808252601d908201527f53746172676174653a206e6f20636861696e7061746873206578697374000000604082015260600190565b60208082526017908201527f4272696467653a2063756d2066656573203e2031303025000000000000000000604082015260600190565b6020808252601b908201527f53746172676174653a2077726f6e672044656c746120706172616d0000000000604082015260600190565b60208082526021908201527f53746172676174653a20666565206c6962726172792063616e742062652030786040820152600360fc1b606082015260800190565b6020808252601d908201527f53746172676174653a205f66726f6d2063616e6e6f7420626520307830000000604082015260600190565b60208082526028908201527f53746172676174653a20636f756e74657220636861696e50617468206973206e6040820152676f7420726561647960c01b606082015260800190565b60208082526033908201527f53746172676174653a2063616e7420636f6e76657274204c50746f53442077686040820152720656e20746f74616c537570706c79203d3d203606c1b606082015260800190565b60208082526044908201527f53746172676174653a2063616e7420637265617465436861696e50617468206f60408201527f66206578697374696e6720647374436861696e496420616e64205f647374506f6060820152631bdb125960e21b608082015260a00190565b6020808252602e908201527f53746172676174653a206f6e6c792074686520726f757465722063616e20636160408201526d1b1b081d1a1a5cc81b595d1a1bd960921b606082015260800190565b6020808252601d908201527f53746172676174653a204e6f20436861696e5061746873206578697374000000604082015260600190565b6020808252601d908201527f53746172676174653a206473742062616c616e636520746f6f206c6f77000000604082015260600190565b6020808252601b908201527f53746172676174653a20736c69707061676520746f6f20686967680000000000604082015260600190565b60208082526026908201527f53746172676174653a206e6f7420656e6f756768204c5020746f6b656e7320746040820152653790313ab93760d11b606082015260800190565b6020808252601b908201527f53746172676174653a20737761702066756e632073746f707065640000000000604082015260600190565b60006101008201905082511515825261ffff602084015116602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015292915050565b815181526020918201519181019190915260400190565b600060c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b61ffff95909516855260208501939093526001600160a01b039190911660408401526060830152608082015260a00190565b61ffff98909816885260208801969096526001600160a01b039490941660408701526060860192909252608085015260a084015260c083015260e08201526101000190565b61ffff93841681526020810192909252909116604082015260600190565b61ffff9390931683526020830191909152604082015260600190565b61ffff94909416845260208401929092526040830152606082015260800190565b918252602082015260400190565b948552602085019390935261ffff9190911660408401526001600160a01b03166060830152608082015260a00190565b60005b8381101561441b578181015183820152602001614403565b8381111561442a576000848401525b50505050565b801515811461158757600080fdfe5265656e7472616e637947756172643a207265656e7472616e742063616c6c00536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212207aaedc0ccd2d34f140152446b43279f2d93751be1b5b4321d4ba3041dfdc231164736f6c63430007060033000000000000000000000000000000000000000000000000000000000000000d0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e7590000000000000000000000000224d8fd7ab6ad4c6eb4611ce56ef35dec2277f030000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001200000000000000000000000045a01e4e04f14f7a4a6702c74187c5f6222033cd0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000175374617267617465204574686572205661756c742d4c500000000000000000000000000000000000000000000000000000000000000000000000000000000007532a534745544800000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103ae5760003560e01c80637ecebe00116101f4578063b0fab0bc1161011a578063e065608b116100ad578063f887ea401161007c578063f887ea401461076e578063faa24f0714610776578063fc0c546a1461077e578063feb56b1514610786576103ae565b8063e065608b1461071f578063e46e705814610732578063ea89e2aa1461073a578063f6cd35ee1461075b576103ae565b8063be310294116100e9578063be310294146106de578063cdfed0ab146106f1578063d505accf146106f9578063dd62ed3e1461070c576103ae565b8063b0fab0bc1461069d578063b30daeac146106b0578063b633b364146106c3578063b6addec7146106cb576103ae565b806399a22d6811610192578063a9059cbb11610161578063a9059cbb1461065c578063a985565f1461066f578063abe685cd14610682578063ac2cc36b1461068a576103ae565b806399a22d68146106125780639bb811191461061a578063a138ed6b14610622578063a457c2d714610649576103ae565b80638bd86d0a116101ce5780638bd86d0a146105dc578063902b8ab7146105ef57806395d89b411461060257806396c82e571461060a576103ae565b80637ecebe00146105ae5780637fb65265146105c1578063857749b0146105d4576103ae565b806328f079c2116102d957806340c10f191161027757806365152f2b1161024657806365152f2b1461056d57806369fe0e2d1461057557806370a08231146105885780637298a5dc1461059b576103ae565b806340c10f1914610521578063476efe40146105345780634b5cacbc1461054757806364c5f02d1461055a576103ae565b806336448777116102b357806336448777146104f65780633644e515146104fe57806339509351146105065780633e0dc34e14610519576103ae565b806328f079c2146104de57806330adf81f146104e6578063313ce567146104ee576103ae565b8063159f6add116103515780631e8e51da116103205780631e8e51da146104a657806320d6bc75146104ae57806323b872dd146104c357806327f92376146104d6576103ae565b8063159f6add14610456578063163ef4901461047657806318160ddd1461047e5780631b7319b614610486576103ae565b8063095ea7b31161038d578063095ea7b3146104065780630986b61a146104265780630a22d68c1461044657806315770f921461044e576103ae565b80621edfab146103b357806306fdde03146103d157806308e9d8c2146103e6575b600080fd5b6103bb61078e565b6040516103c89190613b9e565b60405180910390f35b6103d961079d565b6040516103c89190613d14565b6103f96103f43660046138d4565b61082b565b6040516103c89190614295565b6104196104143660046136c6565b610998565b6040516103c89190613c9b565b6104396104343660046136ef565b6109af565b6040516103c89190613d0b565b610439610b23565b610439610b29565b6104696104643660046138d4565b610b2f565b6040516103c89190614236565b610439610c10565b610439610c16565b610499610494366004613a31565b610c1c565b6040516103c891906142ac565b610439610fc2565b6104c16104bc366004613b38565b610fc8565b005b6104196104d136600461361a565b6112ce565b610419611362565b61041961136b565b61043961137a565b61043961139e565b6104396113a4565b6104396113aa565b6104196105143660046136c6565b6113b0565b6104396113eb565b61043961052f3660046136c6565b61140f565b6104c16105423660046135ce565b6114bd565b6104c16105553660046135ce565b61158a565b6104396105683660046138d4565b61164e565b61043961166b565b6104c1610583366004613b6a565b611671565b6104396105963660046135ce565b611710565b6104c16105a93660046139a1565b611722565b6104396105bc3660046135ce565b61188c565b6104c16105cf3660046137cb565b61189e565b6104396118ef565b6104c16105ea3660046138d4565b6118f5565b6104396105fd3660046138ef565b61197d565b6103d9611b72565b610439611bcc565b610419611bd2565b610439611be0565b610635610630366004613b6a565b611be6565b6040516103c8989796959493929190613ca6565b6104196106573660046136c6565b611c44565b61041961066a3660046136c6565b611c93565b6104c161067d366004613b06565b611ca0565b610439611d66565b6104c16106983660046137cb565b611d6c565b6104396106ab36600461372a565b611df2565b6104c16106be3660046139e4565b611fad565b610419612101565b6104c16106d9366004613a93565b61210a565b6104c16106ec3660046135ce565b612263565b610439612323565b6104c1610707366004613655565b612329565b61043961071a3660046135e8565b612528565b6104c161072d366004613803565b612545565b610439612638565b61074d610748366004613b38565b61263e565b6040516103c89291906143c2565b610439610769366004613b6a565b61276e565b6103bb612784565b6104396127a8565b6103bb6127ae565b6104396127d2565b6014546001600160a01b031681565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108235780601f106107f857610100808354040283529160200191610823565b820191906000526020600020905b81548152906001019060200180831161080657829003601f168201915b505050505081565b61083361350a565b60026008541415610879576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759016146108cf5760405162461bcd60e51b81526004016108c6906140c6565b60405180910390fd5b60006108db8484612853565b805490915060ff1615156001146109045760405162461bcd60e51b81526004016108c690613fc1565b60058101546004820154610917916128f0565b6004820155600f546002820154600e5461093c9291610936919061294a565b906129a3565b6020830181905260058201805480855260009091556040517f6939f93e3f21cf1362eb17155b740277de5687dae9a83a85909fd71da95944e7926109849288928892906143a1565b60405180910390a150600160085592915050565b60006109a5338484612a0a565b5060015b92915050565b6000600260085414156109f7576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e75901614610a445760405162461bcd60e51b81526004016108c6906140c6565b6001600160a01b038416610a6a5760405162461bcd60e51b81526004016108c690613f8a565b6015546000610a7882612a6c565b905080851115610a86578094505b610a908686612aaa565b9250610a9c82846127f6565b6015556000610aaa84612b83565b9050610ad77f000000000000000000000000224d8fd7ab6ad4c6eb4611ce56ef35dec2277f038683612baf565b7f2125a70154569bd1686edd3cf981bb23dea7c1fa1637909dbb3c9a967cb0c2f287878688604051610b0c9493929190613bec565b60405180910390a150506001600855509392505050565b60115481565b600e5481565b610b37613524565b61ffff83166000908152600a60209081526040808320858452909152812054600980549091908110610b6557fe5b60009182526020918290206040805161010080820183526007909402909201805460ff81161515845261ffff94900484169483018590526001810154918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e082015292508516148015610bed5750828160400151145b610c095760405162461bcd60e51b81526004016108c690613d97565b9392505050565b60095490565b60045481565b610c2461356f565b60026008541415610c6a576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e75901614610cb75760405162461bcd60e51b81526004016108c6906140c6565b600d5460ff1615610cda5760405162461bcd60e51b81526004016108c6906141ff565b6000610ce68888612853565b805490915060ff161515600114610d0f5760405162461bcd60e51b81526004016108c690613fc1565b6000610d1a86612cf3565b90506000610d2786612cf3565b90506000601460009054906101000a90046001600160a01b03166001600160a01b0316631ab624307f000000000000000000000000000000000000000000000000000000000000000d8c8e8d886040518663ffffffff1660e01b8152600401610d949594939291906143d0565b60c060405180830381600087803b158015610dae57600080fd5b505af1158015610dc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de69190613861565b9050610e0181604001516013546127f690919063ffffffff16565b601355606081015160808201516020830151610e2b9291610e2591829088906127f6565b906127f6565b80825260408201518391610e3e916128f0565b1015610e5c5760405162461bcd60e51b81526004016108c690614182565b610e818160400151610e7b8360600151866127f690919063ffffffff16565b906128f0565b60a0820181905260038501541015610eab5760405162461bcd60e51b81526004016108c69061414b565b60a08101516003850154610ebe916127f6565b60038501558515610eee57610ee68160400151610e7b856015546128f090919063ffffffff16565b601555610f0d565b604081015115610f0d576040810151601554610f09916128f0565b6015555b60165460ff161580610f3d5750610f37612710610936601754600e5461294a90919063ffffffff16565b60155410155b15610f5657601654610f5690610100900460ff16612d1f565b7f34660fc8af304464529f48a778e03d03e4d34bcd5f9b6f0cfbf3cd238c642f7f8b8b8b84600001518560400151866020015187608001518860600151604051610fa7989796959493929190614322565b60405180910390a160016008559a9950505050505050505050565b60155481565b336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759016146110105760405162461bcd60e51b81526004016108c6906140c6565b60005b6009548110156110de5760006009828154811061102c57fe5b600091825260208083206040805161010080820183526007909502909201805460ff81161515845261ffff95900485169383018490526001810154918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e082015293509087161480156110b45750848260400151145b905080156110d45760405162461bcd60e51b81526004016108c69061405c565b5050600101611013565b50600f546110ec90826128f0565b600f556009805461ffff8581166000818152600a602090815260408083208984528252808320869055805161010080820183528482529281019485528082018a8152606082018a81526080830186815260a0840187815260c0850188815260e0860189815260018d018e559c90985293517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af6007909b029a8b018054995160ff19909a169115159190911762ffff001916989099169095029690961790965594517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b087015592517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b1860155517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b285015591517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b384015590517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b483015591517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b590910155517f8fb3b21a941c2361df46475f9ae2f7b5dac5de7bd085fa22415ec0bb30c77e22906112c190859085908590614385565b60405180910390a1505050565b6001600160a01b03831660009081526006602090815260408083203384529091528120546000191461134d576001600160a01b038416600090815260066020908152604080832033845290915290205461132890836127f6565b6001600160a01b03851660009081526006602090815260408083203384529091529020555b611358848484613111565b5060019392505050565b60165460ff1681565b60165462010000900460ff1681565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60035481565b60185481565b60025481565b3360008181526006602090815260408083206001600160a01b038716845290915281205490916109a59185906113e690866128f0565b612a0a565b7f000000000000000000000000000000000000000000000000000000000000000d81565b600060026008541415611457576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759016146114a45760405162461bcd60e51b81526004016108c6906140c6565b6114b183836001806131bf565b60016008559392505050565b336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759016146115055760405162461bcd60e51b81526004016108c6906140c6565b6012541561158757600061151a601254612b83565b6000601255905061154c7f000000000000000000000000224d8fd7ab6ad4c6eb4611ce56ef35dec2277f038383612baf565b7f87b3b2749102aa96f2d08396e34cd47673e57148af9cfff965d99bc0378a87dc828260405161157d929190613bb2565b60405180910390a1505b50565b336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759016146115d25760405162461bcd60e51b81526004016108c6906140c6565b6001600160a01b0381166115f85760405162461bcd60e51b81526004016108c690613f49565b601480546001600160a01b0319166001600160a01b0383161790556040517f5138b884a20454b6db937b9e11c8534e02e708750e0c465df6cd9701622952ce90611643908390613b9e565b60405180910390a150565b600a60209081526000928352604080842090915290825290205481565b60125481565b336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759016146116b95760405162461bcd60e51b81526004016108c6906140c6565b6127108111156116db5760405162461bcd60e51b81526004016108c690613edb565b60108190556040517f9fe6eeb0f0541c644a56c67efeb872dbadd803a60b909d7dde1b35a3fe230b0e90611643908390613d0b565b60056020526000908152604090205481565b60026008541415611768576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759016146117b55760405162461bcd60e51b81526004016108c6906140c6565b6001600160a01b0382166117db5760405162461bcd60e51b81526004016108c690613f8a565b60006117e78383612aaa565b60165490915060ff1615806118195750611814612710610936601854600e5461294a90919063ffffffff16565b601554115b15611833576016546118339062010000900460ff16612d1f565b600061183e82612b83565b90507fa33f5c0b76f00f6737b1780a8a7f18e19c3fe8fe9ee01a6c1b8ce1eae5ed54f986868686856040516118779594939291906142f0565b60405180910390a15050600160085550505050565b60076020526000908152604090205481565b336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759016146118e65760405162461bcd60e51b81526004016108c6906140c6565b61158781612d1f565b600b5481565b336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e7590161461193d5760405162461bcd60e51b81526004016108c6906140c6565b60006119498383612853565b805490915060ff161561196e5760405162461bcd60e51b81526004016108c690613e28565b805460ff191660011790555050565b6000600260085414156119c5576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e75901614611a125760405162461bcd60e51b81526004016108c6906140c6565b6060820151600e54611a23916128f0565b600e556020820151601354611a37916128f0565b6013556080820151601154611a4b916128f0565b60115561ffff85166000908152600a6020908152604080832087845290915290205460a083015160098054611aa692919084908110611a8657fe5b9060005260206000209060070201600401546127f690919063ffffffff16565b60098281548110611ab357fe5b600091825260209091206004600790920201015560408301518351611ae191611adc91906128f0565b612b83565b9150611b0e7f000000000000000000000000224d8fd7ab6ad4c6eb4611ce56ef35dec2277f038584612baf565b604083015183517ffb2b592367452f1c437675bed47f5e1e6c25188c17d7ba01a12eb030bc41ccef918691611b42916128f0565b85608001518660200151604051611b5c9493929190613c75565b60405180910390a1506001600855949350505050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108235780601f106107f857610100808354040283529160200191610823565b600f5481565b601654610100900460ff1681565b60135481565b60098181548110611bf657600080fd5b6000918252602090912060079091020180546001820154600283015460038401546004850154600586015460069096015460ff8616975061010090950461ffff169593949293919290919088565b60006109a533846113e685604051806060016040528060258152602001614480602591393360009081526006602090815260408083206001600160a01b038d1684529091529020549190613319565b60006109a5338484613111565b336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e75901614611ce85760405162461bcd60e51b81526004016108c6906140c6565b6000611cf48484612853565b9050611d178261ffff16610e7b8360020154600f546127f690919063ffffffff16565b600f5561ffff821660028201556040517f8fb3b21a941c2361df46475f9ae2f7b5dac5de7bd085fa22415ec0bb30c77e2290611d5890869086908690614367565b60405180910390a150505050565b61271081565b336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e75901614611db45760405162461bcd60e51b81526004016108c6906140c6565b600d805460ff19168215151790556040517f59a9350977452c5240699f57f18b5915cd0440a56f08820a38b9f2432a82ba3e90611643908390613c9b565b600060026008541415611e3a576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e75901614611e875760405162461bcd60e51b81526004016108c6906140c6565b6001600160a01b038716611ead5760405162461bcd60e51b81526004016108c690613f8a565b61ffff85166000908152600a60209081526040808320878452909152902054600980549091908110611edb57fe5b600091825260209091206007909102015460ff161515600114611f105760405162461bcd60e51b81526004016108c690613fc1565b611f1a8787612aaa565b60165490915060ff161580611f4c5750611f47612710610936601854600e5461294a90919063ffffffff16565b601554115b15611f5b57611f5b6000612d1f565b7f53c03ee0722b52efeb42444f48d90173854501b3de3c590fcb445743377115c287878388888888604051611f969796959493929190613c17565b60405180910390a160016008559695505050505050565b60026008541415611ff3576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759016146120405760405162461bcd60e51b81526004016108c6906140c6565b801561205d5761205b8361205383612b83565b6000806131bf565b505b60006120698686612853565b600481015490915061207b90846127f6565b6004820155600061208b84612b83565b90506120b87f000000000000000000000000224d8fd7ab6ad4c6eb4611ce56ef35dec2277f038683612baf565b7fa97166013ecf5305dd9a58d6d867f05e646d4275f52d2bd52a5c7f00a690ad1b8585856040516120eb93929190613bcb565b60405180910390a1505060016008555050505050565b600d5460ff1681565b60026008541415612150576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e7590161461219d5760405162461bcd60e51b81526004016108c6906140c6565b61ffff83166000908152600a602090815260408083208584529091528120546009805490919081106121cb57fe5b906000526020600020906007020190506121f6826000015182600301546128f090919063ffffffff16565b6003820155602082015160068201541461221557602082015160068201555b815160208301516040517fdbdd25248751feb2f3b66721dfdd11662a68bc155af3771e661aabec92fba81492612250928892889291906143a1565b60405180910390a1505060016008555050565b336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759016146122ab5760405162461bcd60e51b81526004016108c6906140c6565b601154156115875760006122c0601154612b83565b600060115590506122f27f000000000000000000000000224d8fd7ab6ad4c6eb4611ce56ef35dec2277f038383612baf565b7f70dc5a44816033bea80f836440f4b1fe1b3bb06b568c8dc2301901f03bf237c7828260405161157d929190613bb2565b60175481565b42841015612370576040805162461bcd60e51b815260206004820152600f60248201526e109c9a5919d94e8811561412549151608a1b604482015290519081900360640190fd5b6002546001600160a01b0380891660008181526007602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e08501825280519083012061190160f01b6101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e280820193601f1981019281900390910190855afa15801561248b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906124c15750886001600160a01b0316816001600160a01b0316145b612512576040805162461bcd60e51b815260206004820152601960248201527f4272696467653a20494e56414c49445f5349474e415455524500000000000000604482015290519081900360640190fd5b61251d898989612a0a565b505050505050505050565b600660209081526000928352604080842090915290825290205481565b336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e7590161461258d5760405162461bcd60e51b81526004016108c6906140c6565b61271084111580156125a157506127108311155b6125bd5760405162461bcd60e51b81526004016108c690613f12565b601680546017869055601885905560ff19168615151761ff001916610100841515021762ff0000191662010000831515021790556040517f7cc11124872dc29ed41dd447ee7ab07d9eee5d8ebb55f65dd92bce19bb20224a906126299087908790879087908790613ce2565b60405180910390a15050505050565b600c5481565b60008060026008541415612687576040805162461bcd60e51b815260206004820152601f602482015260008051602061443f833981519152604482015290519081900360640190fd5b6002600855336001600160a01b037f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759016146126d45760405162461bcd60e51b81526004016108c6906140c6565b60006126e08686612853565b9050806003015484111561270557600381018054600090915592508284039150612721565b600381015461271490856127f6565b6003820155839250600091505b7f44d3575fd94f9e0a41d7ebbc7e952f9b615c3f8d1faf924e1e9e98c0edf0d3808686858560405161275694939291906143a1565b60405180910390a15060016008559094909350915050565b600061277c611adc836133b0565b90505b919050565b7f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759081565b60105481565b7f000000000000000000000000224d8fd7ab6ad4c6eb4611ce56ef35dec2277f0381565b7f000000000000000000000000000000000000000000000000000000000000000181565b60008282111561284d576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6009546000906128755760405162461bcd60e51b81526004016108c690613ea4565b61ffff83166000908152600a602090815260408083208584529091528120546009805490919081106128a357fe5b60009182526020909120600790910201805490915061ffff85811661010090920416148015610bed575082816001015414610c095760405162461bcd60e51b81526004016108c690613d97565b600082820183811015610c09576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082612959575060006109a9565b8282028284828161296657fe5b0414610c095760405162461bcd60e51b815260040180806020018281038252602181526020018061445f6021913960400191505060405180910390fd5b60008082116129f9576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381612a0257fe5b049392505050565b6001600160a01b03808416600081815260066020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600080600e5411612a8f5760405162461bcd60e51b81526004016108c690613d47565b61277c600e546109366004548561294a90919063ffffffff16565b60008060045411612acd5760405162461bcd60e51b81526004016108c690613ddf565b6001600160a01b03831660009081526005602052604090205482811015612b065760405162461bcd60e51b81526004016108c6906141b9565b6000612b23600454610936600e548761294a90919063ffffffff16565b600e54909150612b3390826127f6565b600e55612b4085856133ee565b7f49995e5dd6158cf69ad3e9777c46755a1a826a446c6416992167462dad033b2a858583604051612b7393929190613bcb565b60405180910390a1949350505050565b600061277c827f000000000000000000000000000000000000000000000000000000000000000161294a565b604080518082018252601981527f7472616e7366657228616464726573732c75696e7432353629000000000000006020909101525160009081906001600160a01b038616907fa9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b90612c269087908790602401613bb2565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051612c649190613b82565b6000604051808303816000865af19150503d8060008114612ca1576040519150601f19603f3d011682016040523d82523d6000602084013e612ca6565b606091505b5091509150818015612cd0575080511580612cd0575080806020019051810190612cd091906137e7565b612cec5760405162461bcd60e51b81526004016108c690613e6d565b5050505050565b600061277c827f00000000000000000000000000000000000000000000000000000000000000016129a3565b6000601554118015612d3357506000600f54115b156115875760095460008167ffffffffffffffff81118015612d5457600080fd5b50604051908082528060200260200182016040528015612d7e578160200160208202803683370190505b5090506000805b83811015612e4857600060098281548110612d9c57fe5b906000526020600020906007020190506000612dcd600f546109368460020154600e5461294a90919063ffffffff16565b90506000612dec836005015484600401546128f090919063ffffffff16565b905080821115612e3a57808203868581518110612e0557fe5b602002602001018181525050612e37868581518110612e2057fe5b6020026020010151866128f090919063ffffffff16565b94505b505050806001019050612d85565b50600081612ee657848015612e5f57506000601554115b15612ee15760005b84811015612edf57600060098281548110612e7e57fe5b906000526020600020906007020190506000612eaf600f54610936846002015460155461294a90919063ffffffff16565b9050612ebb84826128f0565b6005830154909450612ecd90826128f0565b60059092019190915550600101612e67565b505b6130fa565b6015548211613053578415612fbd5760155482900360005b85811015612fb6576000858281518110612f1457fe5b60200260200101511115612fae57600060098281548110612f3157fe5b906000526020600020906007020190506000612f85612f63600f5461093685600201548861294a90919063ffffffff16565b888581518110612f6f57fe5b60200260200101516128f090919063ffffffff16565b9050612f9185826128f0565b6005830154909550612fa390826128f0565b826005018190555050505b600101612efe565b5050612ee1565b60005b84811015612edf576000848281518110612fd657fe5b6020026020010151111561304b57600060098281548110612ff357fe5b90600052602060002090600702019050600085838151811061301157fe5b6020026020010151905061302e81856128f090919063ffffffff16565b600583015490945061304090826128f0565b826005018190555050505b600101612fc0565b60005b848110156130f857600084828151811061306c57fe5b602002602001015111156130f05760006009828154811061308957fe5b9060005260206000209060070201905060006130c7856109366015548987815181106130b157fe5b602002602001015161294a90919063ffffffff16565b90506130d384826128f0565b60058301549094506130e590826128f0565b826005018190555050505b600101613056565b505b60155461310790826127f6565b6015555050505050565b6001600160a01b03831660009081526005602052604090205461313490826127f6565b6001600160a01b03808516600090815260056020526040808220939093559084168152205461316390826128f0565b6001600160a01b0380841660008181526005602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600f54116131e25760405162461bcd60e51b81526004016108c690614114565b6131eb84612cf3565b905060008315613230576132106127106109366010548561294a90919063ffffffff16565b905061321c82826127f6565b60125490925061322c90826128f0565b6012555b82156132475760155461324390836128f0565b6015555b60045482901561326f5761326c600e546109366004548661294a90919063ffffffff16565b90505b600e5461327c90846128f0565b600e55613289878261347f565b7fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb878285856040516132be9493929190613c75565b60405180910390a160165460ff1615806132f557506132f0612710610936601854600e5461294a90919063ffffffff16565b601554115b1561330f5760165461330f9062010000900460ff16612d1f565b5050949350505050565b600081848411156133a85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561336d578181015183820152602001613355565b50505050905090810190601f16801561339a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600080600454116133d35760405162461bcd60e51b81526004016108c690614009565b61277c600454610936600e548561294a90919063ffffffff16565b6001600160a01b03821660009081526005602052604090205461341190826127f6565b6001600160a01b03831660009081526005602052604090205560045461343790826127f6565b6004556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b60045461348c90826128f0565b6004556001600160a01b0382166000908152600560205260409020546134b290826128f0565b6001600160a01b03831660008181526005602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b604051806040016040528060008152602001600081525090565b604051806101000160405280600015158152602001600061ffff1681526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b80356001600160a01b038116811461277f57600080fd5b803561ffff8116811461277f57600080fd5b6000602082840312156135df578081fd5b610c09826135a5565b600080604083850312156135fa578081fd5b613603836135a5565b9150613611602084016135a5565b90509250929050565b60008060006060848603121561362e578081fd5b613637846135a5565b9250613645602085016135a5565b9150604084013590509250925092565b600080600080600080600060e0888a03121561366f578283fd5b613678886135a5565b9650613686602089016135a5565b95506040880135945060608801359350608088013560ff811681146136a9578384fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156136d8578182fd5b6136e1836135a5565b946020939093013593505050565b600080600060608486031215613703578283fd5b61370c846135a5565b925060208401359150613721604085016135a5565b90509250925092565b60008060008060008060a08789031215613742578182fd5b61374b876135a5565b955060208701359450613760604088016135bc565b935060608701359250608087013567ffffffffffffffff80821115613783578384fd5b818901915089601f830112613796578384fd5b8135818111156137a4578485fd5b8a60208285010111156137b5578485fd5b6020830194508093505050509295509295509295565b6000602082840312156137dc578081fd5b8135610c0981614430565b6000602082840312156137f8578081fd5b8151610c0981614430565b600080600080600060a0868803121561381a578283fd5b853561382581614430565b94506020860135935060408601359250606086013561384381614430565b9150608086013561385381614430565b809150509295509295909350565b600060c08284031215613872578081fd5b60405160c0810181811067ffffffffffffffff8211171561388f57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a08201528091505092915050565b600080604083850312156138e6578182fd5b6136e1836135bc565b600080600080848603610120811215613906578283fd5b61390f866135bc565b945060208601359350613924604087016135a5565b925060c0605f1982011215613937578182fd5b5060405160c0810181811067ffffffffffffffff8211171561395557fe5b8060405250606086013581526080860135602082015260a0860135604082015260c0860135606082015260e0860135608082015261010086013560a08201528091505092959194509250565b600080600080608085870312156139b6578182fd5b6139bf856135bc565b9350602085013592506139d4604086016135a5565b9396929550929360600135925050565b600080600080600060a086880312156139fb578283fd5b613a04866135bc565b945060208601359350613a19604087016135a5565b94979396509394606081013594506080013592915050565b60008060008060008060c08789031215613a49578384fd5b613a52876135bc565b955060208701359450613a67604088016135a5565b9350606087013592506080870135915060a0870135613a8581614430565b809150509295509295509295565b60008060008385036080811215613aa8578182fd5b613ab1856135bc565b9350602085013592506040603f1982011215613acb578182fd5b506040516040810181811067ffffffffffffffff82111715613ae957fe5b604090815285013581526060909401356020850152509093909250565b600080600060608486031215613b1a578081fd5b613b23846135bc565b925060208401359150613721604085016135bc565b600080600060608486031215613b4c578081fd5b613b55846135bc565b95602085013595506040909401359392505050565b600060208284031215613b7b578081fd5b5035919050565b60008251613b94818460208701614400565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b03948516815260208101939093526040830191909152909116606082015260800190565b600060018060a01b038916825287602083015286604083015261ffff8616606083015284608083015260c060a08301528260c0830152828460e084013781830160e090810191909152601f909201601f191601019695505050505050565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b901515815260200190565b971515885261ffff96909616602088015260408701949094526060860192909252608085015260a084015260c083015260e08201526101000190565b941515855260208501939093526040840191909152151560608301521515608082015260a00190565b90815260200190565b6000602082528251806020840152613d33816040850160208701614400565b601f01601f19169190910160400192915050565b60208082526030908201527f53746172676174653a2063616e7420636f6e76657274205344746f4c5020776860408201526f0656e20746f74616c4c6971203d3d20360841b606082015260800190565b60208082526028908201527f53746172676174653a206c6f63616c20636861696e5061746820646f6573206e6040820152671bdd08195e1a5cdd60c21b606082015260800190565b60208082526029908201527f53746172676174653a2063616e74206275726e207768656e20746f74616c5375604082015268070706c79203d3d20360bc1b606082015260800190565b60208082526025908201527f53746172676174653a20636861696e5061746820697320616c72656164792061604082015264637469766560d81b606082015260800190565b60208082526019908201527f53746172676174653a205452414e534645525f4641494c454400000000000000604082015260600190565b6020808252601d908201527f53746172676174653a206e6f20636861696e7061746873206578697374000000604082015260600190565b60208082526017908201527f4272696467653a2063756d2066656573203e2031303025000000000000000000604082015260600190565b6020808252601b908201527f53746172676174653a2077726f6e672044656c746120706172616d0000000000604082015260600190565b60208082526021908201527f53746172676174653a20666565206c6962726172792063616e742062652030786040820152600360fc1b606082015260800190565b6020808252601d908201527f53746172676174653a205f66726f6d2063616e6e6f7420626520307830000000604082015260600190565b60208082526028908201527f53746172676174653a20636f756e74657220636861696e50617468206973206e6040820152676f7420726561647960c01b606082015260800190565b60208082526033908201527f53746172676174653a2063616e7420636f6e76657274204c50746f53442077686040820152720656e20746f74616c537570706c79203d3d203606c1b606082015260800190565b60208082526044908201527f53746172676174653a2063616e7420637265617465436861696e50617468206f60408201527f66206578697374696e6720647374436861696e496420616e64205f647374506f6060820152631bdb125960e21b608082015260a00190565b6020808252602e908201527f53746172676174653a206f6e6c792074686520726f757465722063616e20636160408201526d1b1b081d1a1a5cc81b595d1a1bd960921b606082015260800190565b6020808252601d908201527f53746172676174653a204e6f20436861696e5061746873206578697374000000604082015260600190565b6020808252601d908201527f53746172676174653a206473742062616c616e636520746f6f206c6f77000000604082015260600190565b6020808252601b908201527f53746172676174653a20736c69707061676520746f6f20686967680000000000604082015260600190565b60208082526026908201527f53746172676174653a206e6f7420656e6f756768204c5020746f6b656e7320746040820152653790313ab93760d11b606082015260800190565b6020808252601b908201527f53746172676174653a20737761702066756e632073746f707065640000000000604082015260600190565b60006101008201905082511515825261ffff602084015116602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015292915050565b815181526020918201519181019190915260400190565b600060c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b61ffff95909516855260208501939093526001600160a01b039190911660408401526060830152608082015260a00190565b61ffff98909816885260208801969096526001600160a01b039490941660408701526060860192909252608085015260a084015260c083015260e08201526101000190565b61ffff93841681526020810192909252909116604082015260600190565b61ffff9390931683526020830191909152604082015260600190565b61ffff94909416845260208401929092526040830152606082015260800190565b918252602082015260400190565b948552602085019390935261ffff9190911660408401526001600160a01b03166060830152608082015260a00190565b60005b8381101561441b578181015183820152602001614403565b8381111561442a576000848401525b50505050565b801515811461158757600080fdfe5265656e7472616e637947756172643a207265656e7472616e742063616c6c00536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212207aaedc0ccd2d34f140152446b43279f2d93751be1b5b4321d4ba3041dfdc231164736f6c63430007060033

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

000000000000000000000000000000000000000000000000000000000000000d0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e7590000000000000000000000000224d8fd7ab6ad4c6eb4611ce56ef35dec2277f030000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001200000000000000000000000045a01e4e04f14f7a4a6702c74187c5f6222033cd0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000175374617267617465204574686572205661756c742d4c500000000000000000000000000000000000000000000000000000000000000000000000000000000007532a534745544800000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _poolId (uint256): 13
Arg [1] : _router (address): 0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590
Arg [2] : _token (address): 0x224D8Fd7aB6AD4c6eb4611Ce56EF35Dec2277F03
Arg [3] : _sharedDecimals (uint256): 18
Arg [4] : _localDecimals (uint256): 18
Arg [5] : _feeLibrary (address): 0x45A01E4e04F14f7A4a6702c74187c5F6222033cd
Arg [6] : _name (string): Stargate Ether Vault-LP
Arg [7] : _symbol (string): S*SGETH

-----Encoded View---------------
12 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [1] : 0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e7590
Arg [2] : 000000000000000000000000224d8fd7ab6ad4c6eb4611ce56ef35dec2277f03
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000012
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000012
Arg [5] : 00000000000000000000000045a01e4e04f14f7a4a6702c74187c5f6222033cd
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000017
Arg [9] : 5374617267617465204574686572205661756c742d4c50000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [11] : 532a534745544800000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
view all blocks sequenced

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

Validator Index Block Amount
View All Withdrawals

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

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