Contract 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xb1cf573011b07b6e21b40a8b2c830cbb4f08344dbadd6a4952543901459ab360Refund Native237913042022-09-09 15:20:5826 days 13 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.00003659
0xcedf764c616b14f8846b0c730bcb957c4c0ac3dc9bd26e46e2e5ff012dc76b17Refund237911992022-09-09 15:20:1526 days 13 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.00004556
0x0309dffc9c09b7f27b904814c38ccfb0b7e00fca7544929b39d9c38487efd2ffRefund Native237896932022-09-09 15:11:1426 days 13 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.00003672
0x90ed50d4ba6810a33b3c43bae715ea877ecd3952b937dd82a439e314d5c6dfdcAdd Whitelist178320982022-07-17 13:04:5280 days 15 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000081137064 ETH
0xb0f6ef1bb370bf88f9cbbeb611d66fe6b1402a427f3cbf8044a67070d2425770Add Whitelist178320752022-07-17 13:04:4080 days 15 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.00007346402 ETH
0x1c87d91ebe1878d5a56bf6be303c547225977767849f6a2fb10ea988d3b3f796Add Whitelist178320532022-07-17 13:04:4080 days 15 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.00007325459 ETH
0x1fe16842828a048107f407a819be6cd53db69418c8fffeb8a5a48efcd84e3ac9Add Whitelist178320262022-07-17 13:03:1180 days 15 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.00007346402 ETH
0x77eaec47575b7d8780701839b32d3367b41bb8123742b093962d048cc89745b7Set Message Bus177492872022-07-16 11:11:1081 days 17 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000083255324 ETH
0x9b6f6eb0ac6f85f827718c8a5dece14246e94be665f0a30f1b971167d9490016Update C Bridge ...177492822022-07-16 11:11:1081 days 17 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000083016843 ETH
0xc446dbc98aeeba4a33ae1319853a7d994c0251aa110cf1363dcc87355ee822bcAdd Whitelist177492792022-07-16 11:11:1081 days 17 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000085423524 ETH
0xd205052e371bfc7d40128a3290c3d3d4e82d76dae4138fbefffda549ccdcd991Add Whitelist177492622022-07-16 11:11:1081 days 17 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.00008567348 ETH
0xaeac09e57897b6eae5658ce11f20ccfb987d767748683157cd4701ac0fc12ce9Add Whitelist177492452022-07-16 11:09:2681 days 17 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.00008567097 ETH
0x2e84dba906b0db3dc991348b11176f0eb656f24028b806ef4e5f16cefdb362d1Set Message Bus177488782022-07-16 11:01:4681 days 17 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000082760432 ETH
0xaa8e673f02c5a2098a196866e0f8e01f6965aae5d569c01e73904b77f0f72417Update C Bridge ...177488722022-07-16 11:01:4681 days 17 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000083016843 ETH
0x403ec2334ae251811d06a4f251ea6c819e240c4b728b534405187e4077e87e38Add Whitelist177488462022-07-16 11:00:5581 days 17 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000085423524 ETH
0x4acaedd44efbb64deef526f7f7dd1573f53f77819faa6b31d2a89c1a8114eecbAdd Whitelist177488302022-07-16 11:00:5581 days 17 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000085920926 ETH
0x49e2d0b8adc99798a70ec80d081f7138b6268afb5033c9dd7d97d1094ff6a2feAdd Whitelist177488162022-07-16 10:59:5381 days 17 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.00008567097 ETH
0xd58871464c419b1245797f6decb88326264ea129af95debca99196783cd25779Set Message Bus175318612022-07-13 7:09:2984 days 21 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000130061402 ETH
0x1bb15c2243c142e929b409900532596011ca21b8a05991d59aadd668b4ccd959Update C Bridge ...175318512022-07-13 7:09:2984 days 21 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000130074888 ETH
0x830876c573592bf6bf7f900a2142446ad64f9b10e4133ee0ef11d37ca04d353aAdd Whitelist175308242022-07-13 6:54:4684 days 21 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000141531274 ETH
0x6d6a43143978af15fe79d18533100859b96312a98ef98342205143d4d1cbfa89Add Whitelist175308172022-07-13 6:54:4684 days 21 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000142275887 ETH
0x522e182b2f9a4c79233a132b2e57d6921669299e5b32db2ebac1c6c8436b683dAdd Whitelist175308122022-07-13 6:54:4684 days 21 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH0.000141903581 ETH
0x777ac4985299c3ecbdcf48f3ae619e95caf8cb92736e6e1894d8ac633af7c4a60x60806040175308082022-07-13 6:54:4684 days 21 hrs ago0x7e8a8b130272430008eca062419acd8b423d339d IN  Create: RangoCBridge0 ETH0.018132130516 ETH
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x89deb327e6a38350cfa4b2f5c6709e22ad28cf4d9200feabbc3e7af6fed8ccb9286085542022-10-06 2:53:571 hr 30 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0x161940cd334d4fcaba3bf9d5e8c70ea67f6c5f220.070806788591753527 ETH
0x89deb327e6a38350cfa4b2f5c6709e22ad28cf4d9200feabbc3e7af6fed8ccb9286085542022-10-06 2:53:571 hr 30 mins ago 0x82af49447d8a07e3bd95bd0d56f35241523fbab10x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0.070806788591753527 ETH
0x89deb327e6a38350cfa4b2f5c6709e22ad28cf4d9200feabbc3e7af6fed8ccb9286085542022-10-06 2:53:571 hr 30 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af 0x82af49447d8a07e3bd95bd0d56f35241523fbab10 ETH
0x89deb327e6a38350cfa4b2f5c6709e22ad28cf4d9200feabbc3e7af6fed8ccb9286085542022-10-06 2:53:571 hr 30 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af SushiSwap: Router0 ETH
0x89deb327e6a38350cfa4b2f5c6709e22ad28cf4d9200feabbc3e7af6fed8ccb9286085542022-10-06 2:53:571 hr 30 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af 0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb90 ETH
0x89deb327e6a38350cfa4b2f5c6709e22ad28cf4d9200feabbc3e7af6fed8ccb9286085542022-10-06 2:53:571 hr 30 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af 0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb90 ETH
0x89deb327e6a38350cfa4b2f5c6709e22ad28cf4d9200feabbc3e7af6fed8ccb9286085542022-10-06 2:53:571 hr 30 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af 0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb90 ETH
0x89deb327e6a38350cfa4b2f5c6709e22ad28cf4d9200feabbc3e7af6fed8ccb9286085542022-10-06 2:53:571 hr 30 mins ago 0x3ad9d0648cdaa2426331e894e980d0a5ed16257f0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH
0x87764459d355ece89c1531ec450017e4801c9e8c534bb155c89eb20bfbee60ec285980382022-10-06 1:19:333 hrs 5 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0x9f1700829173c67c49a3d07dca9447c121418cb40.034622559563461526 ETH
0x87764459d355ece89c1531ec450017e4801c9e8c534bb155c89eb20bfbee60ec285980382022-10-06 1:19:333 hrs 5 mins ago 0x3ad9d0648cdaa2426331e894e980d0a5ed16257f0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH
0xbbbad22b0cc86944ecd757dd6aca728293261c86ca09f79285699d7ce6e47b76285980292022-10-06 1:19:293 hrs 5 mins ago Celer Network: cBridge0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0.034622559563461526 ETH
0x1fc9c4cf548b78419ddf59392c30548eba77ad17cab4cb5e8b4177e9219de7a2285798992022-10-05 21:38:376 hrs 45 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af 0xff970a61a04b1ca14834a43f5de4533ebddb5cc80 ETH
0x1fc9c4cf548b78419ddf59392c30548eba77ad17cab4cb5e8b4177e9219de7a2285798992022-10-05 21:38:376 hrs 45 mins ago 0x3ad9d0648cdaa2426331e894e980d0a5ed16257f0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH
0x32d1853ecee4d1ada008f0521b08cb90899eb91d3639f484e2b7ffb8bc64f170285743502022-10-05 20:43:417 hrs 40 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0xe65bc9d90619e0f98fdb6bda851aaa19e054355a0.074234845290136044 ETH
0x32d1853ecee4d1ada008f0521b08cb90899eb91d3639f484e2b7ffb8bc64f170285743502022-10-05 20:43:417 hrs 40 mins ago 0x3ad9d0648cdaa2426331e894e980d0a5ed16257f0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH
0xa3f4eaa5ee7a0f5c9dc1d96737bb5ac97447a98a05a3307f338f0c0c31e7a70c285743442022-10-05 20:43:387 hrs 40 mins ago Celer Network: cBridge0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0.074234845290136044 ETH
0x42efc56ffdfa40b548eaf88124e3d991f6e751e39782327c4c731fad14620464285570072022-10-05 18:14:3910 hrs 9 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0x4795709756256485eceb2867369d2b65030a55ab0.005997034429055459 ETH
0x42efc56ffdfa40b548eaf88124e3d991f6e751e39782327c4c731fad14620464285570072022-10-05 18:14:3910 hrs 9 mins ago 0x3ad9d0648cdaa2426331e894e980d0a5ed16257f0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH
0x61ab15b2287eb7d8d966bb897de7017765f7b45d00e7ee5d5bffd4b29a810e0b285570002022-10-05 18:14:3610 hrs 9 mins ago Celer Network: cBridge0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0.005997034429055459 ETH
0xfff9410ffdddfb59081357b3d86f2f3be0c132cf221d961eea001246fad64acd285467822022-10-05 16:46:0311 hrs 38 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af 0x4e352cf164e64adcbad318c3a1e222e9eba4ce420 ETH
0xfff9410ffdddfb59081357b3d86f2f3be0c132cf221d961eea001246fad64acd285467822022-10-05 16:46:0311 hrs 38 mins ago 0x3ad9d0648cdaa2426331e894e980d0a5ed16257f0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH
0xa363fb2cfa46015e67028fe8b82dcde7de2aff84247da49c5ede1e21ecebcf5f285465642022-10-05 16:44:1211 hrs 40 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0xdd39a0698ad792f23716c6e6ca922ba316f78fc30.057815487283853894 ETH
0xa363fb2cfa46015e67028fe8b82dcde7de2aff84247da49c5ede1e21ecebcf5f285465642022-10-05 16:44:1211 hrs 40 mins ago 0x3ad9d0648cdaa2426331e894e980d0a5ed16257f0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0 ETH
0x41409223dcea981b97c725718ea57c2a768923aa42e38c9d4760b02175a0b1d9285465542022-10-05 16:44:0811 hrs 40 mins ago Celer Network: cBridge0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0.057815487283853894 ETH
0x0864c6d0d42369c4e4d5efd4dbac5e4e9e1917bda1509bf330030adfc69f388f285431882022-10-05 16:13:1612 hrs 11 mins ago 0x2b2e0ea5e0b698252ae3c740b6e73415223fb5af0x1eb8271d94292d5bb9e043eb94ba0904115eb5f40.016299914939855325 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RangoCBridge

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion, Unlicense license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 31 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = _setInitializedVersion(1);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        bool isTopLevelCall = _setInitializedVersion(version);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(version);
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        _setInitializedVersion(type(uint8).max);
    }

    function _setInitializedVersion(uint8 version) private returns (bool) {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level
        // of initializers, because in other contexts the contract may have been reentered.
        if (_initializing) {
            require(
                version == 1 && !AddressUpgradeable.isContract(address(this)),
                "Initializable: contract is already initialized"
            );
            return false;
        } else {
            require(_initialized < version, "Initializable: contract is already initialized");
            _initialized = version;
            return true;
        }
    }
}

File 2 of 31 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 3 of 31 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

File 4 of 31 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 6 of 31 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 7 of 31 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

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'
        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
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 8 of 31 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

File 10 of 31 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

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

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

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

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

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

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

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

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

File 11 of 31 : RangoCBridge.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.13;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./im/message/framework/MessageSenderApp.sol";
import "./im/message/framework/MessageReceiverApp.sol";
import "../../../interfaces/IUniswapV2.sol";
import "../../../interfaces/IWETH.sol";
import "./im/interfaces/IMessageBusSender.sol";
import "./RangoCBridgeModels.sol";
import "../../rango/bridges/cbridge/IRangoCBridge.sol";
import "../../libs/BaseContract.sol";
import "../../../interfaces/IRangoMessageReceiver.sol";

