Contract 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e9 2

 
Ad
Ad
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x827a81026f7724a5705476d5bc2f754eef13b41ce27c27ae0c933c3838941d0bCreate205833482021-10-25 4:40:433 mins ago0xbf627cfef11b4f577e3a5de7efb12f65e2d9df51 IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.00813816
0xc0231a320b31c16815de1ab552a7d12a8bf97fd204e5b8756052891e1998c087Complete Order205833122021-10-25 4:39:314 mins ago0x835e5c4b6ab3c4554d5458827fae89c1e84040c8 IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0689388
0x19e14c07f5ce426d73e48c164c447ee338203036582ffe2c369cbe412777403fComplete Order205832762021-10-25 4:38:156 mins ago0x188e64402148feee2623b834c41f365cd7193fab IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0586716
0x2566d96068547892e566353d959ba4d41af16c90c8ccd5697314a87a0e493e1dClose Order205832532021-10-25 4:37:296 mins ago0x99424417f89171d5f040d93054d5464beedf3dee IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0120306
0x7ea2e6b1c82192d61c56baf07415f8ae60db5111ca8010130447b94dc96e2de1Close Order205832522021-10-25 4:37:276 mins ago0xa967314fff11dfd6f2aeda9dfa6cf2b41cd9c37c IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0149706
0x5445caf73c8a7d43943de96f8d226c02a8b5f890793d5dba699412346ea84be4Close Order205831932021-10-25 4:35:258 mins ago0x835e5c4b6ab3c4554d5458827fae89c1e84040c8 IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0149706
0x1661c07ceef468f0b698606acef563695d897d052cd40744fe5f1a11f679a199Close Order205831512021-10-25 4:33:2510 mins ago0x42db5e69201aa5bebe81d89f9cd529f45ad7fb37 IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0149706
0xa12451cd35b88fc8897fbe44140353804a97fc301e4bcb99fc816c6d60dbeffcCreate205831392021-10-25 4:32:3711 mins ago0x5a6d31204551b63a8b7540374a3dd8fb16ff755b IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.00813816
0x47c24c25e3cfad64cfbb29e4eb383deb1f7b6f372ed716e0477ff4c4f830e976Create205831252021-10-25 4:31:4112 mins ago0x15cffefe05979f2027a8c812aa9bb83e2eeb9565 IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.00858744
0x55ba087535a8ef6f13070f31c1158125517fee8a439df0e6eb54f94f1035f96aCreate205830772021-10-25 4:29:1715 mins ago0x2601c115feec709e30844fdf2ea310c5f91d4283 IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.00794934
0xfcd72e2a260708eeed923dff8e9003d39615049a6ceba66a031857b40736dd92Create205830332021-10-25 4:27:3716 mins ago0x936ffbad9ec2150640ad757cb31d0a214cde492b IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.00051774
0x009d2dd046285bbef17b392f1df0a35878037d5071be9c420fb9da3bb091aaa4Close Order205830002021-10-25 4:26:3117 mins ago0x6ea2f80bdf4ad3f0add325ea3b2dc8e60a73ef2e IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0040102
0x0b2e06f3eac30bf57fba4e775232675f65fa40ae689b3f1fe318f98cfc4c38e4Close Order205830002021-10-25 4:26:3117 mins ago0x99424417f89171d5f040d93054d5464beedf3dee IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0040102
0x38a73b903c71d83b2be59150025c637fd5c152f971576f522a59da5f21e65635Complete Order205828922021-10-25 4:22:0922 mins ago0x188e64402148feee2623b834c41f365cd7193fab IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0803172
0x85625a28d82fb5851a4c3c78b4704bb378d9eec095e5bde75ea3a4a6808713a7Create205828812021-10-25 4:21:2522 mins ago0xa96a0fa110bdc4cfd26450113c814176bb924a4c IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.00776532
0x3ca02100b375d676027ccff7eb0bfb6ebea6f3ff90ac1e179efdea0d17fae6d9Create205828762021-10-25 4:21:0523 mins ago0xbdf57bca63ad3c0bdf1c85eb0fea99c2aed9b9bd IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.00858816
0x33384c831b45849766c08c80b67712e3e62a1268b9803c92d4dfc18ae3dc056eComplete Order205828572021-10-25 4:19:4924 mins ago0x85cd32f6914ae922c868a37467957d7be86cc070 IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.05865
0x7edfd209a097274626c6506f236e641476c9e1e03e7897030ab6c26892ce4b6cComplete Order205828282021-10-25 4:18:2725 mins ago0x99424417f89171d5f040d93054d5464beedf3dee IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0653316
0x296598f6fe62d8d846a2cecb86d41673d7e150e765308c3649aa0cd06aa2d8bfClose Order205828002021-10-25 4:17:3126 mins ago0xa967314fff11dfd6f2aeda9dfa6cf2b41cd9c37c IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0120306
0x40092e7d207d9e5258fa0ced4a75310cd0cd80303c2d0fb09f4157d3edc3f383Close Order205826842021-10-25 4:13:3130 mins ago0x6ea2f80bdf4ad3f0add325ea3b2dc8e60a73ef2e IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0149706
0x08669ec76ff96dd80d87640f40b5d040e02baaa1f8daec352b185362e4a479baCreate205826602021-10-25 4:12:4331 mins ago0xf085b0d3313ad17b1f5184f2f7c13b06a9afe567 IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0081378
0x1ea5d78ce4800a62c41b5d350374d8e09eaf03d6137df31883cedc978aa71e12Complete Order205826422021-10-25 4:12:0332 mins ago0x598e630ea3e4c3de045ca0dd5f377565ec2f540c IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0550644
0xa39200b6a7c7909e3949998d53a975a0e560f141b4cb4c6ddf6b69fdb5e4347dClose Order205826242021-10-25 4:11:2732 mins ago0x99424417f89171d5f040d93054d5464beedf3dee IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0149706
0x6f52417df7ffb95f4fa11ff81969a61b09795da52b29424ad66043bfabdb2933Create205825702021-10-25 4:09:3534 mins ago0x4a5e19fd3dd3409224b9826efcfdfe9ed04b7ffe IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0010648872
0x96e76e1e95c62240f8911432754044ab1e72a21119aad30d004bd73931c3fab4Complete Order205825122021-10-25 4:07:3536 mins ago0x188e64402148feee2623b834c41f365cd7193fab IN  0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90 MATIC0.0653172
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xc0231a320b31c16815de1ab552a7d12a8bf97fd204e5b8756052891e1998c087205833122021-10-25 4:39:314 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x0bad4cf275bc0d0440406c2afa44f7e13b80fe120.01 MATIC
0x19e14c07f5ce426d73e48c164c447ee338203036582ffe2c369cbe412777403f205832762021-10-25 4:38:156 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x17ea8e92c7c8b97a05e517f799ce35e04d2b7abb0.01 MATIC
0x38a73b903c71d83b2be59150025c637fd5c152f971576f522a59da5f21e65635205828922021-10-25 4:22:0922 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x1e54610f3c14ea56a990357b0831f1350e677ba50.01 MATIC
0x33384c831b45849766c08c80b67712e3e62a1268b9803c92d4dfc18ae3dc056e205828572021-10-25 4:19:4924 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x379db0e7c74d85ba21e779cbb5a7f52408fa1c2c0.01 MATIC
0x7edfd209a097274626c6506f236e641476c9e1e03e7897030ab6c26892ce4b6c205828282021-10-25 4:18:2725 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90xce1268e0ae1be83a87403319b44320e2357adfc50.01 MATIC
0x1ea5d78ce4800a62c41b5d350374d8e09eaf03d6137df31883cedc978aa71e12205826422021-10-25 4:12:0332 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x35ea5f6cfaa5c2dbf0ff7ba53407c51fa720bb970.01 MATIC
0x96e76e1e95c62240f8911432754044ab1e72a21119aad30d004bd73931c3fab4205825122021-10-25 4:07:3536 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x35ea5f6cfaa5c2dbf0ff7ba53407c51fa720bb970.01 MATIC
0x44423d32fa4110248fa151bbab9f6b699f3c379a1eb770c9c3065d0202437012205824322021-10-25 4:04:5139 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x936ffbad9ec2150640ad757cb31d0a214cde492b0.01 MATIC
0xc9787d3bfbac3cdca2cd094958f266858545b0751a4c461cf0648712f58d2e21205823892021-10-25 4:03:2140 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x02b6c967d96c6351dbd0a4ce5b02db1f899e36a10.01 MATIC
0x58b9c3de5f94a46f6bc55ae43f8413385a86425b5d98ec893ebf39f619224361205822912021-10-25 3:58:3345 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x718f6e31a8f6e509d712bdad41712ef61eff16bd0.01 MATIC
0x0cf2f9b03efd8ae16d8d157ffa7534626f8014abad62ed19f90975876f6e19a0205822482021-10-25 3:56:2347 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90xe7ca2be8fe40f7669544db63ad748cb42887962f0.01 MATIC
0x1b681ed7b7ffdc07fd8d492b4b68925800b8c10c73899618c4740a0ccc3e945d205822062021-10-25 3:54:5149 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x7acd5929937ce93b1b6860a2c93090aa6500bd5f0.01 MATIC
0xf59b2dbc62218424852ba2235dfd6274a50cbf33650dc73eea39bee04e7ca29b205821942021-10-25 3:53:3950 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x7fdaa97f8896fd3ce42652255da289f16870a7540.01 MATIC
0x180279fb217b4019162a6289af2791d4805b88ee5eba825ec058685e4de9a050205821812021-10-25 3:52:2151 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x8611fd8e8835ff11389fc2eb890131e3a72c35830.01 MATIC
0xccad7b97b6c257347cc675b3491f777299787dbacd94c93c66e682b39a38ea8c205820982021-10-25 3:46:5957 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x3d1e1e4ed53356330f5dd8bcbe320764847833260.01 MATIC
0x10dca96ed42ba06e54cf92e67518a7f7a9c9681c9413472a01cf58d46ca4641f205820602021-10-25 3:45:3958 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x3d1e1e4ed53356330f5dd8bcbe320764847833260.01 MATIC
0xb433a88b994fc1448081757fee44c2cca8e458820a3df1f14f8d110f6350a130205819032021-10-25 3:38:411 hr 5 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90xd1b83fcd0928dc34f26f9258af9846556bea272b0.01 MATIC
0x7d4c6eebbfcec72455eae7147272b42466512cd6f87bfea747ccf9eea439a6d1205818502021-10-25 3:36:191 hr 8 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x6455ce58efb402797476a54f5ba6870bff6b9b480.01 MATIC
0x358aaf6f8965d7af402ed9670459d5f34e566d4cddc8e5d25c8dea751259d44a205817822021-10-25 3:33:591 hr 10 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90xc4735b87dfb6c7cc3651677651e4bf139b27cc590.01 MATIC
0xbe84f18c4ecef82bdb4abb4f22f087142b718cbdb3c7bc62ba5476238a1be8c8205817362021-10-25 3:32:231 hr 11 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90xe175330874f9684d822b9c78320422186102d3ef0.01 MATIC
0x9f085ba3abe2b6da47b9de04266485e50ab28eba86972e9331611352ea7c478a205817042021-10-25 3:31:191 hr 13 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90xd1b83fcd0928dc34f26f9258af9846556bea272b0.01 MATIC
0x756574db487c2bbe622aadddaa97c4b003a3fdcf78a73abc495506704b280782205816722021-10-25 3:30:111 hr 14 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x707dc5f60a1e511933d8950b75f8253c825f9c000.01 MATIC
0xe4b72461ea1696023d6dc0761d6a5b5f2cf2d6f84c2e158e3f4478222be8e6e2205815862021-10-25 3:27:151 hr 17 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90xf2cf8b6b03ceca7d0d5a75d93371eb22085a10510.01 MATIC
0x44e0fe96e3aa3f5f920e1f39128a0dfbcd63baf91380f4495df5267682c7f965205815622021-10-25 3:26:231 hr 17 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x3fdd482fb9eb65414170a9c7eb1be3f21d76ea5f0.01 MATIC
0xf27eddaedfaf3c44eeac8e06ad06bf961bc8a470c89a13cce2d3bdfcf538ce01205815582021-10-25 3:26:151 hr 18 mins ago 0xa889df7bbf4f2ad689ecb4dd172c6f0b9065d2e90x936ffbad9ec2150640ad757cb31d0a214cde492b0.01 MATIC
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Bridge

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 11 : Bridge.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.6;

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";

