MATIC Price: $1.01 (-2.81%)
Gas: 161 GWei
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Token Holdings

Transaction Hash
Method
Block
From
To
Value
Multi Swap549395012024-03-22 4:58:436 days ago1711083523IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.0021651465.99854946
Multi Swap549394742024-03-22 4:57:216 days ago1711083441IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.0019440459.2588095
Transfer546775692024-03-15 6:36:2513 days ago1710484585IN
Paraswap v5: Token Transfer Proxy
10.02 MATIC0.00643762305.89807768
Simple Swap472470962023-09-07 8:16:05203 days ago1694074565IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00542488196
Direct Uni V3Swa...472462882023-09-07 7:45:33203 days ago1694072733IN
Paraswap v5: Token Transfer Proxy
2 MATIC0.00484473192
Simple Swap472462362023-09-07 7:43:30203 days ago1694072610IN
Paraswap v5: Token Transfer Proxy
0.0184817 MATIC0.00483017175
Simple Swap472459922023-09-07 7:34:07203 days ago1694072047IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00669807242
Simple Swap472458922023-09-07 7:30:30203 days ago1694071830IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00521248188
Simple Swap472204032023-09-06 16:06:04203 days ago1694016364IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00681051245
Direct Uni V3Swa...468959852023-08-29 12:23:45212 days ago1693311825IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00448199177
Direct Uni V3Swa...468958132023-08-29 12:17:07212 days ago1693311427IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00371628146
Simple Swap444688872023-06-29 7:36:16273 days ago1688024176IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00814879294.66974799
Simple Swap444682522023-06-29 7:12:16273 days ago1688022736IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00808109292.22162598
Simple Swap444681672023-06-29 7:09:15273 days ago1688022555IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00459276166.07953371
Simple Swap444680502023-06-29 7:05:07273 days ago1688022307IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00789624285.53726935
Transfer From439519962023-06-15 21:00:34286 days ago1686862834IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00695415277.1353742
Approve430327442023-05-23 1:23:37310 days ago1684805017IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.00281334128.89896694
Transfer From411295052023-04-04 10:09:04359 days ago1680602944IN
Paraswap v5: Token Transfer Proxy
0 MATIC0.0024053495.71972456
Transfer407247712023-03-24 20:04:37369 days ago1679688277IN
Paraswap v5: Token Transfer Proxy
0.30085707 MATIC0.00238803113.47290741
Transfer397583402023-02-27 6:23:49395 days ago1677479029IN
Paraswap v5: Token Transfer Proxy
0.03 MATIC0.00343207163.082502
Transfer397582992023-02-27 6:22:11395 days ago1677478931IN
Paraswap v5: Token Transfer Proxy
0.01 MATIC0.00278436132.30538457
Transfer383260002023-01-20 22:36:13432 days ago1674254173IN
Paraswap v5: Token Transfer Proxy
0.03 MATIC0.0011301553.8167417
Transfer380920722023-01-15 2:35:11438 days ago1673750111IN
Paraswap v5: Token Transfer Proxy
10 MATIC0.0008802141.82514638
Transfer380920542023-01-15 2:34:35438 days ago1673750075IN
Paraswap v5: Token Transfer Proxy
10 MATIC0.0008800541.81797189
Simple Swap379007452023-01-10 11:55:31443 days ago1673351731IN
Paraswap v5: Token Transfer Proxy
0.015366 MATIC0.001957168
View all transactions

Latest 1 internal transaction

Parent Txn Hash Block From To Value
181189672021-08-18 11:43:46953 days ago1629287026  Contract Creation0 MATIC
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TokenTransferProxy

Compiler Version
v0.7.5+commit.eb77ed08

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at polygonscan.com on 2021-08-23
*/

// File: openzeppelin-solidity/contracts/utils/EnumerableSet.sol



pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

            bytes32 lastvalue = set._values[lastIndex];

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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


    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

// File: openzeppelin-solidity/contracts/utils/Address.sol



pragma solidity >=0.6.2 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// File: openzeppelin-solidity/contracts/GSN/Context.sol



pragma solidity >=0.6.0 <0.8.0;

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

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

// File: openzeppelin-solidity/contracts/access/AccessControl.sol



pragma solidity >=0.6.0 <0.8.0;




