ETH Price: $3,391.03 (+1.84%)

Contract

0xA0d885316Be23dE8bB19E7C53F6d483279E3467D
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit122630432021-04-18 8:32:031350 days ago1618734723IN
0xA0d88531...279E3467D
0 ETH0.04058678127
Deposit122428132021-04-15 5:38:451354 days ago1618465125IN
0xA0d88531...279E3467D
0 ETH0.0253078386.29211469
Deposit122376442021-04-14 10:22:421354 days ago1618395762IN
0xA0d88531...279E3467D
0 ETH0.0255133587
Deposit121649712021-04-03 6:18:181366 days ago1617430698IN
0xA0d88531...279E3467D
0 ETH0.02991221102
Deposit121435162021-03-30 23:02:301369 days ago1617145350IN
0xA0d88531...279E3467D
0 ETH0.03289112125
Deposit121432482021-03-30 22:00:451369 days ago1617141645IN
0xA0d88531...279E3467D
0 ETH0.04105598140
Deposit121431422021-03-30 21:38:071369 days ago1617140287IN
0xA0d88531...279E3467D
0 ETH0.03362015136
Deposit121430392021-03-30 21:14:501369 days ago1617138890IN
0xA0d88531...279E3467D
0 ETH0.0069138
Deposit121086362021-03-25 14:30:551374 days ago1616682655IN
0xA0d88531...279E3467D
0 ETH0.07039032240
Deposit120802572021-03-21 5:27:031379 days ago1616304423IN
0xA0d88531...279E3467D
0 ETH0.00325593
Withdraw120640302021-03-18 17:33:581381 days ago1616088838IN
0xA0d88531...279E3467D
0 ETH0.04751395184
Deposit120639692021-03-18 17:19:121381 days ago1616087952IN
0xA0d88531...279E3467D
0 ETH0.05837917197
Deposit120172312021-03-11 12:16:191388 days ago1615464979IN
0xA0d88531...279E3467D
0 ETH0.0289727794
Deposit119863512021-03-06 17:48:001393 days ago1615052880IN
0xA0d88531...279E3467D
0 ETH0.0250431390
Deposit119776162021-03-05 9:57:211394 days ago1614938241IN
0xA0d88531...279E3467D
0 ETH0.03267142106
Withdraw119621272021-03-03 0:32:301397 days ago1614731550IN
0xA0d88531...279E3467D
0 ETH0.0201592279
Withdraw119497272021-03-01 2:43:501399 days ago1614566630IN
0xA0d88531...279E3467D
0 ETH0.0175305173
Deposit119496862021-03-01 2:35:181399 days ago1614566118IN
0xA0d88531...279E3467D
0 ETH0.0218845471
Withdraw119477902021-02-28 19:52:181399 days ago1614541938IN
0xA0d88531...279E3467D
0 ETH0.02716773106.48
Deposit119473032021-02-28 18:00:421399 days ago1614535242IN
0xA0d88531...279E3467D
0 ETH0.03196893109
Deposit119464662021-02-28 14:49:511399 days ago1614523791IN
0xA0d88531...279E3467D
0 ETH0.03050247104
Deposit119418492021-02-27 21:45:301400 days ago1614462330IN
0xA0d88531...279E3467D
0 ETH0.02610289
Withdraw119386712021-02-27 9:59:391400 days ago1614419979IN
0xA0d88531...279E3467D
0 ETH0.0224558488
Deposit119385802021-02-27 9:37:501400 days ago1614418670IN
0xA0d88531...279E3467D
0 ETH0.0258097888
Deposit119301712021-02-26 2:36:581402 days ago1614307018IN
0xA0d88531...279E3467D
0 ETH0.03723906127
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
P1CurrencyConverterProxy

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion, Apache-2.0 license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-06-08
*/

/*

    Copyright 2020 dYdX Trading Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

*/

// File: @openzeppelin/contracts/token/ERC20/IERC20.sol

pragma solidity 0.5.16;
pragma experimental ABIEncoderV2;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP. Does not include
 * the optional functions; to access them see {ERC20Detailed}.
 */
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/contracts/math/SafeMath.sol

/**
 * @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.
     *
     * _Available since v2.4.0._
     */
    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.
     *
     * _Available since v2.4.0._
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        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.
     *
     * _Available since v2.4.0._
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

// File: @openzeppelin/contracts/utils/Address.sol

/**
 * @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) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

    /**
     * @dev Converts an `address` into `address payable`. Note that this is
     * simply a type cast: the actual underlying value is not changed.
     *
     * _Available since v2.4.0._
     */
    function toPayable(address account) internal pure returns (address payable) {
        return address(uint160(account));
    }

    /**
     * @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].
     *
     * _Available since v2.4.0._
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

// File: @openzeppelin/contracts/token/ERC20/SafeERC20.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 ERC20;` 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));
    }

    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.

        // A Solidity high level call has three parts:
        //  1. The target address is checked to verify it contains contract code
        //  2. The call itself is made, and success asserted
        //  3. The return value is decoded, which in turn checks the size of the returned data.
        // solhint-disable-next-line max-line-length
        require(address(token).isContract(), "SafeERC20: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "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: contracts/external/I_ExchangeWrapper.sol

/**
 * @title I_ExchangeWrapper
 * @author dYdX
 *
 * @notice Interface for exchange wrappers, used to trade ERC20 tokens.
 */
interface I_ExchangeWrapper {

    // ============ Public Functions ============

    /**
     * Exchange some amount of takerToken for makerToken.
     *
     * @param  tradeOriginator      Address of the initiator of the trade (however, this value
     *                              cannot always be trusted as it is set at the discretion of the
     *                              msg.sender)
     * @param  receiver             Address to set allowance on once the trade has completed
     * @param  makerToken           Address of makerToken, the token to receive
     * @param  takerToken           Address of takerToken, the token to pay
     * @param  requestedFillAmount  Amount of takerToken being paid
     * @param  orderData            Arbitrary bytes data for any information to pass to the exchange
     * @return                      The amount of makerToken received
     */
    function exchange(
        address tradeOriginator,
        address receiver,
        address makerToken,
        address takerToken,
        uint256 requestedFillAmount,
        bytes calldata orderData
    )
        external
        returns (uint256);

