ETH Price: $2,340.24 (-1.71%)

Contract

0x0cA14d901ffE8461B8196e593083d004993916B8

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Initialize185481992022-08-10 7:08:42763 days ago1660115322IN
0x0cA14d90...4993916B8
0 ETH0.0000259717910.001
0x60806040185481752022-08-10 7:08:27763 days ago1660115307IN
 Create: DelegateApproval
0 ETH0.0003679741240.001

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
1075583852023-07-30 11:12:27409 days ago1690715547
0x0cA14d90...4993916B8
0 ETH
1075583822023-07-30 11:12:21409 days ago1690715541
0x0cA14d90...4993916B8
0 ETH
1075583802023-07-30 11:12:17409 days ago1690715537
0x0cA14d90...4993916B8
0 ETH
1075583672023-07-30 11:11:51409 days ago1690715511
0x0cA14d90...4993916B8
0 ETH
1075583642023-07-30 11:11:45409 days ago1690715505
0x0cA14d90...4993916B8
0 ETH
1075583582023-07-30 11:11:33409 days ago1690715493
0x0cA14d90...4993916B8
0 ETH
1075583532023-07-30 11:11:23409 days ago1690715483
0x0cA14d90...4993916B8
0 ETH
1075583412023-07-30 11:10:59409 days ago1690715459
0x0cA14d90...4993916B8
0 ETH
1075583312023-07-30 11:10:39409 days ago1690715439
0x0cA14d90...4993916B8
0 ETH
1075583062023-07-30 11:09:49409 days ago1690715389
0x0cA14d90...4993916B8
0 ETH
1075582892023-07-30 11:09:15409 days ago1690715355
0x0cA14d90...4993916B8
0 ETH
1075582802023-07-30 11:08:57409 days ago1690715337
0x0cA14d90...4993916B8
0 ETH
1075582592023-07-30 11:08:15409 days ago1690715295
0x0cA14d90...4993916B8
0 ETH
1075582592023-07-30 11:08:15409 days ago1690715295
0x0cA14d90...4993916B8
0 ETH
1075582572023-07-30 11:08:11409 days ago1690715291
0x0cA14d90...4993916B8
0 ETH
1075582492023-07-30 11:07:55409 days ago1690715275
0x0cA14d90...4993916B8
0 ETH
1075582412023-07-30 11:07:39409 days ago1690715259
0x0cA14d90...4993916B8
0 ETH
1075582212023-07-30 11:06:59409 days ago1690715219
0x0cA14d90...4993916B8
0 ETH
1075581732023-07-30 11:05:23409 days ago1690715123
0x0cA14d90...4993916B8
0 ETH
1075581472023-07-30 11:04:31409 days ago1690715071
0x0cA14d90...4993916B8
0 ETH
1075581452023-07-30 11:04:27409 days ago1690715067
0x0cA14d90...4993916B8
0 ETH
1075581372023-07-30 11:04:11409 days ago1690715051
0x0cA14d90...4993916B8
0 ETH
1075581222023-07-30 11:03:41409 days ago1690715021
0x0cA14d90...4993916B8
0 ETH
1075580942023-07-30 11:02:45409 days ago1690714965
0x0cA14d90...4993916B8
0 ETH
1075580932023-07-30 11:02:43409 days ago1690714963
0x0cA14d90...4993916B8
0 ETH
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DelegateApproval

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion
File 1 of 8 : DelegateApproval.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.6;
pragma abicoder v2;

import { IDelegateApproval } from "./interface/IDelegateApproval.sol";
import { BlockContext } from "./base/BlockContext.sol";
import { SafeOwnable } from "./base/SafeOwnable.sol";
import { DelegateApprovalStorageV1 } from "./storage/DelegateApprovalStorage.sol";

