ETH Price: $3,420.11 (+4.17%)

Contract

0x17ac4cC32696987CEa1737343188716b1D827E7B
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit Eth202528042024-07-07 6:20:11139 days ago1720333211IN
0x17ac4cC3...b1D827E7B
0.06 ETH0.000079151
Withdraw Eth129702292021-08-06 7:59:151205 days ago1628236755IN
0x17ac4cC3...b1D827E7B
0 ETH0.0017387238
Withdraw Eth129702232021-08-06 7:58:041205 days ago1628236684IN
0x17ac4cC3...b1D827E7B
0 ETH0.0018302440
Withdraw Eth128107102021-07-12 6:01:581230 days ago1626069718IN
0x17ac4cC3...b1D827E7B
0 ETH0.01317772288
Deposit Eth126253592021-06-13 9:38:231259 days ago1623577103IN
0x17ac4cC3...b1D827E7B
0.1 ETH0.000395775
Withdraw Eth126236792021-06-13 3:19:091259 days ago1623554349IN
0x17ac4cC3...b1D827E7B
0 ETH0.000274536
Deposit Eth125794482021-06-06 7:00:541266 days ago1622962854IN
0x17ac4cC3...b1D827E7B
0.2 ETH0.0007915510
Deposit Eth125734642021-06-05 8:42:281267 days ago1622882548IN
0x17ac4cC3...b1D827E7B
0.1 ETH0.0010290113
Deposit Eth125418422021-05-31 11:24:341272 days ago1622460274IN
0x17ac4cC3...b1D827E7B
0.0001 ETH0.0011873215
Withdraw Eth123726082021-05-05 6:28:531298 days ago1620196133IN
0x17ac4cC3...b1D827E7B
0 ETH0.0014634232
Withdraw Eth123726032021-05-05 6:28:291298 days ago1620196109IN
0x17ac4cC3...b1D827E7B
0 ETH0.0054421119
Withdraw Eth123726032021-05-05 6:28:291298 days ago1620196109IN
0x17ac4cC3...b1D827E7B
0 ETH0.0054421119
Withdraw Eth123726032021-05-05 6:28:291298 days ago1620196109IN
0x17ac4cC3...b1D827E7B
0 ETH0.00539637118
Withdraw Eth122787972021-04-20 18:57:061312 days ago1618945026IN
0x17ac4cC3...b1D827E7B
0 ETH0.0251124200
Withdraw Eth122786962021-04-20 18:36:241312 days ago1618943784IN
0x17ac4cC3...b1D827E7B
0 ETH0.03176415253
Withdraw Eth122775052021-04-20 14:16:191313 days ago1618928179IN
0x17ac4cC3...b1D827E7B
0 ETH0.04430128315
Withdraw Eth122767252021-04-20 11:24:491313 days ago1618917889IN
0x17ac4cC3...b1D827E7B
0 ETH0.02715916186
Withdraw Eth122762632021-04-20 9:43:411313 days ago1618911821IN
0x17ac4cC3...b1D827E7B
0 ETH0.03599078246
Withdraw Eth122762632021-04-20 9:43:411313 days ago1618911821IN
0x17ac4cC3...b1D827E7B
0 ETH0.03679741246
Withdraw Eth122762632021-04-20 9:43:411313 days ago1618911821IN
0x17ac4cC3...b1D827E7B
0 ETH0.04213555288
Withdraw Eth122762632021-04-20 9:43:411313 days ago1618911821IN
0x17ac4cC3...b1D827E7B
0 ETH0.03208806255.58
Withdraw Eth122762622021-04-20 9:43:401313 days ago1618911820IN
0x17ac4cC3...b1D827E7B
0 ETH0.04213555288
Withdraw Eth122762622021-04-20 9:43:401313 days ago1618911820IN
0x17ac4cC3...b1D827E7B
0 ETH0.03208806255.58
Withdraw Eth122762532021-04-20 9:42:051313 days ago1618911725IN
0x17ac4cC3...b1D827E7B
0 ETH0.03151305251
Withdraw Eth122761642021-04-20 9:20:421313 days ago1618910442IN
0x17ac4cC3...b1D827E7B
0 ETH0.0300375267
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
202528042024-07-07 6:20:11139 days ago1720333211
0x17ac4cC3...b1D827E7B
0.06 ETH
126253592021-06-13 9:38:231259 days ago1623577103
0x17ac4cC3...b1D827E7B
0.1 ETH
125794482021-06-06 7:00:541266 days ago1622962854
0x17ac4cC3...b1D827E7B
0.2 ETH
125734642021-06-05 8:42:281267 days ago1622882548
0x17ac4cC3...b1D827E7B
0.1 ETH
125418422021-05-31 11:24:341272 days ago1622460274
0x17ac4cC3...b1D827E7B
0.0001 ETH
122787972021-04-20 18:57:061312 days ago1618945026
0x17ac4cC3...b1D827E7B
51.85595708 ETH
122787972021-04-20 18:57:061312 days ago1618945026
0x17ac4cC3...b1D827E7B
51.85595708 ETH
122786962021-04-20 18:36:241312 days ago1618943784
0x17ac4cC3...b1D827E7B
15.59744087 ETH
122786962021-04-20 18:36:241312 days ago1618943784
0x17ac4cC3...b1D827E7B
15.59744087 ETH
122775052021-04-20 14:16:191313 days ago1618928179
0x17ac4cC3...b1D827E7B
182 ETH
122775052021-04-20 14:16:191313 days ago1618928179
0x17ac4cC3...b1D827E7B
182 ETH
122767252021-04-20 11:24:491313 days ago1618917889
0x17ac4cC3...b1D827E7B
1,500 ETH
122767252021-04-20 11:24:491313 days ago1618917889
0x17ac4cC3...b1D827E7B
1,500 ETH
122762632021-04-20 9:43:411313 days ago1618911821
0x17ac4cC3...b1D827E7B
1.10043563 ETH
122762632021-04-20 9:43:411313 days ago1618911821
0x17ac4cC3...b1D827E7B
1.10043563 ETH
122762622021-04-20 9:43:401313 days ago1618911820
0x17ac4cC3...b1D827E7B
1.04243176 ETH
122762622021-04-20 9:43:401313 days ago1618911820
0x17ac4cC3...b1D827E7B
1.04243176 ETH
122762532021-04-20 9:42:051313 days ago1618911725
0x17ac4cC3...b1D827E7B
1.08684249 ETH
122762532021-04-20 9:42:051313 days ago1618911725
0x17ac4cC3...b1D827E7B
1.08684249 ETH
122761642021-04-20 9:20:421313 days ago1618910442
0x17ac4cC3...b1D827E7B
8.07151876 ETH
122761642021-04-20 9:20:421313 days ago1618910442
0x17ac4cC3...b1D827E7B
8.07151876 ETH
122761642021-04-20 9:20:421313 days ago1618910442
0x17ac4cC3...b1D827E7B
1.17196699 ETH
122761642021-04-20 9:20:421313 days ago1618910442
0x17ac4cC3...b1D827E7B
1.17196699 ETH
122761592021-04-20 9:19:341313 days ago1618910374
0x17ac4cC3...b1D827E7B
1.14983579 ETH
122761592021-04-20 9:19:341313 days ago1618910374
0x17ac4cC3...b1D827E7B
1.14983579 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
P1WethProxy

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-07-22
*/