/// @title The root contract that handles Rango's interaction with cBridge and receives message from Celer IM
/// @author Uchiha Sasuke
/// @dev This is deployed as a separate contract from RangoV1
contract RangoCBridge is IRangoCBridge, MessageSenderApp, MessageReceiverApp, BaseContract {

    /// @notice The address of cBridge contract
    address cBridgeAddress;

    /// @notice The constructor of this contract that receives WETH address and initiates the settings
    /// @param _nativeWrappedAddress The address of WETH, WBNB, etc of the current network
    constructor(address _nativeWrappedAddress) {
        BaseContractStorage storage baseStorage = getBaseContractStorage();
        baseStorage.nativeWrappedAddress = _nativeWrappedAddress;
        cBridgeAddress = NULL_ADDRESS;
        messageBus = NULL_ADDRESS;
    }

    /// @notice Enables the contract to receive native ETH token from other contracts including WETH contract
    receive() external payable { }

    /// @notice A series of events with different status value to help us track the progress of cross-chain swap
    /// @param id The transferId generated by cBridge
    /// @param token The token address in the current network that is being bridged
    /// @param outputAmount The latest observed amount in the path, aka: input amount for source and output amount on dest
    /// @param _destination The destination address that received the money, ZERO address if not sent to the end-user yet
    event CBridgeIMStatusUpdated(bytes32 id, address token, uint256 outputAmount, OperationStatus status, address _destination);

    /// @notice A simple cBridge.send scenario
    /// @param _receiver The wallet address of receiver on the destination
    /// @param _token The address of token on the source chain
    /// @param _amount The input amount sent to the bridge
    /// @param _dstChainId The network id of destination chain
    /// @param _nonce A nonce mechanism used by cBridge that is generated off-chain, it normally is the time.now()
    /// @param _maxSlippage The maximum tolerable slippage by user on cBridge side (The bridge is not 1-1 and may have slippage in big swaps)
    event CBridgeSend(address _receiver, address _token, uint256 _amount, uint64 _dstChainId, uint64 _nonce, uint32 _maxSlippage);

    /// @notice Emits when the cBridge address is updated
    /// @param _oldAddress The previous address
    /// @param _newAddress The new address

    event CBridgeAddressUpdated(address _oldAddress, address _newAddress);

    /// @notice Status of cross-chain celer IM swap
    /// @param Created It's sent to bridge and waiting for bridge response
    /// @param Succeeded The whole process is success and end-user received the desired token in the destination
    /// @param RefundInSource Bridge was out of liquidity and middle asset (ex: USDC) is returned to user on source chain
    /// @param RefundInDestination Our handler on dest chain this.executeMessageWithTransfer failed and we send middle asset (ex: USDC) to user on destination chain
    /// @param SwapFailedInDestination Everything was ok, but the final DEX on destination failed (ex: Market price change and slippage)
    enum OperationStatus {
        Created,
        Succeeded,
        RefundInSource,
        RefundInDestination,
        SwapFailedInDestination
    }

    /// @notice Updates the address of cBridge contract
    /// @param _address The new address of cBridge contract
    function updateCBridgeAddress(address _address) external onlyOwner {
        address oldAddress = cBridgeAddress;
        cBridgeAddress = _address;

        emit CBridgeAddressUpdated(oldAddress, _address);
    }

    /// @notice Computes the sgnFee for a given message based on messageBus formula
    /// @param imMessage The message that fee is computed for
    function computeCBridgeSgnFee(RangoCBridgeModels.RangoCBridgeInterChainMessage memory imMessage) external view returns(uint) {
        bytes memory msgBytes = abi.encode(imMessage);
        return IMessageBus(messageBus).calcFee(msgBytes);
    }

    /// @inheritdoc IRangoCBridge
    function send(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage
    ) external override whenNotPaused nonReentrant {
        require(cBridgeAddress != NULL_ADDRESS, 'cBridge address not set');
        SafeERC20.safeTransferFrom(IERC20(_token), msg.sender, address(this), _amount);
        approve(_token, cBridgeAddress, _amount);
        IBridge(cBridgeAddress).send(_receiver, _token, _amount, _dstChainId, _nonce, _maxSlippage);
        emit CBridgeSend(_receiver, _token, _amount, _dstChainId, _nonce, _maxSlippage);
    }

    /// @inheritdoc IRangoCBridge
    function cBridgeIM(
        address _fromToken,
        uint _inputAmount,
        address _receiverContract, // The receiver app contract address, not recipient
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage,
        uint _sgnFee,

        RangoCBridgeModels.RangoCBridgeInterChainMessage memory imMessage
    ) external override payable whenNotPaused nonReentrant {
        require(msg.value >= _sgnFee, 'sgnFee is bigger than the input');

        require(messageBus != NULL_ADDRESS, 'cBridge message-bus address not set');
        require(cBridgeAddress != NULL_ADDRESS, 'cBridge address not set');
        require(imMessage.dstChainId == _dstChainId, '_dstChainId and imMessage.dstChainId do not match');

        SafeERC20.safeTransferFrom(IERC20(_fromToken), msg.sender, address(this), _inputAmount);
        approve(_fromToken, cBridgeAddress, _inputAmount);

        bytes memory message = abi.encode(imMessage);

        sendMessageWithTransfer(
            _receiverContract,
            _fromToken,
            _inputAmount,
            _dstChainId,
            _nonce,
            _maxSlippage,
            message,
            MsgDataTypes.BridgeSendType.Liquidity,
            _sgnFee
        );

        bytes32 id = _computeSwapRequestId(imMessage.originalSender, uint64(block.chainid), _dstChainId, message);
        emit CBridgeIMStatusUpdated(id, _fromToken, _inputAmount, OperationStatus.Created, NULL_ADDRESS);
    }

    /// @inheritdoc IMessageReceiverApp
    /// @dev We also send a message to dApp if dAppMessage is valid
    /// @dev We refund the money back to the _message.originalSender which is the source wallet address or any wallet that dapp likes to be receiver of the refund
    function executeMessageWithTransferRefund(
        address _token,
        uint256 _amount,
        bytes calldata _message,
        address // executor
    ) external payable override onlyMessageBus returns (ExecutionStatus) {
        RangoCBridgeModels.RangoCBridgeInterChainMessage memory m = abi.decode((_message), (RangoCBridgeModels.RangoCBridgeInterChainMessage));

        BaseContractStorage storage baseStorage = getBaseContractStorage();
        address fromToken = _token;
        bool nativeOut = false;
        if (_token == baseStorage.nativeWrappedAddress) {
            if (IERC20(_token).balanceOf(address(this)) < _amount) {
                if (address(this).balance >= _amount) {
                    nativeOut = true;
                    fromToken = NULL_ADDRESS;
                } else {
                    revert("Neither WETH nor ETH were found on contract");
                }
            }
        }
        
        _sendToken(
            fromToken,
            _amount,
            m.originalSender,
            nativeOut,
            false,
            m.dAppMessage,
            m.dAppSourceContract,
            IRangoMessageReceiver.ProcessStatus.REFUND_IN_SOURCE
        );

        bytes32 id = _computeSwapRequestId(m.originalSender, uint64(block.chainid), m.dstChainId, _message);
        emit CBridgeIMStatusUpdated(id, fromToken, _amount, OperationStatus.RefundInSource, m.originalSender);

        return ExecutionStatus.Success;
    }

    /// @inheritdoc IMessageReceiverApp
    /**
     * @dev If our _message contains a uniswap-like DEX call on the destination we also perform it here
     * There are also some flags such as:
     * 1. _message.bridgeNativeOut which indicates that bridge sent native token to us, so we unwrap it if required
     * 2. _message.nativeOut which indicates that we should send native token to end-user/dapp so we unwrap it if needed
     */
    function executeMessageWithTransfer(
        address, // _sender
        address _token,
        uint256 _amount,
        uint64 _srcChainId,
        bytes memory _message,
        address // executor
    ) external payable override onlyMessageBus whenNotPaused nonReentrant returns (ExecutionStatus) {
        RangoCBridgeModels.RangoCBridgeInterChainMessage memory m = abi.decode((_message), (RangoCBridgeModels.RangoCBridgeInterChainMessage));
        BaseContractStorage storage baseStorage = getBaseContractStorage();
        require(_token == m.path[0], "bridged token must be the same as the first token in destination swap path");
        require(_token == m.fromToken, "bridged token must be the same as the requested swap token");
        if (m.bridgeNativeOut) {
            require(_token == baseStorage.nativeWrappedAddress, "_token must be WETH address");
        }

        bytes32 id = _computeSwapRequestId(m.originalSender, _srcChainId, uint64(block.chainid), _message);
        uint256 dstAmount;
        OperationStatus status = OperationStatus.Succeeded;
        address receivedToken = _token;

        if (m.path.length > 1) {
            if (m.bridgeNativeOut) {
                IWETH(baseStorage.nativeWrappedAddress).deposit{value: _amount}();
            }
            bool ok = true;
            (ok, dstAmount) = _trySwap(m, _amount);
            if (ok) {
                _sendToken(
                    m.toToken,
                    dstAmount,
                    m.recipient,
                    m.nativeOut,
                    true,
                    m.dAppMessage,
                    m.dAppDestContract,
                    IRangoMessageReceiver.ProcessStatus.SUCCESS
                );

                status = OperationStatus.Succeeded;
                receivedToken = m.nativeOut ? NULL_ADDRESS : m.toToken;
            } else {
                // handle swap failure, send the received token directly to receiver
                _sendToken(
                    _token,
                    _amount,
                    m.recipient,
                    false,
                    false,
                    m.dAppMessage,
                    m.dAppDestContract,
                    IRangoMessageReceiver.ProcessStatus.REFUND_IN_DESTINATION
                );

                dstAmount = _amount;
                status = OperationStatus.SwapFailedInDestination;
                receivedToken = _token;
            }
        } else {
            // no need to swap, directly send the bridged token to user
            if (m.bridgeNativeOut) {
                require(m.nativeOut, "You should enable native out when m.bridgeNativeOut is true");
            }
            address sourceToken = m.bridgeNativeOut ? NULL_ADDRESS: _token;
            bool withdraw = m.bridgeNativeOut ? false : true;
            _sendToken(
                sourceToken,
                _amount,
                m.recipient,
                m.nativeOut,
                withdraw,
                m.dAppMessage,
                m.dAppDestContract,
                IRangoMessageReceiver.ProcessStatus.SUCCESS
            );
            dstAmount = _amount;
            status = OperationStatus.Succeeded;
            receivedToken = m.nativeOut ? NULL_ADDRESS : m.path[0];
        }
        emit CBridgeIMStatusUpdated(id, receivedToken, dstAmount, status, m.recipient);
        // always return success since swap failure is already handled in-place
        return ExecutionStatus.Success;
    }

    /// @inheritdoc IMessageReceiverApp
    /// @dev In case of failure in the destination, we only send money to the end-user in the destination
    function executeMessageWithTransferFallback(
        address, // _sender
        address _token, // _token
        uint256 _amount, // _amount
        uint64 _srcChainId,
        bytes memory _message,
        address // executor
    ) external payable override onlyMessageBus whenNotPaused nonReentrant returns (ExecutionStatus) {
        RangoCBridgeModels.RangoCBridgeInterChainMessage memory m = abi.decode((_message), (RangoCBridgeModels.RangoCBridgeInterChainMessage));
        bytes32 id = _computeSwapRequestId(m.originalSender, _srcChainId, uint64(block.chainid), _message);
        SafeERC20.safeTransfer(IERC20(_token), m.originalSender, _amount);

        emit CBridgeIMStatusUpdated(id, _token, _amount, OperationStatus.RefundInDestination, m.originalSender);
        return ExecutionStatus.Fail;
    }

    /// @notice Computes the transferId generated by cBridge
    /// @param _sender The sender wallet or contract address
    /// @param _srcChainId The network id of source
    /// @param _dstChainId The network id of destination
    /// @param _message The byte array message that Rango likes to transfer
    /// @return The bytes32 hash of all these information combined
    function _computeSwapRequestId(
        address _sender,
        uint64 _srcChainId,
        uint64 _dstChainId,
        bytes memory _message
    ) private pure returns (bytes32) {
        return keccak256(abi.encodePacked(_sender, _srcChainId, _dstChainId, _message));
    }

    /// @notice Performs a uniswap-v2 operation
    /// @param _swap The interchain message that contains the swap info
    /// @param _amount The amount of input token
    /// @return ok Indicates that the swap operation was success or fail
    /// @return amountOut If ok = true, amountOut is the output amount of the swap
    function _trySwap(
        RangoCBridgeModels.RangoCBridgeInterChainMessage memory _swap,
        uint256 _amount
    ) private returns (bool ok, uint256 amountOut) {
        BaseContractStorage storage baseStorage = getBaseContractStorage();
        require(baseStorage.whitelistContracts[_swap.dexAddress] == true, "Dex address is not whitelisted");
        uint256 zero;
        approve(_swap.fromToken, _swap.dexAddress, _amount);

        try
            IUniswapV2(_swap.dexAddress).swapExactTokensForTokens(
                _amount,
                _swap.amountOutMin,
                _swap.path,
                address(this),
                _swap.deadline
            )
        returns (uint256[] memory amounts) {
            return (true, amounts[amounts.length - 1]);
        } catch {
            return (false, zero);
        }
    }
}

File 12 of 31 : RangoCBridgeModels.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.13;

library RangoCBridgeModels {
    struct RangoCBridgeInterChainMessage {
        uint64 dstChainId;
        bool bridgeNativeOut;
        address dexAddress;
        address fromToken;
        address toToken;
        uint amountOutMin;
        address[] path;
        uint deadline;
        bool nativeOut;
        address originalSender;
        address recipient;

        // Extra message
        bytes dAppMessage;
        address dAppSourceContract;
        address dAppDestContract;
    }
}

File 13 of 31 : IBridge.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

interface IBridge {
    function send(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage
    ) external;

    function relay(
        bytes calldata _relayRequest,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external;

    function transfers(bytes32 transferId) external view returns (bool);

    function withdraws(bytes32 withdrawId) external view returns (bool);

    function withdraw(
        bytes calldata _wdmsg,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external;

    /**
     * @notice Verifies that a message is signed by a quorum among the signers.
     * @param _msg signed message
     * @param _sigs list of signatures sorted by signer addresses in ascending order
     * @param _signers sorted list of current signers
     * @param _powers powers of current signers
     */
    function verifySigs(
        bytes memory _msg,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external view;
}

File 14 of 31 : IMessageBusSender.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.13;

interface IMessageBusSender {
    function calcFee(bytes calldata _message) external view returns (uint256);
}

File 15 of 31 : IOriginalTokenVault.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

interface IOriginalTokenVault {
    /**
     * @notice Lock original tokens to trigger mint at a remote chain's PeggedTokenBridge
     * @param _token local token address
     * @param _amount locked token amount
     * @param _mintChainId destination chainId to mint tokens
     * @param _mintAccount destination account to receive minted tokens
     * @param _nonce user input to guarantee unique depositId
     */
    function deposit(
        address _token,
        uint256 _amount,
        uint64 _mintChainId,
        address _mintAccount,
        uint64 _nonce
    ) external;

    /**
     * @notice Withdraw locked original tokens triggered by a burn at a remote chain's PeggedTokenBridge.
     * @param _request The serialized Withdraw protobuf.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the bridge's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function withdraw(
        bytes calldata _request,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external;

    function records(bytes32 recordId) external view returns (bool);
}

File 16 of 31 : IOriginalTokenVaultV2.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

interface IOriginalTokenVaultV2 {
    /**
     * @notice Lock original tokens to trigger mint at a remote chain's PeggedTokenBridge
     * @param _token local token address
     * @param _amount locked token amount
     * @param _mintChainId destination chainId to mint tokens
     * @param _mintAccount destination account to receive minted tokens
     * @param _nonce user input to guarantee unique depositId
     */
    function deposit(
        address _token,
        uint256 _amount,
        uint64 _mintChainId,
        address _mintAccount,
        uint64 _nonce
    ) external returns (bytes32);

    /**
     * @notice Withdraw locked original tokens triggered by a burn at a remote chain's PeggedTokenBridge.
     * @param _request The serialized Withdraw protobuf.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the bridge's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function withdraw(
        bytes calldata _request,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external returns (bytes32);

    function records(bytes32 recordId) external view returns (bool);
}

File 17 of 31 : IPeggedTokenBridge.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

interface IPeggedTokenBridge {
    /**
     * @notice Burn tokens to trigger withdrawal at a remote chain's OriginalTokenVault
     * @param _token local token address
     * @param _amount locked token amount
     * @param _withdrawAccount account who withdraw original tokens on the remote chain
     * @param _nonce user input to guarantee unique depositId
     */
    function burn(
        address _token,
        uint256 _amount,
        address _withdrawAccount,
        uint64 _nonce
    ) external;

    /**
     * @notice Mint tokens triggered by deposit at a remote chain's OriginalTokenVault.
     * @param _request The serialized Mint protobuf.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function mint(
        bytes calldata _request,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external;

    function records(bytes32 recordId) external view returns (bool);
}

File 18 of 31 : IPeggedTokenBridgeV2.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

interface IPeggedTokenBridgeV2 {
    /**
     * @notice Burn pegged tokens to trigger a cross-chain withdrawal of the original tokens at a remote chain's
     * OriginalTokenVault, or mint at another remote chain
     * @param _token The pegged token address.
     * @param _amount The amount to burn.
     * @param _toChainId If zero, withdraw from original vault; otherwise, the remote chain to mint tokens.
     * @param _toAccount The account to receive tokens on the remote chain
     * @param _nonce A number to guarantee unique depositId. Can be timestamp in practice.
     */
    function burn(
        address _token,
        uint256 _amount,
        uint64 _toChainId,
        address _toAccount,
        uint64 _nonce
    ) external returns (bytes32);

    // same with `burn` above, use openzeppelin ERC20Burnable interface
    function burnFrom(
        address _token,
        uint256 _amount,
        uint64 _toChainId,
        address _toAccount,
        uint64 _nonce
    ) external returns (bytes32);

    /**
     * @notice Mint tokens triggered by deposit at a remote chain's OriginalTokenVault.
     * @param _request The serialized Mint protobuf.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function mint(
        bytes calldata _request,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external returns (bytes32);

    function records(bytes32 recordId) external view returns (bool);
}

File 19 of 31 : MessageBusAddress.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

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

abstract contract MessageBusAddress is Ownable {
    event MessageBusUpdated(address messageBus);

    address public messageBus;

    function setMessageBus(address _messageBus) public onlyOwner {
        messageBus = _messageBus;
        emit MessageBusUpdated(messageBus);
    }
}

File 20 of 31 : MessageReceiverApp.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

import "../interfaces/IMessageReceiverApp.sol";
import "./MessageBusAddress.sol";

abstract contract MessageReceiverApp is IMessageReceiverApp, MessageBusAddress {
    modifier onlyMessageBus() {
        require(msg.sender == messageBus, "caller is not message bus");
        _;
    }

    /**
     * @notice Called by MessageBus (MessageBusReceiver) if the process is originated from MessageBus (MessageBusSender)'s
     *         sendMessageWithTransfer it is only called when the tokens are checked to be arrived at this contract's address.
     * @param _sender The address of the source app contract
     * @param _token The address of the token that comes out of the bridge
     * @param _amount The amount of tokens received at this contract through the cross-chain bridge.
     *        the contract that implements this contract can safely assume that the tokens will arrive before this
     *        function is called.
     * @param _srcChainId The source chain ID where the transfer is originated from
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessageWithTransfer(
        address _sender,
        address _token,
        uint256 _amount,
        uint64 _srcChainId,
        bytes calldata _message,
        address _executor
    ) external payable virtual override onlyMessageBus returns (ExecutionStatus) {}

    /**
     * @notice Only called by MessageBus (MessageBusReceiver) if
     *         1. executeMessageWithTransfer reverts, or
     *         2. executeMessageWithTransfer returns ExecutionStatus.Fail
     * @param _sender The address of the source app contract
     * @param _token The address of the token that comes out of the bridge
     * @param _amount The amount of tokens received at this contract through the cross-chain bridge.
     *        the contract that implements this contract can safely assume that the tokens will arrive before this
     *        function is called.
     * @param _srcChainId The source chain ID where the transfer is originated from
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessageWithTransferFallback(
        address _sender,
        address _token,
        uint256 _amount,
        uint64 _srcChainId,
        bytes calldata _message,
        address _executor
    ) external payable virtual override onlyMessageBus returns (ExecutionStatus) {}

    /**
     * @notice Called by MessageBus (MessageBusReceiver) to process refund of the original transfer from this contract
     * @param _token The token address of the original transfer
     * @param _amount The amount of the original transfer
     * @param _message The same message associated with the original transfer
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessageWithTransferRefund(
        address _token,
        uint256 _amount,
        bytes calldata _message,
        address _executor
    ) external payable virtual override onlyMessageBus returns (ExecutionStatus) {}

    /**
     * @notice Called by MessageBus (MessageBusReceiver)
     * @param _sender The address of the source app contract
     * @param _srcChainId The source chain ID where the transfer is originated from
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessage(
        address _sender,
        uint64 _srcChainId,
        bytes calldata _message,
        address _executor
    ) external payable virtual override onlyMessageBus returns (ExecutionStatus) {}
}

File 21 of 31 : MessageSenderApp.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

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

import "../libraries/MsgDataTypes.sol";
import "../libraries/MessageSenderLib.sol";
import "./MessageBusAddress.sol";

abstract contract MessageSenderApp is MessageBusAddress {
    using SafeERC20 for IERC20;

    // ============== Utility functions called by apps ==============

    /**
     * @notice Sends a message to a contract on another chain.
     * Sender needs to make sure the uniqueness of the message Id, which is computed as
     * hash(type.MessageOnly, sender, receiver, srcChainId, srcTxHash, dstChainId, message).
     * If messages with the same Id are sent, only one of them will succeed at dst chain.
     * @param _receiver The address of the destination app contract.
     * @param _dstChainId The destination chain ID.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     * @param _fee The fee amount to pay to MessageBus.
     */
    function sendMessage(
        address _receiver,
        uint64 _dstChainId,
        bytes memory _message,
        uint256 _fee
    ) internal {
        MessageSenderLib.sendMessage(_receiver, _dstChainId, _message, messageBus, _fee);
    }

    /**
     * @notice Sends a message associated with a transfer to a contract on another chain.
     * @param _receiver The address of the destination app contract.
     * @param _token The address of the token to be sent.
     * @param _amount The amount of tokens to be sent.
     * @param _dstChainId The destination chain ID.
     * @param _nonce A number input to guarantee uniqueness of transferId. Can be timestamp in practice.
     * @param _maxSlippage The max slippage accepted, given as percentage in point (pip). Eg. 5000 means 0.5%.
     *        Must be greater than minimalMaxSlippage. Receiver is guaranteed to receive at least
     *        (100% - max slippage percentage) * amount or the transfer can be refunded.
     *        Only applicable to the {MsgDataTypes.BridgeSendType.Liquidity}.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     *        If message is empty, only the token transfer will be sent
     * @param _bridgeSendType One of the {BridgeSendType} enum.
     * @param _fee The fee amount to pay to MessageBus.
     * @return The transfer ID.
     */
    function sendMessageWithTransfer(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage,
        bytes memory _message,
        MsgDataTypes.BridgeSendType _bridgeSendType,
        uint256 _fee
    ) internal returns (bytes32) {
        return
            MessageSenderLib.sendMessageWithTransfer(
                _receiver,
                _token,
                _amount,
                _dstChainId,
                _nonce,
                _maxSlippage,
                _message,
                _bridgeSendType,
                messageBus,
                _fee
            );
    }

    /**
     * @notice Sends a token transfer via a bridge.
     * @dev sendMessageWithTransfer with empty message
     * @param _receiver The address of the destination app contract.
     * @param _token The address of the token to be sent.
     * @param _amount The amount of tokens to be sent.
     * @param _dstChainId The destination chain ID.
     * @param _nonce A number input to guarantee uniqueness of transferId. Can be timestamp in practice.
     * @param _maxSlippage The max slippage accepted, given as percentage in point (pip). Eg. 5000 means 0.5%.
     *        Must be greater than minimalMaxSlippage. Receiver is guaranteed to receive at least
     *        (100% - max slippage percentage) * amount or the transfer can be refunded.
     *        Only applicable to the {MsgDataTypes.BridgeSendType.Liquidity}.
     * @param _bridgeSendType One of the {BridgeSendType} enum.
     */
    function sendTokenTransfer(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage,
        MsgDataTypes.BridgeSendType _bridgeSendType
    ) internal returns (bytes32) {
        return
            MessageSenderLib.sendMessageWithTransfer(
                _receiver,
                _token,
                _amount,
                _dstChainId,
                _nonce,
                _maxSlippage,
                "", // empty message, which will not trigger sendMessage
                _bridgeSendType,
                messageBus,
                0
            );
    }
}

File 22 of 31 : IMessageBus.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

import "../libraries/MsgDataTypes.sol";

interface IMessageBus {
    function liquidityBridge() external view returns (address);

    function pegBridge() external view returns (address);

    function pegBridgeV2() external view returns (address);

    function pegVault() external view returns (address);

    function pegVaultV2() external view returns (address);

    /**
     * @notice Calculates the required fee for the message.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     @ @return The required fee.
     */
    function calcFee(bytes calldata _message) external view returns (uint256);

    /**
     * @notice Sends a message to a contract on another chain.
     * Sender needs to make sure the uniqueness of the message Id, which is computed as
     * hash(type.MessageOnly, sender, receiver, srcChainId, srcTxHash, dstChainId, message).
     * If messages with the same Id are sent, only one of them will succeed at dst chain..
     * A fee is charged in the native gas token.
     * @param _receiver The address of the destination app contract.
     * @param _dstChainId The destination chain ID.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     */
    function sendMessage(
        address _receiver,
        uint256 _dstChainId,
        bytes calldata _message
    ) external payable;

    /**
     * @notice Sends a message associated with a transfer to a contract on another chain.
     * If messages with the same srcTransferId are sent, only one of them will succeed at dst chain..
     * A fee is charged in the native token.
     * @param _receiver The address of the destination app contract.
     * @param _dstChainId The destination chain ID.
     * @param _srcBridge The bridge contract to send the transfer with.
     * @param _srcTransferId The transfer ID.
     * @param _dstChainId The destination chain ID.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     */
    function sendMessageWithTransfer(
        address _receiver,
        uint256 _dstChainId,
        address _srcBridge,
        bytes32 _srcTransferId,
        bytes calldata _message
    ) external payable;

    /**
     * @notice Withdraws message fee in the form of native gas token.
     * @param _account The address receiving the fee.
     * @param _cumulativeFee The cumulative fee credited to the account. Tracked by SGN.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A withdrawal must be
     * signed-off by +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function withdrawFee(
        address _account,
        uint256 _cumulativeFee,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external;

    /**
     * @notice Execute a message with a successful transfer.
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _transfer The transfer info.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function executeMessageWithTransfer(
        bytes calldata _message,
        MsgDataTypes.TransferInfo calldata _transfer,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external payable;

    /**
     * @notice Execute a message with a refunded transfer.
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _transfer The transfer info.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function executeMessageWithTransferRefund(
        bytes calldata _message, // the same message associated with the original transfer
        MsgDataTypes.TransferInfo calldata _transfer,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external payable;

    /**
     * @notice Execute a message not associated with a transfer.
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function executeMessage(
        bytes calldata _message,
        MsgDataTypes.RouteInfo calldata _route,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external payable;
}

File 23 of 31 : IMessageReceiverApp.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

interface IMessageReceiverApp {
    enum ExecutionStatus {
        Fail, // execution failed, finalized
        Success, // execution succeeded, finalized
        Retry // execution rejected, can retry later
    }

    /**
     * @notice Called by MessageBus (MessageBusReceiver) if the process is originated from MessageBus (MessageBusSender)'s
     *         sendMessageWithTransfer it is only called when the tokens are checked to be arrived at this contract's address.
     * @param _sender The address of the source app contract
     * @param _token The address of the token that comes out of the bridge
     * @param _amount The amount of tokens received at this contract through the cross-chain bridge.
     *        the contract that implements this contract can safely assume that the tokens will arrive before this
     *        function is called.
     * @param _srcChainId The source chain ID where the transfer is originated from
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessageWithTransfer(
        address _sender,
        address _token,
        uint256 _amount,
        uint64 _srcChainId,
        bytes calldata _message,
        address _executor
    ) external payable returns (ExecutionStatus);

    /**
     * @notice Only called by MessageBus (MessageBusReceiver) if
     *         1. executeMessageWithTransfer reverts, or
     *         2. executeMessageWithTransfer returns ExecutionStatus.Fail
     * @param _sender The address of the source app contract
     * @param _token The address of the token that comes out of the bridge
     * @param _amount The amount of tokens received at this contract through the cross-chain bridge.
     *        the contract that implements this contract can safely assume that the tokens will arrive before this
     *        function is called.
     * @param _srcChainId The source chain ID where the transfer is originated from
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessageWithTransferFallback(
        address _sender,
        address _token,
        uint256 _amount,
        uint64 _srcChainId,
        bytes calldata _message,
        address _executor
    ) external payable returns (ExecutionStatus);

    /**
     * @notice Called by MessageBus (MessageBusReceiver) to process refund of the original transfer from this contract
     * @param _token The token address of the original transfer
     * @param _amount The amount of the original transfer
     * @param _message The same message associated with the original transfer
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessageWithTransferRefund(
        address _token,
        uint256 _amount,
        bytes calldata _message,
        address _executor
    ) external payable returns (ExecutionStatus);

    /**
     * @notice Called by MessageBus (MessageBusReceiver)
     * @param _sender The address of the source app contract
     * @param _srcChainId The source chain ID where the transfer is originated from
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessage(
        address _sender,
        uint64 _srcChainId,
        bytes calldata _message,
        address _executor
    ) external payable returns (ExecutionStatus);
}

File 24 of 31 : MessageSenderLib.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../../interfaces/IBridge.sol";
import "../../interfaces/IOriginalTokenVault.sol";
import "../../interfaces/IOriginalTokenVaultV2.sol";
import "../../interfaces/IPeggedTokenBridge.sol";
import "../../interfaces/IPeggedTokenBridgeV2.sol";
import "../interfaces/IMessageBus.sol";
import "./MsgDataTypes.sol";

library MessageSenderLib {
    using SafeERC20 for IERC20;

    // ============== Internal library functions called by apps ==============

    /**
     * @notice Sends a message to a contract on another chain.
     * Sender needs to make sure the uniqueness of the message Id, which is computed as
     * hash(type.MessageOnly, sender, receiver, srcChainId, srcTxHash, dstChainId, message).
     * If messages with the same Id are sent, only one of them will succeed at dst chain.
     * @param _receiver The address of the destination app contract.
     * @param _dstChainId The destination chain ID.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     * @param _messageBus The address of the MessageBus on this chain.
     * @param _fee The fee amount to pay to MessageBus.
     */
    function sendMessage(
        address _receiver,
        uint64 _dstChainId,
        bytes memory _message,
        address _messageBus,
        uint256 _fee
    ) internal {
        IMessageBus(_messageBus).sendMessage{value: _fee}(_receiver, _dstChainId, _message);
    }

    /**
     * @notice Sends a message associated with a transfer to a contract on another chain.
     * @param _receiver The address of the destination app contract.
     * @param _token The address of the token to be sent.
     * @param _amount The amount of tokens to be sent.
     * @param _dstChainId The destination chain ID.
     * @param _nonce A number input to guarantee uniqueness of transferId. Can be timestamp in practice.
     * @param _maxSlippage The max slippage accepted, given as percentage in point (pip). Eg. 5000 means 0.5%.
     *        Must be greater than minimalMaxSlippage. Receiver is guaranteed to receive at least
     *        (100% - max slippage percentage) * amount or the transfer can be refunded.
     *        Only applicable to the {MsgDataTypes.BridgeSendType.Liquidity}.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     *        If message is empty, only the token transfer will be sent
     * @param _bridgeSendType One of the {MsgDataTypes.BridgeSendType} enum.
     * @param _messageBus The address of the MessageBus on this chain.
     * @param _fee The fee amount to pay to MessageBus.
     * @return The transfer ID.
     */
    function sendMessageWithTransfer(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage,
        bytes memory _message,
        MsgDataTypes.BridgeSendType _bridgeSendType,
        address _messageBus,
        uint256 _fee
    ) internal returns (bytes32) {
        if (_bridgeSendType == MsgDataTypes.BridgeSendType.Liquidity) {
            return
                sendMessageWithLiquidityBridgeTransfer(
                    _receiver,
                    _token,
                    _amount,
                    _dstChainId,
                    _nonce,
                    _maxSlippage,
                    _message,
                    _messageBus,
                    _fee
                );
        } else if (
            _bridgeSendType == MsgDataTypes.BridgeSendType.PegDeposit ||
            _bridgeSendType == MsgDataTypes.BridgeSendType.PegV2Deposit
        ) {
            return
                sendMessageWithPegVaultDeposit(
                    _bridgeSendType,
                    _receiver,
                    _token,
                    _amount,
                    _dstChainId,
                    _nonce,
                    _message,
                    _messageBus,
                    _fee
                );
        } else if (
            _bridgeSendType == MsgDataTypes.BridgeSendType.PegBurn ||
            _bridgeSendType == MsgDataTypes.BridgeSendType.PegV2Burn ||
            _bridgeSendType == MsgDataTypes.BridgeSendType.PegV2BurnFrom
        ) {
            return
                sendMessageWithPegBridgeBurn(
                    _bridgeSendType,
                    _receiver,
                    _token,
                    _amount,
                    _dstChainId,
                    _nonce,
                    _message,
                    _messageBus,
                    _fee
                );
        } else {
            revert("bridge type not supported");
        }
    }

    /**
     * @notice Sends a message to an app on another chain via MessageBus with an associated liquidity bridge transfer.
     * @param _receiver The address of the destination app contract.
     * @param _token The address of the token to be sent.
     * @param _amount The amount of tokens to be sent.
     * @param _dstChainId The destination chain ID.
     * @param _nonce A number input to guarantee uniqueness of transferId. Can be timestamp in practice.
     * @param _maxSlippage The max slippage accepted, given as percentage in point (pip). Eg. 5000 means 0.5%.
     *        Must be greater than minimalMaxSlippage. Receiver is guaranteed to receive at least
     *        (100% - max slippage percentage) * amount or the transfer can be refunded.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     *        If message is empty, only the token transfer will be sent
     * @param _messageBus The address of the MessageBus on this chain.
     * @param _fee The fee amount to pay to MessageBus.
     * @return The transfer ID.
     */
    function sendMessageWithLiquidityBridgeTransfer(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage,
        bytes memory _message,
        address _messageBus,
        uint256 _fee
    ) internal returns (bytes32) {
        address bridge = IMessageBus(_messageBus).liquidityBridge();
        IERC20(_token).safeIncreaseAllowance(bridge, _amount);
        IBridge(bridge).send(_receiver, _token, _amount, _dstChainId, _nonce, _maxSlippage);
        bytes32 transferId = keccak256(
            abi.encodePacked(address(this), _receiver, _token, _amount, _dstChainId, _nonce, uint64(block.chainid))
        );
        if (_message.length > 0) {
            IMessageBus(_messageBus).sendMessageWithTransfer{value: _fee}(
                _receiver,
                _dstChainId,
                bridge,
                transferId,
                _message
            );
        }
        return transferId;
    }

    /**
     * @notice Sends a message to an app on another chain via MessageBus with an associated OriginalTokenVault deposit.
     * @param _receiver The address of the destination app contract.
     * @param _token The address of the token to be sent.
     * @param _amount The amount of tokens to be sent.
     * @param _dstChainId The destination chain ID.
     * @param _nonce A number input to guarantee uniqueness of transferId. Can be timestamp in practice.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     *        If message is empty, only the token transfer will be sent
     * @param _messageBus The address of the MessageBus on this chain.
     * @param _fee The fee amount to pay to MessageBus.
     * @return The transfer ID.
     */
    function sendMessageWithPegVaultDeposit(
        MsgDataTypes.BridgeSendType _bridgeSendType,
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        bytes memory _message,
        address _messageBus,
        uint256 _fee
    ) internal returns (bytes32) {
        address pegVault;
        if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegDeposit) {
            pegVault = IMessageBus(_messageBus).pegVault();
        } else {
            pegVault = IMessageBus(_messageBus).pegVaultV2();
        }
        IERC20(_token).safeIncreaseAllowance(pegVault, _amount);
        bytes32 transferId;
        if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegDeposit) {
            IOriginalTokenVault(pegVault).deposit(_token, _amount, _dstChainId, _receiver, _nonce);
            transferId = keccak256(
                abi.encodePacked(address(this), _token, _amount, _dstChainId, _receiver, _nonce, uint64(block.chainid))
            );
        } else {
            transferId = IOriginalTokenVaultV2(pegVault).deposit(_token, _amount, _dstChainId, _receiver, _nonce);
        }
        if (_message.length > 0) {
            IMessageBus(_messageBus).sendMessageWithTransfer{value: _fee}(
                _receiver,
                _dstChainId,
                pegVault,
                transferId,
                _message
            );
        }
        return transferId;
    }

    /**
     * @notice Sends a message to an app on another chain via MessageBus with an associated PeggedTokenBridge burn.
     * @param _receiver The address of the destination app contract.
     * @param _token The address of the token to be sent.
     * @param _amount The amount of tokens to be sent.
     * @param _dstChainId The destination chain ID.
     * @param _nonce A number input to guarantee uniqueness of transferId. Can be timestamp in practice.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     *        If message is empty, only the token transfer will be sent
     * @param _messageBus The address of the MessageBus on this chain.
     * @param _fee The fee amount to pay to MessageBus.
     * @return The transfer ID.
     */
    function sendMessageWithPegBridgeBurn(
        MsgDataTypes.BridgeSendType _bridgeSendType,
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        bytes memory _message,
        address _messageBus,
        uint256 _fee
    ) internal returns (bytes32) {
        address pegBridge;
        if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegBurn) {
            pegBridge = IMessageBus(_messageBus).pegBridge();
        } else {
            pegBridge = IMessageBus(_messageBus).pegBridgeV2();
        }
        IERC20(_token).safeIncreaseAllowance(pegBridge, _amount);
        bytes32 transferId;
        if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegBurn) {
            IPeggedTokenBridge(pegBridge).burn(_token, _amount, _receiver, _nonce);
            transferId = keccak256(
                abi.encodePacked(address(this), _token, _amount, _receiver, _nonce, uint64(block.chainid))
            );
        } else if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegV2Burn) {
            transferId = IPeggedTokenBridgeV2(pegBridge).burn(_token, _amount, _dstChainId, _receiver, _nonce);
        } else {
            // PegV2BurnFrom
            transferId = IPeggedTokenBridgeV2(pegBridge).burnFrom(_token, _amount, _dstChainId, _receiver, _nonce);
        }
        // handle cases where certain tokens do not spend allowance for role-based burn
        IERC20(_token).safeApprove(pegBridge, 0);
        if (_message.length > 0) {
            IMessageBus(_messageBus).sendMessageWithTransfer{value: _fee}(
                _receiver,
                _dstChainId,
                pegBridge,
                transferId,
                _message
            );
        }
        return transferId;
    }
}

File 25 of 31 : MsgDataTypes.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

library MsgDataTypes {
    // bridge operation type at the sender side (src chain)
    enum BridgeSendType {
        Null,
        Liquidity,
        PegDeposit,
        PegBurn,
        PegV2Deposit,
        PegV2Burn,
        PegV2BurnFrom
    }

    // bridge operation type at the receiver side (dst chain)
    enum TransferType {
        Null,
        LqRelay, // relay through liquidity bridge
        LqWithdraw, // withdraw from liquidity bridge
        PegMint, // mint through pegged token bridge
        PegWithdraw, // withdraw from original token vault
        PegV2Mint, // mint through pegged token bridge v2
        PegV2Withdraw // withdraw from original token vault v2
    }

    enum MsgType {
        MessageWithTransfer,
        MessageOnly
    }

    enum TxStatus {
        Null,
        Success,
        Fail,
        Fallback,
        Pending // transient state within a transaction
    }

    struct TransferInfo {
        TransferType t;
        address sender;
        address receiver;
        address token;
        uint256 amount;
        uint64 wdseq; // only needed for LqWithdraw (refund)
        uint64 srcChainId;
        bytes32 refId;
        bytes32 srcTxHash; // src chain msg tx hash
    }

    struct RouteInfo {
        address sender;
        address receiver;
        uint64 srcChainId;
        bytes32 srcTxHash; // src chain msg tx hash
    }

    struct MsgWithTransferExecutionParams {
        bytes message;
        TransferInfo transfer;
        bytes[] sigs;
        address[] signers;
        uint256[] powers;
    }

    struct BridgeTransferParams {
        bytes request;
        bytes[] sigs;
        address[] signers;
        uint256[] powers;
    }
}

File 26 of 31 : BaseContract.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.13;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "../../interfaces/IWETH.sol";
import "../../interfaces/IThorchainRouter.sol";
import "../../interfaces/IRangoMessageReceiver.sol";


/// @title The base contract for the non-TransparentProxy based contracts
/// @notice It supports refund and DEX whitelisting
/// @author Uchiha Sasuke
/// @notice It contains storage for whitelisted contracts, refund ERC20 and native tokens and on-chain swap
contract BaseContract is Pausable, Ownable, ReentrancyGuard {
    address payable constant NULL_ADDRESS = payable(0x0000000000000000000000000000000000000000);

    using SafeMath for uint;

    /// @dev keccak256("exchange.rango.basecontract")
    bytes32 internal constant BASE_CONTRACT_NAMESPACE = hex"4c641b369cb23edb735ebedf93a426da9d88d71734c5e7d6076697dcf08d6878";

    struct BaseContractStorage {
        address nativeWrappedAddress;
        mapping (address => bool) whitelistContracts;
        mapping (address => bool) whitelistMessagingContracts;
    }

    /// @notice The output money (ERC20/Native) is sent to a wallet
    /// @param _token The token that is sent to a wallet, ZERO address for native
    /// @param _amount The sent amount
    /// @param _receiver The receiver wallet address
    /// @param _nativeOut means the output was native token
    /// @param _withdraw If true, indicates that we swapped WETH to ETH before sending the money and _nativeOut is also true
    event SendToken(address _token, uint256 _amount, address _receiver, bool _nativeOut, bool _withdraw);

    /// @notice This event indicates that a dApp used Rango messaging (dAppMessage field) and we delivered the message to it
    /// @param _receiverContract The address of dApp's contract that was called
    /// @param _token The address of the token that is sent to the dApp, NULL_ADDRESS for native token
    /// @param _amount The amount of the token sent to them
    /// @param _status The status of operation, informing the dApp that the whole process was a success or refund
    /// @param _appMessage The custom message that the dApp asked Rango to deliver
    /// @param success Indicates that the function call to the dApp encountered error or not
    /// @param failReason If success = false, failReason will be the string reason of the failure (aka message of require)
    event CrossChainMessageCalled(
        address _receiverContract,
        address _token,
        uint _amount,
        IRangoMessageReceiver.ProcessStatus _status,
        bytes _appMessage,
        bool success,
        string failReason
    );

    /// @notice Notifies that a new contract is whitelisted
    /// @param _factory The address of the contract
    /// @param _isMessagingDApp If true the whitelisted contract is a dApp based on Rango messaging dApp, otherwise it's a dex or dex aggregator
    event ContractWhitelisted(address _factory, bool _isMessagingDApp);

    /// @notice Notifies that a new contract is blacklisted
    /// @param _factory The address of the contract
    /// @param _isMessagingDApp If true the whitelisted contract is a dApp based on Rango messaging dApp, otherwise it's a dex or dex aggregator
    event ContractBlacklisted(address _factory, bool _isMessagingDApp);

    /// @notice Notifies that admin manually refunded some money
    /// @param _token The address of refunded token, 0x000..00 address for native token
    /// @param _amount The amount that is refunded
    event Refunded(address _token, uint _amount);

    /// @notice Adds a contract to the whitelisted DEXes or whitelisted messaging dApps that can be called
    /// @param _factory The address of the DEX or dApp
    /// @param isMessagingDApp Is true for dApps and false for DEX
    function addWhitelist(address _factory, bool isMessagingDApp) external onlyOwner {
        BaseContractStorage storage baseStorage = getBaseContractStorage();
        if (isMessagingDApp)
            baseStorage.whitelistMessagingContracts[_factory] = true;
        else
            baseStorage.whitelistContracts[_factory] = true;

        emit ContractWhitelisted(_factory, isMessagingDApp);
    }

    /// @notice Removes a contract from the whitelisted DEXes or dApps that can be called
    /// @param _factory The address of the DEX or dApp
    /// @param isMessagingDApp Is true for dApps and false for DEX
    function removeWhitelist(address _factory, bool isMessagingDApp) external onlyOwner {
        BaseContractStorage storage baseStorage = getBaseContractStorage();

        if (isMessagingDApp) {
            require(baseStorage.whitelistMessagingContracts[_factory], 'Factory not found');
            delete baseStorage.whitelistMessagingContracts[_factory];
        } else {
            require(baseStorage.whitelistContracts[_factory], 'Factory not found');
            delete baseStorage.whitelistContracts[_factory];
        }

        emit ContractBlacklisted(_factory, isMessagingDApp);
    }

    /// @notice Transfers an ERC20 token from this contract to msg.sender
    /// @dev This endpoint is to return money to a user if we didn't handle failure correctly and the money is still in the contract
    /// @dev Currently the money goes to admin and they should manually transfer it to a wallet later
    /// @param _tokenAddress The address of ERC20 token to be transferred
    /// @param _amount The amount of money that should be transfered
    function refund(address _tokenAddress, uint256 _amount) external onlyOwner {
        IERC20 ercToken = IERC20(_tokenAddress);
        uint balance = ercToken.balanceOf(address(this));
        require(balance >= _amount, 'Insufficient balance');

        SafeERC20.safeTransfer(IERC20(_tokenAddress), msg.sender, _amount);
        emit Refunded(_tokenAddress, _amount);
    }

    /// @notice Transfers the native token from this contract to msg.sender
    /// @dev This endpoint is to return money to a user if we didn't handle failure correctly and the money is still in the contract
    /// @dev Currently the money goes to admin and they should manually transfer it to a wallet later
    /// @param _amount The amount of native token that should be transfered
    function refundNative(uint256 _amount) external onlyOwner {
        uint balance = address(this).balance;
        require(balance >= _amount, 'Insufficient balance');

        _sendToken(
            NULL_ADDRESS,
            _amount,
            msg.sender,
            true,
            false,
            new bytes(0),
            NULL_ADDRESS,
            IRangoMessageReceiver.ProcessStatus.SUCCESS
        );

        emit Refunded(NULL_ADDRESS, _amount);
    }

    /// @notice Approves an ERC20 token to a contract to transfer from the current contract
    /// @param token The address of an ERC20 token
    /// @param to The contract address that should be approved
    /// @param value The amount that should be approved
    function approve(address token, address to, uint value) internal {
        SafeERC20.safeApprove(IERC20(token), to, 0);
        SafeERC20.safeIncreaseAllowance(IERC20(token), to, value);
    }

    /// @notice An internal function to send a token from the current contract to another contract or wallet
    /// @dev This function also can convert WETH to ETH before sending if _withdraw flat is set to true
    /// @dev To send native token _nativeOut param should be set to true, otherwise we assume it's an ERC20 transfer
    /// @dev If there is a message from a dApp it sends the money to the contract instead of the end-user and calls its handleRangoMessage
    /// @param _token The token that is going to be sent to a wallet, ZERO address for native
    /// @param _amount The sent amount
    /// @param _receiver The receiver wallet address or contract
    /// @param _nativeOut means the output is native token
    /// @param _withdraw If true, indicates that we should swap WETH to ETH before sending the money and _nativeOut must also be true
    function _sendToken(
        address _token,
        uint256 _amount,
        address _receiver,
        bool _nativeOut,
        bool _withdraw,
        bytes memory _dAppMessage,
        address _dAppReceiverContract,
        IRangoMessageReceiver.ProcessStatus processStatus
    ) internal {
        bool thereIsAMessage = _dAppReceiverContract != NULL_ADDRESS;
        address immediateReceiver = thereIsAMessage ? _dAppReceiverContract : _receiver;
        BaseContractStorage storage baseStorage = getBaseContractStorage();
        emit SendToken(_token, _amount, immediateReceiver, _nativeOut, _withdraw);

        if (_nativeOut) {
            if (_withdraw) {
                require(_token == baseStorage.nativeWrappedAddress, "token mismatch");
                IWETH(baseStorage.nativeWrappedAddress).withdraw(_amount);
            }
            _sendNative(immediateReceiver, _amount);
        } else {
            SafeERC20.safeTransfer(IERC20(_token), immediateReceiver, _amount);
        }

        if (thereIsAMessage) {
            require(
                baseStorage.whitelistMessagingContracts[_dAppReceiverContract],
                "Third-party message handler contract not whitelisted"
            );

            address receivedToken = _nativeOut ? NULL_ADDRESS : _token;
            try IRangoMessageReceiver(_dAppReceiverContract)
                .handleRangoMessage(receivedToken, _amount, processStatus, _dAppMessage)
            {
                emit CrossChainMessageCalled(_dAppReceiverContract, receivedToken, _amount, processStatus, _dAppMessage, true, "");
            } catch Error(string memory reason) {
                emit CrossChainMessageCalled(_dAppReceiverContract, receivedToken, _amount, processStatus, _dAppMessage, false, reason);
            } catch (bytes memory lowLevelData) {
                emit CrossChainMessageCalled(_dAppReceiverContract, receivedToken, _amount, processStatus, _dAppMessage, false, _getRevertMsg(lowLevelData));
            }
        }
    }

    /// @notice An internal function to send native token to a contract or wallet
    /// @param _receiver The address that will receive the native token
    /// @param _amount The amount of the native token that should be sent
    function _sendNative(address _receiver, uint _amount) internal {
        (bool sent, ) = _receiver.call{value: _amount}("");
        require(sent, "failed to send native");
    }

    /// @notice A utility function to fetch storage from a predefined random slot using assembly
    /// @return s The storage object
    function getBaseContractStorage() internal pure returns (BaseContractStorage storage s) {
        bytes32 namespace = BASE_CONTRACT_NAMESPACE;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            s.slot := namespace
        }
    }

    /// @notice To extract revert message from a DEX/contract call to represent to the end-user in the blockchain
    /// @param _returnData The resulting bytes of a failed call to a DEX or contract
    /// @return A string that describes what was the error
    function _getRevertMsg(bytes memory _returnData) internal pure returns (string memory) {
        // If the _res length is less than 68, then the transaction failed silently (without a revert message)
        if (_returnData.length < 68) return 'Transaction reverted silently';

        assembly {
        // Slice the sighash.
            _returnData := add(_returnData, 0x04)
        }
        return abi.decode(_returnData, (string)); // All that remains is the revert string
    }
}