contract DelegateApproval is IDelegateApproval, BlockContext, SafeOwnable, DelegateApprovalStorageV1 {
    //
    // CONSTANTS
    //

    /// @dev remember to update checkActions() if we add new actions
    ///      the rule for action constants is `<<`, 2^n, n starts from 0
    ///      so actions will be 1, 2, 4, 8, 16, 32, 64, 128
    uint8 internal constant _CLEARINGHOUSE_OPENPOSITION = 1; // 00000001
    uint8 internal constant _CLEARINGHOUSE_ADDLIQUIDITY = 2; // 00000010, not used for now
    uint8 internal constant _CLEARINGHOUSE_REMOVELIQUIDITY = 4; // 00000100, not used for now

    //
    // MODIFIER
    //

    /// @dev prevent user from approving/revoking non-existed actions
    ///      we only have 3 actions now, so actions cannot be greater than 7 (00000111)
    modifier checkActions(uint8 actions) {
        // DA_IA: Invalid Actions
        require(actions > 0 && actions <= 7, "DA_IA");
        _;
    }

    //
    // EXTERNAL NON-VIEW
    //

    function initialize() external initializer {
        __SafeOwnable_init();
    }

    /// @inheritdoc IDelegateApproval
    function approve(address delegate, uint8 actions) external override checkActions(actions) {
        address trader = _msgSender();
        bytes32 key = _getApprovalKey(trader, delegate);

        // Examples:
        // oldApprovedActions: 001
        // actions: 010
        // newApprovedActions: 011

        // oldApprovedActions: 010
        // actions: 110
        // newApprovedActions: 110

        // oldApprovedActions: 010
        // actions: 100
        // newApprovedActions: 110
        _approvalMap[key] = _approvalMap[key] | actions;

        emit DelegationApproved(trader, delegate, actions);
    }

    /// @inheritdoc IDelegateApproval
    function revoke(address delegate, uint8 actions) external override checkActions(actions) {
        address trader = _msgSender();
        bytes32 key = _getApprovalKey(trader, delegate);

        // oldApprovedActions: 010
        // actions: 010
        // newApprovedActions: 000

        // oldApprovedActions: 010
        // actions: 110
        // newApprovedActions: 000

        // oldApprovedActions: 010
        // actions: 100
        // newApprovedActions: 010
        _approvalMap[key] = _approvalMap[key] & (~actions);

        emit DelegationRevoked(trader, delegate, actions);
    }

    //
    // EXTERNAL VIEW
    //

    /// @inheritdoc IDelegateApproval
    function getClearingHouseOpenPositionAction() external pure override returns (uint8) {
        return _CLEARINGHOUSE_OPENPOSITION;
    }

    /// @inheritdoc IDelegateApproval
    function getClearingHouseAddLiquidityAction() external pure override returns (uint8) {
        return _CLEARINGHOUSE_ADDLIQUIDITY;
    }

    /// @inheritdoc IDelegateApproval
    function getClearingHouseRemoveLiquidityAction() external pure override returns (uint8) {
        return _CLEARINGHOUSE_REMOVELIQUIDITY;
    }

    /// @inheritdoc IDelegateApproval
    function getApprovedActions(address trader, address delegate) external view override returns (uint8) {
        bytes32 key = _getApprovalKey(trader, delegate);
        return _approvalMap[key];
    }

    /// @inheritdoc IDelegateApproval
    function hasApprovalFor(
        address trader,
        address delegate,
        uint8 actions
    ) external view override checkActions(actions) returns (bool) {
        return _hasApprovalFor(trader, delegate, actions);
    }

    /// @inheritdoc IDelegateApproval
    function canOpenPositionFor(address trader, address delegate) external view override returns (bool) {
        return _hasApprovalFor(trader, delegate, _CLEARINGHOUSE_OPENPOSITION);
    }

    /// @inheritdoc IDelegateApproval
    function canAddLiquidityFor(address trader, address delegate) external view override returns (bool) {
        return _hasApprovalFor(trader, delegate, _CLEARINGHOUSE_ADDLIQUIDITY);
    }

    /// @inheritdoc IDelegateApproval
    function canRemoveLiquidityFor(address trader, address delegate) external view override returns (bool) {
        return _hasApprovalFor(trader, delegate, _CLEARINGHOUSE_REMOVELIQUIDITY);
    }

    //
    // INTERNAL VIEW
    //

    function _getApprovalKey(address trader, address delegate) internal pure returns (bytes32) {
        return keccak256(abi.encode(trader, delegate));
    }

    function _hasApprovalFor(
        address trader,
        address delegate,
        uint8 actions
    ) internal view checkActions(actions) returns (bool) {
        bytes32 key = _getApprovalKey(trader, delegate);

        // approvedActions: 010
        // actions: 110
        // 010 & 110 = 010 != 110 => false

        // approvedActions: 000
        // actions: 010
        // 000 & 010 = 000 != 010 => false

        // approvedActions: 110
        // actions: 110
        // 110 & 110 = 110 == 110 => true
        return (_approvalMap[key] & actions) == actions;
    }
}

File 2 of 8 : IDelegateApproval.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.6;
pragma abicoder v2;

interface IDelegateApproval {
    /// @param trader The address of trader
    /// @param delegate The address of delegate
    /// @param actions The actions to be approved
    event DelegationApproved(address indexed trader, address delegate, uint8 actions);

    /// @param trader The address of trader
    /// @param delegate The address of delegate
    /// @param actions The actions to be revoked
    event DelegationRevoked(address indexed trader, address delegate, uint8 actions);

    /// @param delegate The address of delegate
    /// @param actions The actions to be approved
    function approve(address delegate, uint8 actions) external;

    /// @param delegate The address of delegate
    /// @param actions The actions to be revoked
    function revoke(address delegate, uint8 actions) external;

    /// @return action The value of action `_CLEARINGHOUSE_OPENPOSITION`
    function getClearingHouseOpenPositionAction() external pure returns (uint8);

    /// @return action The value of action `_CLEARINGHOUSE_ADDLIQUIDITY`
    function getClearingHouseAddLiquidityAction() external pure returns (uint8);

    /// @return action The value of action `_CLEARINGHOUSE_REMOVELIQUIDITY`
    function getClearingHouseRemoveLiquidityAction() external pure returns (uint8);

    /// @param trader The address of trader
    /// @param delegate The address of delegate
    /// @return actions The approved actions
    function getApprovedActions(address trader, address delegate) external view returns (uint8);

    /// @param trader The address of trader
    /// @param delegate The address of delegate
    /// @param actions The actions to be checked
    /// @return true if delegate is allowed to perform **each** actions for trader, otherwise false
    function hasApprovalFor(
        address trader,
        address delegate,
        uint8 actions
    ) external view returns (bool);

    /// @param trader The address of trader
    /// @param delegate The address of delegate
    /// @return true if delegate can open position for trader, otherwise false
    function canOpenPositionFor(address trader, address delegate) external view returns (bool);

    /// @param trader The address of trader
    /// @param delegate The address of delegate
    /// @return true if delegate can add liquidity for trader, otherwise false
    function canAddLiquidityFor(address trader, address delegate) external view returns (bool);

    /// @param trader The address of trader
    /// @param delegate The address of delegate
    /// @return true if delegate can remove liquidity for trader, otherwise false
    function canRemoveLiquidityFor(address trader, address delegate) external view returns (bool);
}

File 3 of 8 : BlockContext.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.6;

abstract contract BlockContext {
    function _blockTimestamp() internal view virtual returns (uint256) {
        // Reply from Arbitrum
        // block.timestamp returns timestamp at the time at which the sequencer receives the tx.
        // It may not actually correspond to a particular L1 block
        return block.timestamp;
    }

    function _blockNumber() internal view virtual returns (uint256) {
        return block.number;
    }
}

File 4 of 8 : SafeOwnable.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.6;

import { ContextUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";

abstract contract SafeOwnable is ContextUpgradeable {
    address private _owner;
    address private _candidate;

    // __gap is reserved storage
    uint256[50] private __gap;

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */

    function __SafeOwnable_init() internal initializer {
        __Context_init();
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    /**
     * @dev Set ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function setOwner(address newOwner) external onlyOwner {
        // newOwner is 0
        require(newOwner != address(0), "SO_NW0");
        // same as original
        require(newOwner != _owner, "SO_SAO");
        // same as candidate
        require(newOwner != _candidate, "SO_SAC");

        _candidate = newOwner;
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`_candidate`).
     * Can only be called by the new owner.
     */
    function updateOwner() external {
        // candidate is zero
        require(_candidate != address(0), "SO_C0");
        // caller is not candidate
        require(_candidate == _msgSender(), "SO_CNC");

        // emitting event first to avoid caching values
        emit OwnershipTransferred(_owner, _candidate);
        _owner = _candidate;
        _candidate = address(0);
    }

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

    /**
     * @dev Returns the candidate that can become the owner.
     */
    function candidate() external view returns (address) {
        return _candidate;
    }
}

File 5 of 8 : DelegateApprovalStorage.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.6;

/// @notice For future upgrades, do not change DelegateApprovalStorageV1. Create a new
/// contract which implements DelegateApprovalStorageV1 and following the naming convention
/// DelegateApprovalStorageVX.
abstract contract DelegateApprovalStorageV1 {
    // key: the hash of `trader` and `delegate`, see _getApprovalKey()
    // value: the bit value of approved actions
    mapping(bytes32 => uint8) internal _approvalMap;
}

File 6 of 8 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;
import "../proxy/Initializable.sol";

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

    function __Context_init_unchained() internal initializer {
    }
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

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

File 7 of 8 : Initializable.sol
// SPDX-License-Identifier: MIT

// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;

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

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

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

pragma solidity >=0.6.2 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 100
  },
  "evmVersion": "berlin",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint8","name":"actions","type":"uint8"}],"name":"DelegationApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint8","name":"actions","type":"uint8"}],"name":"DelegationRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint8","name":"actions","type":"uint8"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"trader","type":"address"},{"internalType":"address","name":"delegate","type":"address"}],"name":"canAddLiquidityFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"trader","type":"address"},{"internalType":"address","name":"delegate","type":"address"}],"name":"canOpenPositionFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"trader","type":"address"},{"internalType":"address","name":"delegate","type":"address"}],"name":"canRemoveLiquidityFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"candidate","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"trader","type":"address"},{"internalType":"address","name":"delegate","type":"address"}],"name":"getApprovedActions","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getClearingHouseAddLiquidityAction","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getClearingHouseOpenPositionAction","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getClearingHouseRemoveLiquidityAction","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"trader","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint8","name":"actions","type":"uint8"}],"name":"hasApprovalFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint8","name":"actions","type":"uint8"}],"name":"revoke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50610c7e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100e05760003560e01c80639686a5b6116100875780639686a5b61461016b578063a08012a314610173578063a4f5dd3b14610193578063bc5920ba146101a6578063c43036f9146101ae578063c7d572e5146101c1578063cbab07b6146101d4578063f3ac8f12146101dc576100e0565b80631042c2ad146100e557806313af40351461010e57806315ed7caa146101235780634342e9661461012b5780636c8381f81461013e578063715018a6146101535780638129fc1c1461015b5780638da5cb5b14610163575b600080fd5b6100f86100f3366004610adb565b6101ef565b6040516101059190610bec565b60405180910390f35b61012161011c366004610ac1565b610216565b005b6100f8610371565b610121610139366004610b4f565b610376565b61014661043b565b6040516101059190610b78565b61012161044a565b6101216104eb565b610146610595565b6100f86105a4565b610186610181366004610adb565b6105a9565b6040516101059190610bc2565b6101866101a1366004610adb565b6105be565b6101216105cc565b6101866101bc366004610b0d565b6106b8565b6101866101cf366004610adb565b610702565b6100f8610710565b6101216101ea366004610b4f565b610715565b6000806101fc84846107c1565b60009081526067602052604090205460ff16949350505050565b61021e6107f4565b6001600160a01b031661022f610595565b6001600160a01b031614610273576040805162461bcd60e51b8152602060048201526006602482015265534f5f434e4f60d01b604482015290519081900360640190fd5b6001600160a01b0381166102b7576040805162461bcd60e51b81526020600482015260066024820152650534f5f4e57360d41b604482015290519081900360640190fd5b6033546001600160a01b0382811691161415610303576040805162461bcd60e51b8152602060048201526006602482015265534f5f53414f60d01b604482015290519081900360640190fd5b6034546001600160a01b038281169116141561034f576040805162461bcd60e51b8152602060048201526006602482015265534f5f53414360d01b604482015290519081900360640190fd5b603480546001600160a01b0319166001600160a01b0392909216919091179055565b600290565b8060008160ff1611801561038e575060078160ff1611155b6103b35760405162461bcd60e51b81526004016103aa90610bcd565b60405180910390fd5b60006103bd6107f4565b905060006103cb82866107c1565b60008181526067602052604090819020805460ff80821689171660ff19909116179055519091506001600160a01b038316907f283397791e09409b99db81b486878c1fe41c0d40fb646e721f04bc52549fbc829061042c9088908890610ba6565b60405180910390a25050505050565b6034546001600160a01b031690565b6104526107f4565b6001600160a01b0316610463610595565b6001600160a01b0316146104a7576040805162461bcd60e51b8152602060048201526006602482015265534f5f434e4f60d01b604482015290519081900360640190fd5b6033546040516000916001600160a01b031690600080516020610c29833981519152908390a3603380546001600160a01b0319908116909155603480549091169055565b600054610100900460ff168061050457506105046107f8565b80610512575060005460ff16155b61054d5760405162461bcd60e51b815260040180806020018281038252602e815260200180610bfb602e913960400191505060405180910390fd5b600054610100900460ff16158015610578576000805460ff1961ff0019909116610100171660011790555b610580610809565b8015610592576000805461ff00191690555b50565b6033546001600160a01b031690565b600490565b60006105b7838360016108f8565b9392505050565b60006105b7838360046108f8565b6034546001600160a01b0316610611576040805162461bcd60e51b81526020600482015260056024820152640534f5f43360dc1b604482015290519081900360640190fd5b6106196107f4565b6034546001600160a01b03908116911614610664576040805162461bcd60e51b8152602060048201526006602482015265534f5f434e4360d01b604482015290519081900360640190fd5b6034546033546040516001600160a01b039283169290911690600080516020610c2983398151915290600090a360348054603380546001600160a01b03199081166001600160a01b03841617909155169055565b60008160008160ff161180156106d2575060078160ff1611155b6106ee5760405162461bcd60e51b81526004016103aa90610bcd565b6106f98585856108f8565b95945050505050565b60006105b7838360026108f8565b600190565b8060008160ff1611801561072d575060078160ff1611155b6107495760405162461bcd60e51b81526004016103aa90610bcd565b60006107536107f4565b9050600061076182866107c1565b60008181526067602052604090819020805460ff881982161660ff19909116179055519091506001600160a01b038316907f1e84a572409e246a20065a062c50f43afa35723be0d38bf1a25e7ffb38c699359061042c9088908890610ba6565b600082826040516020016107d6929190610b8c565b60405160208183030381529060405280519060200120905092915050565b3390565b60006108033061095f565b15905090565b600054610100900460ff168061082257506108226107f8565b80610830575060005460ff16155b61086b5760405162461bcd60e51b815260040180806020018281038252602e815260200180610bfb602e913960400191505060405180910390fd5b600054610100900460ff16158015610896576000805460ff1961ff0019909116610100171660011790555b61089e610969565b60006108a86107f4565b603380546001600160a01b0319166001600160a01b03831690811790915560405191925090600090600080516020610c29833981519152908290a3508015610592576000805461ff001916905550565b60008160008160ff16118015610912575060078160ff1611155b61092e5760405162461bcd60e51b81526004016103aa90610bcd565b600061093a86866107c1565b600090815260676020526040902054841660ff90811690851614925050509392505050565b803b15155b919050565b600054610100900460ff168061098257506109826107f8565b80610990575060005460ff16155b6109cb5760405162461bcd60e51b815260040180806020018281038252602e815260200180610bfb602e913960400191505060405180910390fd5b600054610100900460ff161580156109f6576000805460ff1961ff0019909116610100171660011790555b610580600054610100900460ff1680610a125750610a126107f8565b80610a20575060005460ff16155b610a5b5760405162461bcd60e51b815260040180806020018281038252602e815260200180610bfb602e913960400191505060405180910390fd5b600054610100900460ff16158015610580576000805460ff1961ff0019909116610100171660011790558015610592576000805461ff001916905550565b80356001600160a01b038116811461096457600080fd5b803560ff8116811461096457600080fd5b600060208284031215610ad2578081fd5b6105b782610a99565b60008060408385031215610aed578081fd5b610af683610a99565b9150610b0460208401610a99565b90509250929050565b600080600060608486031215610b21578081fd5b610b2a84610a99565b9250610b3860208501610a99565b9150610b4660408501610ab0565b90509250925092565b60008060408385031215610b61578182fd5b610b6a83610a99565b9150610b0460208401610ab0565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0392909216825260ff16602082015260400190565b901515815260200190565b60208082526005908201526444415f494160d81b604082015260600190565b60ff9190911681526020019056fe496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a65648be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a2646970667358221220ed808e61d7c95a68272b9962c2fd034ab7a5ed381c76a1686586258873d9d50364736f6c63430007060033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100e05760003560e01c80639686a5b6116100875780639686a5b61461016b578063a08012a314610173578063a4f5dd3b14610193578063bc5920ba146101a6578063c43036f9146101ae578063c7d572e5146101c1578063cbab07b6146101d4578063f3ac8f12146101dc576100e0565b80631042c2ad146100e557806313af40351461010e57806315ed7caa146101235780634342e9661461012b5780636c8381f81461013e578063715018a6146101535780638129fc1c1461015b5780638da5cb5b14610163575b600080fd5b6100f86100f3366004610adb565b6101ef565b6040516101059190610bec565b60405180910390f35b61012161011c366004610ac1565b610216565b005b6100f8610371565b610121610139366004610b4f565b610376565b61014661043b565b6040516101059190610b78565b61012161044a565b6101216104eb565b610146610595565b6100f86105a4565b610186610181366004610adb565b6105a9565b6040516101059190610bc2565b6101866101a1366004610adb565b6105be565b6101216105cc565b6101866101bc366004610b0d565b6106b8565b6101866101cf366004610adb565b610702565b6100f8610710565b6101216101ea366004610b4f565b610715565b6000806101fc84846107c1565b60009081526067602052604090205460ff16949350505050565b61021e6107f4565b6001600160a01b031661022f610595565b6001600160a01b031614610273576040805162461bcd60e51b8152602060048201526006602482015265534f5f434e4f60d01b604482015290519081900360640190fd5b6001600160a01b0381166102b7576040805162461bcd60e51b81526020600482015260066024820152650534f5f4e57360d41b604482015290519081900360640190fd5b6033546001600160a01b0382811691161415610303576040805162461bcd60e51b8152602060048201526006602482015265534f5f53414f60d01b604482015290519081900360640190fd5b6034546001600160a01b038281169116141561034f576040805162461bcd60e51b8152602060048201526006602482015265534f5f53414360d01b604482015290519081900360640190fd5b603480546001600160a01b0319166001600160a01b0392909216919091179055565b600290565b8060008160ff1611801561038e575060078160ff1611155b6103b35760405162461bcd60e51b81526004016103aa90610bcd565b60405180910390fd5b60006103bd6107f4565b905060006103cb82866107c1565b60008181526067602052604090819020805460ff80821689171660ff19909116179055519091506001600160a01b038316907f283397791e09409b99db81b486878c1fe41c0d40fb646e721f04bc52549fbc829061042c9088908890610ba6565b60405180910390a25050505050565b6034546001600160a01b031690565b6104526107f4565b6001600160a01b0316610463610595565b6001600160a01b0316146104a7576040805162461bcd60e51b8152602060048201526006602482015265534f5f434e4f60d01b604482015290519081900360640190fd5b6033546040516000916001600160a01b031690600080516020610c29833981519152908390a3603380546001600160a01b0319908116909155603480549091169055565b600054610100900460ff168061050457506105046107f8565b80610512575060005460ff16155b61054d5760405162461bcd60e51b815260040180806020018281038252602e815260200180610bfb602e913960400191505060405180910390fd5b600054610100900460ff16158015610578576000805460ff1961ff0019909116610100171660011790555b610580610809565b8015610592576000805461ff00191690555b50565b6033546001600160a01b031690565b600490565b60006105b7838360016108f8565b9392505050565b60006105b7838360046108f8565b6034546001600160a01b0316610611576040805162461bcd60e51b81526020600482015260056024820152640534f5f43360dc1b604482015290519081900360640190fd5b6106196107f4565b6034546001600160a01b03908116911614610664576040805162461bcd60e51b8152602060048201526006602482015265534f5f434e4360d01b604482015290519081900360640190fd5b6034546033546040516001600160a01b039283169290911690600080516020610c2983398151915290600090a360348054603380546001600160a01b03199081166001600160a01b03841617909155169055565b60008160008160ff161180156106d2575060078160ff1611155b6106ee5760405162461bcd60e51b81526004016103aa90610bcd565b6106f98585856108f8565b95945050505050565b60006105b7838360026108f8565b600190565b8060008160ff1611801561072d575060078160ff1611155b6107495760405162461bcd60e51b81526004016103aa90610bcd565b60006107536107f4565b9050600061076182866107c1565b60008181526067602052604090819020805460ff881982161660ff19909116179055519091506001600160a01b038316907f1e84a572409e246a20065a062c50f43afa35723be0d38bf1a25e7ffb38c699359061042c9088908890610ba6565b600082826040516020016107d6929190610b8c565b60405160208183030381529060405280519060200120905092915050565b3390565b60006108033061095f565b15905090565b600054610100900460ff168061082257506108226107f8565b80610830575060005460ff16155b61086b5760405162461bcd60e51b815260040180806020018281038252602e815260200180610bfb602e913960400191505060405180910390fd5b600054610100900460ff16158015610896576000805460ff1961ff0019909116610100171660011790555b61089e610969565b60006108a86107f4565b603380546001600160a01b0319166001600160a01b03831690811790915560405191925090600090600080516020610c29833981519152908290a3508015610592576000805461ff001916905550565b60008160008160ff16118015610912575060078160ff1611155b61092e5760405162461bcd60e51b81526004016103aa90610bcd565b600061093a86866107c1565b600090815260676020526040902054841660ff90811690851614925050509392505050565b803b15155b919050565b600054610100900460ff168061098257506109826107f8565b80610990575060005460ff16155b6109cb5760405162461bcd60e51b815260040180806020018281038252602e815260200180610bfb602e913960400191505060405180910390fd5b600054610100900460ff161580156109f6576000805460ff1961ff0019909116610100171660011790555b610580600054610100900460ff1680610a125750610a126107f8565b80610a20575060005460ff16155b610a5b5760405162461bcd60e51b815260040180806020018281038252602e815260200180610bfb602e913960400191505060405180910390fd5b600054610100900460ff16158015610580576000805460ff1961ff0019909116610100171660011790558015610592576000805461ff001916905550565b80356001600160a01b038116811461096457600080fd5b803560ff8116811461096457600080fd5b600060208284031215610ad2578081fd5b6105b782610a99565b60008060408385031215610aed578081fd5b610af683610a99565b9150610b0460208401610a99565b90509250929050565b600080600060608486031215610b21578081fd5b610b2a84610a99565b9250610b3860208501610a99565b9150610b4660408501610ab0565b90509250925092565b60008060408385031215610b61578182fd5b610b6a83610a99565b9150610b0460208401610ab0565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0392909216825260ff16602082015260400190565b901515815260200190565b60208082526005908201526444415f494160d81b604082015260600190565b60ff9190911681526020019056fe496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a65648be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a2646970667358221220ed808e61d7c95a68272b9962c2fd034ab7a5ed381c76a1686586258873d9d50364736f6c63430007060033

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