import "./IBridgeSwap.sol";
import "./Trustable.sol";

contract Bridge is Trustable {
    using EnumerableSet for EnumerableSet.UintSet;
    using SafeERC20 for ERC20;

    struct Order {
        uint id;
        uint8 tokenId;
        address sender;
        bytes32 target;
        uint amount;
        uint feeAmount;
        uint8 decimals;
        uint8 destination;
        address tokenIn;
        bytes32 tokenOut;
    }

    struct Token {
        ERC20 token;
        address feeTarget;
        uint16 defaultFee;
        uint defaultFeeBase;
        uint defaultMinAmount;
        uint defaultMaxAmount;
        uint bonus;
    }

    struct Config {
        uint16 fee;
        uint feeBase;
        uint minAmount;
        uint maxAmount;
        bool directTransferAllowed;
    }

    struct CompleteParams {
        uint orderId;
        uint8 dstFrom;
        uint8 tokenId;
        address payable to;
        uint amount;
        uint decimals;
        ERC20 tokenOut;
        address[] swapPath;
    }

    event OrderCreated(uint indexed id, Order order);
    event OrderCompleted(uint indexed id, uint8 indexed dstFrom);

    uint nextOrderId = 0;
    uint8 tokensLength = 0;
    uint8 nativeTokenId = 255;

    // swap settings
    IBridgeSwap public swapper;
    bool public swapsAllowed = false;
    uint8 public swapDefaultTokenId = 0;

    mapping (uint8 => Token) public tokens;
    mapping (address => uint8) public addresses;
    mapping (uint8 => mapping (uint8 => Config)) public configs;
    mapping (uint => Order) public orders;
    EnumerableSet.UintSet private orderIds;
    mapping (bytes32 => bool) public completed;

    function setToken(
        uint8 tokenId,
        ERC20 token,
        address feeTarget,
        uint16 defaultFee,
        uint defaultFeeBase,
        uint defaultMinAmount,
        uint defaultMaxAmount,
        uint8 inputDecimals,
        uint bonus
    ) external onlyOwner {
        require(defaultFee <= 10000, "invalid fee");
        tokens[tokenId] = Token(
            token,
            feeTarget,
            defaultFee,
            convertAmount(token, defaultFeeBase, inputDecimals),
            convertAmount(token, defaultMinAmount, inputDecimals),
            convertAmount(token, defaultMaxAmount, inputDecimals),
            bonus
        );
        addresses[address(token)] = tokenId;

        if (tokenId + 1 > tokensLength) {
            tokensLength = tokenId + 1;
        }
    }

    function setFeeTarget(uint8 tokenId, address feeTarget) external onlyOwner {
        tokens[tokenId].feeTarget = feeTarget;
    }

    function setDefaultFee(uint8 tokenId, uint16 defaultFee) external onlyOwner {
        require(defaultFee <= 10000, "invalid fee");
        tokens[tokenId].defaultFee = defaultFee;
    }

    function setDefaultFeeBase(uint8 tokenId, uint defaultFeeBase, uint8 inputDecimals) external onlyOwner {
        tokens[tokenId].defaultFeeBase = convertAmount(tokens[tokenId].token, defaultFeeBase, inputDecimals);
    }

    function setDefaultMinAmount(uint8 tokenId, uint defaultMinAmount, uint8 inputDecimals) external onlyOwner {
        tokens[tokenId].defaultMinAmount = convertAmount(tokens[tokenId].token, defaultMinAmount, inputDecimals);
    }

    function setDefaultMaxAmount(uint8 tokenId, uint defaultMaxAmount, uint8 inputDecimals) external onlyOwner {
        tokens[tokenId].defaultMaxAmount = convertAmount(tokens[tokenId].token, defaultMaxAmount, inputDecimals);
    }

    function setBonus(uint8 tokenId, uint bonus) external onlyOwner {
        tokens[tokenId].bonus = bonus;
    }

    function setFee(uint8 tokenId, uint8 destination, uint16 fee) external onlyOwner {
        require(fee <= 10000, "invalid fee");
        configs[tokenId][destination].fee = fee;
    }

    function setFeeBase(uint8 tokenId, uint8 destination, uint feeBase, uint8 inputDecimals) external onlyOwner {
        configs[tokenId][destination].feeBase = convertAmount(tokens[tokenId].token, feeBase, inputDecimals);
    }

    function setMinAmount(uint8 tokenId, uint8 destination, uint minAmount, uint8 inputDecimals) external onlyOwner {
        configs[tokenId][destination].minAmount = convertAmount(tokens[tokenId].token, minAmount, inputDecimals);
    }

    function setMaxAmount(uint8 tokenId, uint8 destination, uint maxAmount, uint8 inputDecimals) external onlyOwner {
        configs[tokenId][destination].maxAmount = convertAmount(tokens[tokenId].token, maxAmount, inputDecimals);
    }

    function setDirectTransferAllowed(uint8 tokenId, uint8 destination, bool directTransferAllowed) external onlyOwner {
        configs[tokenId][destination].directTransferAllowed = directTransferAllowed;
    }

    function setConfig(uint8 tokenId, uint8 destination, Config calldata config) external onlyOwner {
        configs[tokenId][destination] = config;
    }

    function setSwapper(IBridgeSwap newSwapper) external onlyOwner {
        swapper = newSwapper;
    }

    function setSwapSettings(bool allowed, uint8 tokenId) external onlyOwner {
        swapsAllowed = allowed;
        swapDefaultTokenId = tokenId;
    }

    function createWithSwap(
        ERC20 tokenIn,
        uint amount,
        uint8 destination,
        bytes32 target,
        bytes32 tokenOut,
        address[] calldata swapPath
    ) external payable {
        require(swapsAllowed && address(swapper) != address(0), "swaps currently disabled");

        // collect user tokens
        if (address(tokenIn) == address(1)) {
            require (amount == msg.value, "native token amount must be equal amount parameter");
        } else {
            tokenIn.safeTransferFrom(msg.sender, address(this), amount);
        }

        // default transfer token
        uint8 tokenId = swapDefaultTokenId;

        // checking for direct transfer allowed
        uint8 tokenInId = addresses[address(tokenIn)];
        if (tokens[tokenInId].token == tokenIn && configs[tokenInId][destination].directTransferAllowed) {
            tokenId = tokenInId;
        }

        // transfer token
        Token memory tok = tokens[tokenId];

        // swap user tokens if need
        if (tok.token != tokenIn) {
            if (address(tokenIn) == address(1)) {
                amount = swapper.swapFromNative{ value: amount }(tok.token, address(this), swapPath);
            } else {
                tokenIn.approve(address(swapper), amount);
                amount = swapper.swap(tokenIn, amount, tok.token, address(this), swapPath);
            }
        }

        require(checkAmount(tokenId, destination, amount), "amount must be in allowed range");

        uint feeAmount = transferFee(tokenId, destination, amount);

        orders[nextOrderId] = Order(
            nextOrderId,
            tokenId,
            msg.sender,
            target,
            amount - feeAmount,
            feeAmount,
            tokenDecimals(tok.token),
            destination,
            address(tokenIn),
            tokenOut
        );
        orderIds.add(nextOrderId);

        emit OrderCreated(nextOrderId, orders[nextOrderId]);
        nextOrderId++;
    }

    function create(uint8 tokenId, uint amount, uint8 destination, bytes32 target) public payable {
        Token storage tok = tokens[tokenId];
        require(address(tok.token) != address(0), "unknown token");

        require(checkAmount(tokenId, destination, amount), "amount must be in allowed range");

        if (address(tok.token) == address(1)) {
            require (amount == msg.value, "native token amount must be equal amount parameter");
        } else {
            tok.token.safeTransferFrom(msg.sender, address(this), amount);
        }

        uint feeAmount = transferFee(tokenId, destination, amount);

        orders[nextOrderId] = Order(
            nextOrderId,
            tokenId,
            msg.sender,
            target,
            amount - feeAmount,
            feeAmount,
            tokenDecimals(tok.token),
            destination,
            address(0),
            bytes32(0)
        );
        orderIds.add(nextOrderId);

        emit OrderCreated(nextOrderId, orders[nextOrderId]);
        nextOrderId++;
    }

    function closeOrder(uint orderId) external onlyTrusted {
        orderIds.remove(orderId);
    }

    function closeManyOrders(uint[] calldata _orderIds) external onlyTrusted {
        for (uint i = 0; i < _orderIds.length; i++) {
            orderIds.remove(_orderIds[i]);
        }
    }

    function completeOrder(
        uint orderId,
        uint8 dstFrom,
        uint8 tokenId,
        address payable to,
        uint amount,
        uint decimals,
        ERC20 tokenOut,
        address[] calldata swapPath
    ) public onlyTrusted {
        bytes32 orderHash = keccak256(abi.encodePacked(orderId, dstFrom));
        require (completed[orderHash] == false, "already transfered");
        require (!Address.isContract(to), "contract targets not supported");

        Token storage tok = tokens[tokenId];
        require(address(tok.token) != address(0), "unknown token");

        amount = convertAmount(tok.token, amount, decimals);

        if (address(tokenOut) != address(0) && tok.token != tokenOut) {
            tok.token.approve(address(swapper), amount);
            if (address(tokenOut) == address(1)) {
                swapper.swapToNative(tok.token, amount, to, swapPath);
            } else {
                swapper.swap(tok.token, amount, tokenOut, to, swapPath);
            }
        } else if (address(tok.token) == address(1)) {
            to.transfer(amount);
        } else {
            tok.token.safeTransfer(to, amount);
        }

        completed[orderHash] = true;

        uint bonus = Math.min(tok.bonus, address(this).balance);
        if (bonus > 0) {
            to.transfer(bonus);
        }

        emit OrderCompleted(orderId, dstFrom);
    }

    function completeManyOrders(CompleteParams[] calldata params) external onlyTrusted {
        for (uint i = 0; i < params.length; i++) {
            completeOrder(
                params[i].orderId,
                params[i].dstFrom,
                params[i].tokenId,
                params[i].to,
                params[i].amount,
                params[i].decimals,
                params[i].tokenOut,
                params[i].swapPath
            );
        }
    }

    function withdraw(uint8 tokenId, address payable to, uint amount, uint8 inputDecimals) external onlyTrusted {
        Token storage tok = tokens[tokenId];

        if (address(tok.token) == address(1)) {
            to.transfer(convertAmount(tok.token, amount, inputDecimals));
        } else {
            tok.token.safeTransfer(to, convertAmount(tok.token, amount, inputDecimals));
        }
    }

    function withdrawToken(ERC20 token, address payable to, uint amount, uint8 inputDecimals) external onlyTrusted {
        if (address(token) == address(1)) {
            to.transfer(convertAmount(token, amount, inputDecimals));
        } else {
            token.safeTransfer(to, convertAmount(token, amount, inputDecimals));
        }
    }

    function isCompleted(uint orderId, uint8 dstFrom) external view returns (bool) {
        return completed[keccak256(abi.encodePacked(orderId, dstFrom))];
    }

    function listOrders() external view returns (Order[] memory) {
        Order[] memory list = new Order[](orderIds.length());
        for (uint i = 0; i < orderIds.length(); i++) {
            list[i] = orders[orderIds.at(i)];
        }

        return list;
    }

    function listTokensNames() external view returns (string[] memory) {
        string[] memory list = new string[](tokensLength);
        for (uint8 i = 0; i < tokensLength; i++) {
            if (address(tokens[i].token) != address(0)) {
                list[i] = tokens[i].token.symbol();
            }
        }

        return list;
    }

    receive() external payable {}

    function convertAmount(ERC20 token, uint amount, uint fromDecimals) view private returns (uint) {
        return amount * (10 ** tokenDecimals(token)) / (10 ** fromDecimals);
    }

    function tokenDecimals(ERC20 token) private view returns (uint8) {
        if (address(token) == address(1)) {
            return 18;
        } else {
            return token.decimals();
        }
    }

    function checkAmount(uint8 tokenId, uint8 destination, uint amount) private view returns (bool) {
        Token memory tok = tokens[tokenId];
        Config memory config = configs[tokenId][destination];

        uint min = tok.defaultMinAmount;
        uint max = tok.defaultMaxAmount;

        if (config.minAmount > 0) {
            min = config.minAmount;
        }
        if (config.maxAmount > 0) {
            max = config.maxAmount;
        }

        return amount >= min && amount <= max;
    }

    function transferFee(uint8 tokenId, uint8 destination, uint amount) private returns (uint feeAmount) {
        Token memory tok = tokens[tokenId];
        Config memory config = configs[tokenId][destination];

        uint fee = tok.defaultFee;
        uint feeBase = tok.defaultFeeBase;

        if (config.fee > 0) {
            fee = config.fee;
        }
        if (config.feeBase > 0) {
            feeBase = config.feeBase;
        }

        feeAmount = feeBase + amount * fee / 10000;
        if (feeAmount > 0 && tok.feeTarget != address(this)) {
            tok.token.safeTransfer(tok.feeTarget, feeAmount);
        }
    }
}