/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * 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 {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @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 {_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) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

    /**
     * @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 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 {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _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 {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _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 {
        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 {
        emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);
        _roles[role].adminRole = adminRole;
    }

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

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

// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol



pragma solidity >=0.6.0 <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: openzeppelin-solidity/contracts/math/SafeMath.sol



pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

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

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

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

        return c;
    }

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

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

        return c;
    }

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

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

// File: openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol



pragma solidity >=0.6.0 <0.8.0;




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

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

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

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

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

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

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

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

// File: original_contracts/routers/IRouter.sol

pragma solidity 0.7.5;

interface IRouter {

    /**
    * @dev Certain routers/exchanges needs to be initialized.
    * This method will be called from Augustus
    */
    function initialize(bytes calldata data) external;

    /**
    * @dev Returns unique identifier for the router
    */
    function getKey() external pure returns(bytes32);

    event Swapped(
        bytes16 uuid,
        address initiator,
        address indexed beneficiary,
        address indexed srcToken,
        address indexed destToken,
        uint256 srcAmount,
        uint256 receivedAmount,
        uint256 expectedAmount
    );

    event Bought(
        bytes16 uuid,
        address initiator,
        address indexed beneficiary,
        address indexed srcToken,
        address indexed destToken,
        uint256 srcAmount,
        uint256 receivedAmount
    );

    event FeeTaken(
        uint256 fee,
        uint256 partnerShare,
        uint256 paraswapShare
    );
}

// File: original_contracts/ITokenTransferProxy.sol

pragma solidity 0.7.5;


interface ITokenTransferProxy {

    function transferFrom(
        address token,
        address from,
        address to,
        uint256 amount
    )
        external;
}

// File: original_contracts/lib/Utils.sol

pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;





interface IERC20Permit {
    function permit(address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
}

library Utils {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    address constant ETH_ADDRESS = address(
        0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
    );
    
    uint256 constant MAX_UINT = type(uint256).max;

    /**
   * @param fromToken Address of the source token
   * @param fromAmount Amount of source tokens to be swapped
   * @param toAmount Minimum destination token amount expected out of this swap
   * @param expectedAmount Expected amount of destination tokens without slippage
   * @param beneficiary Beneficiary address
   * 0 then 100% will be transferred to beneficiary. Pass 10000 for 100%
   * @param path Route to be taken for this swap to take place

   */
    struct SellData {
        address fromToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address payable beneficiary;
        Utils.Path[] path;
        address payable partner;
        uint256 feePercent;
        bytes permit;
        uint256 deadline;
        bytes16 uuid;
    }

    struct MegaSwapSellData {
        address fromToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address payable beneficiary;
        Utils.MegaSwapPath[] path;
        address payable partner;
        uint256 feePercent;
        bytes permit;
        uint256 deadline;
        bytes16 uuid;
    }

    struct SimpleData {
        address fromToken;
        address toToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address[] callees;
        bytes exchangeData;
        uint256[] startIndexes;
        uint256[] values;
        address payable beneficiary;
        address payable partner;
        uint256 feePercent;
        bytes permit;
        uint256 deadline;
        bytes16 uuid;
    }

    struct Adapter {
        address payable adapter;
        uint256 percent;
        uint256 networkFee;
        Route[] route;
    }

    struct Route {
        uint256 index;//Adapter at which index needs to be used
        address targetExchange;
        uint percent;
        bytes payload;
        uint256 networkFee;//Network fee is associated with 0xv3 trades
    }

    struct MegaSwapPath {
        uint256 fromAmountPercent;
        Path[] path;
    }

    struct Path {
        address to;
        uint256 totalNetworkFee;//Network fee is associated with 0xv3 trades
        Adapter[] adapters;
    }

    function ethAddress() internal pure returns (address) {return ETH_ADDRESS;}

    function maxUint() internal pure returns (uint256) {return MAX_UINT;}

    function approve(
        address addressToApprove,
        address token,
        uint256 amount
    ) internal {
        if (token != ETH_ADDRESS) {
            IERC20 _token = IERC20(token);

            uint allowance = _token.allowance(address(this), addressToApprove);

            if (allowance < amount) {
                _token.safeApprove(addressToApprove, 0);
                _token.safeIncreaseAllowance(addressToApprove, MAX_UINT);
            }
        }
    }

    function transferTokens(
        address token,
        address payable destination,
        uint256 amount
    )
    internal
    {
        if (amount > 0) {
            if (token == ETH_ADDRESS) {
                (bool result, ) = destination.call{value: amount, gas: 10000}("");
                require(result, "Failed to transfer Ether");
            }
            else {
                IERC20(token).safeTransfer(destination, amount);
            }
        }

    }

    function tokenBalance(
        address token,
        address account
    )
    internal
    view
    returns (uint256)
    {
        if (token == ETH_ADDRESS) {
            return account.balance;
        } else {
            return IERC20(token).balanceOf(account);
        }
    }

    function permit(
        address token,
        bytes memory permit
    )
        internal
    {
        if (permit.length == 32 * 7) {
            (bool success,) = token.call(abi.encodePacked(IERC20Permit.permit.selector, permit));
            require(success, "Permit failed");
        }
    }

}

// File: original_contracts/adapters/IAdapter.sol

pragma solidity 0.7.5;



interface IAdapter {