    /**
     * Get amount of takerToken required to buy a certain amount of makerToken for a given trade.
     * Should match the takerToken amount used in exchangeForAmount. If the order cannot provide
     * exactly desiredMakerToken, then it must return the price to buy the minimum amount greater
     * than desiredMakerToken
     *
     * @param  makerToken         Address of makerToken, the token to receive
     * @param  takerToken         Address of takerToken, the token to pay
     * @param  desiredMakerToken  Amount of makerToken requested
     * @param  orderData          Arbitrary bytes data for any information to pass to the exchange
     * @return                    Amount of takerToken the needed to complete the exchange
     */
    function getExchangeCost(
        address makerToken,
        address takerToken,
        uint256 desiredMakerToken,
        bytes calldata orderData
    )
        external
        view
        returns (uint256);
}

// File: contracts/protocol/v1/lib/P1Types.sol

/**
 * @title P1Types
 * @author dYdX
 *
 * @dev Library for common types used in PerpetualV1 contracts.
 */
library P1Types {
    // ============ Structs ============

    /**
     * @dev Used to represent the global index and each account's cached index.
     *  Used to settle funding paymennts on a per-account basis.
     */
    struct Index {
        uint32 timestamp;
        bool isPositive;
        uint128 value;
    }

    /**
     * @dev Used to track the signed margin balance and position balance values for each account.
     */
    struct Balance {
        bool marginIsPositive;
        bool positionIsPositive;
        uint120 margin;
        uint120 position;
    }

    /**
     * @dev Used to cache commonly-used variables that are relatively gas-intensive to obtain.
     */
    struct Context {
        uint256 price;
        uint256 minCollateral;
        Index index;
    }

    /**
     * @dev Used by contracts implementing the I_P1Trader interface to return the result of a trade.
     */
    struct TradeResult {
        uint256 marginAmount;
        uint256 positionAmount;
        bool isBuy; // From taker's perspective.
        bytes32 traderFlags;
    }
}

// File: contracts/protocol/v1/intf/I_PerpetualV1.sol

/**
 * @title I_PerpetualV1
 * @author dYdX
 *
 * @notice Interface for PerpetualV1.
 */
interface I_PerpetualV1 {

    // ============ Structs ============

    struct TradeArg {
        uint256 takerIndex;
        uint256 makerIndex;
        address trader;
        bytes data;
    }

    // ============ State-Changing Functions ============

    /**
     * @notice Submits one or more trades between any number of accounts.
     *
     * @param  accounts  The sorted list of accounts that are involved in trades.
     * @param  trades    The list of trades to execute in-order.
     */
    function trade(
        address[] calldata accounts,
        TradeArg[] calldata trades
    )
        external;

    /**
     * @notice Withdraw the number of margin tokens equal to the value of the account at the time
     *  that final settlement occurred.
     */
    function withdrawFinalSettlement()
        external;

    /**
     * @notice Deposit some amount of margin tokens from the msg.sender into an account.
     *
     * @param  account  The account for which to credit the deposit.
     * @param  amount   the amount of tokens to deposit.
     */
    function deposit(
        address account,
        uint256 amount
    )
        external;

    /**
     * @notice Withdraw some amount of margin tokens from an account to a destination address.
     *
     * @param  account      The account for which to debit the withdrawal.
     * @param  destination  The address to which the tokens are transferred.
     * @param  amount       The amount of tokens to withdraw.
     */
    function withdraw(
        address account,
        address destination,
        uint256 amount
    )
        external;

    /**
     * @notice Grants or revokes permission for another account to perform certain actions on behalf
     *  of the sender.
     *
     * @param  operator  The account that is approved or disapproved.
     * @param  approved  True for approval, false for disapproval.
     */
    function setLocalOperator(
        address operator,
        bool approved
    )
        external;

    // ============ Account Getters ============

    /**
     * @notice Get the balance of an account, without accounting for changes in the index.
     *
     * @param  account  The address of the account to query the balances of.
     * @return          The balances of the account.
     */
    function getAccountBalance(
        address account
    )
        external
        view
        returns (P1Types.Balance memory);

    /**
     * @notice Gets the most recently cached index of an account.
     *
     * @param  account  The address of the account to query the index of.
     * @return          The index of the account.
     */
    function getAccountIndex(
        address account
    )
        external
        view
        returns (P1Types.Index memory);

    /**
     * @notice Gets the local operator status of an operator for a particular account.
     *
     * @param  account   The account to query the operator for.
     * @param  operator  The address of the operator to query the status of.
     * @return           True if the operator is a local operator of the account, false otherwise.
     */
    function getIsLocalOperator(
        address account,
        address operator
    )
        external
        view
        returns (bool);

    // ============ Global Getters ============

    /**
     * @notice Gets the global operator status of an address.
     *
     * @param  operator  The address of the operator to query the status of.
     * @return           True if the address is a global operator, false otherwise.
     */
    function getIsGlobalOperator(
        address operator
    )
        external
        view
        returns (bool);

    /**
     * @notice Gets the address of the ERC20 margin contract used for margin deposits.
     *
     * @return The address of the ERC20 token.
     */
    function getTokenContract()
        external
        view
        returns (address);

    /**
     * @notice Gets the current address of the price oracle contract.
     *
     * @return The address of the price oracle contract.
     */
    function getOracleContract()
        external
        view
        returns (address);

    /**
     * @notice Gets the current address of the funder contract.
     *
     * @return The address of the funder contract.
     */
    function getFunderContract()
        external
        view
        returns (address);

    /**
     * @notice Gets the most recently cached global index.
     *
     * @return The most recently cached global index.
     */
    function getGlobalIndex()
        external
        view
        returns (P1Types.Index memory);

    /**
     * @notice Gets minimum collateralization ratio of the protocol.
     *
     * @return The minimum-acceptable collateralization ratio, returned as a fixed-point number with
     *  18 decimals of precision.
     */
    function getMinCollateral()
        external
        view
        returns (uint256);

    /**
     * @notice Gets the status of whether final-settlement was initiated by the Admin.
     *
     * @return True if final-settlement was enabled, false otherwise.
     */
    function getFinalSettlementEnabled()
        external
        view
        returns (bool);

    // ============ Public Getters ============

    /**
     * @notice Gets whether an address has permissions to operate an account.
     *
     * @param  account   The account to query.
     * @param  operator  The address to query.
     * @return           True if the operator has permission to operate the account,
     *                   and false otherwise.
     */
    function hasAccountPermissions(
        address account,
        address operator
    )
        external
        view
        returns (bool);