File 2 of 11 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

        uint256 size;
        // 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.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

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

        // 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 3 of 11 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The defaut value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overloaded;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        _approve(sender, _msgSender(), currentAllowance - amount);

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        _approve(_msgSender(), spender, currentAllowance - subtractedValue);

        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        _balances[sender] = senderBalance - amount;
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

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

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);
    }

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

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

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

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

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

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

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}

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

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // 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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

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

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

File 5 of 11 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

File 6 of 11 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

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

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

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

pragma solidity ^0.8.6;

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

interface IBridgeSwap {

    function swap(
        IERC20 tokenIn,
        uint amount,
        IERC20 tokenOut,
        address to,
        address[] calldata swapPath
    ) external returns (uint out);

    function swapToNative(
        IERC20 tokenIn,
        uint amount,
        address payable to,
        address[] calldata swapPath
    ) external returns (uint out);

    function swapFromNative(
        IERC20 tokenOut,
        address to,
        address[] calldata swapPath
    ) external payable returns (uint out);

}

File 8 of 11 : Trustable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";

abstract contract Trustable is Ownable {
    mapping(address=>bool) public trusted;

    modifier onlyTrusted {
        require(trusted[msg.sender] || msg.sender == owner(), "not trusted");
        _;
    }

    function setTrusted(address user, bool isTrusted) public onlyOwner {
        trusted[user] = isTrusted;
    }
}