    /**
    * @dev Certain adapters needs to be initialized.
    * This method will be called from Augustus
    */
    function initialize(bytes calldata data) external;

    /**
   * @dev The function which performs the swap on an exchange.
   * @param fromToken Address of the source token
   * @param toToken Address of the destination token
   * @param fromAmount Amount of source tokens to be swapped
   * @param networkFee Network fee to be used in this router
   * @param route Route to be followed
   */
    function swap(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        uint256 networkFee,
        Utils.Route[] calldata route
    )
        external
        payable;
}

// File: openzeppelin-solidity/contracts/access/Ownable.sol



pragma solidity >=0.6.0 <0.8.0;

/**
 * @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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(_owner == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

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

// File: original_contracts/TokenTransferProxy.sol

pragma solidity 0.7.5;







/**
* @dev Allows owner of the contract to transfer tokens on behalf of user.
* User will need to approve this contract to spend tokens on his/her behalf
* on Paraswap platform
*/
contract TokenTransferProxy is Ownable, ITokenTransferProxy {
    using SafeERC20 for IERC20;
    using Address for address;

    /**
    * @dev Allows owner of the contract to transfer tokens on user's behalf
    * @dev Swapper contract will be the owner of this contract
    * @param token Address of the token
    * @param from Address from which tokens will be transferred
    * @param to Receipent address of the tokens
    * @param amount Amount of tokens to transfer
    */
    function transferFrom(
        address token,
        address from,
        address to,
        uint256 amount
    )
        external
        override
        onlyOwner
    {   
        require(
            from == tx.origin ||
            from.isContract(),
            "Invalid from address"
        );
        
        IERC20(token).safeTransferFrom(from, to, amount);
    }
}

// File: original_contracts/AugustusStorage.sol

pragma solidity 0.7.5;


contract AugustusStorage {

    struct FeeStructure {
        uint256 partnerShare;
        bool noPositiveSlippage;
        bool positiveSlippageToUser;
        uint16 feePercent;
        string partnerId;
        bytes data;
    }

    ITokenTransferProxy internal tokenTransferProxy;
    address payable internal feeWallet;
    
    mapping(address => FeeStructure) internal registeredPartners;

    mapping (bytes4 => address) internal selectorVsRouter;
    mapping (bytes32 => bool) internal adapterInitialized;
    mapping (bytes32 => bytes) internal adapterVsData;

    mapping (bytes32 => bytes) internal routerData;
    mapping (bytes32 => bool) internal routerInitialized;


    bytes32 public constant WHITELISTED_ROLE = keccak256("WHITELISTED_ROLE");

    bytes32 public constant ROUTER_ROLE = keccak256("ROUTER_ROLE");

}

// File: original_contracts/AugustusSwapper.sol

pragma solidity 0.7.5;










contract AugustusSwapper is AugustusStorage, AccessControl {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    event AdapterInitialized(address indexed adapter);

    event RouterInitialized(address indexed router);

    /**
     * @dev Throws if called by any account other than the admin.
     */
    modifier onlyAdmin() {
        require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "caller is not the admin");
        _;
    }

    constructor(address payable _feeWallet) public {
        TokenTransferProxy lTokenTransferProxy = new TokenTransferProxy();
        tokenTransferProxy = ITokenTransferProxy(lTokenTransferProxy);
        feeWallet = _feeWallet;
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }
    
    receive () payable external {

    }

    fallback() external payable {
        bytes4 selector = msg.sig;
        //Figure out the router contract for the given function
        address implementation = getImplementation(selector);
        if (implementation == address(0)) {
            _revertWithData(
                abi.encodeWithSelector(
                    bytes4(keccak256("NotImplementedError(bytes4)")),
                    selector
                )
            );
        }

        //Delegate call to the router
        (bool success, bytes memory resultData) = implementation.delegatecall(msg.data);
        if (!success) {
            _revertWithData(resultData);
        }

        _returnWithData(resultData);
    }

    function initializeAdapter(address adapter, bytes calldata data) external onlyAdmin {

        require(
            hasRole(WHITELISTED_ROLE, adapter),
            "Exchange not whitelisted"
        );
        (bool success,) = adapter.delegatecall(abi.encodeWithSelector(IAdapter.initialize.selector, data));
        require(success, "Failed to initialize adapter");
        emit AdapterInitialized(adapter);
    }

    function initializeRouter(address router, bytes calldata data) external onlyAdmin {

        require(
            hasRole(ROUTER_ROLE, router),
            "Router not whitelisted"
        );
        (bool success,) = router.delegatecall(abi.encodeWithSelector(IRouter.initialize.selector, data));
        require(success, "Failed to initialize router");
        emit RouterInitialized(router);
    } 

    
    function getImplementation(bytes4 selector) public view returns(address) {
        return selectorVsRouter[selector];
    }

    function getVersion() external pure returns(string memory) {
        return "5.0.0";
    }

    function getPartnerFeeStructure(address partner) public view returns (FeeStructure memory) {
        return registeredPartners[partner];
    }

    function getFeeWallet() external view returns(address) {
        return feeWallet;
    }

    function setFeeWallet(address payable _feeWallet) external onlyAdmin {
        require(_feeWallet != address(0), "Invalid address");
        feeWallet = _feeWallet;
    }

    function registerPartner(
        address partner,
        uint256 _partnerShare,
        bool _noPositiveSlippage,
        bool _positiveSlippageToUser,
        uint16 _feePercent,
        string calldata partnerId,
        bytes calldata _data
    )
        external
        onlyAdmin
    {   
        require(partner != address(0), "Invalid partner");
        FeeStructure storage feeStructure = registeredPartners[partner];
        require(feeStructure.partnerShare == 0, "Already registered");
        require(_partnerShare > 0 && _partnerShare < 10000, "Invalid values");
        require(_feePercent <= 10000, "Invalid values");

        feeStructure.partnerShare = _partnerShare;
        feeStructure.noPositiveSlippage = _noPositiveSlippage;
        feeStructure.positiveSlippageToUser = _positiveSlippageToUser;
        feeStructure.partnerId = partnerId;
        feeStructure.feePercent = _feePercent;
        feeStructure.data = _data;
    }

    function setImplementation(bytes4 selector, address implementation) external onlyAdmin {
        require(
            hasRole(ROUTER_ROLE, implementation),
            "Router is not whitelisted"
        );
        selectorVsRouter[selector] = implementation;
    }

    /**
    * @dev Allows admin of the contract to transfer any tokens which are assigned to the contract
    * This method is for safety if by any chance tokens or ETHs are assigned to the contract by mistake
    * @dev token Address of the token to be transferred
    * @dev destination Recepient of the token
    * @dev amount Amount of tokens to be transferred
    */
    function transferTokens(
        address token,
        address payable destination,
        uint256 amount
    )
        external
        onlyAdmin
    {
        if (amount > 0) {
            if (token == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)) {
                (bool result, ) = destination.call{value: amount, gas: 10000}("");
                require(result, "Failed to transfer Ether");
            }
            else {
                IERC20(token).safeTransfer(destination, amount);
            }
        }
    }

      function isAdapterInitialized(bytes32 key) public view returns(bool) {
        return adapterInitialized[key];
    }

    function getAdapterData(bytes32 key) public view returns(bytes memory) {
        return adapterVsData[key];
    }

    function isRouterInitialized(bytes32 key) public view returns (bool) {
        return routerInitialized[key];
    }

    function getRouterData(bytes32 key) public view returns (bytes memory) {
        return routerData[key];
    }

    function getTokenTransferProxy() public view returns (address) {
        return address(tokenTransferProxy);
    }

    function _revertWithData(bytes memory data) private pure {
        assembly { revert(add(data, 32), mload(data)) }
    }

    function _returnWithData(bytes memory data) private pure {
        assembly { return(add(data, 32), mload(data)) }
    }

}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50600061001b61006a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061006e565b3390565b610a158061007d6000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806315dacbea14610051578063715018a6146100665780638da5cb5b1461006e578063f2fde38b1461008c575b600080fd5b61006461005f3660046106d0565b61009f565b005b6100646101a0565b61007661026b565b6040516100839190610756565b60405180910390f35b61006461009a3660046106b6565b610287565b6100a76103bd565b60005473ffffffffffffffffffffffffffffffffffffffff908116911614610104576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb906108ea565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831632148061014257506101428373ffffffffffffffffffffffffffffffffffffffff166103c1565b610178576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb906108b3565b61019a73ffffffffffffffffffffffffffffffffffffffff85168484846103cb565b50505050565b6101a86103bd565b60005473ffffffffffffffffffffffffffffffffffffffff9081169116146101fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb906108ea565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b61028f6103bd565b60005473ffffffffffffffffffffffffffffffffffffffff9081169116146102e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb906108ea565b73ffffffffffffffffffffffffffffffffffffffff8116610330576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb906107f9565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b3390565b803b15155b919050565b61019a846323b872dd60e01b8585856040516024016103ec93929190610777565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915260606104cb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166105249092919063ffffffff16565b80519091501561051f57808060200190518101906104e9919061071a565b61051f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb90610956565b505050565b6060610533848460008561053d565b90505b9392505050565b606082471015610579576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb90610856565b610582856103c1565b6105b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb9061091f565b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040516105e2919061073a565b60006040518083038185875af1925050503d806000811461061f576040519150601f19603f3d011682016040523d82523d6000602084013e610624565b606091505b509150915061063482828661063f565b979650505050505050565b6060831561064e575081610536565b82511561065e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb91906107a8565b803573ffffffffffffffffffffffffffffffffffffffff811681146103c657600080fd5b6000602082840312156106c7578081fd5b61053682610692565b600080600080608085870312156106e5578283fd5b6106ee85610692565b93506106fc60208601610692565b925061070a60408601610692565b9396929550929360600135925050565b60006020828403121561072b578081fd5b81518015158114610536578182fd5b6000825161074c8184602087016109b3565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b60006020825282518060208401526107c78160408501602087016109b3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526014908201527f496e76616c69642066726f6d2061646472657373000000000000000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60005b838110156109ce5781810151838201526020016109b6565b8381111561019a575050600091015256fea2646970667358221220a043bdd05a1c168f623a894430cb3a50964c5c00c776399fa2c32e4b6de6029a64736f6c63430007050033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806315dacbea14610051578063715018a6146100665780638da5cb5b1461006e578063f2fde38b1461008c575b600080fd5b61006461005f3660046106d0565b61009f565b005b6100646101a0565b61007661026b565b6040516100839190610756565b60405180910390f35b61006461009a3660046106b6565b610287565b6100a76103bd565b60005473ffffffffffffffffffffffffffffffffffffffff908116911614610104576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb906108ea565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831632148061014257506101428373ffffffffffffffffffffffffffffffffffffffff166103c1565b610178576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb906108b3565b61019a73ffffffffffffffffffffffffffffffffffffffff85168484846103cb565b50505050565b6101a86103bd565b60005473ffffffffffffffffffffffffffffffffffffffff9081169116146101fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb906108ea565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b61028f6103bd565b60005473ffffffffffffffffffffffffffffffffffffffff9081169116146102e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb906108ea565b73ffffffffffffffffffffffffffffffffffffffff8116610330576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb906107f9565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b3390565b803b15155b919050565b61019a846323b872dd60e01b8585856040516024016103ec93929190610777565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915260606104cb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166105249092919063ffffffff16565b80519091501561051f57808060200190518101906104e9919061071a565b61051f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb90610956565b505050565b6060610533848460008561053d565b90505b9392505050565b606082471015610579576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb90610856565b610582856103c1565b6105b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb9061091f565b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040516105e2919061073a565b60006040518083038185875af1925050503d806000811461061f576040519150601f19603f3d011682016040523d82523d6000602084013e610624565b606091505b509150915061063482828661063f565b979650505050505050565b6060831561064e575081610536565b82511561065e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fb91906107a8565b803573ffffffffffffffffffffffffffffffffffffffff811681146103c657600080fd5b6000602082840312156106c7578081fd5b61053682610692565b600080600080608085870312156106e5578283fd5b6106ee85610692565b93506106fc60208601610692565b925061070a60408601610692565b9396929550929360600135925050565b60006020828403121561072b578081fd5b81518015158114610536578182fd5b6000825161074c8184602087016109b3565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b60006020825282518060208401526107c78160408501602087016109b3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526014908201527f496e76616c69642066726f6d2061646472657373000000000000000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60005b838110156109ce5781810151838201526020016109b6565b8381111561019a575050600091015256fea2646970667358221220a043bdd05a1c168f623a894430cb3a50964c5c00c776399fa2c32e4b6de6029a64736f6c63430007050033