/*

    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.

*/

pragma solidity 0.5.16;
pragma experimental ABIEncoderV2;

// File: canonical-weth/contracts/WETH9.sol

contract WETH9 {
    string public name     = "Wrapped Ether";
    string public symbol   = "WETH";
    uint8  public decimals = 18;

    event  Approval(address indexed src, address indexed guy, uint wad);
    event  Transfer(address indexed src, address indexed dst, uint wad);
    event  Deposit(address indexed dst, uint wad);
    event  Withdrawal(address indexed src, uint wad);

    mapping (address => uint)                       public  balanceOf;
    mapping (address => mapping (address => uint))  public  allowance;

    function() external payable {
        deposit();
    }
    function deposit() public payable {
        balanceOf[msg.sender] += msg.value;
        emit Deposit(msg.sender, msg.value);
    }
    function withdraw(uint wad) public {
        require(balanceOf[msg.sender] >= wad);
        balanceOf[msg.sender] -= wad;
        msg.sender.transfer(wad);
        emit Withdrawal(msg.sender, wad);
    }

    function totalSupply() public view returns (uint) {
        return address(this).balance;
    }

    function approve(address guy, uint wad) public returns (bool) {
        allowance[msg.sender][guy] = wad;
        emit Approval(msg.sender, guy, wad);
        return true;
    }

    function transfer(address dst, uint wad) public returns (bool) {
        return transferFrom(msg.sender, dst, wad);
    }

    function transferFrom(address src, address dst, uint wad)
        public
        returns (bool)
    {
        require(balanceOf[src] >= wad);

        if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {
            require(allowance[src][msg.sender] >= wad);
            allowance[src][msg.sender] -= wad;
        }

        balanceOf[src] -= wad;
        balanceOf[dst] += wad;

        emit Transfer(src, dst, wad);

        return true;
    }
}

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

/**
 * @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/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/P1Proxy.sol

/**
 * @title P1Proxy
 * @author dYdX
 *
 * @notice Base contract for proxy contracts, which can be used to provide additional functionality
 *  or restrictions when making calls to a Perpetual contract on behalf of a user.
 */