File 9 of 11 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 10 of 11 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () {
        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;
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint8","name":"dstFrom","type":"uint8"}],"name":"OrderCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"bytes32","name":"target","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"bytes32","name":"tokenOut","type":"bytes32"}],"indexed":false,"internalType":"struct Bridge.Order","name":"order","type":"tuple"}],"name":"OrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"addresses","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_orderIds","type":"uint256[]"}],"name":"closeManyOrders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"}],"name":"closeOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"uint8","name":"dstFrom","type":"uint8"},{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"decimals","type":"uint256"},{"internalType":"contract ERC20","name":"tokenOut","type":"address"},{"internalType":"address[]","name":"swapPath","type":"address[]"}],"internalType":"struct Bridge.CompleteParams[]","name":"params","type":"tuple[]"}],"name":"completeManyOrders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"uint8","name":"dstFrom","type":"uint8"},{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"decimals","type":"uint256"},{"internalType":"contract ERC20","name":"tokenOut","type":"address"},{"internalType":"address[]","name":"swapPath","type":"address[]"}],"name":"completeOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"completed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"uint8","name":"","type":"uint8"}],"name":"configs","outputs":[{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"uint256","name":"feeBase","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"bool","name":"directTransferAllowed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"destination","type":"uint8"},{"internalType":"bytes32","name":"target","type":"bytes32"}],"name":"create","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"destination","type":"uint8"},{"internalType":"bytes32","name":"target","type":"bytes32"},{"internalType":"bytes32","name":"tokenOut","type":"bytes32"},{"internalType":"address[]","name":"swapPath","type":"address[]"}],"name":"createWithSwap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"uint8","name":"dstFrom","type":"uint8"}],"name":"isCompleted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"listOrders","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"bytes32","name":"target","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"bytes32","name":"tokenOut","type":"bytes32"}],"internalType":"struct Bridge.Order[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"listTokensNames","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"orders","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"bytes32","name":"target","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"bytes32","name":"tokenOut","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint256","name":"bonus","type":"uint256"}],"name":"setBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"},{"components":[{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"uint256","name":"feeBase","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"bool","name":"directTransferAllowed","type":"bool"}],"internalType":"struct Bridge.Config","name":"config","type":"tuple"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint16","name":"defaultFee","type":"uint16"}],"name":"setDefaultFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint256","name":"defaultFeeBase","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"setDefaultFeeBase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint256","name":"defaultMaxAmount","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"setDefaultMaxAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint256","name":"defaultMinAmount","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"setDefaultMinAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"},{"internalType":"bool","name":"directTransferAllowed","type":"bool"}],"name":"setDirectTransferAllowed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"},{"internalType":"uint16","name":"fee","type":"uint16"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"},{"internalType":"uint256","name":"feeBase","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"setFeeBase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"address","name":"feeTarget","type":"address"}],"name":"setFeeTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"setMaxAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"setMinAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"allowed","type":"bool"},{"internalType":"uint8","name":"tokenId","type":"uint8"}],"name":"setSwapSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBridgeSwap","name":"newSwapper","type":"address"}],"name":"setSwapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"contract ERC20","name":"token","type":"address"},{"internalType":"address","name":"feeTarget","type":"address"},{"internalType":"uint16","name":"defaultFee","type":"uint16"},{"internalType":"uint256","name":"defaultFeeBase","type":"uint256"},{"internalType":"uint256","name":"defaultMinAmount","type":"uint256"},{"internalType":"uint256","name":"defaultMaxAmount","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"},{"internalType":"uint256","name":"bonus","type":"uint256"}],"name":"setToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bool","name":"isTrusted","type":"bool"}],"name":"setTrusted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapDefaultTokenId","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapper","outputs":[{"internalType":"contract IBridgeSwap","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapsAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"tokens","outputs":[{"internalType":"contract ERC20","name":"token","type":"address"},{"internalType":"address","name":"feeTarget","type":"address"},{"internalType":"uint16","name":"defaultFee","type":"uint16"},{"internalType":"uint256","name":"defaultFeeBase","type":"uint256"},{"internalType":"uint256","name":"defaultMinAmount","type":"uint256"},{"internalType":"uint256","name":"defaultMaxAmount","type":"uint256"},{"internalType":"uint256","name":"bonus","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"trusted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"token","type":"address"},{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405260006002556003805461ffff61ffff60b01b01191661ff0017905534801561002b57600080fd5b50600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350613f258061007c6000396000f3fe6080604052600436106102345760003560e01c80636e9821c21161012e5780639b7e76c1116100ab578063ecf34cbf1161006f578063ecf34cbf14610881578063f2fde38b146108a1578063f32a12ac146108c1578063f6419d96146108e1578063fe3387161461091157600080fd5b80639b7e76c1146106bd5780639c82f2a4146106dd578063a85c38ef146106fd578063bbaed29d146107d5578063ecbbd497146107f557600080fd5b806382d38954116100f257806382d38954146105895780638856c0d6146105b95780638a91497b1461066c5780638da5cb5b1461067f57806398f554261461069d57600080fd5b80636e9821c2146104d15780636f1815de14610501578063715018a61461052157806373d2498014610536578063766a1c661461056957600080fd5b806327e021e8116101bc578063594cd10511610180578063594cd1051461043d5780635cd951081461045d57806362cf39ab1461047057806363abf1d2146104915780636db35e8d146104b157600080fd5b806327e021e81461036f5780632b3297f91461039f5780633afbb588146103dd57806348e97896146103fd578063583301081461041d57600080fd5b8063176091f411610203578063176091f4146102c257806320b53cc6146102ed57806323bda3061461030d57806323c689191461032d578063277b08b41461034d57600080fd5b8063069d6d1c146102405780630c67766d146102625780630e926e6d1461028257806312394191146102a257600080fd5b3661023b57005b600080fd5b34801561024c57600080fd5b5061026061025b366004613222565b610931565b005b34801561026e57600080fd5b5061026061027d366004613195565b61098d565b34801561028e57600080fd5b5061026061029d3660046131f4565b610b71565b3480156102ae57600080fd5b506102606102bd366004613195565b610bd2565b3480156102ce57600080fd5b506102d7610c60565b6040516102e491906138bc565b60405180910390f35b3480156102f957600080fd5b50610260610308366004613798565b610dff565b34801561031957600080fd5b5061026061032836600461323b565b610e85565b34801561033957600080fd5b5061026061034836600461361d565b610f4d565b34801561035957600080fd5b50610362610fc2565b6040516102e4919061385a565b34801561037b57600080fd5b5061038f61038a3660046133cf565b611111565b60405190151581526020016102e4565b3480156103ab57600080fd5b506003546103c5906201000090046001600160a01b031681565b6040516001600160a01b0390911681526020016102e4565b3480156103e957600080fd5b506102606103f83660046135f1565b611172565b34801561040957600080fd5b5061026061041836600461361d565b6111b5565b34801561042957600080fd5b5061026061043836600461350a565b61122a565b34801561044957600080fd5b506102606104583660046135c3565b61131a565b61026061046b36600461365f565b6113a0565b34801561047c57600080fd5b5060035461038f90600160b01b900460ff1681565b34801561049d57600080fd5b506102606104ac3660046134dc565b611664565b3480156104bd57600080fd5b506102606104cc366004613798565b6116c4565b3480156104dd57600080fd5b5061038f6104ec36600461313f565b60016020526000908152604090205460ff1681565b34801561050d57600080fd5b5061026061051c366004613758565b61174a565b34801561052d57600080fd5b506102606117d2565b34801561054257600080fd5b5060035461055790600160b81b900460ff1681565b60405160ff90911681526020016102e4565b34801561057557600080fd5b50610260610584366004613705565b611846565b34801561059557600080fd5b506105576105a436600461313f565b60056020526000908152604090205460ff1681565b3480156105c557600080fd5b506106236105d43660046134a2565b60046020819052600091825260409091208054600182015460028301546003840154948401546005909401546001600160a01b039384169593831694600160a01b90930461ffff169391929087565b604080516001600160a01b03988916815297909616602088015261ffff909416948601949094526060850191909152608084015260a083019190915260c082015260e0016102e4565b61026061067a36600461328e565b61189b565b34801561068b57600080fd5b506000546001600160a01b03166103c5565b3480156106a957600080fd5b506102606106b83660046136c5565b611e84565b3480156106c957600080fd5b506102606106d836600461352b565b611ee5565b3480156106e957600080fd5b506102606106f836600461313f565b6120f8565b34801561070957600080fd5b50610777610718366004613222565b6007602052600090815260409020805460018201546002830154600384015460048501546005860154600690960154949560ff808616966001600160a01b0361010097889004811697848416949081049093169262010000900416908a565b604080519a8b5260ff998a1660208c01526001600160a01b03988916908b015260608a0196909652608089019490945260a0880192909252851660c087015290931660e08501529116610100830152610120820152610140016102e4565b3480156107e157600080fd5b506102606107f03660046133f4565b61214c565b34801561080157600080fd5b506108526108103660046136a7565b60066020908152600092835260408084209091529082529020805460018201546002830154600384015460049094015461ffff90931693919290919060ff1685565b6040805161ffff909616865260208601949094529284019190915260608301521515608082015260a0016102e4565b34801561088d57600080fd5b5061026061089c366004613798565b612593565b3480156108ad57600080fd5b506102606108bc36600461313f565b612619565b3480156108cd57600080fd5b506102606108dc36600461315c565b612703565b3480156108ed57600080fd5b5061038f6108fc366004613222565b600a6020526000908152604090205460ff1681565b34801561091d57600080fd5b5061026061092c36600461361d565b612758565b3360009081526001602052604090205460ff168061095957506000546001600160a01b031633145b61097e5760405162461bcd60e51b815260040161097590613a34565b60405180910390fd5b6109896008826127ce565b5050565b3360009081526001602052604090205460ff16806109b557506000546001600160a01b031633145b6109d15760405162461bcd60e51b815260040161097590613a34565b60005b81811015610b6c57610b5a8383838181106109f1576109f1613e1d565b9050602002810190610a039190613be4565b35848484818110610a1657610a16613e1d565b9050602002810190610a289190613be4565b610a399060408101906020016134a2565b858585818110610a4b57610a4b613e1d565b9050602002810190610a5d9190613be4565b610a6e9060608101906040016134a2565b868686818110610a8057610a80613e1d565b9050602002810190610a929190613be4565b610aa390608081019060600161313f565b878787818110610ab557610ab5613e1d565b9050602002810190610ac79190613be4565b60800135888888818110610add57610add613e1d565b9050602002810190610aef9190613be4565b60a00135898989818110610b0557610b05613e1d565b9050602002810190610b179190613be4565b610b289060e081019060c00161313f565b8a8a8a818110610b3a57610b3a613e1d565b9050602002810190610b4c9190613be4565b6107f09060e0810190613b9a565b80610b6481613db6565b9150506109d4565b505050565b6000546001600160a01b03163314610b9b5760405162461bcd60e51b815260040161097590613a7e565b6003805461ffff60b01b1916600160b01b9315159390930260ff60b81b191692909217600160b81b60ff9290921691909102179055565b3360009081526001602052604090205460ff1680610bfa57506000546001600160a01b031633145b610c165760405162461bcd60e51b815260040161097590613a34565b60005b81811015610b6c57610c4d838383818110610c3657610c36613e1d565b9050602002013560086127ce90919063ffffffff16565b5080610c5881613db6565b915050610c19565b60606000610c6e60086127e1565b67ffffffffffffffff811115610c8657610c86613e33565b604051908082528060200260200182016040528015610d0557816020015b604080516101408101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e0820181905261010082018190526101208201528252600019909201910181610ca45790505b50905060005b610d1560086127e1565b811015610df95760076000610d2b6008846127eb565b8152602080820192909252604090810160002081516101408101835281548152600182015460ff808216958301959095526001600160a01b03610100918290048116948301949094526002830154606083015260038301546080830152600483015460a0830152600583015480861660c084015281810490951660e083015262010000909404909216928201929092526006909101546101208201528251839083908110610ddb57610ddb613e1d565b60200260200101819052508080610df190613db6565b915050610d0b565b50919050565b6000546001600160a01b03163314610e295760405162461bcd60e51b815260040161097590613a7e565b60ff808516600090815260046020526040902054610e56916001600160a01b0390911690849084166127f7565b60ff94851660009081526006602090815260408083209690971682529490945293909220600301929092555050565b3360009081526001602052604090205460ff1680610ead57506000546001600160a01b031633145b610ec95760405162461bcd60e51b815260040161097590613a34565b6001600160a01b03841660011415610f2457826001600160a01b03166108fc610ef686858560ff166127f7565b6040518115909202916000818181858888f19350505050158015610f1e573d6000803e3d6000fd5b50610f47565b610f4783610f3686858560ff166127f7565b6001600160a01b0387169190612834565b50505050565b6000546001600160a01b03163314610f775760405162461bcd60e51b815260040161097590613a7e565b60ff808416600090815260046020526040902054610fa4916001600160a01b0390911690849084166127f7565b60ff9093166000908152600460205260409020600301929092555050565b60035460609060009060ff1667ffffffffffffffff811115610fe657610fe6613e33565b60405190808252806020026020018201604052801561101957816020015b60608152602001906001900390816110045790505b50905060005b60035460ff9081169082161015610df95760ff81166000908152600460205260409020546001600160a01b0316156110ff5760ff811660009081526004602081905260408083205481516395d89b4160e01b815291516001600160a01b03909116936395d89b419383810193919291829003018186803b1580156110a257600080fd5b505afa1580156110b6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110de9190810190613314565b828260ff16815181106110f3576110f3613e1d565b60200260200101819052505b8061110981613dd1565b91505061101f565b6000600a6000848460405160200161114092919091825260f81b6001600160f81b031916602082015260210190565b60408051601f198184030181529181528151602092830120835290820192909252016000205460ff1690505b92915050565b6000546001600160a01b0316331461119c5760405162461bcd60e51b815260040161097590613a7e565b60ff909116600090815260046020526040902060050155565b6000546001600160a01b031633146111df5760405162461bcd60e51b815260040161097590613a7e565b60ff80841660009081526004602052604090205461120c916001600160a01b0390911690849084166127f7565b60ff9093166000908152600460205260409020600201929092555050565b3360009081526001602052604090205460ff168061125257506000546001600160a01b031633145b61126e5760405162461bcd60e51b815260040161097590613a34565b60ff8416600090815260046020526040902080546001600160a01b0316600114156112e25780546001600160a01b03808616916108fc916112b491168660ff87166127f7565b6040518115909202916000818181858888f193505050501580156112dc573d6000803e3d6000fd5b50611313565b8054611313908590611301906001600160a01b03168660ff87166127f7565b83546001600160a01b03169190612834565b5050505050565b6000546001600160a01b031633146113445760405162461bcd60e51b815260040161097590613a7e565b6127108161ffff16111561136a5760405162461bcd60e51b815260040161097590613a59565b60ff9091166000908152600460205260409020600101805461ffff909216600160a01b0261ffff60a01b19909216919091179055565b60ff8416600090815260046020526040902080546001600160a01b03166113f95760405162461bcd60e51b815260206004820152600d60248201526c3ab735b737bbb7103a37b5b2b760991b6044820152606401610975565b611404858486612897565b6114505760405162461bcd60e51b815260206004820152601f60248201527f616d6f756e74206d75737420626520696e20616c6c6f7765642072616e6765006044820152606401610975565b80546001600160a01b031660011415611487573484146114825760405162461bcd60e51b815260040161097590613ab3565b61149e565b805461149e906001600160a01b0316333087612a52565b60006114ab868587612a8a565b905060405180610140016040528060025481526020018760ff168152602001336001600160a01b0316815260200184815260200182876114eb9190613d73565b815260208101839052835460409091019061150e906001600160a01b0316612c9f565b60ff908116825286811660208084019190915260006040808501829052606094850182905260028054835260078452918190208651815592860151600184018054928801516001600160a01b039081166101009081026001600160a81b03199095169388169390931793909317905594860151838301556080860151600384015560a0860151600484015560c086015160058401805460e0890151888a0151909416620100000262010000600160b01b031994881690980261ffff19909116929096169190911794909417169390931790915561012090920151600690920191909155546115fe90600890612d2c565b506002546000818152600760205260409081902090517f222cd2efea00866c545bed597165587aac41b8666a50ac9b1880e7513900e0889161163f91613b05565b60405180910390a26002805490600061165783613db6565b9190505550505050505050565b6000546001600160a01b0316331461168e5760405162461bcd60e51b815260040161097590613a7e565b60ff91909116600090815260046020526040902060010180546001600160a01b0319166001600160a01b03909216919091179055565b6000546001600160a01b031633146116ee5760405162461bcd60e51b815260040161097590613a7e565b60ff80851660009081526004602052604090205461171b916001600160a01b0390911690849084166127f7565b60ff94851660009081526006602090815260408083209690971682529490945293909220600201929092555050565b6000546001600160a01b031633146117745760405162461bcd60e51b815260040161097590613a7e565b6127108161ffff16111561179a5760405162461bcd60e51b815260040161097590613a59565b60ff928316600090815260066020908152604080832094909516825292909252919020805461ffff191661ffff909216919091179055565b6000546001600160a01b031633146117fc5760405162461bcd60e51b815260040161097590613a7e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146118705760405162461bcd60e51b815260040161097590613a7e565b60ff808416600090815260066020908152604080832093861683529290522081906113138282613e49565b600354600160b01b900460ff1680156118c457506003546201000090046001600160a01b031615155b6119105760405162461bcd60e51b815260206004820152601860248201527f73776170732063757272656e746c792064697361626c656400000000000000006044820152606401610975565b6001600160a01b03871660011415611946573486146119415760405162461bcd60e51b815260040161097590613ab3565b61195b565b61195b6001600160a01b038816333089612a52565b6003546001600160a01b0388811660008181526005602090815260408083205460ff9081168085526004909352922054600160b81b909504909116939092161480156119c8575060ff80821660009081526006602090815260408083208b85168452909152902060040154165b156119d1578091505b60ff8216600090815260046020818152604092839020835160e08101855281546001600160a01b03908116808352600184015480831695840195909552600160a01b90940461ffff169582019590955260028201546060820152600382015460808201529281015460a08401526005015460c083015290918b1614611c1a576001600160a01b038a1660011415611af957600354815160405163aeb3baab60e01b8152620100009092046001600160a01b03169163aeb3baab918c91611aa0919030908b908b9060040161397a565b6020604051808303818588803b158015611ab957600080fd5b505af1158015611acd573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611af291906133b6565b9850611c1a565b60035460405163095ea7b360e01b8152620100009091046001600160a01b039081166004830152602482018b90528b169063095ea7b390604401602060405180830381600087803b158015611b4d57600080fd5b505af1158015611b61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8591906131d7565b50600354815160405163eecad21960e01b8152620100009092046001600160a01b03169163eecad21991611bc5918e918e9130908c908c906004016139e5565b602060405180830381600087803b158015611bdf57600080fd5b505af1158015611bf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c1791906133b6565b98505b611c2583898b612897565b611c715760405162461bcd60e51b815260206004820152601f60248201527f616d6f756e74206d75737420626520696e20616c6c6f7765642072616e6765006044820152606401610975565b6000611c7e848a8c612a8a565b905060405180610140016040528060025481526020018560ff168152602001336001600160a01b03168152602001898152602001828c611cbe9190613d73565b8152602001828152602001611cd68460000151612c9f565b60ff1681526020018a60ff1681526020018c6001600160a01b03168152602001888152506007600060025481526020019081526020016000206000820151816000015560208201518160010160006101000a81548160ff021916908360ff16021790555060408201518160010160016101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600201556080820151816003015560a0820151816004015560c08201518160050160006101000a81548160ff021916908360ff16021790555060e08201518160050160016101000a81548160ff021916908360ff1602179055506101008201518160050160026101000a8154816001600160a01b0302191690836001600160a01b031602179055506101208201518160060155905050611e196002546008612d2c90919063ffffffff16565b506002546000818152600760205260409081902090517f222cd2efea00866c545bed597165587aac41b8666a50ac9b1880e7513900e08891611e5a91613b05565b60405180910390a260028054906000611e7283613db6565b91905055505050505050505050505050565b6000546001600160a01b03163314611eae5760405162461bcd60e51b815260040161097590613a7e565b60ff928316600090815260066020908152604080832094909516825292909252919020600401805460ff1916911515919091179055565b6000546001600160a01b03163314611f0f5760405162461bcd60e51b815260040161097590613a7e565b6127108661ffff161115611f355760405162461bcd60e51b815260040161097590613a59565b6040518060e00160405280896001600160a01b03168152602001886001600160a01b031681526020018761ffff168152602001611f768a888660ff166127f7565b8152602001611f898a878660ff166127f7565b8152602001611f9c8a868660ff166127f7565b815260200182815250600460008b60ff1660ff16815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160146101000a81548161ffff021916908361ffff160217905550606082015181600201556080820151816003015560a0820151816004015560c0820151816005015590505088600560008a6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908360ff160217905550600360009054906101000a900460ff1660ff168960016120c49190613c12565b60ff1611156120ed576120d8896001613c12565b6003805460ff191660ff929092169190911790555b505050505050505050565b6000546001600160a01b031633146121225760405162461bcd60e51b815260040161097590613a7e565b600380546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b3360009081526001602052604090205460ff168061217457506000546001600160a01b031633145b6121905760405162461bcd60e51b815260040161097590613a34565b600089896040516020016121bb92919091825260f81b6001600160f81b031916602082015260210190565b60408051601f1981840301815291815281516020928301206000818152600a90935291205490915060ff16156122285760405162461bcd60e51b8152602060048201526012602482015271185b1c9958591e481d1c985b9cd9995c995960721b6044820152606401610975565b863b156122775760405162461bcd60e51b815260206004820152601e60248201527f636f6e74726163742074617267657473206e6f7420737570706f7274656400006044820152606401610975565b60ff8816600090815260046020526040902080546001600160a01b03166122d05760405162461bcd60e51b815260206004820152600d60248201526c3ab735b737bbb7103a37b5b2b760991b6044820152606401610975565b80546122e6906001600160a01b031688886127f7565b96506001600160a01b0385161580159061230d575080546001600160a01b03868116911614155b1561248e57805460035460405163095ea7b360e01b81526001600160a01b036201000090920482166004820152602481018a905291169063095ea7b390604401602060405180830381600087803b15801561236757600080fd5b505af115801561237b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239f91906131d7565b506001600160a01b0385166001141561244b5760035481546040516370071feb60e11b81526001600160a01b036201000090930483169263e00e3fd6926123f3929116908b908d908a908a906004016139b1565b602060405180830381600087803b15801561240d57600080fd5b505af1158015612421573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244591906133b6565b506124ed565b600354815460405163eecad21960e01b81526001600160a01b036201000090930483169263eecad219926123f3929116908b908a908e908b908b906004016139e5565b80546001600160a01b0316600114156124d7576040516001600160a01b0389169088156108fc029089906000818181858888f19350505050158015612445573d6000803e3d6000fd5b80546124ed906001600160a01b03168989612834565b6000828152600a60205260408120805460ff1916600117905560058201546125159047612d38565b90508015612555576040516001600160a01b038a169082156108fc029083906000818181858888f19350505050158015612553573d6000803e3d6000fd5b505b60405160ff8c16908d907f2bd2d9c5f8a1215c53d8d1e6eeed2a5edde1be47f27f9d43e053043628ecb31f90600090a3505050505050505050505050565b6000546001600160a01b031633146125bd5760405162461bcd60e51b815260040161097590613a7e565b60ff8085166000908152600460205260409020546125ea916001600160a01b0390911690849084166127f7565b60ff94851660009081526006602090815260408083209690971682529490945293909220600101929092555050565b6000546001600160a01b031633146126435760405162461bcd60e51b815260040161097590613a7e565b6001600160a01b0381166126a85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610975565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461272d5760405162461bcd60e51b815260040161097590613a7e565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146127825760405162461bcd60e51b815260040161097590613a7e565b60ff8084166000908152600460205260409020546127af916001600160a01b0390911690849084166127f7565b60ff909316600090815260046020819052604090912001929092555050565b60006127da8383612d4e565b9392505050565b600061116c825490565b60006127da8383612e41565b600061280482600a613c9c565b61280d85612c9f565b61281890600a613ca8565b6128229085613d54565b61282c9190613c37565b949350505050565b6040516001600160a01b038316602482015260448101829052610b6c90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612ec7565b600080600460008660ff1660ff1681526020019081526020016000206040518060e00160405290816000820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820160149054906101000a900461ffff1661ffff1661ffff16815260200160028201548152602001600382015481526020016004820154815260200160058201548152505090506000600660008760ff1660ff16815260200190815260200160002060008660ff1660ff1681526020019081526020016000206040518060a00160405290816000820160009054906101000a900461ffff1661ffff1661ffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff161515151581525050905060008260800151905060008360a001519050600083604001511115612a2557826040015191505b606083015115612a36575060608201515b818610158015612a465750808611155b98975050505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610f479085906323b872dd60e01b90608401612860565b600080600460008660ff1660ff1681526020019081526020016000206040518060e00160405290816000820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820160149054906101000a900461ffff1661ffff1661ffff16815260200160028201548152602001600382015481526020016004820154815260200160058201548152505090506000600660008760ff1660ff16815260200190815260200160002060008660ff1660ff1681526020019081526020016000206040518060a00160405290816000820160009054906101000a900461ffff1661ffff1661ffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff16151515158152505090506000826040015161ffff1690506000836060015190506000836000015161ffff161115612c2157825161ffff1691505b602083015115612c32575060208201515b612710612c3f8388613d54565b612c499190613c37565b612c539082613bfa565b9450600085118015612c72575060208401516001600160a01b03163014155b15612c945760208401518451612c94916001600160a01b039091169087612834565b505050509392505050565b60006001600160a01b03821660011415612cbb57506012919050565b816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015612cf457600080fd5b505afa158015612d08573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116c91906134bf565b60006127da8383612f99565b6000818310612d4757816127da565b5090919050565b60008181526001830160205260408120548015612e37576000612d72600183613d73565b8554909150600090612d8690600190613d73565b90506000866000018281548110612d9f57612d9f613e1d565b9060005260206000200154905080876000018481548110612dc257612dc2613e1d565b600091825260209091200155612dd9836001613bfa565b60008281526001890160205260409020558654879080612dfb57612dfb613e07565b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061116c565b600091505061116c565b81546000908210612e9f5760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b6064820152608401610975565b826000018281548110612eb457612eb4613e1d565b9060005260206000200154905092915050565b6000612f1c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612fe89092919063ffffffff16565b805190915015610b6c5780806020019051810190612f3a91906131d7565b610b6c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610975565b6000818152600183016020526040812054612fe05750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561116c565b50600061116c565b606061282c848460008585843b6130415760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610975565b600080866001600160a01b0316858760405161305d919061383e565b60006040518083038185875af1925050503d806000811461309a576040519150601f19603f3d011682016040523d82523d6000602084013e61309f565b606091505b50915091506130af8282866130ba565b979650505050505050565b606083156130c95750816127da565b8251156130d95782518084602001fd5b8160405162461bcd60e51b81526004016109759190613a21565b60008083601f84011261310557600080fd5b50813567ffffffffffffffff81111561311d57600080fd5b6020830191508360208260051b850101111561313857600080fd5b9250929050565b60006020828403121561315157600080fd5b81356127da81613eaa565b6000806040838503121561316f57600080fd5b823561317a81613eaa565b9150602083013561318a81613ec2565b809150509250929050565b600080602083850312156131a857600080fd5b823567ffffffffffffffff8111156131bf57600080fd5b6131cb858286016130f3565b90969095509350505050565b6000602082840312156131e957600080fd5b81516127da81613ec2565b6000806040838503121561320757600080fd5b823561321281613ec2565b9150602083013561318a81613ee0565b60006020828403121561323457600080fd5b5035919050565b6000806000806080858703121561325157600080fd5b843561325c81613eaa565b9350602085013561326c81613eaa565b925060408501359150606085013561328381613ee0565b939692955090935050565b600080600080600080600060c0888a0312156132a957600080fd5b87356132b481613eaa565b96506020880135955060408801356132cb81613ee0565b9450606088013593506080880135925060a088013567ffffffffffffffff8111156132f557600080fd5b6133018a828b016130f3565b989b979a50959850939692959293505050565b60006020828403121561332657600080fd5b815167ffffffffffffffff8082111561333e57600080fd5b818401915084601f83011261335257600080fd5b81518181111561336457613364613e33565b604051601f8201601f19908116603f0116810190838211818310171561338c5761338c613e33565b816040528281528760208487010111156133a557600080fd5b6130af836020830160208801613d8a565b6000602082840312156133c857600080fd5b5051919050565b600080604083850312156133e257600080fd5b82359150602083013561318a81613ee0565b60008060008060008060008060006101008a8c03121561341357600080fd5b8935985060208a013561342581613ee0565b975060408a013561343581613ee0565b965060608a013561344581613eaa565b955060808a0135945060a08a0135935060c08a013561346381613eaa565b925060e08a013567ffffffffffffffff81111561347f57600080fd5b61348b8c828d016130f3565b915080935050809150509295985092959850929598565b6000602082840312156134b457600080fd5b81356127da81613ee0565b6000602082840312156134d157600080fd5b81516127da81613ee0565b600080604083850312156134ef57600080fd5b82356134fa81613ee0565b9150602083013561318a81613eaa565b6000806000806080858703121561352057600080fd5b843561325c81613ee0565b60008060008060008060008060006101208a8c03121561354a57600080fd5b893561355581613ee0565b985060208a013561356581613eaa565b975060408a013561357581613eaa565b965060608a013561358581613ed0565b955060808a0135945060a08a0135935060c08a0135925060e08a01356135aa81613ee0565b809250506101008a013590509295985092959850929598565b600080604083850312156135d657600080fd5b82356135e181613ee0565b9150602083013561318a81613ed0565b6000806040838503121561360457600080fd5b823561360f81613ee0565b946020939093013593505050565b60008060006060848603121561363257600080fd5b833561363d81613ee0565b925060208401359150604084013561365481613ee0565b809150509250925092565b6000806000806080858703121561367557600080fd5b843561368081613ee0565b935060208501359250604085013561369781613ee0565b9396929550929360600135925050565b600080604083850312156136ba57600080fd5b823561321281613ee0565b6000806000606084860312156136da57600080fd5b83356136e581613ee0565b925060208401356136f581613ee0565b9150604084013561365481613ec2565b600080600083850360e081121561371b57600080fd5b843561372681613ee0565b9350602085013561373681613ee0565b925060a0603f198201121561374a57600080fd5b506040840190509250925092565b60008060006060848603121561376d57600080fd5b833561377881613ee0565b9250602084013561378881613ee0565b9150604084013561365481613ed0565b600080600080608085870312156137ae57600080fd5b84356137b981613ee0565b9350602085013561326c81613ee0565b8183526000602080850194508260005b858110156138075781356137ec81613eaa565b6001600160a01b0316875295820195908201906001016137d9565b509495945050505050565b6000815180845261382a816020860160208601613d8a565b601f01601f19169290920160200192915050565b60008251613850818460208701613d8a565b9190910192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156138af57603f1988860301845261389d858351613812565b94509285019290850190600101613881565b5092979650505050505050565b602080825282518282018190526000919060409081850190868401855b8281101561396d578151805185528681015160ff90811688870152868201516001600160a01b0390811688880152606080840151908801526080808401519088015260a0808401519088015260c08084015183169088015260e080840151909216918701919091526101008083015190911690860152610120908101519085015261014090930192908501906001016138d9565b5091979650505050505050565b6001600160a01b038581168252841660208201526060604082018190526000906139a790830184866137c9565b9695505050505050565b6001600160a01b03868116825260208201869052841660408201526080606082018190526000906130af90830184866137c9565b6001600160a01b0387811682526020820187905285811660408301528416606082015260a060808201819052600090612a4690830184866137c9565b6020815260006127da6020830184613812565b6020808252600b908201526a1b9bdd081d1c9d5cdd195960aa1b604082015260600190565b6020808252600b908201526a696e76616c69642066656560a81b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526032908201527f6e617469766520746f6b656e20616d6f756e74206d7573742062652065717561604082015271361030b6b7bab73a103830b930b6b2ba32b960711b606082015260800190565b81548152600182015460ff811660208301526101408201906001600160a01b03600882901c811660408501526002850154606085015260038501546080850152600485015460a0850152600585015460ff811660c08601529150600882901c60ff1660e0850152613b876101008501828460101c166001600160a01b03169052565b5050600683015461012083015292915050565b6000808335601e19843603018112613bb157600080fd5b83018035915067ffffffffffffffff821115613bcc57600080fd5b6020019150600581901b360382131561313857600080fd5b6000823560fe1983360301811261385057600080fd5b60008219821115613c0d57613c0d613df1565b500190565b600060ff821660ff84168060ff03821115613c2f57613c2f613df1565b019392505050565b600082613c5457634e487b7160e01b600052601260045260246000fd5b500490565b600181815b80851115613c94578160001904821115613c7a57613c7a613df1565b80851615613c8757918102915b93841c9390800290613c5e565b509250929050565b60006127da8383613cb3565b60006127da60ff8416835b600082613cc25750600161116c565b81613ccf5750600061116c565b8160018114613ce55760028114613cef57613d0b565b600191505061116c565b60ff841115613d0057613d00613df1565b50506001821b61116c565b5060208310610133831016604e8410600b8410161715613d2e575081810a61116c565b613d388383613c59565b8060001904821115613d4c57613d4c613df1565b029392505050565b6000816000190483118215151615613d6e57613d6e613df1565b500290565b600082821015613d8557613d85613df1565b500390565b60005b83811015613da5578181015183820152602001613d8d565b83811115610f475750506000910152565b6000600019821415613dca57613dca613df1565b5060010190565b600060ff821660ff811415613de857613de8613df1565b60010192915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8135613e5481613ed0565b61ffff811661ffff1983541617825550602082013560018201556040820135600282015560608201356003820155600481016080830135613e9481613ec2565b815490151560ff1660ff19919091161790555050565b6001600160a01b0381168114613ebf57600080fd5b50565b8015158114613ebf57600080fd5b61ffff81168114613ebf57600080fd5b60ff81168114613ebf57600080fdfea26469706673582212202e28fb9bcafe1697f88c223a5c5ad36bf928b8809e4b1422b53d8a2574d9561764736f6c63430008060033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.