Contract 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 1

Contract Overview

Balance:
7.24968418 BNB
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xfb00dd9231c30e10e983c163c2a7a0e07daac5884b699510fe0bfb7101c9219dSwap Tokens To E...117253152021-08-23 9:18:5033 days 21 hrs ago0x56a2a358d687a40e3bfd2be28e69ab229e0b444e IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00312554
0xfdadc72eb29be62f7b1ddf5f6bd1c02a8f6ac65c03c3e270831e19d58b1b24b4Swap ETH To Toke...91634532021-05-25 23:12:49123 days 7 hrs ago0x833519fea96810826f416b46286db27049815ff6 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480.1 BNB0.00242028
0x525a94dda877ac89e7d461df426dcb8b224b594248c373c0a094e0fbbbe1940fDecrease Positio...84907022021-05-02 13:31:43146 days 17 hrs ago0x12175b07e2447550415d6e4136f816823b88a433 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00347247
0xf6b7eb1ca33df241dc1cc58cd2e256987f368030bfd27fda280b6a21232b243aIncrease Positio...84857442021-05-02 9:23:49146 days 21 hrs ago0x12175b07e2447550415d6e4136f816823b88a433 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00367623
0x69c830c4337ddf772f1a90a87c18e1697cfe8767f57c3c7be86e4002fd89fe5cIncrease Positio...84362922021-04-30 16:11:10148 days 14 hrs ago0x12175b07e2447550415d6e4136f816823b88a433 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00314107
0xb554ef025772adb5018c8f20c862a692f3645ee18686f680d20397848c0c4113Increase Positio...84358622021-04-30 15:49:40148 days 15 hrs ago0x12175b07e2447550415d6e4136f816823b88a433 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00219819
0x20850e13ff79ade1a67783162b9cd6cfc3c805915c1ad55d6941f6b8983de6f1Swap ETH To Toke...83732132021-04-28 11:37:10150 days 19 hrs ago0x27c27151f9bc6330b767bab8dcada11a253ccb8c IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480.1 BNB0.00209232
0xefdbc217af1da24f9164cddc713f82fbdac90249d50b7b0bb8f9f937061deab4Decrease Positio...83729052021-04-28 11:21:46150 days 19 hrs ago0xcb36bd046fe8a42f4289572286ae72cfca4a3669 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00174731
0xa08ca0a3b64d8327014e7aef923e4f1d4786f13227b146d9955ca9ade10f0c19Swap ETH To Toke...83727482021-04-28 11:13:55150 days 19 hrs ago0x854a97345c8b923602ee5dd2daf29c89b5b5d547 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480.089999999999999 BNB0.00216619
0x19de76841b4db2e7c2c7ab1ef36ec97c7f0e2cf6acbea7acee389f2a72d61dcfSwap Tokens To E...83727302021-04-28 11:13:01150 days 19 hrs ago0x854a97345c8b923602ee5dd2daf29c89b5b5d547 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00291096
0x481e7c8bcc5d71cd4168420867c67b0bc60309d4fd318be2826745ea007c80a8Swap ETH To Toke...83727052021-04-28 11:11:46150 days 19 hrs ago0x854a97345c8b923602ee5dd2daf29c89b5b5d547 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480.1 BNB0.00209232
0x81a2a010025862bd8bbc2a807c9048003290839e3e455713204a0451a908712bSwap Tokens To E...83727012021-04-28 11:11:34150 days 19 hrs ago0xaa6d0726bd07b786786ac2579531c1076bbf8f1b IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00208076
0x32eeb50fb6096e52549bf5e35bb0e38e91aef27726934054ea3dcfc045b05242Decrease Positio...83726822021-04-28 11:10:37150 days 19 hrs ago0xaa6d0726bd07b786786ac2579531c1076bbf8f1b IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00152903
0xc0c8e0eaff59841da5ff94a822923f35f11e4fa81ab0ef99814ee58ddd7d84dcDecrease Positio...83726732021-04-28 11:10:10150 days 19 hrs ago0xaa6d0726bd07b786786ac2579531c1076bbf8f1b IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00215661
0x91f4efedd28abefbdb758f2c46f836ed9dfa983a992cdde25069cd611d990ba6Decrease Positio...83726622021-04-28 11:09:37150 days 20 hrs ago0xaa6d0726bd07b786786ac2579531c1076bbf8f1b IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00290618
0x94f96d6e310a0e7a0380c962d16e3e0746550ed59be54696f448562ff200a3a8Increase Positio...83726352021-04-28 11:08:16150 days 20 hrs ago0xaa6d0726bd07b786786ac2579531c1076bbf8f1b IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f481 BNB0.00452548
0x7dc74b7dc423034f6a2f436dec8936f913003368f6050718fe30ae98df0acfd1Increase Positio...83726212021-04-28 11:07:34150 days 20 hrs ago0xaa6d0726bd07b786786ac2579531c1076bbf8f1b IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f481 BNB0.00545137
0xa6fad6d97634168c1547199269cc51f1bef140afa392c0efed9541a286acb40dIncrease Positio...83726092021-04-28 11:06:58150 days 20 hrs ago0x96a64738234c891fafd838ceb21e703399bf1320 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00545408
0x8f0827f3370e31507512eb8902a44acb1a8e0e0b27d8f4698e8bd6e984e89cc5Swap Tokens To E...83726032021-04-28 11:06:40150 days 20 hrs ago0xfc9c4c0e17c3a3139a77d86282ecf18687c14780 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00208076
0x904fda0f5b3ecbb08a79f44764ad67a124774136577d5a6d1d621233c5f1a483Swap Tokens To E...83725802021-04-28 11:05:31150 days 20 hrs ago0xfc9c4c0e17c3a3139a77d86282ecf18687c14780 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00219205
0xbdd6a2af15f33a43c72662a5260e9ce2c0b00e8e91988d2f9df84e7853547b22Decrease Positio...83725702021-04-28 11:05:01150 days 20 hrs ago0xfc9c4c0e17c3a3139a77d86282ecf18687c14780 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00215661
0xce94d2d94a4e7a892c99557922c79a0c99c71d5102d6ffb1906131e4bdb5e7bbDecrease Positio...83725622021-04-28 11:04:37150 days 20 hrs ago0xfc9c4c0e17c3a3139a77d86282ecf18687c14780 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00152879
0x535c2d11379a2b8d30ff271f2cf432cb2e957c77edd22dd5c992c00928276200Decrease Positio...83725472021-04-28 11:03:52150 days 20 hrs ago0xfc9c4c0e17c3a3139a77d86282ecf18687c14780 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00290606
0x80d0565f64efa002b28bc979b5009a0150b96ecc110b19196f36e2031546b0a9Swap Tokens To E...83725332021-04-28 11:03:10150 days 20 hrs ago0xfc9c4c0e17c3a3139a77d86282ecf18687c14780 IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480 BNB0.00291096
0x22aca5174708c7ae6c6ae78e6eb0142c479fb445101c3d188d757c1c9b1d74f4Swap ETH To Toke...83725192021-04-28 11:02:28150 days 20 hrs ago0xc96e67f8e69776cd9e3fa3c09ae14bfb517127dd IN  0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480.1 BNB0.00209232
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xfb00dd9231c30e10e983c163c2a7a0e07daac5884b699510fe0bfb7101c9219d117253152021-08-23 9:18:5033 days 21 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f480x56a2a358d687a40e3bfd2be28e69ab229e0b444e609.539155815342995047 BNB
0xfb00dd9231c30e10e983c163c2a7a0e07daac5884b699510fe0bfb7101c9219d117253152021-08-23 9:18:5033 days 21 hrs ago 0x6a2345e019db2acc6007dcd3a69731f51d7dca52 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48609.539155815342995047 BNB
0xfb00dd9231c30e10e983c163c2a7a0e07daac5884b699510fe0bfb7101c9219d117253152021-08-23 9:18:5033 days 21 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x6a2345e019db2acc6007dcd3a69731f51d7dca520 BNB
0xfb00dd9231c30e10e983c163c2a7a0e07daac5884b699510fe0bfb7101c9219d117253152021-08-23 9:18:5033 days 21 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0xfb00dd9231c30e10e983c163c2a7a0e07daac5884b699510fe0bfb7101c9219d117253152021-08-23 9:18:5033 days 21 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0xe14f46ee1e23b68003bced6d85465455a309dfff0 BNB
0xfdadc72eb29be62f7b1ddf5f6bd1c02a8f6ac65c03c3e270831e19d58b1b24b491634532021-05-25 23:12:49123 days 7 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0xfdadc72eb29be62f7b1ddf5f6bd1c02a8f6ac65c03c3e270831e19d58b1b24b491634532021-05-25 23:12:49123 days 7 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x6a2345e019db2acc6007dcd3a69731f51d7dca520 BNB
0xfdadc72eb29be62f7b1ddf5f6bd1c02a8f6ac65c03c3e270831e19d58b1b24b491634532021-05-25 23:12:49123 days 7 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x6a2345e019db2acc6007dcd3a69731f51d7dca520.1 BNB
0x525a94dda877ac89e7d461df426dcb8b224b594248c373c0a094e0fbbbe1940f84907022021-05-02 13:31:43146 days 17 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0x525a94dda877ac89e7d461df426dcb8b224b594248c373c0a094e0fbbbe1940f84907022021-05-02 13:31:43146 days 17 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0xf6b7eb1ca33df241dc1cc58cd2e256987f368030bfd27fda280b6a21232b243a84857442021-05-02 9:23:49146 days 21 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0xf6b7eb1ca33df241dc1cc58cd2e256987f368030bfd27fda280b6a21232b243a84857442021-05-02 9:23:49146 days 21 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0xf6b7eb1ca33df241dc1cc58cd2e256987f368030bfd27fda280b6a21232b243a84857442021-05-02 9:23:49146 days 21 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0xd19a92c0f37880cd3d19cbc8bb2636e7051f7d890 BNB
0x69c830c4337ddf772f1a90a87c18e1697cfe8767f57c3c7be86e4002fd89fe5c84362922021-04-30 16:11:10148 days 14 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0x69c830c4337ddf772f1a90a87c18e1697cfe8767f57c3c7be86e4002fd89fe5c84362922021-04-30 16:11:10148 days 14 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0x69c830c4337ddf772f1a90a87c18e1697cfe8767f57c3c7be86e4002fd89fe5c84362922021-04-30 16:11:10148 days 14 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0xd19a92c0f37880cd3d19cbc8bb2636e7051f7d890 BNB
0xb554ef025772adb5018c8f20c862a692f3645ee18686f680d20397848c0c411384358622021-04-30 15:49:40148 days 15 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0xb554ef025772adb5018c8f20c862a692f3645ee18686f680d20397848c0c411384358622021-04-30 15:49:40148 days 15 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0xb554ef025772adb5018c8f20c862a692f3645ee18686f680d20397848c0c411384358622021-04-30 15:49:40148 days 15 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0xae7486c680720159130b71e0f9ef7afd8f4132270 BNB
0x20850e13ff79ade1a67783162b9cd6cfc3c805915c1ad55d6941f6b8983de6f183732132021-04-28 11:37:10150 days 19 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0x20850e13ff79ade1a67783162b9cd6cfc3c805915c1ad55d6941f6b8983de6f183732132021-04-28 11:37:10150 days 19 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x6a2345e019db2acc6007dcd3a69731f51d7dca520 BNB
0x20850e13ff79ade1a67783162b9cd6cfc3c805915c1ad55d6941f6b8983de6f183732132021-04-28 11:37:10150 days 19 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x6a2345e019db2acc6007dcd3a69731f51d7dca520.100000000000000006 BNB
0xefdbc217af1da24f9164cddc713f82fbdac90249d50b7b0bb8f9f937061deab483729052021-04-28 11:21:46150 days 19 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0xefdbc217af1da24f9164cddc713f82fbdac90249d50b7b0bb8f9f937061deab483729052021-04-28 11:21:46150 days 19 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
0xa08ca0a3b64d8327014e7aef923e4f1d4786f13227b146d9955ca9ade10f0c1983727482021-04-28 11:13:55150 days 19 hrs ago 0xeab009d0e467f6bd9a98cd9e9d3b7da909ae7f48 0x3239bf99d4d1f7ca2ddada64e0345053bfb456550 BNB
[ Download CSV Export 
Loading

Contract Source Code Verified (Similar Match)
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0x41c86e88be1472F1D12CDE6469BC46fb0F98BF59

Contract Name:
Router

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 7 : Router.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

import "../libraries/math/SafeMath.sol";
import "../libraries/token/IERC20.sol";
import "../libraries/token/SafeERC20.sol";
import "../libraries/utils/Address.sol";

import "../tokens/interfaces/IWETH.sol";
import "./interfaces/IVault.sol";

contract Router {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using Address for address payable;

    enum TriggerType { None, AboveTriggerPrice, BelowTriggerPrice, Trailing }

    struct SwapOrder {
        address account;
        address[] path;
        uint256 amountIn;
        uint256 minOut;
        address receiver;
        uint256 relayerFee;
    }

    struct IncreasePositionOrder {
        address account;
        address[] path;
        address indexToken;
        uint256 amountIn;
        uint256 sizeDelta;
        bool isLong;
        uint256 price;
        uint256 relayerFee;
    }

    struct DecreasePositionOrder {
        address account;
        address collateralToken;
        address indexToken;
        uint256 collateralDelta;
        uint256 sizeDelta;
        bool isLong;
        address receiver;
        uint256 price;
        uint256 relayerFee;
        TriggerType triggerType;
        uint256 triggerPrice;
        uint256 roundId;
    }

    // wrapped BNB / ETH
    address public weth;
    address public usdg;
    address public vault;

    mapping (bytes32 => SwapOrder) public swapOrders;
    mapping (bytes32 => IncreasePositionOrder) public increasePositionOrders;
    mapping (bytes32 => DecreasePositionOrder) public decreasePositionOrders;

    constructor(address _vault, address _usdg, address _weth) public {
        vault = _vault;
        usdg = _usdg;
        weth = _weth;
    }

    receive() external payable {}

    function storeSwap(
        address[] memory _path,
        uint256 _amountIn,
        uint256 _minOut,
        address _receiver,
        uint256 _nonce,
        uint256 _relayerFee
    ) external {
        bytes32 id = getId(_sender(), _nonce);
        swapOrders[id] = SwapOrder(
            _sender(),
            _path,
            _amountIn,
            _minOut,
            _receiver,
            _relayerFee
        );
    }

    function execSwap(bytes32 _id) external {
        SwapOrder memory order = swapOrders[_id];
        IERC20(order.path[0]).safeTransferFrom(order.account, vault, order.amountIn);

        uint256 amountOut = _swap(order.path, order.minOut, address(this));
        IERC20(order.path[order.path.length - 1]).safeTransfer(msg.sender, order.relayerFee);
        IERC20(order.path[order.path.length - 1]).safeTransfer(order.receiver, amountOut.sub(order.relayerFee));

        delete swapOrders[_id];
    }

    function cancelSwap(bytes32 _id) external {
        delete swapOrders[_id];
    }

    function storeIncreasePosition(
        address[] memory _path,
        address _indexToken,
        uint256 _amountIn,
        uint256 _sizeDelta,
        bool _isLong,
        uint256 _price,
        uint256 _nonce,
        uint256 _relayerFee
    ) external {
        bytes32 id = getId(_sender(), _nonce);
        increasePositionOrders[id] = IncreasePositionOrder(
            _sender(),
            _path,
            _indexToken,
            _amountIn,
            _sizeDelta,
            _isLong,
            _price,
            _relayerFee
        );
    }

    function execIncreasePosition(bytes32 _id) external {
        IncreasePositionOrder memory order = increasePositionOrders[_id];
        IERC20(order.path[0]).safeTransferFrom(order.account, msg.sender, order.relayerFee);
        IERC20(order.path[0]).safeTransferFrom(order.account, vault, order.amountIn.sub(order.relayerFee));
        if (order.path.length > 1) {
            uint256 amountOut = _swap(order.path, 0, address(this));
            IERC20(order.path[order.path.length - 1]).safeTransfer(vault, amountOut);
        }
        _increasePosition(order.path[order.path.length - 1], order.indexToken, order.sizeDelta, order.isLong, order.price);

        delete increasePositionOrders[_id];
    }

    function cancelIncreasePosition(bytes32 _id) external {
        delete increasePositionOrders[_id];
    }

    function storeDecreasePosition(
        address _collateralToken,
        address _indexToken,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        bool _isLong,
        address _receiver,
        uint256 _price,
        uint256 _nonce,
        uint256 _relayerFee,
        TriggerType _triggerType,
        uint256 _triggerPrice
    ) external {
        bytes32 id = getId(_sender(), _nonce);
        decreasePositionOrders[id] = DecreasePositionOrder(
            _sender(),
            _collateralToken,
            _indexToken,
            _collateralDelta,
            _sizeDelta,
            _isLong,
            _receiver,
            _price,
            _relayerFee,
            _triggerType,
            _triggerPrice,
            IVault(vault).getRoundId(_indexToken)
        );
    }

    function execDecreasePosition(bytes32 _id, uint256 _trailingRoundId) external {
        DecreasePositionOrder memory order = decreasePositionOrders[_id];
        uint256 price = IVault(vault).getSinglePrice(order.indexToken);

        if (order.triggerType == TriggerType.AboveTriggerPrice) {
            require(price > order.triggerPrice, "Router: mark price not above trigger price");
        }
        if (order.triggerType == TriggerType.BelowTriggerPrice) {
            require(price < order.triggerPrice, "Router: mark price not below trigger price");
        }
        if (order.triggerType == TriggerType.Trailing) {
            require(_trailingRoundId > order.roundId, "Router: invalid _trailingRoundId");
            uint256 trailingPrice = IVault(vault).getRoundPrice(order.indexToken, _trailingRoundId);

            if (order.isLong) {
                require(trailingPrice.sub(order.triggerPrice) > price, "Router: invalid trail gap");
            } else {
                require(trailingPrice.add(order.triggerPrice) > price, "Router: invalid trail gap");
            }
        }

        uint256 amountOut = _decreasePosition(order.collateralToken, order.indexToken, order.collateralDelta, order.sizeDelta, order.isLong, address(this), order.price);
        if (amountOut > order.relayerFee) {
            IERC20(order.collateralToken).safeTransfer(msg.sender, order.relayerFee);
            IERC20(order.collateralToken).safeTransfer(order.receiver, amountOut.sub(order.relayerFee));
        } else {
            IERC20(order.collateralToken).safeTransferFrom(order.account, msg.sender, order.relayerFee);
            IERC20(order.collateralToken).safeTransfer(order.receiver, amountOut);
        }

        delete increasePositionOrders[_id];
    }

    function swap(address[] memory _path, uint256 _amountIn, uint256 _minOut, address _receiver) public {
        IERC20(_path[0]).safeTransferFrom(_sender(), vault, _amountIn);
        _swap(_path, _minOut, _receiver);
    }

    function swapETHToTokens(address[] memory _path, uint256 _minOut, address _receiver) external payable {
        require(_path[0] == weth, "Router: invalid _path");
        _transferETHToVault();
        _swap(_path, _minOut, _receiver);
    }

    function swapTokensToETH(address[] memory _path, uint256 _amountIn, uint256 _minOut, address payable _receiver) external {
        require(_path[_path.length - 1] == weth, "Router: invalid _path");
        IERC20(_path[0]).safeTransferFrom(_sender(), vault, _amountIn);
        uint256 amountOut = _swap(_path, _minOut, address(this));
        _transferOutETH(amountOut, _receiver);
    }

    function increasePosition(address[] memory _path, address _indexToken, uint256 _amountIn, uint256 _minOut, uint256 _sizeDelta, bool _isLong, uint256 _price) external {
        if (_amountIn > 0) {
            IERC20(_path[0]).safeTransferFrom(_sender(), vault, _amountIn);
        }
        if (_path.length > 1 && _amountIn > 0) {
            uint256 amountOut = _swap(_path, _minOut, address(this));
            IERC20(_path[_path.length - 1]).safeTransfer(vault, amountOut);
        }
        _increasePosition(_path[_path.length - 1], _indexToken, _sizeDelta, _isLong, _price);
    }

    function increasePositionETH(address[] memory _path, address _indexToken, uint256 _minOut, uint256 _sizeDelta, bool _isLong, uint256 _price) external payable {
        require(_path[0] == weth, "Router: invalid _path");
        if (msg.value > 0) {
            _transferETHToVault();
        }
        if (_path.length > 1 && msg.value > 0) {
            uint256 amountOut = _swap(_path, _minOut, address(this));
            IERC20(_path[_path.length - 1]).safeTransfer(vault, amountOut);
        }
        _increasePosition(_path[_path.length - 1], _indexToken, _sizeDelta, _isLong, _price);
    }

    function decreasePosition(address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver, uint256 _price) external {
        _decreasePosition(_collateralToken, _indexToken, _collateralDelta, _sizeDelta, _isLong, _receiver, _price);
    }

    function decreasePositionETH(address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address payable _receiver, uint256 _price) external {
        uint256 amountOut = _decreasePosition(_collateralToken, _indexToken, _collateralDelta, _sizeDelta, _isLong, address(this), _price);
        _transferOutETH(amountOut, _receiver);
    }

    function getId(address _account, uint256 _nonce) public pure returns (bytes32) {
        return keccak256(abi.encodePacked(
            _account,
            _nonce
        ));
    }

    function _increasePosition(address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong, uint256 _price) private {
        if (_isLong) {
            require(IVault(vault).getMaxPrice(_indexToken) <= _price, "Router: mark price higher than limit");
        } else {
            require(IVault(vault).getMinPrice(_indexToken) >= _price, "Router: mark price lower than limit");
        }

        IVault(vault).increasePosition(_sender(), _collateralToken, _indexToken, _sizeDelta, _isLong);
    }

    function _decreasePosition(address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver, uint256 _price) private returns (uint256) {
        if (_isLong) {
            require(IVault(vault).getMinPrice(_indexToken) >= _price, "Router: mark price lower than limit");
        } else {
            require(IVault(vault).getMaxPrice(_indexToken) <= _price, "Router: mark price higher than limit");
        }

        return IVault(vault).decreasePosition(_sender(), _collateralToken, _indexToken, _collateralDelta, _sizeDelta, _isLong, _receiver);
    }

    function _transferETHToVault() private {
        IWETH(weth).deposit{value: msg.value}();
        IERC20(weth).safeTransfer(vault, msg.value);
    }

    function _transferOutETH(uint256 _amountOut, address payable _receiver) private {
        IWETH(weth).withdraw(_amountOut);
        _receiver.sendValue(_amountOut);
    }

    function _swap(address[] memory _path, uint256 _minOut, address _receiver) private returns (uint256) {
        if (_path.length == 2) {
            return _vaultSwap(_path[0], _path[1], _minOut, _receiver);
        }
        if (_path.length == 3) {
            uint256 midOut = _vaultSwap(_path[0], _path[1], 0, address(this));
            IERC20(_path[1]).safeTransfer(vault, midOut);
            return _vaultSwap(_path[1], _path[2], _minOut, _receiver);
        }

        revert("Router: invalid _path.length");
    }

    function _vaultSwap(address _tokenIn, address _tokenOut, uint256 _minOut, address _receiver) private returns (uint256) {
        uint256 amountOut;

        if (_tokenOut == usdg) { // buyUSDG
            amountOut = IVault(vault).buyUSDG(_tokenIn, _receiver);
        } else if (_tokenIn == usdg) { // sellUSDG
            amountOut = IVault(vault).sellUSDG(_tokenOut, _receiver);
        } else { // swap
            amountOut = IVault(vault).swap(_tokenIn, _tokenOut, _receiver);
        }

        require(amountOut >= _minOut, "Router: insufficient amountOut");
        return amountOut;
    }

    function _sender() private view returns (address) {
        return msg.sender;
    }
}

File 2 of 7 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

/**
 * @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, 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) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * 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);
        uint256 c = a - b;

        return c;
    }

    /**
     * @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) {
        // 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 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts 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) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts 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) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 3 of 7 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

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

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

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

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

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

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

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

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

File 4 of 7 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

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

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

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

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

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

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

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

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

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

File 5 of 7 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

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

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 6 of 7 : IWETH.sol
//SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IWETH {
    function deposit() external payable;
    function transfer(address to, uint value) external returns (bool);
    function withdraw(uint) external;
}

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

pragma solidity 0.6.12;

interface IVault {
    function buyUSDG(address _token, address _receiver) external returns (uint256);
    function sellUSDG(address _token, address _receiver) external returns (uint256);
    function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256);
    function increasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external;
    function decreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external returns (uint256);

    function fundingRateFactor() external view returns (uint256);
    function cumulativeFundingRates(address _token) external view returns (uint256);
    function getNextFundingRate(address _token) external view returns (uint256);

    function poolAmounts(address _token) external view returns (uint256);
    function reservedAmounts(address _token) external view returns (uint256);
    function usdgAmounts(address _token) external view returns (uint256);
    function getRedemptionAmount(address _token, uint256 _usdgAmount) external view returns (uint256);
    function getMaxPrice(address _token) external view returns (uint256);
    function getMinPrice(address _token) external view returns (uint256);
    function getSinglePrice(address _token) external view returns (uint256);
    function getRoundId(address _token) external view returns (uint256);
    function getRoundPrice(address _token, uint256 _roundId) external view returns (uint256);

    function getDelta(address _indexToken, uint256 _size, uint256 _averagePrice, bool _isLong) external view returns (bool, uint256);
    function getPosition(address _account, address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256, uint256, uint256, uint256, uint256, uint256, bool);
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_usdg","type":"address"},{"internalType":"address","name":"_weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"cancelIncreasePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"cancelSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collateralToken","type":"address"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"uint256","name":"_collateralDelta","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"decreasePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collateralToken","type":"address"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"uint256","name":"_collateralDelta","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"address payable","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"decreasePositionETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"decreasePositionOrders","outputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"indexToken","type":"address"},{"internalType":"uint256","name":"collateralDelta","type":"uint256"},{"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"internalType":"bool","name":"isLong","type":"bool"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"enum Router.TriggerType","name":"triggerType","type":"uint8"},{"internalType":"uint256","name":"triggerPrice","type":"uint256"},{"internalType":"uint256","name":"roundId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"},{"internalType":"uint256","name":"_trailingRoundId","type":"uint256"}],"name":"execDecreasePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"execIncreasePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"execSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_nonce","type":"uint256"}],"name":"getId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"increasePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"increasePositionETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"increasePositionOrders","outputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"indexToken","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"internalType":"bool","name":"isLong","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"relayerFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collateralToken","type":"address"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"uint256","name":"_collateralDelta","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"uint256","name":"_relayerFee","type":"uint256"},{"internalType":"enum Router.TriggerType","name":"_triggerType","type":"uint8"},{"internalType":"uint256","name":"_triggerPrice","type":"uint256"}],"name":"storeDecreasePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"uint256","name":"_relayerFee","type":"uint256"}],"name":"storeIncreasePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"uint256","name":"_relayerFee","type":"uint256"}],"name":"storeSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"swapETHToTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"swapOrders","outputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"minOut","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"address payable","name":"_receiver","type":"address"}],"name":"swapTokensToETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdg","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b50604051612fe7380380612fe78339818101604052606081101561003357600080fd5b5080516020820151604090920151600280546001600160a01b03199081166001600160a01b039485161790915560018054821694841694909417909355600080549093169116178155612f5b90819061008c90396000f3fe6080604052600436106101395760003560e01c8063a2da8bbe116100ab578063c3055e151161006f578063c3055e1514610947578063c5d3e11d14610a05578063d541beb314610a50578063f5b91b7b14610a7a578063fbfa77cf14610a8f578063fc8b46e814610aa457610140565b8063a2da8bbe14610607578063a5040039146106d5578063abe68eaa146106ff578063b32755de146107ae578063b7ddc9921461087157610140565b80636023e966116100fd5780636023e966146103855780636c85c8cb146104475780637be5ade6146104715780638d7cf55d1461054e57806390205d8c1461057e57806391a1ea7b146105dd57610140565b80631e47d83d146101455780632d4ba6a7146101b35780633ddede2a146102775780633fc8cef3146102f5578063430ed37c1461032657610140565b3661014057005b600080fd5b34801561015157600080fd5b5061016f6004803603602081101561016857600080fd5b5035610b14565b60405180866001600160a01b03168152602001858152602001848152602001836001600160a01b031681526020018281526020019550505050505060405180910390f35b3480156101bf57600080fd5b50610275600480360360808110156101d657600080fd5b810190602081018135600160201b8111156101f057600080fd5b82018360208201111561020257600080fd5b803590602001918460208302840111600160201b8311171561022357600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602081013590604001356001600160a01b0316610b51565b005b34801561028357600080fd5b50610275600480360361016081101561029b57600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013515159160a08101359091169060c08101359060e0810135906101008101359060ff61012082013516906101400135610c37565b34801561030157600080fd5b5061030a610e6b565b604080516001600160a01b039092168252519081900360200190f35b34801561033257600080fd5b50610275600480360360e081101561034957600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013515159160a08101359091169060c00135610e7a565b34801561039157600080fd5b50610275600480360360808110156103a857600080fd5b810190602081018135600160201b8111156103c257600080fd5b8201836020820111156103d457600080fd5b803590602001918460208302840111600160201b831117156103f557600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602081013590604001356001600160a01b0316610ea1565b34801561045357600080fd5b506102756004803603602081101561046a57600080fd5b5035610eb7565b34801561047d57600080fd5b50610275600480360361010081101561049557600080fd5b810190602081018135600160201b8111156104af57600080fd5b8201836020820111156104c157600080fd5b803590602001918460208302840111600160201b831117156104e257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013515159060808101359060a08101359060c00135611109565b34801561055a57600080fd5b506102756004803603604081101561057157600080fd5b5080359060200135611229565b34801561058a57600080fd5b50610275600480360360e08110156105a157600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013515159160a08101359091169060c00135611760565b3480156105e957600080fd5b506102756004803603602081101561060057600080fd5b503561176f565b34801561061357600080fd5b50610275600480360360c081101561062a57600080fd5b810190602081018135600160201b81111561064457600080fd5b82018360208201111561065657600080fd5b803590602001918460208302840111600160201b8311171561067757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550508235935050506020810135906001600160a01b0360408201351690606081013590608001356117d8565b3480156106e157600080fd5b50610275600480360360208110156106f857600080fd5b50356118bb565b6102756004803603606081101561071557600080fd5b810190602081018135600160201b81111561072f57600080fd5b82018360208201111561074157600080fd5b803590602001918460208302840111600160201b8311171561076257600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602001356001600160a01b0316611a92565b610275600480360360c08110156107c457600080fd5b810190602081018135600160201b8111156107de57600080fd5b8201836020820111156107f057600080fd5b803590602001918460208302840111600160201b8311171561081157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013515159060800135611b20565b34801561087d57600080fd5b50610275600480360360e081101561089457600080fd5b810190602081018135600160201b8111156108ae57600080fd5b8201836020820111156108c057600080fd5b803590602001918460208302840111600160201b831117156108e157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013590608081013515159060a00135611c20565b34801561095357600080fd5b506109716004803603602081101561096a57600080fd5b5035611ccd565b604051808d6001600160a01b031681526020018c6001600160a01b031681526020018b6001600160a01b031681526020018a81526020018981526020018815158152602001876001600160a01b031681526020018681526020018581526020018460038111156109dd57fe5b81526020018381526020018281526020019c5050505050505050505050505060405180910390f35b348015610a1157600080fd5b50610a3e60048036036040811015610a2857600080fd5b506001600160a01b038135169060200135611d41565b60408051918252519081900360200190f35b348015610a5c57600080fd5b5061027560048036036020811015610a7357600080fd5b5035611d86565b348015610a8657600080fd5b5061030a611ddc565b348015610a9b57600080fd5b5061030a611deb565b348015610ab057600080fd5b50610ace60048036036020811015610ac757600080fd5b5035611dfa565b604080516001600160a01b0398891681529690971660208701528587019490945260608501929092521515608084015260a083015260c082015290519081900360e00190f35b6003602081905260009182526040909120805460028201549282015460048301546005909301546001600160a01b03928316949391929091169085565b60005484516001600160a01b039091169085906000198101908110610b7257fe5b60200260200101516001600160a01b031614610bcd576040805162461bcd60e51b81526020600482015260156024820152740a4deeae8cae47440d2dcecc2d8d2c840bee0c2e8d605b1b604482015290519081900360640190fd5b610c17610bd8611e48565b60025486516001600160a01b039091169086908890600090610bf657fe5b60200260200101516001600160a01b0316611e4c909392919063ffffffff16565b6000610c24858430611ea6565b9050610c308183611fe7565b5050505050565b6000610c4a610c44611e48565b86611d41565b9050604051806101800160405280610c60611e48565b6001600160a01b031681526020018d6001600160a01b031681526020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b03168152602001878152602001858152602001846003811115610cc757fe5b8152602001838152602001600260009054906101000a90046001600160a01b03166001600160a01b03166385c092058e6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610d3457600080fd5b505afa158015610d48573d6000803e3d6000fd5b505050506040513d6020811015610d5e57600080fd5b50519052600082815260056020818152604092839020845181546001600160a01b03199081166001600160a01b039283161783559286015160018084018054861692841692909217909155948601516002830180549094169082161790925560608501516003808301919091556080860151600483015560a0860151938201805460c088015160ff1991821696151596909617610100600160a81b03191661010096909516860294909417905560e0860151600683015592850151600782015561012085015160088201805492959194909392909216918490811115610e4057fe5b0217905550610140820151600982015561016090910151600a90910155505050505050505050505050565b6000546001600160a01b031681565b6000610e8b8888888888308861205f565b9050610e978184611fe7565b5050505050505050565b610eac610bd8611e48565b610c30848383611ea6565b610ebf612c42565b60008281526004602090815260409182902082516101008101845281546001600160a01b0316815260018201805485518186028101860190965280865291949293858101939290830182828015610f3f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f21575b505050918352505060028201546001600160a01b03166020808301919091526003830154604083015260048301546060830152600583015460ff1615156080830152600683015460a083015260079092015460c090910152815160e0830151918301518051939450610fbb9391923392909190600090610bf657fe5b805160025460e08301516060840151610ff493926001600160a01b031691610fe391906122a4565b8460200151600081518110610bf657fe5b600181602001515111156110645760006110148260200151600030611ea6565b60025460208401518051929350611062926001600160a01b0390921691849190600019810190811061104257fe5b60200260200101516001600160a01b03166122e69092919063ffffffff16565b505b6020810151805161109f9190600019810190811061107e57fe5b6020026020010151826040015183608001518460a001518560c0015161233d565b600082815260046020526040812080546001600160a01b0319168155906110c96001830182612c9b565b506002810180546001600160a01b03191690556000600382018190556004820181905560058201805460ff19169055600682018190556007909101555050565b600061111c611116611e48565b84611d41565b9050604051806101000160405280611132611e48565b6001600160a01b03908116825260208083018d90528b8216604080850191909152606084018c9052608084018b905289151560a085015260c0840189905260e090930186905260008581526004825292909220835181546001600160a01b031916921691909117815582820151805191926111b592600185019290910190612cbc565b5060408201516002820180546001600160a01b0319166001600160a01b03909216919091179055606082015160038201556080820151600482015560a082015160058201805460ff191691151591909117905560c0820151600682015560e090910151600790910155505050505050505050565b611231612d21565b60008381526005602081815260409283902083516101808101855281546001600160a01b039081168252600183015481169382019390935260028201548316948101949094526003808201546060860152600482015460808601529281015460ff808216151560a08701526101009182900490931660c0860152600682015460e08601526007820154908501526008810154909261012085019291909116908111156112d957fe5b60038111156112e457fe5b81526009820154602080830191909152600a90920154604091820152600254838201518251632709c7d960e01b81526001600160a01b0391821660048201529251949550600094911692632709c7d99260248082019391829003018186803b15801561134f57600080fd5b505afa158015611363573d6000803e3d6000fd5b505050506040513d602081101561137957600080fd5b505190506001826101200151600381111561139057fe5b14156113d95781610140015181116113d95760405162461bcd60e51b815260040180806020018281038252602a815260200180612e2b602a913960400191505060405180910390fd5b600282610120015160038111156113ec57fe5b14156114355781610140015181106114355760405162461bcd60e51b815260040180806020018281038252602a815260200180612e01602a913960400191505060405180910390fd5b6003826101200151600381111561144857fe5b14156116105781610160015183116114a7576040805162461bcd60e51b815260206004820181905260248201527f526f757465723a20696e76616c6964205f747261696c696e67526f756e644964604482015290519081900360640190fd5b600254604080840151815163180cd03f60e01b81526001600160a01b039182166004820152602481018790529151600093919091169163180cd03f916044808301926020929190829003018186803b15801561150257600080fd5b505afa158015611516573d6000803e3d6000fd5b505050506040513d602081101561152c57600080fd5b505160a0840151909150156115a75781611554846101400151836122a490919063ffffffff16565b116115a2576040805162461bcd60e51b81526020600482015260196024820152780526f757465723a20696e76616c696420747261696c2067617603c1b604482015290519081900360640190fd5b61160e565b816115c08461014001518361255790919063ffffffff16565b1161160e576040805162461bcd60e51b81526020600482015260196024820152780526f757465723a20696e76616c696420747261696c2067617603c1b604482015290519081900360640190fd5b505b600061163983602001518460400151856060015186608001518760a00151308960e0015161205f565b90508261010001518111156116a95761166f3384610100015185602001516001600160a01b03166122e69092919063ffffffff16565b6116a48360c0015161168f856101000151846122a490919063ffffffff16565b60208601516001600160a01b031691906122e6565b6116f3565b825161010084015160208501516116cd926001600160a01b03909116913390611e4c565b6116f38360c001518285602001516001600160a01b03166122e69092919063ffffffff16565b600085815260046020526040812080546001600160a01b03191681559061171d6001830182612c9b565b506002810180546001600160a01b03191690556000600382018190556004820181905560058201805460ff19169055600682018190556007909101555050505050565b610e978787878787878761205f565b600081815260046020526040812080546001600160a01b0319168155906117996001830182612c9b565b506002810180546001600160a01b03191690556000600382018190556004820181905560058201805460ff191690556006820181905560079091015550565b60006117e5611116611e48565b90506040518060c001604052806117fa611e48565b6001600160a01b03908116825260208083018b905260408084018b9052606084018a9052888316608085015260a090930186905260008581526003825292909220835181546001600160a01b0319169216919091178155828201518051919261186b92600185019290910190612cbc565b50604082015160028201556060820151600382015560808201516004820180546001600160a01b0319166001600160a01b0390921691909117905560a09091015160059091015550505050505050565b6118c3612d84565b600082815260036020908152604091829020825160c08101845281546001600160a01b031681526001820180548551818602810186019096528086529194929385810193929083018282801561194257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611924575b5050505050815260200160028201548152602001600382015481526020016004820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b0316815260200160058201548152505090506119ce8160000151600260009054906101000a90046001600160a01b031683604001518460200151600081518110610bf657fe5b60006119e38260200151836060015130611ea6565b9050611a06338360a0015184602001516001866020015151038151811061104257fe5b611a3a8260800151611a258460a00151846122a490919063ffffffff16565b60208501518051600019810190811061104257fe5b600083815260036020526040812080546001600160a01b031916815590611a646001830182612c9b565b50600060028201819055600382018190556004820180546001600160a01b0319169055600590910155505050565b6000805484516001600160a01b03909116918591611aac57fe5b60200260200101516001600160a01b031614611b07576040805162461bcd60e51b81526020600482015260156024820152740a4deeae8cae47440d2dcecc2d8d2c840bee0c2e8d605b1b604482015290519081900360640190fd5b611b0f6125b1565b611b1a838383611ea6565b50505050565b6000805487516001600160a01b03909116918891611b3a57fe5b60200260200101516001600160a01b031614611b95576040805162461bcd60e51b81526020600482015260156024820152740a4deeae8cae47440d2dcecc2d8d2c840bee0c2e8d605b1b604482015290519081900360640190fd5b3415611ba357611ba36125b1565b60018651118015611bb45750600034115b15611bf4576000611bc6878630611ea6565b9050611bf2600260009054906101000a90046001600160a01b0316828960018b51038151811061104257fe5b505b611c1886600188510381518110611c0757fe5b60200260200101518685858561233d565b505050505050565b8415611c4f57611c4f611c31611e48565b60025489516001600160a01b039091169088908b90600090610bf657fe5b60018751118015611c605750600085115b15611ca0576000611c72888630611ea6565b9050611c9e600260009054906101000a90046001600160a01b0316828a60018c51038151811061104257fe5b505b611cc487600189510381518110611cb357fe5b60200260200101518785858561233d565b50505050505050565b600560208190526000918252604090912080546001820154600283015460038401546004850154958501546006860154600787015460088801546009890154600a909901546001600160a01b039889169a978916999689169895979660ff808716976101009097049096169590921691908c565b6000828260405160200180836001600160a01b031660601b81526014018281526020019250505060405160208183030381529060405280519060200120905092915050565b600081815260036020526040812080546001600160a01b031916815590611db06001830182612c9b565b50600060028201819055600382018190556004820180546001600160a01b031916905560059091015550565b6001546001600160a01b031681565b6002546001600160a01b031681565b600460208190526000918252604090912080546002820154600383015493830154600584015460068501546007909501546001600160a01b03948516969490931694919260ff909116919087565b3390565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611b1a908590612638565b6000835160021415611eed57611ee684600081518110611ec257fe5b602002602001015185600181518110611ed757fe5b602002602001015185856126e9565b9050611fe0565b835160031415611f93576000611f2e85600081518110611f0957fe5b602002602001015186600181518110611f1e57fe5b60200260200101516000306126e9565b9050611f57600260009054906101000a90046001600160a01b0316828760018151811061104257fe5b611f8b85600181518110611f6757fe5b602002602001015186600281518110611f7c57fe5b602002602001015186866126e9565b915050611fe0565b6040805162461bcd60e51b815260206004820152601c60248201527f526f757465723a20696e76616c6964205f706174682e6c656e67746800000000604482015290519081900360640190fd5b9392505050565b6000805460408051632e1a7d4d60e01b81526004810186905290516001600160a01b0390921692632e1a7d4d9260248084019382900301818387803b15801561202f57600080fd5b505af1158015612043573d6000803e3d6000fd5b5061205b925050506001600160a01b038216836128e7565b5050565b6000831561212557600254604080516340d3096b60e11b81526001600160a01b038a811660048301529151859392909216916381a612d691602480820192602092909190829003018186803b1580156120b757600080fd5b505afa1580156120cb573d6000803e3d6000fd5b505050506040513d60208110156120e157600080fd5b505110156121205760405162461bcd60e51b8152600401808060200182810382526023815260200180612eb56023913960400191505060405180910390fd5b6121de565b60025460408051637092736960e11b81526001600160a01b038a8116600483015291518593929092169163e124e6d291602480820192602092909190829003018186803b15801561217557600080fd5b505afa158015612189573d6000803e3d6000fd5b505050506040513d602081101561219f57600080fd5b505111156121de5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f026024913960400191505060405180910390fd5b6002546001600160a01b03166382a084906121f7611e48565b604080516001600160e01b031960e085901b1681526001600160a01b039283166004820152828d166024820152828c166044820152606481018b9052608481018a905288151560a482015291871660c48301525160e48083019260209291908290030181600087803b15801561226c57600080fd5b505af1158015612280573d6000803e3d6000fd5b505050506040513d602081101561229657600080fd5b505198975050505050505050565b6000611fe083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506129cc565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612338908490612638565b505050565b81156124015760025460408051637092736960e11b81526001600160a01b03878116600483015291518493929092169163e124e6d291602480820192602092909190829003018186803b15801561239357600080fd5b505afa1580156123a7573d6000803e3d6000fd5b505050506040513d60208110156123bd57600080fd5b505111156123fc5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f026024913960400191505060405180910390fd5b6124ba565b600254604080516340d3096b60e11b81526001600160a01b0387811660048301529151849392909216916381a612d691602480820192602092909190829003018186803b15801561245157600080fd5b505afa158015612465573d6000803e3d6000fd5b505050506040513d602081101561247b57600080fd5b505110156124ba5760405162461bcd60e51b8152600401808060200182810382526023815260200180612eb56023913960400191505060405180910390fd5b6002546001600160a01b03166348d91abf6124d3611e48565b604080516001600160e01b031960e085901b1681526001600160a01b039283166004820152828a16602482015291881660448301526064820187905285151560848301525160a480830192600092919082900301818387803b15801561253857600080fd5b505af115801561254c573d6000803e3d6000fd5b505050505050505050565b600082820183811015611fe0576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156125ff57600080fd5b505af1158015612613573d6000803e3d6000fd5b505060025460005461263694506001600160a01b039081169350169050346122e6565b565b606061268d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a639092919063ffffffff16565b805190915015612338578080602001905160208110156126ac57600080fd5b50516123385760405162461bcd60e51b815260040180806020018281038252602a815260200180612ed8602a913960400191505060405180910390fd5b60015460009081906001600160a01b038681169116141561278e576002546040805163817bb85760e01b81526001600160a01b03898116600483015286811660248301529151919092169163817bb8579160448083019260209291908290030181600087803b15801561275b57600080fd5b505af115801561276f573d6000803e3d6000fd5b505050506040513d602081101561278557600080fd5b50519050612889565b6001546001600160a01b03878116911614156127fb5760025460408051630711e61960e41b81526001600160a01b03888116600483015286811660248301529151919092169163711e61909160448083019260209291908290030181600087803b15801561275b57600080fd5b60025460408051634998b10960e11b81526001600160a01b038981166004830152888116602483015286811660448301529151919092169163933162129160648083019260209291908290030181600087803b15801561285a57600080fd5b505af115801561286e573d6000803e3d6000fd5b505050506040513d602081101561288457600080fd5b505190505b838110156128de576040805162461bcd60e51b815260206004820152601e60248201527f526f757465723a20696e73756666696369656e7420616d6f756e744f75740000604482015290519081900360640190fd5b95945050505050565b8047101561293c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114612987576040519150601f19603f3d011682016040523d82523d6000602084013e61298c565b606091505b50509050806123385760405162461bcd60e51b815260040180806020018281038252603a815260200180612e55603a913960400191505060405180910390fd5b60008184841115612a5b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612a20578181015183820152602001612a08565b50505050905090810190601f168015612a4d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6060612a728484600085612a7a565b949350505050565b606082471015612abb5760405162461bcd60e51b8152600401808060200182810382526026815260200180612e8f6026913960400191505060405180910390fd5b612ac485612bd6565b612b15576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612b545780518252601f199092019160209182019101612b35565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612bb6576040519150601f19603f3d011682016040523d82523d6000602084013e612bbb565b606091505b5091509150612bcb828286612bdc565b979650505050505050565b3b151590565b60608315612beb575081611fe0565b825115612bfb5782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315612a20578181015183820152602001612a08565b60405180610100016040528060006001600160a01b031681526020016060815260200160006001600160a01b03168152602001600081526020016000815260200160001515815260200160008152602001600081525090565b5080546000825590600052602060002090810190612cb99190612dcc565b50565b828054828255906000526020600020908101928215612d11579160200282015b82811115612d1157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612cdc565b50612d1d929150612de1565b5090565b6040805161018081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905290610120820190815260200160008152602001600081525090565b6040518060c0016040528060006001600160a01b0316815260200160608152602001600081526020016000815260200160006001600160a01b03168152602001600081525090565b5b80821115612d1d5760008155600101612dcd565b5b80821115612d1d5780546001600160a01b0319168155600101612de256fe526f757465723a206d61726b207072696365206e6f742062656c6f772074726967676572207072696365526f757465723a206d61726b207072696365206e6f742061626f76652074726967676572207072696365416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c526f757465723a206d61726b207072696365206c6f776572207468616e206c696d69745361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564526f757465723a206d61726b20707269636520686967686572207468616e206c696d6974a264697066735822122070c0fc746b5dcd015c73807c9f333655b411c8f65d6d66f3543f51f1bcb0d82d64736f6c634300060c003300000000000000000000000096ee5959d640bf6f7bdecaf55e65cb8b5fd09856000000000000000000000000d8fcb8cceab1e2eb7357c4e8483fe0bb0aeec8ff0000000000000000000000006a2345e019db2acc6007dcd3a69731f51d7dca52

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading