Contract 0x1c3755958472b573af3ad9b6a9deac415056e8e5

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x7d0a6ac0c97fa3a7926456cc7fd793351a8a7ba08edcf9710f7142ad47c66b14Renounce Role63624632023-01-06 8:01:4725 days 6 hrs ago0x0132613b3a1061816f4661ad301612910e3cce0b IN  0x1c3755958472b573af3ad9b6a9deac415056e8e50 CRO0.1943278192730
0x3644b55196e88cca3322bbe2a225ae8af3b7b8a771cfe0b903b0cbb0cdf69d44Grant Role63332792023-01-04 10:08:0827 days 4 hrs ago0x0132613b3a1061816f4661ad301612910e3cce0b IN  0x1c3755958472b573af3ad9b6a9deac415056e8e50 CRO0.396894636610
0x00751f36c3cf342f05be35a9a880f50dbd831765817dbb5c17187a1ea087cf3fGrant Role48071352022-09-26 5:02:44127 days 9 hrs ago0x0132613b3a1061816f4661ad301612910e3cce0b IN  0x1c3755958472b573af3ad9b6a9deac415056e8e50 CRO0.2818530060610
0x375af3849601ac0dbe546202dc89d2dd952b982b6b3e8a631529c14cdf0e4666Set Aggregator A...44400282022-09-02 2:44:16151 days 11 hrs ago0x0132613b3a1061816f4661ad301612910e3cce0b IN  0x1c3755958472b573af3ad9b6a9deac415056e8e50 CRO0.26512352160
0x4996456b9aeea8532cfe6d3406563aac7ceb21319da1684440d8cf3a2b5b560bSet Router44400242022-09-02 2:43:53151 days 11 hrs ago0x0132613b3a1061816f4661ad301612910e3cce0b IN  0x1c3755958472b573af3ad9b6a9deac415056e8e50 CRO0.2573920243920
0xad137cf56a221046e8ed5861e041cecb3205cda353e9f7f02aca558f2906a12bSet Router44400202022-09-02 2:43:30151 days 12 hrs ago0x0132613b3a1061816f4661ad301612910e3cce0b IN  0x1c3755958472b573af3ad9b6a9deac415056e8e50 CRO0.2573920243920
0x32cf1a3163be06d00924342416f74ae80aac7ac8e8c30160300896a09668bca8Set Router44400182022-09-02 2:43:19151 days 12 hrs ago0x0132613b3a1061816f4661ad301612910e3cce0b IN  0x1c3755958472b573af3ad9b6a9deac415056e8e50 CRO0.2573920368030
0x805a5996354edd006d94efb0a63711de96891f2b59d77e88e968bcb5b86c2268Set Router44400162022-09-02 2:43:08151 days 12 hrs ago0x0132613b3a1061816f4661ad301612910e3cce0b IN  0x1c3755958472b573af3ad9b6a9deac415056e8e50 CRO0.2573920343070
0x79d5d0f075b6ea78ec6d176385bb9277a60481ba2469e3df5a56f7730346f28aSet Router44400132022-09-02 2:42:51151 days 12 hrs ago0x0132613b3a1061816f4661ad301612910e3cce0b IN  0x1c3755958472b573af3ad9b6a9deac415056e8e50 CRO0.257392046760
0x941816191cbec13b5633004ec74e2251a84bc34fed1372092a9759dc440ef3c6Set Router44400022022-09-02 2:41:49151 days 12 hrs ago0x0132613b3a1061816f4661ad301612910e3cce0b IN  0x1c3755958472b573af3ad9b6a9deac415056e8e50 CRO0.2573920709060
0x0d17350e2aadc7512fad3b423687102307ae07ec6ecc9efdbd7116517b2c3bef0x6080604044399992022-09-02 2:41:31151 days 12 hrs ago0x0132613b3a1061816f4661ad301612910e3cce0b IN  Create: XYDexAggregator0 CRO8.4144649908830
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xc7c595e51a1b515cc4d4312cd7b67b3c40ebe8e1e10e34de87f6a2996a79af9f67478652023-01-31 14:29:2214 mins ago 0x1c3755958472b573af3ad9b6a9deac415056e8e5 Mad Meerkat Finance: Master Meerkat & Router30 CRO
0xc7c595e51a1b515cc4d4312cd7b67b3c40ebe8e1e10e34de87f6a2996a79af9f67478652023-01-31 14:29:2214 mins ago 0x24411099170128f533a9786f6defddcebc9cfe6e 0x1c3755958472b573af3ad9b6a9deac415056e8e530 CRO
0x82924396d9b4a86176bd19ca6571ea5db6f659f52a1fd485bb4b892780ccf64967444442023-01-31 9:06:595 hrs 36 mins ago 0x1c3755958472b573af3ad9b6a9deac415056e8e5 VVS Finance: Router400 CRO
0x82924396d9b4a86176bd19ca6571ea5db6f659f52a1fd485bb4b892780ccf64967444442023-01-31 9:06:595 hrs 36 mins ago 0x24411099170128f533a9786f6defddcebc9cfe6e 0x1c3755958472b573af3ad9b6a9deac415056e8e5400 CRO
0xc164f26769b122401c6f5bfb17be2016762a8b880c602b773fa79bfc24fc2fbc67439422023-01-31 8:19:416 hrs 24 mins ago 0x1c3755958472b573af3ad9b6a9deac415056e8e5 VVS Finance: Router94 CRO
0xc164f26769b122401c6f5bfb17be2016762a8b880c602b773fa79bfc24fc2fbc67439422023-01-31 8:19:416 hrs 24 mins ago 0x24411099170128f533a9786f6defddcebc9cfe6e 0x1c3755958472b573af3ad9b6a9deac415056e8e594 CRO
0x94585a1934303bbeba00d540193013d6184bdf457da2527e13e9a58f5837bb7367429412023-01-31 6:45:127 hrs 58 mins ago 0x1c3755958472b573af3ad9b6a9deac415056e8e50x0bcc9f918acb817394ea0b9b75c4d0e8f6a0c4ea458.186749918862327829 CRO
0x94585a1934303bbeba00d540193013d6184bdf457da2527e13e9a58f5837bb7367429412023-01-31 6:45:127 hrs 58 mins ago CronaSwap: Router 0x1c3755958472b573af3ad9b6a9deac415056e8e5458.186749918862327829 CRO
0x06495b62eb592e4fa1129e85d1fa51f8c0cd526286b95d4ee901c5e35d55a5dd67399842023-01-31 2:05:2312 hrs 38 mins ago 0x1c3755958472b573af3ad9b6a9deac415056e8e5 VVS Finance: Router1,000 CRO
0x06495b62eb592e4fa1129e85d1fa51f8c0cd526286b95d4ee901c5e35d55a5dd67399842023-01-31 2:05:2312 hrs 38 mins ago 0x24411099170128f533a9786f6defddcebc9cfe6e 0x1c3755958472b573af3ad9b6a9deac415056e8e51,000 CRO
0x75556232fc38775f5ad1f44a36094a9b009e89323b50d166215efffb65d77a2467382932023-01-30 23:25:1015 hrs 18 mins ago 0x1c3755958472b573af3ad9b6a9deac415056e8e5 0xec0a7a0c2439e8cb67b992b12ecd020ea943c7be128.96 CRO
0x75556232fc38775f5ad1f44a36094a9b009e89323b50d166215efffb65d77a2467382932023-01-30 23:25:1015 hrs 18 mins ago 0x24411099170128f533a9786f6defddcebc9cfe6e 0x1c3755958472b573af3ad9b6a9deac415056e8e5128.96 CRO
0x6ed544307e10b48a57d51fcc486e22c6a1930b3b2e53996d546a8eb1a067e78467348902023-01-30 18:02:2020 hrs 41 mins ago 0x1c3755958472b573af3ad9b6a9deac415056e8e5 VVS Finance: Router150 CRO
0x6ed544307e10b48a57d51fcc486e22c6a1930b3b2e53996d546a8eb1a067e78467348902023-01-30 18:02:2020 hrs 41 mins ago 0x24411099170128f533a9786f6defddcebc9cfe6e 0x1c3755958472b573af3ad9b6a9deac415056e8e5150 CRO
0x6df1d68d36a2bc290672327a8890d34b90e59f3a136e1a8cfc513cafcdb7785567335892023-01-30 15:59:3722 hrs 44 mins ago 0x1c3755958472b573af3ad9b6a9deac415056e8e5 Mad Meerkat Finance: Master Meerkat & Router340 CRO
0x6df1d68d36a2bc290672327a8890d34b90e59f3a136e1a8cfc513cafcdb7785567335892023-01-30 15:59:3722 hrs 44 mins ago 0x24411099170128f533a9786f6defddcebc9cfe6e 0x1c3755958472b573af3ad9b6a9deac415056e8e5340 CRO
0x2dd76e599f5b2f40d6f50997e1cc5293f65315fc74b6dbe755aa95c61d1363c767323532023-01-30 14:02:551 day 40 mins ago 0x1c3755958472b573af3ad9b6a9deac415056e8e5 0xec0a7a0c2439e8cb67b992b12ecd020ea943c7be230 CRO
0x2dd76e599f5b2f40d6f50997e1cc5293f65315fc74b6dbe755aa95c61d1363c767323532023-01-30 14:02:551 day 40 mins ago 0x24411099170128f533a9786f6defddcebc9cfe6e 0x1c3755958472b573af3ad9b6a9deac415056e8e5230 CRO
0x4542c679866526a681f800773775fb45325dd72f52c4c219721bb8e9db8e05f267294852023-01-30 9:32:361 day 5 hrs ago 0x1c3755958472b573af3ad9b6a9deac415056e8e5 Mad Meerkat Finance: Master Meerkat & Router1,585 CRO
0x4542c679866526a681f800773775fb45325dd72f52c4c219721bb8e9db8e05f267294852023-01-30 9:32:361 day 5 hrs ago 0x24411099170128f533a9786f6defddcebc9cfe6e 0x1c3755958472b573af3ad9b6a9deac415056e8e51,585 CRO
0xf37cd9025e04b357a35c07d26b16933610fd26e3a82fd3875d545a472a53e7f567293862023-01-30 9:23:171 day 5 hrs ago 0x1c3755958472b573af3ad9b6a9deac415056e8e5 VVS Finance: Router5,950 CRO
0xf37cd9025e04b357a35c07d26b16933610fd26e3a82fd3875d545a472a53e7f567293862023-01-30 9:23:171 day 5 hrs ago 0x24411099170128f533a9786f6defddcebc9cfe6e 0x1c3755958472b573af3ad9b6a9deac415056e8e55,950 CRO
0x58384ea687b7f66040d0567e3b553d44ae1c4432373fac79cb8652e5e9ce9f5367161362023-01-29 12:31:132 days 2 hrs ago 0x1c3755958472b573af3ad9b6a9deac415056e8e5 VVS Finance: Router900.453015754337058572 CRO
0x58384ea687b7f66040d0567e3b553d44ae1c4432373fac79cb8652e5e9ce9f5367161362023-01-29 12:31:132 days 2 hrs ago 0x24411099170128f533a9786f6defddcebc9cfe6e 0x1c3755958472b573af3ad9b6a9deac415056e8e5900.453015754337058572 CRO
0x062006fedc360202b2fbbcb685c4b6823caa529671cc7866f5306127cb67e60267145042023-01-29 9:56:592 days 4 hrs ago 0x1c3755958472b573af3ad9b6a9deac415056e8e50x0bcc9f918acb817394ea0b9b75c4d0e8f6a0c4ea150.511512511849166116 CRO
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
XYDexAggregator

Compiler Version
v0.8.2+commit.661d1103

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 12 : XYDexAggregator.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.2;

import { AccessControl } from "AccessControl.sol";
import { Address } from "Address.sol";
import "Ownable.sol";
import "SafeERC20.sol";
import "ReentrancyGuard.sol";



/// @title XYDexAggregator helps swap assets through designated routes of pools stated in calls array
/// @notice Use `multiswap` to swap assets by `calls` array and receiver address
contract XYDexAggregator is AccessControl, ReentrancyGuard {

    using SafeERC20 for IERC20;

    /* ========== STRUCTURE ========== */

    // Call describes a swap for XYDexAggregator
    struct Call {
        // the contract to execute the swap
        address target;
        // prefix of the swap bytecode
        bytes prefix;
        // suffix of the swap bytecode
        bytes suffix;
        // from token address
        address fromToken;
        // to token address
        address toToken;
        // amount of the token to swap (optional, use non-zero value to specified amount to swap if needed)
        uint256 amountIn;
    }

    /* ========== STATE VARIABLES ========== */
    bytes32 public constant ROLE_OWNER = keccak256("ROLE_OWNER");
    bytes32 public constant ROLE_AGGREGATOR_ADAPTOR = keccak256("ROLE_AGGREGATOR_ADAPTOR");
    address public constant ETHER_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    // Store the whitelisted swap routers.
    mapping(address => bool) public routerWhitelist;

    receive() external payable {}

    /// @dev Constuctor sets deployer as owner. Also, owner is the admin of the role aggregator.
    constructor() {
        _setRoleAdmin(ROLE_OWNER, ROLE_OWNER);
        _setRoleAdmin(ROLE_AGGREGATOR_ADAPTOR, ROLE_OWNER);
        _setupRole(ROLE_OWNER, msg.sender);
    }

    /* ========== INTERNAL FUNCTIONS ========== */

    /// @notice Get balance of the desired account address of the given token
    /// @param token The token address to be checked
    /// @param account The address to be checked
    /// @return The token balance of the desired account address
    function uniBalanceOf(IERC20 token, address account) internal view returns (uint256) {
        if (address(token) == ETHER_ADDRESS) {
            return account.balance;
        } else {
            return token.balanceOf(account);
        }
    }

    /// @notice Infinite approval to spender address if needed
    /// @param token the token contract address to execute `approve` method
    /// @param spender the address allowed to spend
    function approveIfNeeded(IERC20 token, address spender) internal {
        if (address(token) != ETHER_ADDRESS && token.allowance(address(this), spender) == 0) {
            token.safeApprove(spender, 2**256 - 1);
        }
    }

    /* ========== WRITE FUNCTIONS ========== */

    /// @notice Set aggregatorAdaptor address.
    /// @param aggregatorAdaptor The adaptor address. This multicaller should only be used
    /// by `aggregatorAdaptor`.
    function setAggregatorAdaptor(address aggregatorAdaptor) external onlyRole(ROLE_OWNER) {
        require(Address.isContract(aggregatorAdaptor), "AggregatorAdaptor should be a contract");
        _setupRole(ROLE_AGGREGATOR_ADAPTOR, aggregatorAdaptor);
    }

    /// @notice Add/remove a swap router to/from the whitelist. It can only be called by the owner.
    /// @param router The swap router address.
    /// @param isAdding `True` if router is being added and `False` being removed.
    function setRouter(address router, bool isAdding) external onlyRole(ROLE_OWNER) {
        require(Address.isContract(router), "Router should be a contract");
        routerWhitelist[router] = isAdding;
        emit SetRouter(router, isAdding);
    }

    /// @notice Multi-swap through array of calls by sequence and then transfer final swapped token to receiver
    /// @dev Since the output amount of every swap will differ based on exchange conditions, the amount to swap
    /// of next `Call` needs dynamically changed based on the output of the previous swap. In order to support this,
    /// pre-generated bytecode only contains partial call signature excluding input amount param. The complete
    /// calldata will be packed in runtime.
    /// @param calls the array of calls to swap through different pools (See definition of `Call` in this file)
    /// @param receiver the address to receive final swapped token
    function multiswap(
        Call[] memory calls,
        address payable receiver
    )
        public
        payable
        onlyRole(ROLE_AGGREGATOR_ADAPTOR)
        nonReentrant
        returns (uint256 blockNumber, bytes[] memory returnData)
    {
        blockNumber = block.number;
        returnData = new bytes[](calls.length);

        require(calls.length > 0, "Invalid calls length");
        if (calls[0].fromToken == ETHER_ADDRESS) {
            require(msg.value == calls[0].amountIn, "Invalid msg.value");
        } else {
            IERC20(calls[0].fromToken).safeTransferFrom(msg.sender, address(this), calls[0].amountIn);
        }

        // `calls` contain only swap actions
        uint256 amountIn;
        for(uint256 i = 0; i < calls.length; i++) {
            // Check: call target must be a whitelisted swap router.
            require(routerWhitelist[calls[i].target], "ERR_ROUTER_NOT_IN_WHITELIST");

            approveIfNeeded(IERC20(calls[i].fromToken), calls[i].target);

            if (calls[i].amountIn > 0) {
                amountIn = calls[i].amountIn;
            }
            uint256 value = 0;
            bytes memory callData;
            if (calls[i].fromToken == ETHER_ADDRESS) {
                value = amountIn;
                callData = abi.encodePacked(calls[i].prefix, calls[i].suffix);
            } else {
                callData = abi.encodePacked(calls[i].prefix, amountIn, calls[i].suffix);
            }
            uint256 balance = uniBalanceOf(IERC20(calls[i].toToken), address(this));
            bytes memory ret = Address.functionCallWithValue(calls[i].target, callData, value, "Multicall multiswap: call failed");
            amountIn = uniBalanceOf(IERC20(calls[i].toToken), address(this)) - balance;
            returnData[i] = ret;
        }

        Call memory lastCall = calls[calls.length - 1];
        if (lastCall.toToken == ETHER_ADDRESS) {
            receiver.transfer(address(this).balance);
        } else {
            uint256 balance = IERC20(lastCall.toToken).balanceOf(address(this));
            IERC20(lastCall.toToken).safeTransfer(receiver, balance);
        }
    }

    /* ========== EVENTS ========== */

    event SetRouter(address indexed router, bool isAdding);
}

File 2 of 12 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "IAccessControl.sol";
import "Context.sol";
import "Strings.sol";
import "ERC165.sol";

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 12 : IAccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 5 of 12 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

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

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 6 of 12 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 8 of 12 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

        (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 12 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "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() {
        _setOwner(_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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 10 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "IERC20.sol";
import "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 11 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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 make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"router","type":"address"},{"indexed":false,"internalType":"bool","name":"isAdding","type":"bool"}],"name":"SetRouter","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETHER_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROLE_AGGREGATOR_ADAPTOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROLE_OWNER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"prefix","type":"bytes"},{"internalType":"bytes","name":"suffix","type":"bytes"},{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"internalType":"struct XYDexAggregator.Call[]","name":"calls","type":"tuple[]"},{"internalType":"address payable","name":"receiver","type":"address"}],"name":"multiswap","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes[]","name":"returnData","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"routerWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"aggregatorAdaptor","type":"address"}],"name":"setAggregatorAdaptor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bool","name":"isAdding","type":"bool"}],"name":"setRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b50600180556200003160008051602062001dac833981519152806200008d565b6200006c7fd639b7d96542147b109f34196c8d87a8b1aa8715082b224299043911fbae07b160008051602062001dac8339815191526200008d565b6200008760008051602062001dac83398151915233620000d8565b62000188565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b620000e48282620000e8565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000e4576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001443390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611c1480620001986000396000f3fe6080604052600436106100e15760003560e01c806391d148541161007f578063c3c6467411610059578063c3c646741461027c578063cf1d21c01461029c578063d547741f146102dc578063d8d4218a146102fc576100e8565b806391d1485414610226578063969da00014610246578063a217fddf14610267576100e8565b806336568abe116100bb57806336568abe1461018257806363cbb145146101a257806386ac3a7b146101d25780638ad682af146101f2576100e8565b806301ffc9a7146100ed578063248a9ca3146101225780632f2ff15d14610160576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b5061010d6101083660046118d1565b610330565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061015261013d366004611895565b60009081526020819052604090206001015490565b604051908152602001610119565b34801561016c57600080fd5b5061018061017b3660046118ad565b610369565b005b34801561018e57600080fd5b5061018061019d3660046118ad565b610395565b3480156101ae57600080fd5b5061010d6101bd3660046116de565b60026020526000908152604090205460ff1681565b3480156101de57600080fd5b506101806101ed3660046116de565b610418565b3480156101fe57600080fd5b506101527f9f4e1c871d5fdd0aee1cd182666698a4492b24c6832aac230d07b11046af5a8981565b34801561023257600080fd5b5061010d6102413660046118ad565b6104ca565b610259610254366004611732565b6104f5565b604051610119929190611a47565b34801561027357600080fd5b50610152600081565b34801561028857600080fd5b506101806102973660046116fa565b610c9e565b3480156102a857600080fd5b506102c473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6040516001600160a01b039091168152602001610119565b3480156102e857600080fd5b506101806102f73660046118ad565b610d77565b34801561030857600080fd5b506101527fd639b7d96542147b109f34196c8d87a8b1aa8715082b224299043911fbae07b181565b60006001600160e01b03198216637965db0b60e01b148061036157506301ffc9a760e01b6001600160e01b03198316145b90505b919050565b60008281526020819052604090206001015461038681335b610d9d565b6103908383610e01565b505050565b6001600160a01b038116331461040a5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6104148282610e85565b5050565b7f9f4e1c871d5fdd0aee1cd182666698a4492b24c6832aac230d07b11046af5a896104438133610381565b813b6104a05760405162461bcd60e51b815260206004820152602660248201527f41676772656761746f7241646170746f722073686f756c64206265206120636f6044820152651b9d1c9858dd60d21b6064820152608401610401565b6104147fd639b7d96542147b109f34196c8d87a8b1aa8715082b224299043911fbae07b183610eea565b6000828152602081815260408083206001600160a01b038516845290915290205460ff165b92915050565b600060607fd639b7d96542147b109f34196c8d87a8b1aa8715082b224299043911fbae07b16105248133610381565b600260015414156105775760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610401565b6002600155845143935067ffffffffffffffff8111156105a757634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156105da57816020015b60608152602001906001900390816105c55790505b50915060008551116106255760405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840c6c2d8d8e640d8cadccee8d60631b6044820152606401610401565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b03168560008151811061066457634e487b7160e01b600052603260045260246000fd5b6020026020010151606001516001600160a01b031614156106f357846000815181106106a057634e487b7160e01b600052603260045260246000fd5b602002602001015160a0015134146106ee5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964206d73672e76616c756560781b6044820152606401610401565b61076b565b61076b33308760008151811061071957634e487b7160e01b600052603260045260246000fd5b602002602001015160a001518860008151811061074657634e487b7160e01b600052603260045260246000fd5b6020026020010151606001516001600160a01b0316610ef4909392919063ffffffff16565b6000805b8651811015610b4b576002600088838151811061079c57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151516001600160a01b031682528101919091526040016000205460ff166108105760405162461bcd60e51b815260206004820152601b60248201527f4552525f524f555445525f4e4f545f494e5f57484954454c49535400000000006044820152606401610401565b61087087828151811061083357634e487b7160e01b600052603260045260246000fd5b60200260200101516060015188838151811061085f57634e487b7160e01b600052603260045260246000fd5b602002602001015160000151610f65565b600087828151811061089257634e487b7160e01b600052603260045260246000fd5b602002602001015160a0015111156108d3578681815181106108c457634e487b7160e01b600052603260045260246000fd5b602002602001015160a0015191505b6000606073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031689848151811061091557634e487b7160e01b600052603260045260246000fd5b6020026020010151606001516001600160a01b031614156109b25783915088838151811061095357634e487b7160e01b600052603260045260246000fd5b60200260200101516020015189848151811061097f57634e487b7160e01b600052603260045260246000fd5b60200260200101516040015160405160200161099c929190611959565b6040516020818303038152906040529050610a2f565b8883815181106109d257634e487b7160e01b600052603260045260246000fd5b602002602001015160200151848a85815181106109ff57634e487b7160e01b600052603260045260246000fd5b602002602001015160400151604051602001610a1d93929190611988565b60405160208183030381529060405290505b6000610a668a8581518110610a5457634e487b7160e01b600052603260045260246000fd5b60200260200101516080015130611029565b90506000610ad68b8681518110610a8d57634e487b7160e01b600052603260045260246000fd5b60200260200101516000015184866040518060400160405280602081526020017f4d756c746963616c6c206d756c7469737761703a2063616c6c206661696c65648152506110e1565b905081610afc8c8781518110610a5457634e487b7160e01b600052603260045260246000fd5b610b069190611b17565b955080888681518110610b2957634e487b7160e01b600052603260045260246000fd5b6020026020010181905250505050508080610b4390611b71565b91505061076f565b5060008660018851610b5d9190611b17565b81518110610b7b57634e487b7160e01b600052603260045260246000fd5b6020026020010151905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031681608001516001600160a01b03161415610bf2576040516001600160a01b038716904780156108fc02916000818181858888f19350505050158015610bec573d6000803e3d6000fd5b50610c8e565b60808101516040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610c3857600080fd5b505afa158015610c4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7091906118f9565b6080830151909150610c8c906001600160a01b03168883611209565b505b5050600180555090939092509050565b7f9f4e1c871d5fdd0aee1cd182666698a4492b24c6832aac230d07b11046af5a89610cc98133610381565b823b610d175760405162461bcd60e51b815260206004820152601b60248201527f526f757465722073686f756c64206265206120636f6e747261637400000000006044820152606401610401565b6001600160a01b038316600081815260026020908152604091829020805460ff191686151590811790915591519182527f09b50446349d7fd45dbe59f55204a44404c2adf607c59e9420b87535ed2454b1910160405180910390a2505050565b600082815260208190526040902060010154610d938133610381565b6103908383610e85565b610da782826104ca565b61041457610dbf816001600160a01b03166014611239565b610dca836020611239565b604051602001610ddb9291906119bf565b60408051601f198184030181529082905262461bcd60e51b825261040191600401611a34565b610e0b82826104ca565b610414576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610e413390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610e8f82826104ca565b15610414576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6104148282610e01565b6040516001600160a01b0380851660248301528316604482015260648101829052610f5f9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611422565b50505050565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480159061100e5750604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e9060440160206040518083038186803b158015610fd457600080fd5b505afa158015610fe8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061100c91906118f9565b155b15610414576104146001600160a01b038316826000196114f4565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561106157506001600160a01b038116316104ef565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b1580156110a257600080fd5b505afa1580156110b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110da91906118f9565b90506104ef565b6060824710156111425760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610401565b843b6111905760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610401565b600080866001600160a01b031685876040516111ac919061193d565b60006040518083038185875af1925050503d80600081146111e9576040519150601f19603f3d011682016040523d82523d6000602084013e6111ee565b606091505b50915091506111fe828286611618565b979650505050505050565b6040516001600160a01b03831660248201526044810182905261039090849063a9059cbb60e01b90606401610f28565b60606000611248836002611af8565b611253906002611ae0565b67ffffffffffffffff81111561127957634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156112a3576020820181803683370190505b509050600360fc1b816000815181106112cc57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061130957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600061132d846002611af8565b611338906001611ae0565b90505b60018111156113cc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061137a57634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061139e57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936113c581611b5a565b905061133b565b50831561141b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610401565b9392505050565b6000611477826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116519092919063ffffffff16565b80519091501561039057808060200190518101906114959190611879565b6103905760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610401565b80158061157d5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561154357600080fd5b505afa158015611557573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157b91906118f9565b155b6115e85760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610401565b6040516001600160a01b03831660248201526044810182905261039090849063095ea7b360e01b90606401610f28565b6060831561162757508161141b565b8251156116375782518084602001fd5b8160405162461bcd60e51b81526004016104019190611a34565b606061166084846000856110e1565b949350505050565b803561036481611bb8565b600082601f830112611683578081fd5b813567ffffffffffffffff81111561169d5761169d611ba2565b6116b0601f8201601f1916602001611aaf565b8181528460208386010111156116c4578283fd5b816020850160208301379081016020019190915292915050565b6000602082840312156116ef578081fd5b813561141b81611bb8565b6000806040838503121561170c578081fd5b823561171781611bb8565b9150602083013561172781611bd0565b809150509250929050565b60008060408385031215611744578182fd5b823567ffffffffffffffff8082111561175b578384fd5b818501915085601f83011261176e578384fd5b813560208282111561178257611782611ba2565b61178f8182840201611aaf565b82815281810190858301885b8581101561185a578135880160c0818e03601f190112156117ba578a8bfd5b6117c460c0611aaf565b6117cf878301611668565b81526040820135898111156117e2578c8dfd5b6117f08f8983860101611673565b8883015250606082013589811115611806578c8dfd5b6118148f8983860101611673565b60408301525061182660808301611668565b606082015261183760a08301611668565b608082015260c0919091013560a08201528452928401929084019060010161179b565b5050809750505061186c818801611668565b9450505050509250929050565b60006020828403121561188a578081fd5b815161141b81611bd0565b6000602082840312156118a6578081fd5b5035919050565b600080604083850312156118bf578182fd5b82359150602083013561172781611bb8565b6000602082840312156118e2578081fd5b81356001600160e01b03198116811461141b578182fd5b60006020828403121561190a578081fd5b5051919050565b60008151808452611929816020860160208601611b2e565b601f01601f19169290920160200192915050565b6000825161194f818460208701611b2e565b9190910192915050565b6000835161196b818460208801611b2e565b83519083019061197f818360208801611b2e565b01949350505050565b6000845161199a818460208901611b2e565b820184815283516119b2816020808501908801611b2e565b0160200195945050505050565b60007f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000825283516119f7816017850160208801611b2e565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611a28816028840160208801611b2e565b01602801949350505050565b60006020825261141b6020830184611911565b600060408201848352602060408185015281855180845260608601915060608382028701019350828701855b82811015611aa157605f19888703018452611a8f868351611911565b95509284019290840190600101611a73565b509398975050505050505050565b604051601f8201601f1916810167ffffffffffffffff81118282101715611ad857611ad8611ba2565b604052919050565b60008219821115611af357611af3611b8c565b500190565b6000816000190483118215151615611b1257611b12611b8c565b500290565b600082821015611b2957611b29611b8c565b500390565b60005b83811015611b49578181015183820152602001611b31565b83811115610f5f5750506000910152565b600081611b6957611b69611b8c565b506000190190565b6000600019821415611b8557611b85611b8c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611bcd57600080fd5b50565b8015158114611bcd57600080fdfea2646970667358221220ac335ed9baf89d9d92cbb0b58388d24e92637658562af72bc23fdfe281365ce364736f6c634300080200339f4e1c871d5fdd0aee1cd182666698a4492b24c6832aac230d07b11046af5a89

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.