File 27 of 31 : IRangoCBridge.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.13;

import "../../../bridges/cbridge/RangoCBridgeModels.sol";

/// @title An interface to RangoCBridge.sol contract to improve type hinting
/// @author Uchiha Sasuke
interface IRangoCBridge {

    /// @notice Executes a cBridgeIM call
    /// @param _fromToken The address of source token to bridge
    /// @param _inputAmount The amount of input to be bridged
    /// @param _receiverContract Our RangoCbridge.sol contract in the destination chain that will handle the destination logic
    /// @param _dstChainId The network id of destination chain, ex: 10 for optimism
    /// @param _nonce A nonce mechanism used by cBridge that is generated off-chain, it normally is the time.now()
    /// @param _maxSlippage The maximum tolerable slippage by user on cBridge side (The bridge is not 1-1 and may have slippage in big swaps)
    /// @param _sgnFee The fee amount (in native token) that cBridge IM charges for delivering the message
    /// @param imMessage Our custom interchain message that contains all the required info for the RangoCBridge.sol on the destination
    function cBridgeIM(
        address _fromToken,
        uint _inputAmount,
        address _receiverContract, // The receiver app contract address, not recipient
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage,
        uint _sgnFee,

        RangoCBridgeModels.RangoCBridgeInterChainMessage memory imMessage
    ) external payable;

    /// @notice Executes a bridging via cBridge
    /// @param _receiver The receiver address in the destination chain
    /// @param _token The token address to be bridged
    /// @param _amount The amount of the token to be bridged
    /// @param _dstChainId The network id of destination chain, ex: 10 for optimism
    /// @param _nonce A nonce mechanism used by cBridge that is generated off-chain, it normally is the time.now()
    /// @param _maxSlippage The maximum tolerable slippage by user on cBridge side (The bridge is not 1-1 and may have slippage in big swaps)
    function send(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage
    ) external;

}

File 28 of 31 : IRangoMessageReceiver.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.13;

interface IRangoMessageReceiver {
    enum ProcessStatus { SUCCESS, REFUND_IN_SOURCE, REFUND_IN_DESTINATION }

    function handleRangoMessage(
        address _token,
        uint _amount,
        ProcessStatus _status,
        bytes memory _message
    ) external;
}

File 29 of 31 : IThorchainRouter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

/// @dev based on thorchain router https://gitlab.com/thorchain/ethereum/eth-router/-/blob/29b59c2d6c6fc7a65d6bbc0f80d90694ac4122f8/contracts/THORChain_Aggregator.sol#L12
interface IThorchainRouter {
    /// @param vault The vault address of Thorchain. This cannot be hardcoded because Thorchain rotates vaults.
    /// @param asset The token contract address (if token is native, should be 0x0000000000000000000000000000000000000000)
    /// @param amount The amount of token to be swapped. It should be positive and if token is native, msg.value should be bigger than amount.
    /// @param memo The transaction memo used by Thorchain which contains the thorchain swap data. More info: https://dev.thorchain.org/thorchain-dev/memos
    /// @param expiration The expiration block number. If the tx is included after this block, it will be reverted.
    function depositWithExpiry(
        address payable vault,
        address asset,
        uint amount,
        string calldata memo,
        uint expiration
    ) external payable;
}

File 30 of 31 : IUniswapV2.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

/// @dev based on swap router of uniswap v2 https://docs.uniswap.org/protocol/V2/reference/smart-contracts/router-02#swapexactethfortokens
interface IUniswapV2 {
    function swapExactETHForTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable returns (uint[] memory amounts);

    function swapTokensForExactTokens(
        uint256 amountOut,
        uint256 amountInMax,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function swapExactTokensForTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);
}

File 31 of 31 : IWETH.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.13;

interface IWETH {
    function deposit() external payable;