    // ============ Authorized Getters ============

    /**
     * @notice Gets the price returned by the oracle.
     * @dev Only able to be called by global operators.
     *
     * @return The price returned by the current price oracle.
     */
    function getOraclePrice()
        external
        view
        returns (uint256);
}

// File: contracts/protocol/v1/proxies/P1CurrencyConverterProxy.sol

/**
 * @title P1CurrencyConverterProxy
 * @author dYdX
 *
 * @notice Proxy contract which executes a trade via an ExchangeWrapper before making a deposit
 *  or after making a withdrawal.
 */
contract P1CurrencyConverterProxy {
    using SafeERC20 for IERC20;

    // ============ Events ============

    event LogConvertedDeposit(
        address indexed account,
        address source,
        address perpetual,
        address exchangeWrapper,
        address tokenFrom,
        address tokenTo,
        uint256 tokenFromAmount,
        uint256 tokenToAmount
    );

    event LogConvertedWithdrawal(
        address indexed account,
        address destination,
        address perpetual,
        address exchangeWrapper,
        address tokenFrom,
        address tokenTo,
        uint256 tokenFromAmount,
        uint256 tokenToAmount
    );

    // ============ State-Changing Functions ============

    /**
     * @notice Sets the maximum allowance on the Perpetual contract. Must be called at least once
     *  on a given Perpetual before deposits can be made.
     * @dev Cannot be run in the constructor due to technical restrictions in Solidity.
     */
    function approveMaximumOnPerpetual(
        address perpetual
    )
        external
    {
        IERC20 tokenContract = IERC20(I_PerpetualV1(perpetual).getTokenContract());

        // safeApprove requires unsetting the allowance first.
        tokenContract.safeApprove(perpetual, 0);

        // Set the allowance to the highest possible value.
        tokenContract.safeApprove(perpetual, uint256(-1));
    }

    /**
     * @notice Make a margin deposit to a Perpetual, after converting funds to the margin currency.
     *  Funds will be withdrawn from the sender and deposited into the specified account.
     * @dev Emits LogConvertedDeposit event.
     *
     * @param  account          The account for which to credit the deposit.
     * @param  perpetual        The PerpetualV1 contract to deposit to.
     * @param  exchangeWrapper  The ExchangeWrapper contract to trade with.
     * @param  tokenFrom        The token to convert from.
     * @param  tokenFromAmount  The amount of `tokenFrom` tokens to deposit.
     * @param  data             Trade parameters for the ExchangeWrapper.
     */
    function deposit(
        address account,
        address perpetual,
        address exchangeWrapper,
        address tokenFrom,
        uint256 tokenFromAmount,
        bytes calldata data
    )
        external
        returns (uint256)
    {
        I_PerpetualV1 perpetualContract = I_PerpetualV1(perpetual);
        address tokenTo = perpetualContract.getTokenContract();
        address self = address(this);

        // Send fromToken to the ExchangeWrapper.
        //
        // TODO: Take possible ERC20 fee into account.
        IERC20(tokenFrom).safeTransferFrom(
            msg.sender,
            exchangeWrapper,
            tokenFromAmount
        );

        // Convert fromToken to toToken on the ExchangeWrapper.
        I_ExchangeWrapper exchangeWrapperContract = I_ExchangeWrapper(exchangeWrapper);
        uint256 tokenToAmount = exchangeWrapperContract.exchange(
            msg.sender,
            self,
            tokenTo,
            tokenFrom,
            tokenFromAmount,
            data
        );

        // Receive toToken from the ExchangeWrapper.
        IERC20(tokenTo).safeTransferFrom(
            exchangeWrapper,
            self,
            tokenToAmount
        );

        // Deposit toToken to the Perpetual.
        perpetualContract.deposit(
            account,
            tokenToAmount
        );

        // Log the result.
        emit LogConvertedDeposit(
            account,
            msg.sender,
            perpetual,
            exchangeWrapper,
            tokenFrom,
            tokenTo,
            tokenFromAmount,
            tokenToAmount
        );

        return tokenToAmount;
    }

    /**
     * @notice Withdraw margin from a Perpetual, then convert the funds to another currency. Funds
     *  will be withdrawn from the specified account and transfered to the specified destination.
     * @dev Emits LogConvertedWithdrawal event.
     *
     * @param  account          The account to withdraw from.
     * @param  destination      The address to send the withdrawn funds to.
     * @param  perpetual        The PerpetualV1 contract to withdraw from to.
     * @param  exchangeWrapper  The ExchangeWrapper contract to trade with.
     * @param  tokenTo          The token to convert to.
     * @param  tokenFromAmount  The amount of `tokenFrom` tokens to withdraw.
     * @param  data             Trade parameters for the ExchangeWrapper.
     */
    function withdraw(
        address account,
        address destination,
        address perpetual,
        address exchangeWrapper,
        address tokenTo,
        uint256 tokenFromAmount,
        bytes calldata data
    )
        external
        returns (uint256)
    {
        I_PerpetualV1 perpetualContract = I_PerpetualV1(perpetual);
        address tokenFrom = perpetualContract.getTokenContract();
        address self = address(this);

        // Verify that the sender has permission to withdraw from the account.
        require(
            account == msg.sender || perpetualContract.hasAccountPermissions(account, msg.sender),
            "msg.sender cannot operate the account"
        );

        // Withdraw fromToken from the Perpetual.
        perpetualContract.withdraw(
            account,
            exchangeWrapper,
            tokenFromAmount
        );

        // Convert fromToken to toToken on the ExchangeWrapper.
        I_ExchangeWrapper exchangeWrapperContract = I_ExchangeWrapper(exchangeWrapper);
        uint256 tokenToAmount = exchangeWrapperContract.exchange(
            msg.sender,
            self,
            tokenTo,
            tokenFrom,
            tokenFromAmount,
            data
        );

        // Transfer toToken from the ExchangeWrapper to the destination address.
        IERC20(tokenTo).safeTransferFrom(
            exchangeWrapper,
            destination,
            tokenToAmount
        );

        // Log the result.
        emit LogConvertedWithdrawal(
            account,
            destination,
            perpetual,
            exchangeWrapper,
            tokenFrom,
            tokenTo,
            tokenFromAmount,
            tokenToAmount
        );

        return tokenToAmount;
    }
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"source","type":"address"},{"indexed":false,"internalType":"address","name":"perpetual","type":"address"},{"indexed":false,"internalType":"address","name":"exchangeWrapper","type":"address"},{"indexed":false,"internalType":"address","name":"tokenFrom","type":"address"},{"indexed":false,"internalType":"address","name":"tokenTo","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenFromAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenToAmount","type":"uint256"}],"name":"LogConvertedDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"address","name":"perpetual","type":"address"},{"indexed":false,"internalType":"address","name":"exchangeWrapper","type":"address"},{"indexed":false,"internalType":"address","name":"tokenFrom","type":"address"},{"indexed":false,"internalType":"address","name":"tokenTo","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenFromAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenToAmount","type":"uint256"}],"name":"LogConvertedWithdrawal","type":"event"},{"constant":false,"inputs":[{"internalType":"address","name":"perpetual","type":"address"}],"name":"approveMaximumOnPerpetual","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"perpetual","type":"address"},{"internalType":"address","name":"exchangeWrapper","type":"address"},{"internalType":"address","name":"tokenFrom","type":"address"},{"internalType":"uint256","name":"tokenFromAmount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"destination","type":"address"},{"internalType":"address","name":"perpetual","type":"address"},{"internalType":"address","name":"exchangeWrapper","type":"address"},{"internalType":"address","name":"tokenTo","type":"address"},{"internalType":"uint256","name":"tokenFromAmount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506111cd806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80635b3901f614610046578063b13b8d0a1461006f578063fe0f885814610082575b600080fd5b610059610054366004610b58565b610097565b60405161006691906110a4565b60405180910390f35b61005961007d366004610c10565b6103df565b610095610090366004610b1c565b61062f565b005b60008087905060008173ffffffffffffffffffffffffffffffffffffffff166328b7bede6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100e557600080fd5b505afa1580156100f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061011d9190810190610b3a565b90503073ffffffffffffffffffffffffffffffffffffffff8c163314806101e357506040517f84ea286200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906384ea286290610193908f903390600401610fe8565b60206040518083038186803b1580156101ab57600080fd5b505afa1580156101bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506101e39190810190610cb5565b610222576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021990611054565b60405180910390fd5b6040517fd9caed1200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063d9caed1290610278908f908d908c90600401611011565b600060405180830381600087803b15801561029257600080fd5b505af11580156102a6573d6000803e3d6000fd5b50505050600089905060008173ffffffffffffffffffffffffffffffffffffffff16637d98ebac33858d888e8e8e6040518863ffffffff1660e01b81526004016102f69796959493929190610f6b565b602060405180830381600087803b15801561031057600080fd5b505af1158015610324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103489190810190610cd3565b905061037273ffffffffffffffffffffffffffffffffffffffff8b168c8f8463ffffffff61072416565b8d73ffffffffffffffffffffffffffffffffffffffff167f80ff1ccb23c5efa0821893d4924d2f4abe9ddf65316ec0f50606c0642f1d13678e8e8e888f8f886040516103c49796959493929190611003565b60405180910390a29450505050505b98975050505050505050565b60008087905060008173ffffffffffffffffffffffffffffffffffffffff166328b7bede6040518163ffffffff1660e01b815260040160206040518083038186803b15801561042d57600080fd5b505afa158015610441573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506104659190810190610b3a565b90503061049073ffffffffffffffffffffffffffffffffffffffff8916338b8a63ffffffff61072416565b600089905060008173ffffffffffffffffffffffffffffffffffffffff16637d98ebac3385878e8e8e8e6040518863ffffffff1660e01b81526004016104dc9796959493929190610f6b565b602060405180830381600087803b1580156104f657600080fd5b505af115801561050a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061052e9190810190610cd3565b905061055873ffffffffffffffffffffffffffffffffffffffff85168c858463ffffffff61072416565b8473ffffffffffffffffffffffffffffffffffffffff166347e7ef248e836040518363ffffffff1660e01b8152600401610593929190611039565b600060405180830381600087803b1580156105ad57600080fd5b505af11580156105c1573d6000803e3d6000fd5b505050508c73ffffffffffffffffffffffffffffffffffffffff167fb82979dec0b27d2050fc2ec2e499e291b29e8ce7d4cfd1f711b2557d5e609c08338e8e8e898f886040516106179796959493929190610f0f565b60405180910390a29c9b505050505050505050505050565b60008173ffffffffffffffffffffffffffffffffffffffff166328b7bede6040518163ffffffff1660e01b815260040160206040518083038186803b15801561067757600080fd5b505afa15801561068b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106af9190810190610b3a565b90506106d973ffffffffffffffffffffffffffffffffffffffff821683600063ffffffff6107e916565b61072073ffffffffffffffffffffffffffffffffffffffff8216837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff63ffffffff6107e916565b5050565b6040516107e39085907f23b872dd000000000000000000000000000000000000000000000000000000009061076190879087908790602401611011565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261090d565b50505050565b80158061089757506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063dd62ed3e906108459030908690600401610fcd565b60206040518083038186803b15801561085d57600080fd5b505afa158015610871573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108959190810190610cd3565b155b6108cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021990611084565b6040516109089084907f095ea7b300000000000000000000000000000000000000000000000000000000906107619086908690602401611039565b505050565b61092c8273ffffffffffffffffffffffffffffffffffffffff16610a5a565b610962576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021990611094565b600060608373ffffffffffffffffffffffffffffffffffffffff168360405161098b9190610efc565b6000604051808303816000865af19150503d80600081146109c8576040519150601f19603f3d011682016040523d82523d6000602084013e6109cd565b606091505b509150915081610a09576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021990611064565b8051156107e35780806020019051610a249190810190610cb5565b6107e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021990611074565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590610a8e57508115155b949350505050565b8035610aa181611161565b92915050565b8051610aa181611161565b8051610aa181611178565b60008083601f840112610acf57600080fd5b50813567ffffffffffffffff811115610ae757600080fd5b602083019150836001820283011115610aff57600080fd5b9250929050565b8035610aa181611181565b8051610aa181611181565b600060208284031215610b2e57600080fd5b6000610a8e8484610a96565b600060208284031215610b4c57600080fd5b6000610a8e8484610aa7565b60008060008060008060008060e0898b031215610b7457600080fd5b6000610b808b8b610a96565b9850506020610b918b828c01610a96565b9750506040610ba28b828c01610a96565b9650506060610bb38b828c01610a96565b9550506080610bc48b828c01610a96565b94505060a0610bd58b828c01610b06565b93505060c089013567ffffffffffffffff811115610bf257600080fd5b610bfe8b828c01610abd565b92509250509295985092959890939650565b600080600080600080600060c0888a031215610c2b57600080fd5b6000610c378a8a610a96565b9750506020610c488a828b01610a96565b9650506040610c598a828b01610a96565b9550506060610c6a8a828b01610a96565b9450506080610c7b8a828b01610b06565b93505060a088013567ffffffffffffffff811115610c9857600080fd5b610ca48a828b01610abd565b925092505092959891949750929550565b600060208284031215610cc757600080fd5b6000610a8e8484610ab2565b600060208284031215610ce557600080fd5b6000610a8e8484610b11565b610cfa816110f0565b82525050565b610cfa816110c4565b6000610d1583856110b6565b9350610d22838584611101565b610d2b83611139565b9093019392505050565b6000610d40826110b2565b610d4a81856110bf565b9350610d5a81856020860161110d565b9290920192915050565b6000610d716025836110b6565b7f6d73672e73656e6465722063616e6e6f74206f7065726174652074686520616381527f636f756e74000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000610dd06020836110b6565b7f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815260200192915050565b6000610e09602a836110b6565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f74207375636365656400000000000000000000000000000000000000000000602082015260400192915050565b6000610e686036836110b6565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f81527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000602082015260400192915050565b6000610ec7601f836110b6565b7f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400815260200192915050565b610cfa816110ed565b6000610f088284610d35565b9392505050565b60e08101610f1d828a610cf1565b610f2a6020830189610d00565b610f376040830188610d00565b610f446060830187610d00565b610f516080830186610d00565b610f5e60a0830185610ef3565b6103d360c0830184610ef3565b60c08101610f79828a610cf1565b610f866020830189610d00565b610f936040830188610d00565b610fa06060830187610d00565b610fad6080830186610ef3565b81810360a0830152610fc0818486610d09565b9998505050505050505050565b60408101610fdb8285610d00565b610f086020830184610d00565b60408101610ff68285610d00565b610f086020830184610cf1565b60e08101610f1d828a610d00565b6060810161101f8286610d00565b61102c6020830185610d00565b610a8e6040830184610ef3565b604081016110478285610d00565b610f086020830184610ef3565b60208082528101610aa181610d64565b60208082528101610aa181610dc3565b60208082528101610aa181610dfc565b60208082528101610aa181610e5b565b60208082528101610aa181610eba565b60208101610aa18284610ef3565b5190565b90815260200190565b919050565b6000610aa1826110d4565b151590565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b6000610aa1826000610aa1826110c4565b82818337506000910152565b60005b83811015611128578181015183820152602001611110565b838111156107e35750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b61116a816110c4565b811461117557600080fd5b50565b61116a816110cf565b61116a816110ed56fea365627a7a723158202177c5d49d10bd26f74b8c722f721dbaf1a9be5d638a651fad04cea31cbb9a376c6578706572696d656e74616cf564736f6c63430005100040

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100415760003560e01c80635b3901f614610046578063b13b8d0a1461006f578063fe0f885814610082575b600080fd5b610059610054366004610b58565b610097565b60405161006691906110a4565b60405180910390f35b61005961007d366004610c10565b6103df565b610095610090366004610b1c565b61062f565b005b60008087905060008173ffffffffffffffffffffffffffffffffffffffff166328b7bede6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100e557600080fd5b505afa1580156100f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061011d9190810190610b3a565b90503073ffffffffffffffffffffffffffffffffffffffff8c163314806101e357506040517f84ea286200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906384ea286290610193908f903390600401610fe8565b60206040518083038186803b1580156101ab57600080fd5b505afa1580156101bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506101e39190810190610cb5565b610222576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021990611054565b60405180910390fd5b6040517fd9caed1200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063d9caed1290610278908f908d908c90600401611011565b600060405180830381600087803b15801561029257600080fd5b505af11580156102a6573d6000803e3d6000fd5b50505050600089905060008173ffffffffffffffffffffffffffffffffffffffff16637d98ebac33858d888e8e8e6040518863ffffffff1660e01b81526004016102f69796959493929190610f6b565b602060405180830381600087803b15801561031057600080fd5b505af1158015610324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103489190810190610cd3565b905061037273ffffffffffffffffffffffffffffffffffffffff8b168c8f8463ffffffff61072416565b8d73ffffffffffffffffffffffffffffffffffffffff167f80ff1ccb23c5efa0821893d4924d2f4abe9ddf65316ec0f50606c0642f1d13678e8e8e888f8f886040516103c49796959493929190611003565b60405180910390a29450505050505b98975050505050505050565b60008087905060008173ffffffffffffffffffffffffffffffffffffffff166328b7bede6040518163ffffffff1660e01b815260040160206040518083038186803b15801561042d57600080fd5b505afa158015610441573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506104659190810190610b3a565b90503061049073ffffffffffffffffffffffffffffffffffffffff8916338b8a63ffffffff61072416565b600089905060008173ffffffffffffffffffffffffffffffffffffffff16637d98ebac3385878e8e8e8e6040518863ffffffff1660e01b81526004016104dc9796959493929190610f6b565b602060405180830381600087803b1580156104f657600080fd5b505af115801561050a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061052e9190810190610cd3565b905061055873ffffffffffffffffffffffffffffffffffffffff85168c858463ffffffff61072416565b8473ffffffffffffffffffffffffffffffffffffffff166347e7ef248e836040518363ffffffff1660e01b8152600401610593929190611039565b600060405180830381600087803b1580156105ad57600080fd5b505af11580156105c1573d6000803e3d6000fd5b505050508c73ffffffffffffffffffffffffffffffffffffffff167fb82979dec0b27d2050fc2ec2e499e291b29e8ce7d4cfd1f711b2557d5e609c08338e8e8e898f886040516106179796959493929190610f0f565b60405180910390a29c9b505050505050505050505050565b60008173ffffffffffffffffffffffffffffffffffffffff166328b7bede6040518163ffffffff1660e01b815260040160206040518083038186803b15801561067757600080fd5b505afa15801561068b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106af9190810190610b3a565b90506106d973ffffffffffffffffffffffffffffffffffffffff821683600063ffffffff6107e916565b61072073ffffffffffffffffffffffffffffffffffffffff8216837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff63ffffffff6107e916565b5050565b6040516107e39085907f23b872dd000000000000000000000000000000000000000000000000000000009061076190879087908790602401611011565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261090d565b50505050565b80158061089757506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063dd62ed3e906108459030908690600401610fcd565b60206040518083038186803b15801561085d57600080fd5b505afa158015610871573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108959190810190610cd3565b155b6108cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021990611084565b6040516109089084907f095ea7b300000000000000000000000000000000000000000000000000000000906107619086908690602401611039565b505050565b61092c8273ffffffffffffffffffffffffffffffffffffffff16610a5a565b610962576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021990611094565b600060608373ffffffffffffffffffffffffffffffffffffffff168360405161098b9190610efc565b6000604051808303816000865af19150503d80600081146109c8576040519150601f19603f3d011682016040523d82523d6000602084013e6109cd565b606091505b509150915081610a09576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021990611064565b8051156107e35780806020019051610a249190810190610cb5565b6107e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021990611074565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590610a8e57508115155b949350505050565b8035610aa181611161565b92915050565b8051610aa181611161565b8051610aa181611178565b60008083601f840112610acf57600080fd5b50813567ffffffffffffffff811115610ae757600080fd5b602083019150836001820283011115610aff57600080fd5b9250929050565b8035610aa181611181565b8051610aa181611181565b600060208284031215610b2e57600080fd5b6000610a8e8484610a96565b600060208284031215610b4c57600080fd5b6000610a8e8484610aa7565b60008060008060008060008060e0898b031215610b7457600080fd5b6000610b808b8b610a96565b9850506020610b918b828c01610a96565b9750506040610ba28b828c01610a96565b9650506060610bb38b828c01610a96565b9550506080610bc48b828c01610a96565b94505060a0610bd58b828c01610b06565b93505060c089013567ffffffffffffffff811115610bf257600080fd5b610bfe8b828c01610abd565b92509250509295985092959890939650565b600080600080600080600060c0888a031215610c2b57600080fd5b6000610c378a8a610a96565b9750506020610c488a828b01610a96565b9650506040610c598a828b01610a96565b9550506060610c6a8a828b01610a96565b9450506080610c7b8a828b01610b06565b93505060a088013567ffffffffffffffff811115610c9857600080fd5b610ca48a828b01610abd565b925092505092959891949750929550565b600060208284031215610cc757600080fd5b6000610a8e8484610ab2565b600060208284031215610ce557600080fd5b6000610a8e8484610b11565b610cfa816110f0565b82525050565b610cfa816110c4565b6000610d1583856110b6565b9350610d22838584611101565b610d2b83611139565b9093019392505050565b6000610d40826110b2565b610d4a81856110bf565b9350610d5a81856020860161110d565b9290920192915050565b6000610d716025836110b6565b7f6d73672e73656e6465722063616e6e6f74206f7065726174652074686520616381527f636f756e74000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000610dd06020836110b6565b7f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815260200192915050565b6000610e09602a836110b6565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f74207375636365656400000000000000000000000000000000000000000000602082015260400192915050565b6000610e686036836110b6565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f81527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000602082015260400192915050565b6000610ec7601f836110b6565b7f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400815260200192915050565b610cfa816110ed565b6000610f088284610d35565b9392505050565b60e08101610f1d828a610cf1565b610f2a6020830189610d00565b610f376040830188610d00565b610f446060830187610d00565b610f516080830186610d00565b610f5e60a0830185610ef3565b6103d360c0830184610ef3565b60c08101610f79828a610cf1565b610f866020830189610d00565b610f936040830188610d00565b610fa06060830187610d00565b610fad6080830186610ef3565b81810360a0830152610fc0818486610d09565b9998505050505050505050565b60408101610fdb8285610d00565b610f086020830184610d00565b60408101610ff68285610d00565b610f086020830184610cf1565b60e08101610f1d828a610d00565b6060810161101f8286610d00565b61102c6020830185610d00565b610a8e6040830184610ef3565b604081016110478285610d00565b610f086020830184610ef3565b60208082528101610aa181610d64565b60208082528101610aa181610dc3565b60208082528101610aa181610dfc565b60208082528101610aa181610e5b565b60208082528101610aa181610eba565b60208101610aa18284610ef3565b5190565b90815260200190565b919050565b6000610aa1826110d4565b151590565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b6000610aa1826000610aa1826110c4565b82818337506000910152565b60005b83811015611128578181015183820152602001611110565b838111156107e35750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b61116a816110c4565b811461117557600080fd5b50565b61116a816110cf565b61116a816110ed56fea365627a7a723158202177c5d49d10bd26f74b8c722f721dbaf1a9be5d638a651fad04cea31cbb9a376c6578706572696d656e74616cf564736f6c63430005100040

Deployed Bytecode Sourcemap

26246:6491:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26246:6491:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30907:1827;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;28401:1716;;;;;;;;;:::i;27263:425::-;;;;;;;;;:::i;:::-;;30907:1827;31176:7;31201:31;31249:9;31201:58;;31270:17;31290;:34;;;:36;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;31290:36:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;31290:36:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;31290:36:0;;;;;;;;;31270:56;-1:-1:-1;31360:4:0;31480:21;;;31491:10;31480:21;;:85;;-1:-1:-1;31505:60:0;;;;;:39;;;;;;:60;;31545:7;;31554:10;;31505:60;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;31505:60:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;31505:60:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;31505:60:0;;;;;;;;;31458:172;;;;;;;;;;;;;;;;;;;;;;31694:119;;;;;:26;;;;;;:119;;31735:7;;31757:15;;31787;;31694:119;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;31694:119:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;31694:119:0;;;;31891:41;31953:15;31891:78;;31980:21;32004:23;:32;;;32051:10;32076:4;32095:7;32117:9;32141:15;32171:4;;32004:182;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;32004:182:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;32004:182:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;32004:182:0;;;;;;;;;31980:206;-1:-1:-1;32281:127:0;:32;;;32328:15;32358:11;31980:206;32281:127;:32;:127;:::i;:::-;32491:7;32454:239;;;32513:11;32539:9;32563:15;32593:9;32617:7;32639:15;32669:13;32454:239;;;;;;;;;;;;;;;;;;;;;32713:13;-1:-1:-1;;;;;30907:1827:0;;;;;;;;;;;:::o;28401:1716::-;28641:7;28666:31;28714:9;28666:58;;28735:15;28753:17;:34;;;:36;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;28753:36:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;28753:36:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;28753:36:0;;;;;;;;;28735:54;-1:-1:-1;28823:4:0;28960:130;:34;;;29009:10;29034:15;29064;28960:130;:34;:130;:::i;:::-;29168:41;29230:15;29168:78;;29257:21;29281:23;:32;;;29328:10;29353:4;29372:7;29394:9;29418:15;29448:4;;29281:182;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;29281:182:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;29281:182:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;29281:182:0;;;;;;;;;29257:206;-1:-1:-1;29530:120:0;:32;;;29577:15;29607:4;29257:206;29530:120;:32;:120;:::i;:::-;29709:17;:25;;;29749:7;29771:13;29709:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;29709:86:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;29709:86:0;;;;29875:7;29841:235;;;29897:10;29922:9;29946:15;29976:9;30000:7;30022:15;30052:13;29841:235;;;;;;;;;;;;;;;;;;;;;30096:13;28401:1716;-1:-1:-1;;;;;;;;;;;;28401:1716:0:o;27263:425::-;27367:20;27411:9;27397:41;;;:43;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;27397:43:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;27397:43:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;27397:43:0;;;;;;;;;27367:74;-1:-1:-1;27518:39:0;:25;;;27544:9;27555:1;27518:39;:25;:39;:::i;:::-;27631:49;:25;;;27657:9;27676:2;27631:49;:25;:49;:::i;:::-;27263:425;;:::o;12876:204::-;13003:68;;12977:95;;12996:5;;13026:27;;13003:68;;13055:4;;13061:2;;13065:5;;13003:68;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;13003:68:0;;;49:4:-1;25:18;;61:17;;13003:68:0;182:15:-1;13003:68:0;;;;179:29:-1;;;;160:49;;;12977:18:0;:95::i;:::-;12876:204;;;;:::o;13088:621::-;13458:10;;;13457:62;;-1:-1:-1;13474:39:0;;;;;:15;;;;;;:39;;13498:4;;13505:7;;13474:39;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;13474:39:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;13474:39:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;13474:39:0;;;;;;;;;:44;13457:62;13449:152;;;;;;;;;;;;;;13638:62;;13612:89;;13631:5;;13661:22;;13638:62;;13685:7;;13694:5;;13638:62;;;;13612:89;13088:621;;;:::o;14731:1114::-;15335:27;15343:5;15335:25;;;:27::i;:::-;15327:71;;;;;;;;;;;;;;15472:12;15486:23;15521:5;15513:19;;15533:4;15513:25;;;;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;15471:67:0;;;;15557:7;15549:52;;;;;;;;;;;;;;15618:17;;:21;15614:224;;15760:10;15749:30;;;;;;;;;;;;;;15741:85;;;;;;;;;;;;;9754:619;9814:4;10282:20;;10125:66;10322:23;;;;;;:42;;-1:-1:-1;10349:15:0;;;10322:42;10314:51;9754:619;-1:-1:-1;;;;9754:619:0:o;5:130:-1:-;72:20;;97:33;72:20;97:33;;;57:78;;;;;142:134;220:13;;238:33;220:13;238:33;;283:128;358:13;;376:30;358:13;376:30;;432:336;;;546:3;539:4;531:6;527:17;523:27;513:2;;564:1;561;554:12;513:2;-1:-1;584:20;;624:18;613:30;;610:2;;;656:1;653;646:12;610:2;690:4;682:6;678:17;666:29;;741:3;733:4;725:6;721:17;711:8;707:32;704:41;701:2;;;758:1;755;748:12;701:2;506:262;;;;;;776:130;843:20;;868:33;843:20;868:33;;913:134;991:13;;1009:33;991:13;1009:33;;1054:241;;1158:2;1146:9;1137:7;1133:23;1129:32;1126:2;;;1174:1;1171;1164:12;1126:2;1209:1;1226:53;1271:7;1251:9;1226:53;;1302:263;;1417:2;1405:9;1396:7;1392:23;1388:32;1385:2;;;1433:1;1430;1423:12;1385:2;1468:1;1485:64;1541:7;1521:9;1485:64;;1572:1119;;;;;;;;;1797:3;1785:9;1776:7;1772:23;1768:33;1765:2;;;1814:1;1811;1804:12;1765:2;1849:1;1866:53;1911:7;1891:9;1866:53;;;1856:63;;1828:97;1956:2;1974:53;2019:7;2010:6;1999:9;1995:22;1974:53;;;1964:63;;1935:98;2064:2;2082:53;2127:7;2118:6;2107:9;2103:22;2082:53;;;2072:63;;2043:98;2172:2;2190:53;2235:7;2226:6;2215:9;2211:22;2190:53;;;2180:63;;2151:98;2280:3;2299:53;2344:7;2335:6;2324:9;2320:22;2299:53;;;2289:63;;2259:99;2389:3;2408:53;2453:7;2444:6;2433:9;2429:22;2408:53;;;2398:63;;2368:99;2526:3;2515:9;2511:19;2498:33;2551:18;2543:6;2540:30;2537:2;;;2583:1;2580;2573:12;2537:2;2611:64;2667:7;2658:6;2647:9;2643:22;2611:64;;;2601:74;;;;2477:204;1759:932;;;;;;;;;;;;2698:993;;;;;;;;2906:3;2894:9;2885:7;2881:23;2877:33;2874:2;;;2923:1;2920;2913:12;2874:2;2958:1;2975:53;3020:7;3000:9;2975:53;;;2965:63;;2937:97;3065:2;3083:53;3128:7;3119:6;3108:9;3104:22;3083:53;;;3073:63;;3044:98;3173:2;3191:53;3236:7;3227:6;3216:9;3212:22;3191:53;;;3181:63;;3152:98;3281:2;3299:53;3344:7;3335:6;3324:9;3320:22;3299:53;;;3289:63;;3260:98;3389:3;3408:53;3453:7;3444:6;3433:9;3429:22;3408:53;;;3398:63;;3368:99;3526:3;3515:9;3511:19;3498:33;3551:18;3543:6;3540:30;3537:2;;;3583:1;3580;3573:12;3537:2;3611:64;3667:7;3658:6;3647:9;3643:22;3611:64;;;3601:74;;;;3477:204;2868:823;;;;;;;;;;;3698:257;;3810:2;3798:9;3789:7;3785:23;3781:32;3778:2;;;3826:1;3823;3816:12;3778:2;3861:1;3878:61;3931:7;3911:9;3878:61;;3962:263;;4077:2;4065:9;4056:7;4052:23;4048:32;4045:2;;;4093:1;4090;4083:12;4045:2;4128:1;4145:64;4201:7;4181:9;4145:64;;4232:142;4323:45;4362:5;4323:45;;;4318:3;4311:58;4305:69;;;4381:113;4464:24;4482:5;4464:24;;4524:297;;4638:70;4701:6;4696:3;4638:70;;;4631:77;;4720:43;4756:6;4751:3;4744:5;4720:43;;;4785:29;4807:6;4785:29;;;4776:39;;;;4624:197;-1:-1;;;4624:197;4829:356;;4957:38;4989:5;4957:38;;;5007:88;5088:6;5083:3;5007:88;;;5000:95;;5100:52;5145:6;5140:3;5133:4;5126:5;5122:16;5100:52;;;5164:16;;;;;4937:248;-1:-1;;4937:248;5193:374;;5353:67;5417:2;5412:3;5353:67;;;5453:34;5433:55;;5522:7;5517:2;5508:12;;5501:29;5558:2;5549:12;;5339:228;-1:-1;;5339:228;5576:332;;5736:67;5800:2;5795:3;5736:67;;;5836:34;5816:55;;5899:2;5890:12;;5722:186;-1:-1;;5722:186;5917:379;;6077:67;6141:2;6136:3;6077:67;;;6177:34;6157:55;;6246:12;6241:2;6232:12;;6225:34;6287:2;6278:12;;6063:233;-1:-1;;6063:233;6305:391;;6465:67;6529:2;6524:3;6465:67;;;6565:34;6545:55;;6634:24;6629:2;6620:12;;6613:46;6687:2;6678:12;;6451:245;-1:-1;;6451:245;6705:331;;6865:67;6929:2;6924:3;6865:67;;;6965:33;6945:54;;7027:2;7018:12;;6851:185;-1:-1;;6851:185;7044:113;7127:24;7145:5;7127:24;;7164:262;;7308:93;7397:3;7388:6;7308:93;;;7301:100;7289:137;-1:-1;;;7289:137;7433:899;7727:3;7712:19;;7742:79;7716:9;7794:6;7742:79;;;7832:72;7900:2;7889:9;7885:18;7876:6;7832:72;;;7915;7983:2;7972:9;7968:18;7959:6;7915:72;;;7998;8066:2;8055:9;8051:18;8042:6;7998:72;;;8081:73;8149:3;8138:9;8134:19;8125:6;8081:73;;;8165;8233:3;8222:9;8218:19;8209:6;8165:73;;;8249;8317:3;8306:9;8302:19;8293:6;8249:73;;8339:891;8633:3;8618:19;;8648:79;8622:9;8700:6;8648:79;;;8738:72;8806:2;8795:9;8791:18;8782:6;8738:72;;;8821;8889:2;8878:9;8874:18;8865:6;8821:72;;;8904;8972:2;8961:9;8957:18;8948:6;8904:72;;;8987:73;9055:3;9044:9;9040:19;9031:6;8987:73;;;9109:9;9103:4;9099:20;9093:3;9082:9;9078:19;9071:49;9134:86;9215:4;9206:6;9198;9134:86;;;9126:94;8604:626;-1:-1;;;;;;;;;8604:626;9237:324;9383:2;9368:18;;9397:71;9372:9;9441:6;9397:71;;;9479:72;9547:2;9536:9;9532:18;9523:6;9479:72;;9568:340;9722:2;9707:18;;9736:71;9711:9;9780:6;9736:71;;;9818:80;9894:2;9883:9;9879:18;9870:6;9818:80;;9915:883;10201:3;10186:19;;10216:71;10190:9;10260:6;10216:71;;10805:435;10979:2;10964:18;;10993:71;10968:9;11037:6;10993:71;;;11075:72;11143:2;11132:9;11128:18;11119:6;11075:72;;;11158;11226:2;11215:9;11211:18;11202:6;11158:72;;11247:324;11393:2;11378:18;;11407:71;11382:9;11451:6;11407:71;;;11489:72;11557:2;11546:9;11542:18;11533:6;11489:72;;11578:407;11769:2;11783:47;;;11754:18;;11844:131;11754:18;11844:131;;11992:407;12183:2;12197:47;;;12168:18;;12258:131;12168:18;12258:131;;12406:407;12597:2;12611:47;;;12582:18;;12672:131;12582:18;12672:131;;12820:407;13011:2;13025:47;;;12996:18;;13086:131;12996:18;13086:131;;13234:407;13425:2;13439:47;;;13410:18;;13500:131;13410:18;13500:131;;13648:213;13766:2;13751:18;;13780:71;13755:9;13824:6;13780:71;;13868:121;13955:12;;13926:63;13997:162;14099:19;;;14148:4;14139:14;;14092:67;14168:144;14303:3;14281:31;-1:-1;14281:31;14492:91;;14554:24;14572:5;14554:24;;14590:85;14656:13;14649:21;;14632:43;14682:121;14755:42;14744:54;;14727:76;14810:72;14872:5;14855:27;14889:129;;14976:37;15007:5;15025:121;15104:37;15135:5;15104:37;;15269:145;15350:6;15345:3;15340;15327:30;-1:-1;15406:1;15388:16;;15381:27;15320:94;15423:268;15488:1;15495:101;15509:6;15506:1;15503:13;15495:101;;;15576:11;;;15570:18;15557:11;;;15550:39;15531:2;15524:10;15495:101;;;15611:6;15608:1;15605:13;15602:2;;;-1:-1;;15676:1;15658:16;;15651:27;15472:219;15699:97;15787:2;15767:14;15783:7;15763:28;;15747:49;15804:117;15873:24;15891:5;15873:24;;;15866:5;15863:35;15853:2;;15912:1;15909;15902:12;15853:2;15847:74;;15928:111;15994:21;16009:5;15994:21;;16046:117;16115:24;16133:5;16115:24;

Swarm Source

bzzr://2177c5d49d10bd26f74b8c722f721dbaf1a9be5d638a651fad04cea31cbb9a37

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

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.