Deployed Bytecode Sourcemap

46630:894:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;47127:394;;;;;;:::i;:::-;;:::i;:::-;;45799:148;;;:::i;45157:79::-;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;46102:244;;;;;;:::i;:::-;;:::i;47127:394::-;45379:12;:10;:12::i;:::-;45369:6;;:22;:6;;;:22;;;45361:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;47345:17:::1;::::0;::::1;47353:9;47345:17;::::0;:51:::1;;;47379:17;:4;:15;;;:17::i;:::-;47323:121;;;;;;;;;;;;:::i;:::-;47465:48;:30;::::0;::::1;47496:4:::0;47502:2;47506:6;47465:30:::1;:48::i;:::-;47127:394:::0;;;;:::o;45799:148::-;45379:12;:10;:12::i;:::-;45369:6;;:22;:6;;;:22;;;45361:67;;;;;;;;;;;;:::i;:::-;45906:1:::1;45890:6:::0;;45869:40:::1;::::0;::::1;45890:6:::0;;::::1;::::0;45869:40:::1;::::0;45906:1;;45869:40:::1;45937:1;45920:19:::0;;;::::1;::::0;;45799:148::o;45157:79::-;45195:7;45222:6;;;45157:79;:::o;46102:244::-;45379:12;:10;:12::i;:::-;45369:6;;:22;:6;;;:22;;;45361:67;;;;;;;;;;;;:::i;:::-;46191:22:::1;::::0;::::1;46183:73;;;;;;;;;;;;:::i;:::-;46293:6;::::0;;46272:38:::1;::::0;::::1;::::0;;::::1;::::0;46293:6;::::1;::::0;46272:38:::1;::::0;::::1;46321:6;:17:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;46102:244::o;17367:106::-;17455:10;17367:106;:::o;10470:422::-;10837:20;;10876:8;;10470:422;;;;:::o;34365:205::-;34466:96;34486:5;34516:27;;;34545:4;34551:2;34555:5;34493:68;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;36909:23;36935:69;36963:4;36935:69;;;;;;;;;;;;;;;;;36943:5;36935:27;;;;:69;;;;;:::i;:::-;37019:17;;36909:95;;-1:-1:-1;37019:21:0;37015:224;;37161:10;37150:30;;;;;;;;;;;;:::i;:::-;37142:85;;;;;;;;;;;;:::i;:::-;36485:761;;;:::o;13388:195::-;13491:12;13523:52;13545:6;13553:4;13559:1;13562:12;13523:21;:52::i;:::-;13516:59;;13388:195;;;;;;:::o;14440:530::-;14567:12;14625:5;14600:21;:30;;14592:81;;;;;;;;;;;;:::i;:::-;14692:18;14703:6;14692:10;:18::i;:::-;14684:60;;;;;;;;;;;;:::i;:::-;14818:12;14832:23;14859:6;:11;;14879:5;14887:4;14859:33;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14817:75;;;;14910:52;14928:7;14937:10;14949:12;14910:17;:52::i;:::-;14903:59;14440:530;-1:-1:-1;;;;;;;14440:530:0:o;15976:742::-;16091:12;16120:7;16116:595;;;-1:-1:-1;16151:10:0;16144:17;;16116:595;16265:17;;:21;16261:439;;16528:10;16522:17;16589:15;16576:10;16572:2;16568:19;16561:44;16476:148;16671:12;16664:20;;;;;;;;;;;:::i;14:198:1:-;84:20;;144:42;133:54;;123:65;;113:2;;202:1;199;192:12;217:198;;329:2;317:9;308:7;304:23;300:32;297:2;;;350:6;342;335:22;297:2;378:31;399:9;378:31;:::i;420:419::-;;;;;583:3;571:9;562:7;558:23;554:33;551:2;;;605:6;597;590:22;551:2;633:31;654:9;633:31;:::i;:::-;623:41;;683:40;719:2;708:9;704:18;683:40;:::i;:::-;673:50;;742:40;778:2;767:9;763:18;742:40;:::i;:::-;541:298;;;;-1:-1:-1;732:50:1;;829:2;814:18;801:32;;-1:-1:-1;;541:298:1:o;844:297::-;;964:2;952:9;943:7;939:23;935:32;932:2;;;985:6;977;970:22;932:2;1022:9;1016:16;1075:5;1068:13;1061:21;1054:5;1051:32;1041:2;;1102:6;1094;1087:22;1146:274;;1313:6;1307:13;1329:53;1375:6;1370:3;1363:4;1355:6;1351:17;1329:53;:::i;:::-;1398:16;;;;;1283:137;-1:-1:-1;;1283:137:1:o;1425:226::-;1601:42;1589:55;;;;1571:74;;1559:2;1544:18;;1526:125::o;1656:398::-;1868:42;1937:15;;;1919:34;;1989:15;;;;1984:2;1969:18;;1962:43;2036:2;2021:18;;2014:34;;;;1846:2;1831:18;;1813:241::o;2059:442::-;;2208:2;2197:9;2190:21;2240:6;2234:13;2283:6;2278:2;2267:9;2263:18;2256:34;2299:66;2358:6;2353:2;2342:9;2338:18;2333:2;2325:6;2321:15;2299:66;:::i;:::-;2417:2;2405:15;2422:66;2401:88;2386:104;;;;2492:2;2382:113;;2180:321;-1:-1:-1;;2180:321:1:o;2506:402::-;2708:2;2690:21;;;2747:2;2727:18;;;2720:30;2786:34;2781:2;2766:18;;2759:62;2857:8;2852:2;2837:18;;2830:36;2898:3;2883:19;;2680:228::o;2913:402::-;3115:2;3097:21;;;3154:2;3134:18;;;3127:30;3193:34;3188:2;3173:18;;3166:62;3264:8;3259:2;3244:18;;3237:36;3305:3;3290:19;;3087:228::o;3320:344::-;3522:2;3504:21;;;3561:2;3541:18;;;3534:30;3600:22;3595:2;3580:18;;3573:50;3655:2;3640:18;;3494:170::o;3669:356::-;3871:2;3853:21;;;3890:18;;;3883:30;3949:34;3944:2;3929:18;;3922:62;4016:2;4001:18;;3843:182::o;4030:353::-;4232:2;4214:21;;;4271:2;4251:18;;;4244:30;4310:31;4305:2;4290:18;;4283:59;4374:2;4359:18;;4204:179::o;4388:406::-;4590:2;4572:21;;;4629:2;4609:18;;;4602:30;4668:34;4663:2;4648:18;;4641:62;4739:12;4734:2;4719:18;;4712:40;4784:3;4769:19;;4562:232::o;4799:258::-;4871:1;4881:113;4895:6;4892:1;4889:13;4881:113;;;4971:11;;;4965:18;4952:11;;;4945:39;4917:2;4910:10;4881:113;;;5012:6;5009:1;5006:13;5003:2;;;-1:-1:-1;;5047:1:1;5029:16;;5022:27;4852:205::o

Swarm Source

ipfs://a043bdd05a1c168f623a894430cb3a50964c5c00c776399fa2c32e4b6de6029a

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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