contract P1Proxy {
    using SafeERC20 for IERC20;

    /**
     * @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));
    }
}

// File: contracts/protocol/lib/ReentrancyGuard.sol

/**
 * @title ReentrancyGuard
 * @author dYdX
 *
 * @dev Updated ReentrancyGuard library designed to be used with Proxy Contracts.
 */
contract ReentrancyGuard {
    uint256 private constant NOT_ENTERED = 1;
    uint256 private constant ENTERED = uint256(int256(-1));

    uint256 private _STATUS_;

    constructor () internal {
        _STATUS_ = NOT_ENTERED;
    }

    modifier nonReentrant() {
        require(_STATUS_ != ENTERED, "ReentrancyGuard: reentrant call");
        _STATUS_ = ENTERED;
        _;
        _STATUS_ = NOT_ENTERED;
    }
}

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

/**
 * @title P1WethProxy
 * @author dYdX
 *
 * @notice A proxy for depositing and withdrawing ETH to/from a Perpetual contract that uses WETH as
 *  its margin token. The ETH will be wrapper and unwrapped by the proxy.
 */
contract P1WethProxy is
    P1Proxy,
    ReentrancyGuard
{
    // ============ Storage ============

    WETH9 public _WETH_;

    // ============ Constructor ============

    constructor (
        address payable weth
    )
        public
    {
        _WETH_ = WETH9(weth);
    }

    // ============ External Functions ============

    /**
     * Fallback function. Disallows ether to be sent to this contract without data except when
     * unwrapping WETH.
     */
    function ()
        external
        payable
    {
        require(
            msg.sender == address(_WETH_),
            "Cannot receive ETH"
        );
    }

    /**
     * @notice Deposit ETH into a Perpetual, by first wrapping it as WETH. Any ETH paid to this
     *  function will be converted and deposited.
     *
     * @param  perpetual  Address of the Perpetual contract to deposit to.
     * @param  account    The account on the Perpetual for which to credit the deposit.
     */
    function depositEth(
        address perpetual,
        address account
    )
        external
        payable
        nonReentrant
    {
        WETH9 weth = _WETH_;
        address marginToken = I_PerpetualV1(perpetual).getTokenContract();
        require(
            marginToken == address(weth),
            "The perpetual does not use WETH for margin deposits"
        );

        // Wrap ETH.
        weth.deposit.value(msg.value)();

        // Deposit all WETH into the perpetual.
        uint256 amount = weth.balanceOf(address(this));
        I_PerpetualV1(perpetual).deposit(account, amount);
    }

    /**
     * @notice Withdraw ETH from a Perpetual, by first withdrawing and unwrapping WETH.
     *
     * @param  perpetual    Address of the Perpetual contract to withdraw from.
     * @param  account      The account on the Perpetual to withdraw from.
     * @param  destination  The address to send the withdrawn ETH to.
     * @param  amount       The amount of ETH/WETH to withdraw.
     */
    function withdrawEth(
        address perpetual,
        address account,
        address payable destination,
        uint256 amount
    )
        external
        nonReentrant
    {
        WETH9 weth = _WETH_;
        address marginToken = I_PerpetualV1(perpetual).getTokenContract();
        require(
            marginToken == address(weth),
            "The perpetual does not use WETH for margin deposits"
        );

        require(
            // Short-circuit if sender is the account owner.
            msg.sender == account ||
                I_PerpetualV1(perpetual).hasAccountPermissions(account, msg.sender),
            "Sender does not have withdraw permissions for the account"
        );

        // Withdraw WETH from the perpetual.
        I_PerpetualV1(perpetual).withdraw(account, address(this), amount);

        // Unwrap all WETH and send it as ETH to the provided destination.
        uint256 balance = weth.balanceOf(address(this));
        weth.withdraw(balance);
        destination.transfer(balance);
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address payable","name":"weth","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[],"name":"_WETH_","outputs":[{"internalType":"contract WETH9","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"perpetual","type":"address"}],"name":"approveMaximumOnPerpetual","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"perpetual","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"depositEth","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"perpetual","type":"address"},{"internalType":"address","name":"account","type":"address"},{"internalType":"address payable","name":"destination","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawEth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200141538038062001415833981016040819052620000349162000072565b6001600081905580546001600160a01b0319166001600160a01b0392909216919091179055620000c7565b80516200006c81620000ad565b92915050565b6000602082840312156200008557600080fd5b60006200009384846200005f565b949350505050565b60006001600160a01b0382166200006c565b620000b8816200009b565b8114620000c457600080fd5b50565b61133e80620000d76000396000f3fe60806040526004361061003f5760003560e01c80630d4eec8f1461009b5780631e04e856146100c6578063f2f938dc146100d9578063fe0f8858146100f9575b60015473ffffffffffffffffffffffffffffffffffffffff163314610099576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610090906111c8565b60405180910390fd5b005b3480156100a757600080fd5b506100b0610119565b6040516100bd91906111ba565b60405180910390f35b6100996100d4366004610d90565b610135565b3480156100e557600080fd5b506100996100f4366004610dca565b61045f565b34801561010557600080fd5b50610099610114366004610d54565b6108ed565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000541415610191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009090611218565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000908155600154604080517f28b7bede000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff92831693928616916328b7bede916004808301926020929190829003018186803b15801561022557600080fd5b505afa158015610239573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061025d9190810190610d72565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146102c4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610090906111f8565b8173ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561030c57600080fd5b505af1158015610320573d6000803e3d6000fd5b50506040517f70a082310000000000000000000000000000000000000000000000000000000081526000935073ffffffffffffffffffffffffffffffffffffffff861692506370a08231915061037a903090600401611133565b60206040518083038186803b15801561039257600080fd5b505afa1580156103a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103ca9190810190610e49565b6040517f47e7ef2400000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff8616906347e7ef2490610421908790859060040161119f565b600060405180830381600087803b15801561043b57600080fd5b505af115801561044f573d6000803e3d6000fd5b5050600160005550505050505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005414156104bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009090611218565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000908155600154604080517f28b7bede000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff92831693928816916328b7bede916004808301926020929190829003018186803b15801561054f57600080fd5b505afa158015610563573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105879190810190610d72565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146105ee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610090906111f8565b3373ffffffffffffffffffffffffffffffffffffffff861614806106b157506040517f84ea286200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8716906384ea286290610661908890339060040161115c565b60206040518083038186803b15801561067957600080fd5b505afa15801561068d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106b19190810190610e2b565b6106e7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610090906111e8565b6040517fd9caed1200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87169063d9caed129061073d90889030908890600401611177565b600060405180830381600087803b15801561075757600080fd5b505af115801561076b573d6000803e3d6000fd5b50506040517f70a082310000000000000000000000000000000000000000000000000000000081526000925073ffffffffffffffffffffffffffffffffffffffff851691506370a08231906107c4903090600401611133565b60206040518083038186803b1580156107dc57600080fd5b505afa1580156107f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108149190810190610e49565b6040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff841690632e1a7d4d90610869908490600401611248565b600060405180830381600087803b15801561088357600080fd5b505af1158015610897573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8816925083156108fc02915083906000818181858888f193505050501580156108de573d6000803e3d6000fd5b50506001600055505050505050565b60008173ffffffffffffffffffffffffffffffffffffffff166328b7bede6040518163ffffffff1660e01b815260040160206040518083038186803b15801561093557600080fd5b505afa158015610949573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061096d9190810190610d72565b905061099773ffffffffffffffffffffffffffffffffffffffff821683600063ffffffff6109e216565b6109de73ffffffffffffffffffffffffffffffffffffffff8216837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff63ffffffff6109e216565b5050565b801580610a9057506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063dd62ed3e90610a3e9030908690600401611141565b60206040518083038186803b158015610a5657600080fd5b505afa158015610a6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a8e9190810190610e49565b155b610ac6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009090611228565b604051610b839084907f095ea7b30000000000000000000000000000000000000000000000000000000090610b01908690869060240161119f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610b88565b505050565b610ba78273ffffffffffffffffffffffffffffffffffffffff16610cdb565b610bdd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009090611238565b600060608373ffffffffffffffffffffffffffffffffffffffff1683604051610c069190611120565b6000604051808303816000865af19150503d8060008114610c43576040519150601f19603f3d011682016040523d82523d6000602084013e610c48565b606091505b509150915081610c84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610090906111d8565b805115610cd55780806020019051610c9f9190810190610e2b565b610cd5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009090611208565b50505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590610d0f57508115155b949350505050565b8035610d22816112d2565b92915050565b8051610d22816112d2565b8051610d22816112e9565b8035610d22816112f2565b8051610d22816112f2565b600060208284031215610d6657600080fd5b6000610d0f8484610d17565b600060208284031215610d8457600080fd5b6000610d0f8484610d28565b60008060408385031215610da357600080fd5b6000610daf8585610d17565b9250506020610dc085828601610d17565b9150509250929050565b60008060008060808587031215610de057600080fd5b6000610dec8787610d17565b9450506020610dfd87828801610d17565b9350506040610e0e87828801610d17565b9250506060610e1f87828801610d3e565b91505092959194509250565b600060208284031215610e3d57600080fd5b6000610d0f8484610d33565b600060208284031215610e5b57600080fd5b6000610d0f8484610d49565b610e7081611294565b82525050565b610e7081611268565b6000610e8a82611256565b610e94818561125a565b9350610ea48185602086016112a6565b9290920192915050565b610e708161129b565b6000610ec460128361125f565b7f43616e6e6f742072656365697665204554480000000000000000000000000000815260200192915050565b6000610efd60208361125f565b7f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815260200192915050565b6000610f3660398361125f565b7f53656e64657220646f6573206e6f74206861766520776974686472617720706581527f726d697373696f6e7320666f7220746865206163636f756e7400000000000000602082015260400192915050565b6000610f9560338361125f565b7f5468652070657270657475616c20646f6573206e6f742075736520574554482081527f666f72206d617267696e206465706f7369747300000000000000000000000000602082015260400192915050565b6000610ff4602a8361125f565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f74207375636365656400000000000000000000000000000000000000000000602082015260400192915050565b6000611053601f8361125f565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815260200192915050565b600061108c60368361125f565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f81527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000602082015260400192915050565b60006110eb601f8361125f565b7f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400815260200192915050565b610e7081611291565b600061112c8284610e7f565b9392505050565b60208101610d228284610e67565b6040810161114f8285610e76565b61112c6020830184610e76565b6040810161116a8285610e76565b61112c6020830184610e67565b606081016111858286610e76565b6111926020830185610e67565b610d0f6040830184611117565b604081016111ad8285610e76565b61112c6020830184611117565b60208101610d228284610eae565b60208082528101610d2281610eb7565b60208082528101610d2281610ef0565b60208082528101610d2281610f29565b60208082528101610d2281610f88565b60208082528101610d2281610fe7565b60208082528101610d2281611046565b60208082528101610d228161107f565b60208082528101610d22816110de565b60208101610d228284611117565b5190565b919050565b90815260200190565b6000610d2282611278565b151590565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b6000610d22825b6000610d2282611268565b60005b838110156112c15781810151838201526020016112a9565b83811115610cd55750506000910152565b6112db81611268565b81146112e657600080fd5b50565b6112db81611273565b6112db8161129156fea365627a7a72315820b984ba88498af96f236d6e689dc8ca00230f2b20014d06199edf696de03046976c6578706572696d656e74616cf564736f6c63430005100040000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

Deployed Bytecode

0x60806040526004361061003f5760003560e01c80630d4eec8f1461009b5780631e04e856146100c6578063f2f938dc146100d9578063fe0f8858146100f9575b60015473ffffffffffffffffffffffffffffffffffffffff163314610099576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610090906111c8565b60405180910390fd5b005b3480156100a757600080fd5b506100b0610119565b6040516100bd91906111ba565b60405180910390f35b6100996100d4366004610d90565b610135565b3480156100e557600080fd5b506100996100f4366004610dca565b61045f565b34801561010557600080fd5b50610099610114366004610d54565b6108ed565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000541415610191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009090611218565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000908155600154604080517f28b7bede000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff92831693928616916328b7bede916004808301926020929190829003018186803b15801561022557600080fd5b505afa158015610239573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061025d9190810190610d72565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146102c4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610090906111f8565b8173ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561030c57600080fd5b505af1158015610320573d6000803e3d6000fd5b50506040517f70a082310000000000000000000000000000000000000000000000000000000081526000935073ffffffffffffffffffffffffffffffffffffffff861692506370a08231915061037a903090600401611133565b60206040518083038186803b15801561039257600080fd5b505afa1580156103a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103ca9190810190610e49565b6040517f47e7ef2400000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff8616906347e7ef2490610421908790859060040161119f565b600060405180830381600087803b15801561043b57600080fd5b505af115801561044f573d6000803e3d6000fd5b5050600160005550505050505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005414156104bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009090611218565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000908155600154604080517f28b7bede000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff92831693928816916328b7bede916004808301926020929190829003018186803b15801561054f57600080fd5b505afa158015610563573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105879190810190610d72565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146105ee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610090906111f8565b3373ffffffffffffffffffffffffffffffffffffffff861614806106b157506040517f84ea286200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8716906384ea286290610661908890339060040161115c565b60206040518083038186803b15801561067957600080fd5b505afa15801561068d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106b19190810190610e2b565b6106e7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610090906111e8565b6040517fd9caed1200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87169063d9caed129061073d90889030908890600401611177565b600060405180830381600087803b15801561075757600080fd5b505af115801561076b573d6000803e3d6000fd5b50506040517f70a082310000000000000000000000000000000000000000000000000000000081526000925073ffffffffffffffffffffffffffffffffffffffff851691506370a08231906107c4903090600401611133565b60206040518083038186803b1580156107dc57600080fd5b505afa1580156107f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108149190810190610e49565b6040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff841690632e1a7d4d90610869908490600401611248565b600060405180830381600087803b15801561088357600080fd5b505af1158015610897573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8816925083156108fc02915083906000818181858888f193505050501580156108de573d6000803e3d6000fd5b50506001600055505050505050565b60008173ffffffffffffffffffffffffffffffffffffffff166328b7bede6040518163ffffffff1660e01b815260040160206040518083038186803b15801561093557600080fd5b505afa158015610949573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061096d9190810190610d72565b905061099773ffffffffffffffffffffffffffffffffffffffff821683600063ffffffff6109e216565b6109de73ffffffffffffffffffffffffffffffffffffffff8216837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff63ffffffff6109e216565b5050565b801580610a9057506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063dd62ed3e90610a3e9030908690600401611141565b60206040518083038186803b158015610a5657600080fd5b505afa158015610a6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a8e9190810190610e49565b155b610ac6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009090611228565b604051610b839084907f095ea7b30000000000000000000000000000000000000000000000000000000090610b01908690869060240161119f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610b88565b505050565b610ba78273ffffffffffffffffffffffffffffffffffffffff16610cdb565b610bdd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009090611238565b600060608373ffffffffffffffffffffffffffffffffffffffff1683604051610c069190611120565b6000604051808303816000865af19150503d8060008114610c43576040519150601f19603f3d011682016040523d82523d6000602084013e610c48565b606091505b509150915081610c84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610090906111d8565b805115610cd55780806020019051610c9f9190810190610e2b565b610cd5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009090611208565b50505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590610d0f57508115155b949350505050565b8035610d22816112d2565b92915050565b8051610d22816112d2565b8051610d22816112e9565b8035610d22816112f2565b8051610d22816112f2565b600060208284031215610d6657600080fd5b6000610d0f8484610d17565b600060208284031215610d8457600080fd5b6000610d0f8484610d28565b60008060408385031215610da357600080fd5b6000610daf8585610d17565b9250506020610dc085828601610d17565b9150509250929050565b60008060008060808587031215610de057600080fd5b6000610dec8787610d17565b9450506020610dfd87828801610d17565b9350506040610e0e87828801610d17565b9250506060610e1f87828801610d3e565b91505092959194509250565b600060208284031215610e3d57600080fd5b6000610d0f8484610d33565b600060208284031215610e5b57600080fd5b6000610d0f8484610d49565b610e7081611294565b82525050565b610e7081611268565b6000610e8a82611256565b610e94818561125a565b9350610ea48185602086016112a6565b9290920192915050565b610e708161129b565b6000610ec460128361125f565b7f43616e6e6f742072656365697665204554480000000000000000000000000000815260200192915050565b6000610efd60208361125f565b7f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815260200192915050565b6000610f3660398361125f565b7f53656e64657220646f6573206e6f74206861766520776974686472617720706581527f726d697373696f6e7320666f7220746865206163636f756e7400000000000000602082015260400192915050565b6000610f9560338361125f565b7f5468652070657270657475616c20646f6573206e6f742075736520574554482081527f666f72206d617267696e206465706f7369747300000000000000000000000000602082015260400192915050565b6000610ff4602a8361125f565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f74207375636365656400000000000000000000000000000000000000000000602082015260400192915050565b6000611053601f8361125f565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815260200192915050565b600061108c60368361125f565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f81527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000602082015260400192915050565b60006110eb601f8361125f565b7f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400815260200192915050565b610e7081611291565b600061112c8284610e7f565b9392505050565b60208101610d228284610e67565b6040810161114f8285610e76565b61112c6020830184610e76565b6040810161116a8285610e76565b61112c6020830184610e67565b606081016111858286610e76565b6111926020830185610e67565b610d0f6040830184611117565b604081016111ad8285610e76565b61112c6020830184611117565b60208101610d228284610eae565b60208082528101610d2281610eb7565b60208082528101610d2281610ef0565b60208082528101610d2281610f29565b60208082528101610d2281610f88565b60208082528101610d2281610fe7565b60208082528101610d2281611046565b60208082528101610d228161107f565b60208082528101610d22816110de565b60208101610d228284611117565b5190565b919050565b90815260200190565b6000610d2282611278565b151590565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b6000610d22825b6000610d2282611268565b60005b838110156112c15781810151838201526020016112a9565b83811115610cd55750506000910152565b6112db81611268565b81146112e657600080fd5b50565b6112db81611273565b6112db8161129156fea365627a7a72315820b984ba88498af96f236d6e689dc8ca00230f2b20014d06199edf696de03046976c6578706572696d656e74616cf564736f6c63430005100040

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

000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

-----Decoded View---------------
Arg [0] : weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2


Deployed Bytecode Sourcemap

27498:3133:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;28105:6;;;;28083:10;:29;28061:97;;;;;;;;;;;;;;;;;;;;;;27498:3133;27609:19;;8:9:-1;5:2;;;30:1;27;20:12;5:2;27609:19:0;;;:::i;:::-;;;;;;;;;;;;;;;;28513:631;;;;;;;;;:::i;29560:1068::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;29560:1068:0;;;;;;;;:::i;26146:425::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;26146:425:0;;;;;;;;:::i;27609:19::-;;;;;;:::o;28513:631::-;26903:2;27065:8;;:19;;27057:63;;;;;;;;;;;;;;26903:2;27131:8;:18;;;28680:6;;28719:43;;;;;;;;28680:6;;;;;27131:8;28719:41;;;;;:43;;;;;;;;;;;;;;:41;:43;;;5:2:-1;;;;30:1;27;20:12;5:2;28719:43:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;28719: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;28719:43:0;;;;;;;;;28697:65;;28818:4;28795:28;;:11;:28;;;28773:129;;;;;;;;;;;;;;28937:4;:12;;;28956:9;28937:31;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;28937:31:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;29047:29:0;;;;;29030:14;;-1:-1:-1;29047:14:0;;;;-1:-1:-1;29047:14:0;;-1:-1:-1;29047:29:0;;29070:4;;29047:29;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;29047:29:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;29047:29: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;29047:29:0;;;;;;;;;29087:49;;;;;29030:46;;-1:-1:-1;29087:32:0;;;;;;:49;;29120:7;;29030:46;;29087:49;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;29087:49:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;26845:1:0;27172:8;:22;-1:-1:-1;;;;;;;28513:631:0:o;29560:1068::-;26903:2;27065:8;;:19;;27057:63;;;;;;;;;;;;;;26903:2;27131:8;:18;;;29774:6;;29813:43;;;;;;;;29774:6;;;;;27131:8;29813:41;;;;;:43;;;;;;;;;;;;;;:41;:43;;;5:2:-1;;;;30:1;27;20:12;5:2;29813:43:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;29813: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;29813:43:0;;;;;;;;;29791:65;;29912:4;29889:28;;:11;:28;;;29867:129;;;;;;;;;;;;;;30093:10;:21;;;;;:109;;-1:-1:-1;30135:67:0;;;;;:46;;;;;;:67;;30182:7;;30191:10;;30135:67;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;30135:67:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;30135:67: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;30135:67:0;;;;;;;;;30009:278;;;;;;;;;;;;;;30346:65;;;;;:33;;;;;;:65;;30380:7;;30397:4;;30404:6;;30346:65;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;30346:65:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;30518:29:0;;;;;30500:15;;-1:-1:-1;30518:14:0;;;;-1:-1:-1;30518:14:0;;:29;;30541:4;;30518:29;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;30518:29:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;30518:29: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;30518:29:0;;;;;;;;;30558:22;;;;;30500:47;;-1:-1:-1;30558:13:0;;;;;;:22;;30500:47;;30558:22;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;30558:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;30591:29:0;;:20;;;;-1:-1:-1;30591:29:0;;;;;-1:-1:-1;30612:7:0;;30591:29;;;;30612:7;30591:20;:29;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;26845:1:0;27172:8;:22;-1:-1:-1;;;;;;29560:1068:0:o;26146:425::-;26250:20;26294:9;26280:41;;;:43;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26280:43:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;26280: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;26280:43:0;;;;;;;;;26250:74;-1:-1:-1;26401:39:0;:25;;;26427:9;26438:1;26401:39;:25;:39;:::i;:::-;26514:49;:25;;;26540:9;26559:2;26514:49;:25;:49;:::i;:::-;26146:425;;:::o;15007:621::-;15377:10;;;15376:62;;-1:-1:-1;15393:39:0;;;;;:15;;;;;;:39;;15417:4;;15424:7;;15393:39;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;15393:39:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;15393: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;15393:39:0;;;;;;;;;:44;15376:62;15368:152;;;;;;;;;;;;;;15557:62;;15531:89;;15550:5;;15580:22;;15557:62;;15604:7;;15613:5;;15557:62;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;15557:62:0;;;49:4:-1;25:18;;61:17;;15557:62:0;182:15:-1;15557:62:0;;;;179:29:-1;;;;160:49;;;15531:18:0;:89::i;:::-;15007:621;;;:::o;16650:1114::-;17254:27;17262:5;17254:25;;;:27::i;:::-;17246:71;;;;;;;;;;;;;;17391:12;17405:23;17440:5;17432:19;;17452:4;17432: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;;17390:67:0;;;;17476:7;17468:52;;;;;;;;;;;;;;17537:17;;:21;17533:224;;17679:10;17668:30;;;;;;;;;;;;;;17660:85;;;;;;;;;;;;;;16650:1114;;;;:::o;11673:619::-;11733:4;12201:20;;12044:66;12241:23;;;;;;:42;;-1:-1:-1;12268:15:0;;;12241:42;12233:51;11673:619;-1:-1:-1;;;;11673: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;;436:128;511:13;;529:30;511:13;529:30;;571:130;638:20;;663:33;638:20;663:33;;708:134;786:13;;804:33;786:13;804:33;;849:241;;953:2;941:9;932:7;928:23;924:32;921:2;;;969:1;966;959:12;921:2;1004:1;1021:53;1066:7;1046:9;1021:53;;1097:263;;1212:2;1200:9;1191:7;1187:23;1183:32;1180:2;;;1228:1;1225;1218:12;1180:2;1263:1;1280:64;1336:7;1316:9;1280:64;;1367:366;;;1488:2;1476:9;1467:7;1463:23;1459:32;1456:2;;;1504:1;1501;1494:12;1456:2;1539:1;1556:53;1601:7;1581:9;1556:53;;;1546:63;;1518:97;1646:2;1664:53;1709:7;1700:6;1689:9;1685:22;1664:53;;;1654:63;;1625:98;1450:283;;;;;;1740:633;;;;;1903:3;1891:9;1882:7;1878:23;1874:33;1871:2;;;1920:1;1917;1910:12;1871:2;1955:1;1972:53;2017:7;1997:9;1972:53;;;1962:63;;1934:97;2062:2;2080:53;2125:7;2116:6;2105:9;2101:22;2080:53;;;2070:63;;2041:98;2170:2;2188:61;2241:7;2232:6;2221:9;2217:22;2188:61;;;2178:71;;2149:106;2286:2;2304:53;2349:7;2340:6;2329:9;2325:22;2304:53;;;2294:63;;2265:98;1865:508;;;;;;;;2380:257;;2492:2;2480:9;2471:7;2467:23;2463:32;2460:2;;;2508:1;2505;2498:12;2460:2;2543:1;2560:61;2613:7;2593:9;2560:61;;2644:263;;2759:2;2747:9;2738:7;2734:23;2730:32;2727:2;;;2775:1;2772;2765:12;2727:2;2810:1;2827:64;2883:7;2863:9;2827:64;;2914:142;3005:45;3044:5;3005:45;;;3000:3;2993:58;2987:69;;;3063:113;3146:24;3164:5;3146:24;;3183:356;;3311:38;3343:5;3311:38;;;3361:88;3442:6;3437:3;3361:88;;;3354:95;;3454:52;3499:6;3494:3;3487:4;3480:5;3476:16;3454:52;;;3518:16;;;;;3291:248;-1:-1;;3291:248;3546:168;3650:58;3702:5;3650:58;;3722:318;;3882:67;3946:2;3941:3;3882:67;;;3982:20;3962:41;;4031:2;4022:12;;3868:172;-1:-1;;3868:172;4049:332;;4209:67;4273:2;4268:3;4209:67;;;4309:34;4289:55;;4372:2;4363:12;;4195:186;-1:-1;;4195:186;4390:394;;4550:67;4614:2;4609:3;4550:67;;;4650:34;4630:55;;4719:27;4714:2;4705:12;;4698:49;4775:2;4766:12;;4536:248;-1:-1;;4536:248;4793:388;;4953:67;5017:2;5012:3;4953:67;;;5053:34;5033:55;;5122:21;5117:2;5108:12;;5101:43;5172:2;5163:12;;4939:242;-1:-1;;4939:242;5190:379;;5350:67;5414:2;5409:3;5350:67;;;5450:34;5430:55;;5519:12;5514:2;5505:12;;5498:34;5560:2;5551:12;;5336:233;-1:-1;;5336:233;5578:331;;5738:67;5802:2;5797:3;5738:67;;;5838:33;5818:54;;5900:2;5891:12;;5724:185;-1:-1;;5724:185;5918:391;;6078:67;6142:2;6137:3;6078:67;;;6178:34;6158:55;;6247:24;6242:2;6233:12;;6226:46;6300:2;6291:12;;6064:245;-1:-1;;6064:245;6318:331;;6478:67;6542:2;6537:3;6478:67;;;6578:33;6558:54;;6640:2;6631:12;;6464:185;-1:-1;;6464:185;6657:113;6740:24;6758:5;6740:24;;6777:262;;6921:93;7010:3;7001:6;6921:93;;;6914:100;6902:137;-1:-1;;;6902:137;7046:229;7172:2;7157:18;;7186:79;7161:9;7238:6;7186:79;;7282:324;7428:2;7413:18;;7442:71;7417:9;7486:6;7442:71;;;7524:72;7592:2;7581:9;7577:18;7568:6;7524:72;;7613:340;7767:2;7752:18;;7781:71;7756:9;7825:6;7781:71;;;7863:80;7939:2;7928:9;7924:18;7915:6;7863:80;;7960:451;8142:2;8127:18;;8156:71;8131:9;8200:6;8156:71;;;8238:80;8314:2;8303:9;8299:18;8290:6;8238:80;;;8329:72;8397:2;8386:9;8382:18;8373:6;8329:72;;8418:324;8564:2;8549:18;;8578:71;8553:9;8622:6;8578:71;;;8660:72;8728:2;8717:9;8713:18;8704:6;8660:72;;8749:255;8888:2;8873:18;;8902:92;8877:9;8967:6;8902:92;;9011:407;9202:2;9216:47;;;9187:18;;9277:131;9187:18;9277:131;;9425:407;9616:2;9630:47;;;9601:18;;9691:131;9601:18;9691:131;;9839:407;10030:2;10044:47;;;10015:18;;10105:131;10015:18;10105:131;;10253:407;10444:2;10458:47;;;10429:18;;10519:131;10429:18;10519:131;;10667:407;10858:2;10872:47;;;10843:18;;10933:131;10843:18;10933:131;;11081:407;11272:2;11286:47;;;11257:18;;11347:131;11257:18;11347:131;;11495:407;11686:2;11700:47;;;11671:18;;11761:131;11671:18;11761:131;;11909:407;12100:2;12114:47;;;12085:18;;12175:131;12085:18;12175:131;;12323:213;12441:2;12426:18;;12455:71;12430:9;12499:6;12455:71;;12543:121;12630:12;;12601:63;12672:144;12807:3;12785:31;-1:-1;12785:31;12825:163;12928:19;;;12977:4;12968:14;;12921:67;12996:91;;13058:24;13076:5;13058:24;;13200:85;13266:13;13259:21;;13242:43;13292:121;13365:42;13354:54;;13337:76;13420:72;13482:5;13465:27;13499:129;;13586:37;13617:5;13635:155;;13735:50;13779:5;13735:50;;14169:268;14234:1;14241:101;14255:6;14252:1;14249:13;14241:101;;;14322:11;;;14316:18;14303:11;;;14296:39;14277:2;14270:10;14241:101;;;14357:6;14354:1;14351:13;14348:2;;;-1:-1;;14422:1;14404:16;;14397:27;14218:219;14445:117;14514:24;14532:5;14514:24;;;14507:5;14504:35;14494:2;;14553:1;14550;14543:12;14494:2;14488:74;;14709:111;14775:21;14790:5;14775:21;;14827:117;14896:24;14914:5;14896:24;

Swarm Source

bzzr://b984ba88498af96f236d6e689dc8ca00230f2b20014d06199edf696de0304697

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  ]
[ 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.