    function withdraw(uint256) external;
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 999999
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_nativeWrappedAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldAddress","type":"address"},{"indexed":false,"internalType":"address","name":"_newAddress","type":"address"}],"name":"CBridgeAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"outputAmount","type":"uint256"},{"indexed":false,"internalType":"enum RangoCBridge.OperationStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"address","name":"_destination","type":"address"}],"name":"CBridgeIMStatusUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_receiver","type":"address"},{"indexed":false,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_dstChainId","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"uint32","name":"_maxSlippage","type":"uint32"}],"name":"CBridgeSend","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_factory","type":"address"},{"indexed":false,"internalType":"bool","name":"_isMessagingDApp","type":"bool"}],"name":"ContractBlacklisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_factory","type":"address"},{"indexed":false,"internalType":"bool","name":"_isMessagingDApp","type":"bool"}],"name":"ContractWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_receiverContract","type":"address"},{"indexed":false,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"enum IRangoMessageReceiver.ProcessStatus","name":"_status","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"_appMessage","type":"bytes"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"string","name":"failReason","type":"string"}],"name":"CrossChainMessageCalled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"messageBus","type":"address"}],"name":"MessageBusUpdated","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"_receiver","type":"address"},{"indexed":false,"internalType":"bool","name":"_nativeOut","type":"bool"},{"indexed":false,"internalType":"bool","name":"_withdraw","type":"bool"}],"name":"SendToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"bool","name":"isMessagingDApp","type":"bool"}],"name":"addWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fromToken","type":"address"},{"internalType":"uint256","name":"_inputAmount","type":"uint256"},{"internalType":"address","name":"_receiverContract","type":"address"},{"internalType":"uint64","name":"_dstChainId","type":"uint64"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"uint32","name":"_maxSlippage","type":"uint32"},{"internalType":"uint256","name":"_sgnFee","type":"uint256"},{"components":[{"internalType":"uint64","name":"dstChainId","type":"uint64"},{"internalType":"bool","name":"bridgeNativeOut","type":"bool"},{"internalType":"address","name":"dexAddress","type":"address"},{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"nativeOut","type":"bool"},{"internalType":"address","name":"originalSender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bytes","name":"dAppMessage","type":"bytes"},{"internalType":"address","name":"dAppSourceContract","type":"address"},{"internalType":"address","name":"dAppDestContract","type":"address"}],"internalType":"struct RangoCBridgeModels.RangoCBridgeInterChainMessage","name":"imMessage","type":"tuple"}],"name":"cBridgeIM","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"dstChainId","type":"uint64"},{"internalType":"bool","name":"bridgeNativeOut","type":"bool"},{"internalType":"address","name":"dexAddress","type":"address"},{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"nativeOut","type":"bool"},{"internalType":"address","name":"originalSender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bytes","name":"dAppMessage","type":"bytes"},{"internalType":"address","name":"dAppSourceContract","type":"address"},{"internalType":"address","name":"dAppDestContract","type":"address"}],"internalType":"struct RangoCBridgeModels.RangoCBridgeInterChainMessage","name":"imMessage","type":"tuple"}],"name":"computeCBridgeSgnFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"uint64","name":"_srcChainId","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"}],"name":"executeMessage","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint64","name":"_srcChainId","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"","type":"address"}],"name":"executeMessageWithTransfer","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint64","name":"_srcChainId","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"","type":"address"}],"name":"executeMessageWithTransferFallback","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"","type":"address"}],"name":"executeMessageWithTransferRefund","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"messageBus","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"refundNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"bool","name":"isMessagingDApp","type":"bool"}],"name":"removeWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint64","name":"_dstChainId","type":"uint64"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"uint32","name":"_maxSlippage","type":"uint32"}],"name":"send","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_messageBus","type":"address"}],"name":"setMessageBus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"updateCBridgeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b5060405162005137380380620051378339810160408190526200003491620000fe565b6000805460ff191690556200004933620000a5565b600160025560007f4c641b369cb23edb735ebedf93a426da9d88d71734c5e7d6076697dcf08d687880546001600160a01b039093166001600160a01b031993841617905550600380548216905560018054909116905562000130565b600080546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b6000602082840312156200011157600080fd5b81516001600160a01b03811681146200012957600080fd5b9392505050565b614ff780620001406000396000f3fe60806040526004361061012d5760003560e01c8063715018a6116100a55780639fae52e611610074578063a5977fbb11610059578063a5977fbb14610334578063dae0338914610354578063f2fde38b1461037457600080fd5b80639fae52e6146102e7578063a1a227fa1461030757600080fd5b8063715018a61461025b5780637cd2bffc146102705780638da5cb5b146102835780639c649fdf146102d457600080fd5b8063410085df116100fc578063547cad12116100e1578063547cad12146102055780635ab7afc6146102255780635c975abb1461023857600080fd5b8063410085df146101d25780635465f9f5146101f257600080fd5b80630bcb4982146101395780631a9e24d0146101625780631b0aaf3f146101845780633714020e146101b257600080fd5b3661013457005b600080fd5b61014c610147366004613e50565b610394565b6040516101599190613f03565b60405180910390f35b34801561016e57600080fd5b5061018261017d366004613f2f565b610670565b005b34801561019057600080fd5b506101a461019f3660046142a8565b610936565b604051908152602001610159565b3480156101be57600080fd5b506101826101cd366004613f2f565b610a15565b3480156101de57600080fd5b506101826101ed3660046142dd565b610bb8565b61018261020036600461431d565b610d9e565b34801561021157600080fd5b506101826102203660046143c9565b61117d565b61014c6102333660046143e6565b61127d565b34801561024457600080fd5b5060005460ff166040519015158152602001610159565b34801561026757600080fd5b50610182611475565b61014c61027e3660046143e6565b611508565b34801561028f57600080fd5b50600054610100900473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610159565b61014c6102e2366004614478565b611bc9565b3480156102f357600080fd5b506101826103023660046144c7565b611c4d565b34801561031357600080fd5b506001546102af9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561034057600080fd5b5061018261034f3660046144e0565b611da4565b34801561036057600080fd5b5061018261036f3660046143c9565b612072565b34801561038057600080fd5b5061018261038f3660046143c9565b612178565b60015460009073ffffffffffffffffffffffffffffffffffffffff16331461041d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f63616c6c6572206973206e6f74206d657373616765206275730000000000000060448201526064015b60405180910390fd5b600061042b848601866142a8565b7f4c641b369cb23edb735ebedf93a426da9d88d71734c5e7d6076697dcf08d6878805491925090889060009073ffffffffffffffffffffffffffffffffffffffff908116908316036105a8576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152899073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa1580156104e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105079190614555565b10156105a85788471061052057506000905060016105a8565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4e6569746865722057455448206e6f7220455448207765726520666f756e642060448201527f6f6e20636f6e74726163740000000000000000000000000000000000000000006064820152608401610414565b6105c9828a8661012001518460008961016001518a610180015160016122ae565b60006106168561012001514687600001518c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061271f92505050565b90507f1cbe9d2f9c17d230efb5c6ed6065b9872001bf185d0c6bdd82b60fe57e84cbbe81848c6002896101200151604051610655959493929190614582565b60405180910390a16001955050505050505b95945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff6101009091041633146106f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610414565b7f4c641b369cb23edb735ebedf93a426da9d88d71734c5e7d6076697dcf08d687881156108015773ffffffffffffffffffffffffffffffffffffffff8316600090815260028201602052604090205460ff166107af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f466163746f7279206e6f7420666f756e640000000000000000000000000000006044820152606401610414565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600282016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556108e0565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260018201602052604090205460ff16610892576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f466163746f7279206e6f7420666f756e640000000000000000000000000000006044820152606401610414565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600182016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b6040805173ffffffffffffffffffffffffffffffffffffffff8516815283151560208201527f74ed7aa1296e73c384e8d2249cb7c0634d0de15615f6b02d71f636ac411b6e9e91015b60405180910390a1505050565b6000808260405160200161094a9190614695565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526001547f5335dca200000000000000000000000000000000000000000000000000000000835290925073ffffffffffffffffffffffffffffffffffffffff1690635335dca2906109cd908490600401614859565b602060405180830381865afa1580156109ea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0e9190614555565b9392505050565b60005473ffffffffffffffffffffffffffffffffffffffff610100909104163314610a9c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610414565b7f4c641b369cb23edb735ebedf93a426da9d88d71734c5e7d6076697dcf08d68788115610b185773ffffffffffffffffffffffffffffffffffffffff83166000908152600282016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b6b565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001828101602052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690911790555b6040805173ffffffffffffffffffffffffffffffffffffffff8516815283151560208201527f46fe0810a41e3dbf985c77c9f30207ce6eda91dcba24d8de583b6ea30ac16f009101610929565b60005473ffffffffffffffffffffffffffffffffffffffff610100909104163314610c3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610414565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015610cae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd29190614555565b905082811015610d3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e73756666696369656e742062616c616e63650000000000000000000000006044820152606401610414565b610d49843385612758565b6040805173ffffffffffffffffffffffffffffffffffffffff86168152602081018590527fd7dee2702d63ad89917b6a4da9981c90c4d24f8c2bdfd64c604ecae57d8d0651910160405180910390a150505050565b60005460ff1615610e0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610414565b6002805403610e76576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610414565b6002805534821115610ee4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f73676e46656520697320626967676572207468616e2074686520696e707574006044820152606401610414565b60015473ffffffffffffffffffffffffffffffffffffffff16610f89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f63427269646765206d6573736167652d6275732061646472657373206e6f742060448201527f73657400000000000000000000000000000000000000000000000000000000006064820152608401610414565b60035473ffffffffffffffffffffffffffffffffffffffff16611008576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f634272696467652061646472657373206e6f74207365740000000000000000006044820152606401610414565b8467ffffffffffffffff16816000015167ffffffffffffffff16146110af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f5f647374436861696e496420616e6420696d4d6573736167652e64737443686160448201527f696e496420646f206e6f74206d617463680000000000000000000000000000006064820152608401610414565b6110bb8833308a612831565b6003546110e090899073ffffffffffffffffffffffffffffffffffffffff1689612895565b6000816040516020016110f39190614695565b6040516020818303038152906040529050611116878a8a8989898760018b6128ac565b50600061112a83610120015146898561271f565b90507f1cbe9d2f9c17d230efb5c6ed6065b9872001bf185d0c6bdd82b60fe57e84cbbe818b8b600080604051611164959493929190614582565b60405180910390a1505060016002555050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff610100909104163314611204576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610414565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e9060200160405180910390a150565b60015460009073ffffffffffffffffffffffffffffffffffffffff163314611301576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f63616c6c6572206973206e6f74206d65737361676520627573000000000000006044820152606401610414565b60005460ff161561136e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610414565b60028054036113d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610414565b6002805582516000906113f59085016020908101908601614960565b9050600061140a82610120015187468861271f565b905061141c8883610120015189612758565b7f1cbe9d2f9c17d230efb5c6ed6065b9872001bf185d0c6bdd82b60fe57e84cbbe8189896003866101200151604051611459959493929190614582565b60405180910390a1505060016002555060009695505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff6101009091041633146114fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610414565b61150660006128f0565b565b60015460009073ffffffffffffffffffffffffffffffffffffffff16331461158c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f63616c6c6572206973206e6f74206d65737361676520627573000000000000006044820152606401610414565b60005460ff16156115f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610414565b6002805403611664576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610414565b6002805582516000906116809085016020908101908601614960565b905060007f4c641b369cb23edb735ebedf93a426da9d88d71734c5e7d6076697dcf08d687890508160c001516000815181106116be576116be614abd565b602002602001015173ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146117a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604a60248201527f6272696467656420746f6b656e206d757374206265207468652073616d65206160448201527f732074686520666972737420746f6b656e20696e2064657374696e6174696f6e60648201527f2073776170207061746800000000000000000000000000000000000000000000608482015260a401610414565b816060015173ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614611865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f6272696467656420746f6b656e206d757374206265207468652073616d65206160448201527f732074686520726571756573746564207377617020746f6b656e0000000000006064820152608401610414565b8160200151156118f257805473ffffffffffffffffffffffffffffffffffffffff8981169116146118f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f5f746f6b656e206d7573742062652057455448206164647265737300000000006044820152606401610414565b600061190583610120015188468961271f565b60c0840151519091506000906001908b90821015611a41578560200151156119ad578454604080517fd0e30db0000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff9092169163d0e30db0918e91600480830192600092919082900301818588803b15801561199357600080fd5b505af11580156119a7573d6000803e3d6000fd5b50505050505b60016119b9878d61296d565b945090508015611a0f576119ed8760800151858961014001518a610100015160018c61016001518d6101a0015160006122ae565b60019250866101000151611a05578660800151611a08565b60005b9150611a3b565b611a308d8d8961014001516000808c61016001518d6101a0015160026122ae565b8b9350600492508c91505b50611b6c565b856020015115611add57856101000151611add576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f596f752073686f756c6420656e61626c65206e6174697665206f75742077686560448201527f6e206d2e6272696467654e61746976654f7574206973207472756500000000006064820152608401610414565b60008660200151611aee578c611af1565b60005b905060008760200151611b05576001611b08565b60005b9050611b2f828e8a61014001518b6101000151858d61016001518e6101a0015160006122ae565b8c945060019350876101000151611b64578760c00151600081518110611b5757611b57614abd565b6020026020010151611b67565b60005b925050505b7f1cbe9d2f9c17d230efb5c6ed6065b9872001bf185d0c6bdd82b60fe57e84cbbe848285858a6101400151604051611ba8959493929190614582565b60405180910390a16001965050505050505060016002559695505050505050565b60015460009073ffffffffffffffffffffffffffffffffffffffff163314610667576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f63616c6c6572206973206e6f74206d65737361676520627573000000000000006044820152606401610414565b60005473ffffffffffffffffffffffffffffffffffffffff610100909104163314611cd4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610414565b4781811015611d3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e73756666696369656e742062616c616e63650000000000000000000000006044820152606401610414565b60408051600080825260208201909252611d6591908490339060019084906000806122ae565b6040805160008152602081018490527fd7dee2702d63ad89917b6a4da9981c90c4d24f8c2bdfd64c604ecae57d8d065191015b60405180910390a15050565b60005460ff1615611e11576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610414565b6002805403611e7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610414565b6002805560035473ffffffffffffffffffffffffffffffffffffffff16611eff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f634272696467652061646472657373206e6f74207365740000000000000000006044820152606401610414565b611f0b85333087612831565b600354611f3090869073ffffffffffffffffffffffffffffffffffffffff1686612895565b6003546040517fa5977fbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff888116600483015287811660248301526044820187905267ffffffffffffffff80871660648401528516608483015263ffffffff841660a48301529091169063a5977fbb9060c401600060405180830381600087803b158015611fd057600080fd5b505af1158015611fe4573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff808b1682528916602082015290810187905267ffffffffffffffff80871660608301528516608082015263ffffffff841660a08201527fb82ab614e05585ddbdff921ec7c00df0c150470292b0f063d8839ea6928f669d925060c001905060405180910390a15050600160025550505050565b60005473ffffffffffffffffffffffffffffffffffffffff6101009091041633146120f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610414565b6003805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527fa9d7ede4051cd51e676a40194e8854cbdc3238a26c45bc0f8c1bb24ca01780b79101611d98565b60005473ffffffffffffffffffffffffffffffffffffffff6101009091041633146121ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610414565b73ffffffffffffffffffffffffffffffffffffffff81166122a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610414565b6122ab816128f0565b50565b73ffffffffffffffffffffffffffffffffffffffff821615156000816122d457876122d6565b835b6040805173ffffffffffffffffffffffffffffffffffffffff8d81168252602082018d90528316818301528915156060820152881515608082015290519192507f4c641b369cb23edb735ebedf93a426da9d88d71734c5e7d6076697dcf08d6878917fbc5ba848d4a4b8ebad0f5104ceb00e5ef597fe76fecfc967fb39801515271fa79181900360a00190a1871561248457861561247557805473ffffffffffffffffffffffffffffffffffffffff8c81169116146123f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f746f6b656e206d69736d617463680000000000000000000000000000000000006044820152606401610414565b80546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018c905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b15801561245c57600080fd5b505af1158015612470573d6000803e3d6000fd5b505050505b61247f828b612b55565b61248f565b61248f8b838c612758565b82156127125773ffffffffffffffffffffffffffffffffffffffff8516600090815260028201602052604090205460ff1661254c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603460248201527f54686972642d7061727479206d6573736167652068616e646c657220636f6e7460448201527f72616374206e6f742077686974656c69737465640000000000000000000000006064820152608401610414565b600088612559578b61255c565b60005b6040517f910b32a300000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff87169063910b32a3906125b79084908f908a908d90600401614aec565b600060405180830381600087803b1580156125d157600080fd5b505af19250505080156125e2575060015b6126cd576125ee614b3a565b806308c379a0036126575750612602614b56565b8061260d5750612659565b7ffe3b53aeaf88b6a28abd020460eefc20897bd3db095a4b8b21a7b9007cf52ef787838e898c6000876040516126499796959493929190614bfe565b60405180910390a150612710565b505b3d808015612683576040519150601f19603f3d011682016040523d82523d6000602084013e612688565b606091505b507ffe3b53aeaf88b6a28abd020460eefc20897bd3db095a4b8b21a7b9007cf52ef787838e898c60006126ba88612c1f565b6040516126499796959493929190614bfe565b7ffe3b53aeaf88b6a28abd020460eefc20897bd3db095a4b8b21a7b9007cf52ef786828d888b600160405161270796959493929190614c65565b60405180910390a15b505b5050505050505050505050565b6000848484846040516020016127389493929190614cd4565b604051602081830303815290604052805190602001209050949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261282c9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612c84565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261288f9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016127aa565b50505050565b6128a183836000612d90565b61282c838383612f12565b60006128e28a8a8a8a8a8a8a8a600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168b613010565b9a9950505050505050505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b60408281015173ffffffffffffffffffffffffffffffffffffffff1660009081527f4c641b369cb23edb735ebedf93a426da9d88d71734c5e7d6076697dcf08d68796020529081205481907f4c641b369cb23edb735ebedf93a426da9d88d71734c5e7d6076697dcf08d68789060ff161515600114612a48576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4465782061646472657373206973206e6f742077686974656c697374656400006044820152606401610414565b6000612a5d8660600151876040015187612895565b856040015173ffffffffffffffffffffffffffffffffffffffff166338ed1739868860a001518960c00151308b60e001516040518663ffffffff1660e01b8152600401612aae959493929190614d59565b6000604051808303816000875af1925050508015612b0c57506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612b099190810190614de4565b60015b612b1d57600093509150612b4e9050565b60018160018351612b2e9190614ea4565b81518110612b3e57612b3e614abd565b6020026020010151945094505050505b9250929050565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114612baf576040519150601f19603f3d011682016040523d82523d6000602084013e612bb4565b606091505b505090508061282c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f6661696c656420746f2073656e64206e617469766500000000000000000000006044820152606401610414565b6060604482511015612c6457505060408051808201909152601d81527f5472616e73616374696f6e2072657665727465642073696c656e746c79000000602082015290565b60048201915081806020019051810190612c7e9190614ebb565b92915050565b6000612ce6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661314f9092919063ffffffff16565b80519091501561282c5780806020019051810190612d049190614f04565b61282c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610414565b801580612e3057506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612e0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e2e9190614555565b155b612ebc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610414565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261282c9084907f095ea7b300000000000000000000000000000000000000000000000000000000906064016127aa565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612f89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fad9190614555565b612fb79190614f21565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061288f9085907f095ea7b300000000000000000000000000000000000000000000000000000000906064016127aa565b6000600184600681111561302657613026613ec4565b036130435761303c8b8b8b8b8b8b8b8a8a613166565b90506128e2565b600284600681111561305757613057613ec4565b14806130745750600484600681111561307257613072613ec4565b145b1561308a5761303c848c8c8c8c8c8b8a8a6133e7565b600384600681111561309e5761309e613ec4565b14806130bb575060058460068111156130b9576130b9613ec4565b145b806130d7575060068460068111156130d5576130d5613ec4565b145b156130ed5761303c848c8c8c8c8c8b8a8a6137b4565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f6272696467652074797065206e6f7420737570706f72746564000000000000006044820152606401610414565b606061315e8484600085613bf3565b949350505050565b6000808373ffffffffffffffffffffffffffffffffffffffff166382980dc46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156131b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131d89190614f39565b90506131fb73ffffffffffffffffffffffffffffffffffffffff8b16828b612f12565b6040517fa5977fbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c811660048301528b81166024830152604482018b905267ffffffffffffffff808b1660648401528916608483015263ffffffff881660a483015282169063a5977fbb9060c401600060405180830381600087803b15801561329757600080fd5b505af11580156132ab573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffff00000000000000000000000030606090811b821660208401528f811b821660348401528e901b166048820152605c81018c90527fffffffffffffffff00000000000000000000000000000000000000000000000060c08c811b8216607c8401528b811b8216608484015246901b16608c8201526000925060940190506040516020818303038152906040528051906020012090506000865111156133d8578473ffffffffffffffffffffffffffffffffffffffff16634289fbb3858e8c86868c6040518763ffffffff1660e01b81526004016133a5959493929190614f56565b6000604051808303818588803b1580156133be57600080fd5b505af11580156133d2573d6000803e3d6000fd5b50505050505b9b9a5050505050505050505050565b60008060028b60068111156133fe576133fe613ec4565b03613479578373ffffffffffffffffffffffffffffffffffffffff1663d8257d176040518163ffffffff1660e01b8152600401602060405180830381865afa15801561344e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134729190614f39565b90506134eb565b8373ffffffffffffffffffffffffffffffffffffffff1663c66a9c5a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156134c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134e89190614f39565b90505b61350c73ffffffffffffffffffffffffffffffffffffffff8a16828a612f12565b600060028c600681111561352257613522613ec4565b03613695576040517f2346362400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152602482018b905267ffffffffffffffff808b1660448401528d821660648401528916608483015283169063234636249060a401600060405180830381600087803b1580156135b757600080fd5b505af11580156135cb573d6000803e3d6000fd5b50505050308a8a8a8e8b466040516020016136789796959493929190606097881b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116825296881b87166014820152602881019590955260c093841b7fffffffffffffffff00000000000000000000000000000000000000000000000090811660488701529290961b909416605084015292811b831660648301529290921b16606c82015260740190565b604051602081830303815290604052805190602001209050613751565b6040517f2346362400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152602482018b905267ffffffffffffffff808b1660448401528d821660648401528916608483015283169063234636249060a4016020604051808303816000875af115801561372a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061374e9190614555565b90505b8551156133d8576040517f4289fbb300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861690634289fbb39086906133a5908f908d90889088908e90600401614f56565b60008060038b60068111156137cb576137cb613ec4565b03613846578373ffffffffffffffffffffffffffffffffffffffff1663dfa2dbaf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561381b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061383f9190614f39565b90506138b8565b8373ffffffffffffffffffffffffffffffffffffffff166395b12c276040518163ffffffff1660e01b8152600401602060405180830381865afa158015613891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138b59190614f39565b90505b6138d973ffffffffffffffffffffffffffffffffffffffff8a16828a612f12565b600060038c60068111156138ef576138ef613ec4565b03613a3c576040517fde790c7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152602482018b90528c8116604483015267ffffffffffffffff8916606483015283169063de790c7e90608401600060405180830381600087803b15801561397c57600080fd5b505af1158015613990573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffff00000000000000000000000030606090811b821660208401528e811b82166034840152604883018e90528f901b1660688201527fffffffffffffffff00000000000000000000000000000000000000000000000060c08b811b8216607c84015246901b166084820152608c019150613a1f9050565b604051602081830303815290604052805190602001209050613bd1565b60058c6006811115613a5057613a50613ec4565b03613b15576040517fa002930100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152602482018b905267ffffffffffffffff808b1660448401528d821660648401528916608483015283169063a00293019060a4016020604051808303816000875af1158015613aea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b0e9190614555565b9050613bd1565b6040517f9e422c3300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152602482018b905267ffffffffffffffff808b1660448401528d8216606484015289166084830152831690639e422c339060a4016020604051808303816000875af1158015613baa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bce9190614555565b90505b61375173ffffffffffffffffffffffffffffffffffffffff8b16836000612d90565b606082471015613c85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610414565b73ffffffffffffffffffffffffffffffffffffffff85163b613d03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610414565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613d2c9190614fa5565b60006040518083038185875af1925050503d8060008114613d69576040519150601f19603f3d011682016040523d82523d6000602084013e613d6e565b606091505b5091509150613d7e828286613d89565b979650505050505050565b60608315613d98575081610a0e565b825115613da85782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104149190614859565b73ffffffffffffffffffffffffffffffffffffffff811681146122ab57600080fd5b8035613e0981613ddc565b919050565b60008083601f840112613e2057600080fd5b50813567ffffffffffffffff811115613e3857600080fd5b602083019150836020828501011115612b4e57600080fd5b600080600080600060808688031215613e6857600080fd5b8535613e7381613ddc565b945060208601359350604086013567ffffffffffffffff811115613e9657600080fd5b613ea288828901613e0e565b9094509250506060860135613eb681613ddc565b809150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600381106122ab576122ab613ec4565b60208101613f1083613ef3565b91905290565b80151581146122ab57600080fd5b8035613e0981613f16565b60008060408385031215613f4257600080fd5b8235613f4d81613ddc565b91506020830135613f5d81613f16565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f830116810181811067ffffffffffffffff82111715613fdb57613fdb613f68565b6040525050565b6040516101c0810167ffffffffffffffff8111828210171561400657614006613f68565b60405290565b67ffffffffffffffff811681146122ab57600080fd5b8035613e098161400c565b600067ffffffffffffffff82111561404757614047613f68565b5060051b60200190565b600082601f83011261406257600080fd5b8135602061406f8261402d565b60405161407c8282613f97565b83815260059390931b850182019282810191508684111561409c57600080fd5b8286015b848110156140c05780356140b381613ddc565b83529183019183016140a0565b509695505050505050565b600067ffffffffffffffff8211156140e5576140e5613f68565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f83011261412257600080fd5b813561412d816140cb565b60405161413a8282613f97565b82815285602084870101111561414f57600080fd5b82602086016020830137600092810160200192909252509392505050565b60006101c0828403121561418057600080fd5b614188613fe2565b905061419382614022565b81526141a160208301613f24565b60208201526141b260408301613dfe565b60408201526141c360608301613dfe565b60608201526141d460808301613dfe565b608082015260a082013560a082015260c082013567ffffffffffffffff808211156141fe57600080fd5b61420a85838601614051565b60c084015260e084013560e08401526101009150614229828501613f24565b82840152610120915061423d828501613dfe565b828401526101409150614251828501613dfe565b828401526101609150818401358181111561426b57600080fd5b61427786828701614111565b8385015250505061018061428c818401613dfe565b908201526101a061429e838201613dfe565b9082015292915050565b6000602082840312156142ba57600080fd5b813567ffffffffffffffff8111156142d157600080fd5b61315e8482850161416d565b600080604083850312156142f057600080fd5b82356142fb81613ddc565b946020939093013593505050565b803563ffffffff81168114613e0957600080fd5b600080600080600080600080610100898b03121561433a57600080fd5b883561434581613ddc565b975060208901359650604089013561435c81613ddc565b9550606089013561436c8161400c565b9450608089013561437c8161400c565b935061438a60a08a01614309565b925060c0890135915060e089013567ffffffffffffffff8111156143ad57600080fd5b6143b98b828c0161416d565b9150509295985092959890939650565b6000602082840312156143db57600080fd5b8135610a0e81613ddc565b60008060008060008060c087890312156143ff57600080fd5b863561440a81613ddc565b9550602087013561441a81613ddc565b94506040870135935060608701356144318161400c565b9250608087013567ffffffffffffffff81111561444d57600080fd5b61445989828a01614111565b92505060a087013561446a81613ddc565b809150509295509295509295565b60008060008060006080868803121561449057600080fd5b853561449b81613ddc565b945060208601356144ab8161400c565b9350604086013567ffffffffffffffff811115613e9657600080fd5b6000602082840312156144d957600080fd5b5035919050565b60008060008060008060c087890312156144f957600080fd5b863561450481613ddc565b9550602087013561451481613ddc565b945060408701359350606087013561452b8161400c565b9250608087013561453b8161400c565b915061454960a08801614309565b90509295509295509295565b60006020828403121561456757600080fd5b5051919050565b6005811061457e5761457e613ec4565b9052565b85815273ffffffffffffffffffffffffffffffffffffffff85811660208301526040820185905260a08201906145bb606084018661456e565b8084166080840152509695505050505050565b600081518084526020808501945080840160005b8381101561461457815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016145e2565b509495945050505050565b60005b8381101561463a578181015183820152602001614622565b8381111561288f5750506000910152565b6000815180845261466381602086016020860161461f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526146b060208201835167ffffffffffffffff169052565b600060208301516146c5604084018215159052565b50604083015173ffffffffffffffffffffffffffffffffffffffff8116606084015250606083015173ffffffffffffffffffffffffffffffffffffffff8116608084015250608083015173ffffffffffffffffffffffffffffffffffffffff811660a08401525060a083015160c083015260c08301516101c08060e08501526147526101e08501836145ce565b60e0860151610100868101919091528601519092506101206147778187018315159052565b86015190506101406147a08682018373ffffffffffffffffffffffffffffffffffffffff169052565b86015190506101606147c98682018373ffffffffffffffffffffffffffffffffffffffff169052565b808701519150506101807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08685030181870152614806848361464b565b9350808701519150506101a06148338187018373ffffffffffffffffffffffffffffffffffffffff169052565b9095015173ffffffffffffffffffffffffffffffffffffffff1693019290925250919050565b602081526000610a0e602083018461464b565b8051613e098161400c565b8051613e0981613f16565b8051613e0981613ddc565b600082601f83011261489e57600080fd5b815160206148ab8261402d565b6040516148b88282613f97565b83815260059390931b85018201928281019150868411156148d857600080fd5b8286015b848110156140c05780516148ef81613ddc565b83529183019183016148dc565b6000614907836140cb565b6040516149148282613f97565b80925084815285858501111561492957600080fd5b61493785602083018661461f565b50509392505050565b600082601f83011261495157600080fd5b610a0e838351602085016148fc565b60006020828403121561497257600080fd5b815167ffffffffffffffff8082111561498a57600080fd5b908301906101c0828603121561499f57600080fd5b6149a7613fe2565b6149b08361486c565b81526149be60208401614877565b60208201526149cf60408401614882565b60408201526149e060608401614882565b60608201526149f160808401614882565b608082015260a083015160a082015260c083015182811115614a1257600080fd5b614a1e8782860161488d565b60c08301525060e083015160e0820152610100614a3c818501614877565b90820152610120614a4e848201614882565b90820152610140614a60848201614882565b908201526101608381015183811115614a7857600080fd5b614a8488828701614940565b8284015250506101809150614a9a828401614882565b828201526101a09150614aae828401614882565b91810191909152949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff85168152836020820152614b1483613ef3565b826040820152608060608201526000614b30608083018461464b565b9695505050505050565b600060033d1115614b535760046000803e5060005160e01c5b90565b600060443d1015614b645790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715614bb257505050505090565b8285019150815181811115614bca5750505050505090565b843d8701016020828501011115614be45750505050505090565b614bf360208286010187613f97565b509095945050505050565b73ffffffffffffffffffffffffffffffffffffffff888116825287166020820152604081018690526000614c3186613ef3565b85606083015260e06080830152614c4b60e083018661464b565b84151560a084015282810360c08401526128e2818561464b565b73ffffffffffffffffffffffffffffffffffffffff878116825286166020820152604081018590526000614c9885613ef3565b84606083015260e06080830152614cb260e083018561464b565b92151560a08301525080820360c0909101526000815260200195945050505050565b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008560601b16815260007fffffffffffffffff000000000000000000000000000000000000000000000000808660c01b166014840152808560c01b16601c840152508251614d4981602485016020870161461f565b9190910160240195945050505050565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015614db657845173ffffffffffffffffffffffffffffffffffffffff1683529383019391830191600101614d84565b505073ffffffffffffffffffffffffffffffffffffffff969096166060850152505050608001529392505050565b60006020808385031215614df757600080fd5b825167ffffffffffffffff811115614e0e57600080fd5b8301601f81018513614e1f57600080fd5b8051614e2a8161402d565b604051614e378282613f97565b82815260059290921b8301840191848101915087831115614e5757600080fd5b928401925b82841015613d7e57835182529284019290840190614e5c565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015614eb657614eb6614e75565b500390565b600060208284031215614ecd57600080fd5b815167ffffffffffffffff811115614ee457600080fd5b8201601f81018413614ef557600080fd5b61315e848251602084016148fc565b600060208284031215614f1657600080fd5b8151610a0e81613f16565b60008219821115614f3457614f34614e75565b500190565b600060208284031215614f4b57600080fd5b8151610a0e81613ddc565b600073ffffffffffffffffffffffffffffffffffffffff808816835267ffffffffffffffff8716602084015280861660408401525083606083015260a06080830152613d7e60a083018461464b565b60008251614fb781846020870161461f565b919091019291505056fea264697066735822122022f253743c5e0e36b43b8602d24e39ab8d59041fac4ff639278d588636a2097164736f6c634300080d003300000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1

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

00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1

-----Decoded View---------------
Arg [0] : _nativeWrappedAddress (address): 0x82af49447d8a07e3bd95bd0d56f35241523fbab1

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1


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