ETH Price: $3,560.33 (+2.56%)

Contract

0xC02AF29944301c8FbA606a7dF8ef446dc103238C
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
Nominate New Own...891789352023-04-11 21:38:29434 days ago1681249109IN
Synthetix: Perps V2 Market State AVAXPERP
0 ETH0.000000040.001
Add Associated C...870306302023-04-06 20:29:14440 days ago1680812954IN
Synthetix: Perps V2 Market State AVAXPERP
0 ETH0.000000210.001
Remove Associate...870306042023-04-06 20:29:14440 days ago1680812954IN
Synthetix: Perps V2 Market State AVAXPERP
0 ETH0.000000030.001
0x60806040870304162023-04-06 20:27:59440 days ago1680812879IN
 Contract Creation
0 ETH0.0000030.001

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To Value
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
1075577522023-07-30 10:51:21325 days ago1690714281
Synthetix: Perps V2 Market State AVAXPERP
0 ETH
View All Internal Transactions

Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x3DfBB7D0...0f29C76Ff
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
PerpsV2MarketState

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at optimistic.etherscan.io on 2023-04-05
*/

/*
   ____            __   __        __   _
  / __/__ __ ___  / /_ / /  ___  / /_ (_)__ __
 _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
     /___/

* Synthetix: PerpsV2MarketState.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/PerpsV2MarketState.sol
* Docs: https://docs.synthetix.io/contracts/PerpsV2MarketState
*
* Contract Dependencies: 
*	- IPerpsV2MarketBaseTypes
*	- IPerpsV2MarketBaseTypesLegacyR1
*	- Owned
*	- StateShared
* Libraries: 
*	- AddressSetLib
*
* MIT License
* ===========
*
* Copyright (c) 2023 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/



pragma solidity ^0.5.16;

interface IPerpsV2MarketBaseTypes {
    /* ========== TYPES ========== */

    enum OrderType {Atomic, Delayed, Offchain}

    enum Status {
        Ok,
        InvalidPrice,
        InvalidOrderType,
        PriceOutOfBounds,
        CanLiquidate,
        CannotLiquidate,
        MaxMarketSizeExceeded,
        MaxLeverageExceeded,
        InsufficientMargin,
        NotPermitted,
        NilOrder,
        NoPositionOpen,
        PriceTooVolatile,
        PriceImpactToleranceExceeded,
        PositionFlagged,
        PositionNotFlagged
    }

    // If margin/size are positive, the position is long; if negative then it is short.
    struct Position {
        uint64 id;
        uint64 lastFundingIndex;
        uint128 margin;
        uint128 lastPrice;
        int128 size;
    }

    // Delayed order storage
    struct DelayedOrder {
        bool isOffchain; // flag indicating the delayed order is offchain
        int128 sizeDelta; // difference in position to pass to modifyPosition
        uint128 desiredFillPrice; // desired fill price as usd used on fillPrice at execution
        uint128 targetRoundId; // price oracle roundId using which price this order needs to executed
        uint128 commitDeposit; // the commitDeposit paid upon submitting that needs to be refunded if order succeeds
        uint128 keeperDeposit; // the keeperDeposit paid upon submitting that needs to be paid / refunded on tx confirmation
        uint256 executableAtTime; // The timestamp at which this order is executable at
        uint256 intentionTime; // The block timestamp of submission
        bytes32 trackingCode; // tracking code to emit on execution for volume source fee sharing
    }
}


interface IPerpsV2MarketBaseTypesLegacyR1 {
    /* ========== TYPES ========== */

    enum OrderType {Atomic, Delayed, Offchain}

    enum Status {
        Ok,
        InvalidPrice,
        InvalidOrderType,
        PriceOutOfBounds,
        CanLiquidate,
        CannotLiquidate,
        MaxMarketSizeExceeded,
        MaxLeverageExceeded,
        InsufficientMargin,
        NotPermitted,
        NilOrder,
        NoPositionOpen,
        PriceTooVolatile,
        PriceImpactToleranceExceeded,
        PositionFlagged,
        PositionNotFlagged
    }

    // If margin/size are positive, the position is long; if negative then it is short.
    struct Position {
        uint64 id;
        uint64 lastFundingIndex;
        uint128 margin;
        uint128 lastPrice;
        int128 size;
    }

    // Delayed order storage
    struct DelayedOrder {
        bool isOffchain; // flag indicating the delayed order is offchain
        int128 sizeDelta; // difference in position to pass to modifyPosition
        uint128 priceImpactDelta; // desired price delta
        uint128 targetRoundId; // price oracle roundId using which price this order needs to executed
        uint128 commitDeposit; // the commitDeposit paid upon submitting that needs to be refunded if order succeeds
        uint128 keeperDeposit; // the keeperDeposit paid upon submitting that needs to be paid / refunded on tx confirmation
        uint256 executableAtTime; // The timestamp at which this order is executable at
        uint256 intentionTime; // The block timestamp of submission
        bytes32 trackingCode; // tracking code to emit on execution for volume source fee sharing
    }
}


// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned {
    address public owner;
    address public nominatedOwner;

    constructor(address _owner) public {
        require(_owner != address(0), "Owner address cannot be 0");
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    function nominateNewOwner(address _owner) external onlyOwner {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    function acceptOwnership() external {
        require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
        emit OwnerChanged(owner, nominatedOwner);
        owner = nominatedOwner;
        nominatedOwner = address(0);
    }

    modifier onlyOwner {
        _onlyOwner();
        _;
    }

    function _onlyOwner() private view {
        require(msg.sender == owner, "Only the contract owner may perform this action");
    }

    event OwnerNominated(address newOwner);
    event OwnerChanged(address oldOwner, address newOwner);
}


// https://docs.synthetix.io/contracts/source/libraries/addresssetlib/
library AddressSetLib {
    struct AddressSet {
        address[] elements;
        mapping(address => uint) indices;
    }

    function contains(AddressSet storage set, address candidate) internal view returns (bool) {
        if (set.elements.length == 0) {
            return false;
        }
        uint index = set.indices[candidate];
        return index != 0 || set.elements[0] == candidate;
    }

    function getPage(
        AddressSet storage set,
        uint index,
        uint pageSize
    ) internal view returns (address[] memory) {
        // NOTE: This implementation should be converted to slice operators if the compiler is updated to v0.6.0+
        uint endIndex = index + pageSize; // The check below that endIndex <= index handles overflow.

        // If the page extends past the end of the list, truncate it.
        if (endIndex > set.elements.length) {
            endIndex = set.elements.length;
        }
        if (endIndex <= index) {
            return new address[](0);
        }

        uint n = endIndex - index; // We already checked for negative overflow.
        address[] memory page = new address[](n);
        for (uint i; i < n; i++) {
            page[i] = set.elements[i + index];
        }
        return page;
    }

    function add(AddressSet storage set, address element) internal {
        // Adding to a set is an idempotent operation.
        if (!contains(set, element)) {
            set.indices[element] = set.elements.length;
            set.elements.push(element);
        }
    }

    function remove(AddressSet storage set, address element) internal {
        require(contains(set, element), "Element not in set.");
        // Replace the removed element with the last element of the list.
        uint index = set.indices[element];
        uint lastIndex = set.elements.length - 1; // We required that element is in the list, so it is not empty.
        if (index != lastIndex) {
            // No need to shift the last element if it is the one we want to delete.
            address shiftedElement = set.elements[lastIndex];
            set.elements[index] = shiftedElement;
            set.indices[shiftedElement] = index;
        }
        set.elements.pop();
        delete set.indices[element];
    }
}


// Inheritance


// Libraries


/**
 * Based on `State.sol`. This contract adds the capability to have multiple associated contracts
 * enabled to access a state contract.
 *
 * Note: it changed the interface to manage the associated contracts from `setAssociatedContract`
 * to `addAssociatedContracts` or `removeAssociatedContracts` and the modifier is now plural
 */
// https://docs.synthetix.io/contracts/source/contracts/StateShared
contract StateShared is Owned {
    using AddressSetLib for AddressSetLib.AddressSet;

    // the address of the contract that can modify variables
    // this can only be changed by the owner of this contract
    AddressSetLib.AddressSet internal _associatedContracts;

    constructor(address[] memory associatedContracts) internal {
        // This contract is abstract, and thus cannot be instantiated directly
        require(owner != address(0), "Owner must be set");

        _addAssociatedContracts(associatedContracts);
    }

    /* ========== SETTERS ========== */

    function _addAssociatedContracts(address[] memory associatedContracts) internal {
        for (uint i = 0; i < associatedContracts.length; i++) {
            if (!_associatedContracts.contains(associatedContracts[i])) {
                _associatedContracts.add(associatedContracts[i]);
                emit AssociatedContractAdded(associatedContracts[i]);
            }
        }
    }

    // Add associated contracts
    function addAssociatedContracts(address[] calldata associatedContracts) external onlyOwner {
        _addAssociatedContracts(associatedContracts);
    }

    // Remove associated contracts
    function removeAssociatedContracts(address[] calldata associatedContracts) external onlyOwner {
        for (uint i = 0; i < associatedContracts.length; i++) {
            if (_associatedContracts.contains(associatedContracts[i])) {
                _associatedContracts.remove(associatedContracts[i]);
                emit AssociatedContractRemoved(associatedContracts[i]);
            }
        }
    }

    function associatedContracts() external view returns (address[] memory) {
        return _associatedContracts.getPage(0, _associatedContracts.elements.length);
    }

    /* ========== MODIFIERS ========== */

    modifier onlyAssociatedContracts {
        require(_associatedContracts.contains(msg.sender), "Only an associated contract can perform this action");
        _;
    }

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

    event AssociatedContractAdded(address associatedContract);
    event AssociatedContractRemoved(address associatedContract);
}


pragma experimental ABIEncoderV2;

// Inheritance


// Libraries


/**
 Legacy State holding historical data. Old PerpsV2MarketState.sol
 Once this contract is linked to the next generation of PerpsV2MarketState, the data is not updateable anymore. 
 The only contract enabled to operate (if needed) on the data is the next generation PerpsV2MarketState, 
 in order to achieve that, the new State is the only address included as associated contract.

 Atomic data is copied at `migration` time.
 PerpsV2MarketState ---(consumes)--> PerpsV2MarketStateLegacyR1 
 */

// https://docs.synthetix.io/contracts/source/contracts/PerpsV2MarketStateLegacyR1
contract PerpsV2MarketStateLegacyR1 is Owned, StateShared, IPerpsV2MarketBaseTypesLegacyR1 {
    using AddressSetLib for AddressSetLib.AddressSet;

    // The market identifier in the perpsV2 system (manager + settings). Multiple markets can co-exist
    // for the same asset in order to allow migrations.
    bytes32 public marketKey;

    // The asset being traded in this market. This should be a valid key into the ExchangeRates contract.
    bytes32 public baseAsset;

    // The total number of base units in long and short positions.
    uint128 public marketSize;

    /*
     * The net position in base units of the whole market.
     * When this is positive, longs outweigh shorts. When it is negative, shorts outweigh longs.
     */
    int128 public marketSkew;

    /*
     * This holds the value: sum_{p in positions}{p.margin - p.size * (p.lastPrice + fundingSequence[p.lastFundingIndex])}
     * Then marketSkew * (price + _nextFundingEntry()) + _entryDebtCorrection yields the total system debt,
     * which is equivalent to the sum of remaining margins in all positions.
     */
    int128 internal _entryDebtCorrection;

    /*
     * The funding sequence allows constant-time calculation of the funding owed to a given position.
     * Each entry in the sequence holds the net funding accumulated per base unit since the market was created.
     * Then to obtain the net funding over a particular interval, subtract the start point's sequence entry
     * from the end point's sequence entry.
     * Positions contain the funding sequence entry at the time they were confirmed; so to compute
     * the net funding on a given position, obtain from this sequence the net funding per base unit
     * since the position was confirmed and multiply it by the position size.
     */
    uint32 public fundingLastRecomputed;
    int128[] public fundingSequence;

    /*
     * The funding rate last time it was recomputed. The market funding rate floats and requires the previously
     * calculated funding rate, time, and current market conditions to derive the next.
     */
    int128 public fundingRateLastRecomputed;

    /*
     * Each user's position. Multiple positions can always be merged, so each user has
     * only have one position at a time.
     */
    mapping(address => Position) public positions;

    // The set of all addresses (positions) .
    AddressSetLib.AddressSet internal _positionAddresses;

    // The set of all addresses (delayedOrders) .
    AddressSetLib.AddressSet internal _delayedOrderAddresses;

    // This increments for each position; zero reflects a position that does not exist.
    uint64 internal _nextPositionId = 1;

    /// @dev Holds a mapping of accounts to orders. Only one order per account is supported
    mapping(address => DelayedOrder) public delayedOrders;

    constructor(
        address _owner,
        address[] memory _associatedContracts,
        bytes32 _baseAsset,
        bytes32 _marketKey
    ) public Owned(_owner) StateShared(_associatedContracts) {
        baseAsset = _baseAsset;
        marketKey = _marketKey;

        // Initialise the funding sequence with 0 initially accrued, so that the first usable funding index is 1.
        fundingSequence.push(0);

        fundingRateLastRecomputed = 0;
    }

    function entryDebtCorrection() external view returns (int128) {
        return _entryDebtCorrection;
    }

    function nextPositionId() external view returns (uint64) {
        return _nextPositionId;
    }

    function fundingSequenceLength() external view returns (uint) {
        return fundingSequence.length;
    }

    function getPositionAddressesPage(uint index, uint pageSize)
        external
        view
        onlyAssociatedContracts
        returns (address[] memory)
    {
        return _positionAddresses.getPage(index, pageSize);
    }

    function getDelayedOrderAddressesPage(uint index, uint pageSize)
        external
        view
        onlyAssociatedContracts
        returns (address[] memory)
    {
        return _delayedOrderAddresses.getPage(index, pageSize);
    }

    function getPositionAddressesLength() external view onlyAssociatedContracts returns (uint) {
        return _positionAddresses.elements.length;
    }

    function getDelayedOrderAddressesLength() external view onlyAssociatedContracts returns (uint) {
        return _delayedOrderAddresses.elements.length;
    }

    function setMarketKey(bytes32 _marketKey) external onlyAssociatedContracts {
        require(marketKey == bytes32(0) || _marketKey == marketKey, "Cannot change market key");
        marketKey = _marketKey;
    }

    function setBaseAsset(bytes32 _baseAsset) external onlyAssociatedContracts {
        require(baseAsset == bytes32(0) || _baseAsset == baseAsset, "Cannot change base asset");
        baseAsset = _baseAsset;
    }

    function setMarketSize(uint128 _marketSize) external onlyAssociatedContracts {
        marketSize = _marketSize;
    }

    function setEntryDebtCorrection(int128 entryDebtCorrection) external onlyAssociatedContracts {
        _entryDebtCorrection = entryDebtCorrection;
    }

    function setNextPositionId(uint64 nextPositionId) external onlyAssociatedContracts {
        _nextPositionId = nextPositionId;
    }

    function setMarketSkew(int128 _marketSkew) external onlyAssociatedContracts {
        marketSkew = _marketSkew;
    }

    function setFundingLastRecomputed(uint32 lastRecomputed) external onlyAssociatedContracts {
        fundingLastRecomputed = lastRecomputed;
    }

    function pushFundingSequence(int128 _fundingSequence) external onlyAssociatedContracts {
        fundingSequence.push(_fundingSequence);
    }

    // TODO: Perform this update when maxFundingVelocity and skewScale are modified.
    function setFundingRateLastRecomputed(int128 _fundingRateLastRecomputed) external onlyAssociatedContracts {
        fundingRateLastRecomputed = _fundingRateLastRecomputed;
    }

    /**
     * @notice Set the position of a given account
     * @dev Only the associated contract may call this.
     * @param account The account whose value to set.
     * @param id position id.
     * @param lastFundingIndex position lastFundingIndex.
     * @param margin position margin.
     * @param lastPrice position lastPrice.
     * @param size position size.
     */
    function updatePosition(
        address account,
        uint64 id,
        uint64 lastFundingIndex,
        uint128 margin,
        uint128 lastPrice,
        int128 size
    ) external onlyAssociatedContracts {
        positions[account] = Position(id, lastFundingIndex, margin, lastPrice, size);
        _positionAddresses.add(account);
    }

    /**
     * @notice Store a delayed order at the specified account
     * @dev Only the associated contract may call this.
     * @param account The account whose value to set.
     * @param sizeDelta Difference in position to pass to modifyPosition
     * @param priceImpactDelta Price impact tolerance as a percentage used on fillPrice at execution
     * @param targetRoundId Price oracle roundId using which price this order needs to executed
     * @param commitDeposit The commitDeposit paid upon submitting that needs to be refunded if order succeeds
     * @param keeperDeposit The keeperDeposit paid upon submitting that needs to be paid / refunded on tx confirmation
     * @param executableAtTime The timestamp at which this order is executable at
     * @param isOffchain Flag indicating if the order is offchain
     * @param trackingCode Tracking code to emit on execution for volume source fee sharing
     */
    function updateDelayedOrder(
        address account,
        bool isOffchain,
        int128 sizeDelta,
        uint128 priceImpactDelta,
        uint128 targetRoundId,
        uint128 commitDeposit,
        uint128 keeperDeposit,
        uint256 executableAtTime,
        uint256 intentionTime,
        bytes32 trackingCode
    ) external onlyAssociatedContracts {
        delayedOrders[account] = DelayedOrder(
            isOffchain,
            sizeDelta,
            priceImpactDelta,
            targetRoundId,
            commitDeposit,
            keeperDeposit,
            executableAtTime,
            intentionTime,
            trackingCode
        );
        _delayedOrderAddresses.add(account);
    }

    /**
     * @notice Delete the position of a given account
     * @dev Only the associated contract may call this.
     * @param account The account whose position should be deleted.
     */
    function deletePosition(address account) external onlyAssociatedContracts {
        delete positions[account];
        if (_positionAddresses.contains(account)) {
            _positionAddresses.remove(account);
        }
    }

    function deleteDelayedOrder(address account) external onlyAssociatedContracts {
        delete delayedOrders[account];
        if (_delayedOrderAddresses.contains(account)) {
            _delayedOrderAddresses.remove(account);
        }
    }
}


// Inheritance


// Libraries


// https://docs.synthetix.io/contracts/source/contracts/PerpsV2MarketState
// solhint-disable-next-line max-states-count
contract PerpsV2MarketState is Owned, StateShared, IPerpsV2MarketBaseTypes {
    using AddressSetLib for AddressSetLib.AddressSet;

    // Legacy state link
    bool public initialized;
    uint public legacyFundinSequenceOffset;
    PerpsV2MarketStateLegacyR1 public legacyState;
    bool private _legacyContractExists;
    mapping(address => bool) internal _positionMigrated;
    mapping(address => bool) internal _delayedOrderMigrated;

    // The market identifier in the perpsV2 system (manager + settings). Multiple markets can co-exist
    // for the same asset in order to allow migrations.
    bytes32 public marketKey;

    // The asset being traded in this market. This should be a valid key into the ExchangeRates contract.
    bytes32 public baseAsset;

    // The total number of base units in long and short positions.
    uint128 public marketSize;

    /*
     * The net position in base units of the whole market.
     * When this is positive, longs outweigh shorts. When it is negative, shorts outweigh longs.
     */
    int128 public marketSkew;

    /*
     * This holds the value: sum_{p in positions}{p.margin - p.size * (p.lastPrice + fundingSequence[p.lastFundingIndex])}
     * Then marketSkew * (price + _nextFundingEntry()) + _entryDebtCorrection yields the total system debt,
     * which is equivalent to the sum of remaining margins in all positions.
     */
    int128 internal _entryDebtCorrection;

    /*
     * The funding sequence allows constant-time calculation of the funding owed to a given position.
     * Each entry in the sequence holds the net funding accumulated per base unit since the market was created.
     * Then to obtain the net funding over a particular interval, subtract the start point's sequence entry
     * from the end point's sequence entry.
     * Positions contain the funding sequence entry at the time they were confirmed; so to compute
     * the net funding on a given position, obtain from this sequence the net funding per base unit
     * since the position was confirmed and multiply it by the position size.
     */
    uint32 public fundingLastRecomputed;
    int128[] internal _fundingSequence;

    /*
     * The funding rate last time it was recomputed. The market funding rate floats and requires the previously
     * calculated funding rate, time, and current market conditions to derive the next.
     */
    int128 public fundingRateLastRecomputed;

    /*
     * Each user's position. Multiple positions can always be merged, so each user has
     * only have one position at a time.
     */
    mapping(address => Position) internal _positions;

    // The set of all addresses (positions) .
    AddressSetLib.AddressSet internal _positionAddresses;

    // The set of all addresses (delayedOrders) .
    AddressSetLib.AddressSet internal _delayedOrderAddresses;

    // This increments for each position; zero reflects a position that does not exist.
    uint64 internal _nextPositionId = 1;

    /// @dev Holds a mapping of accounts to orders. Only one order per account is supported
    mapping(address => DelayedOrder) internal _delayedOrders;

    /// @dev Holds a mapping of accounts to flagger address to flag an account. Only one order per account is supported
    mapping(address => address) public positionFlagger;
    AddressSetLib.AddressSet internal _flaggedAddresses;

    constructor(
        address _owner,
        address[] memory _associatedContracts,
        bytes32 _baseAsset,
        bytes32 _marketKey,
        address _legacyState
    ) public Owned(_owner) StateShared(_associatedContracts) {
        baseAsset = _baseAsset;
        marketKey = _marketKey;

        // Set legacyState
        if (_legacyState != address(0)) {
            legacyState = PerpsV2MarketStateLegacyR1(_legacyState);
            _legacyContractExists = true;
            // Confirm same asset/market key
            // Passing the marketKey as parameter and confirming with the legacy allows for double check the intended market is configured
            require(
                baseAsset == legacyState.baseAsset() && marketKey == legacyState.marketKey(),
                "Invalid legacy state baseAsset or marketKey"
            );
        }
    }

    /*
     * Links this State contract with the legacy one fixing the latest state on the previous contract.
     * This function should be called with the market paused to prevent any issue.
     * Note: It's not called on constructor to allow separation of deployment and
     * setup/linking and reduce downtime.
     */
    function linkOrInitializeState() external onlyOwner {
        require(!initialized, "State already initialized");

        if (_legacyContractExists) {
            // copy atomic values
            marketSize = legacyState.marketSize();
            marketSkew = legacyState.marketSkew();
            _entryDebtCorrection = legacyState.entryDebtCorrection();
            _nextPositionId = legacyState.nextPositionId();
            fundingLastRecomputed = legacyState.fundingLastRecomputed();
            fundingRateLastRecomputed = legacyState.fundingRateLastRecomputed();
            uint legacyFundingSequenceLength = legacyState.fundingSequenceLength() - 1;

            // link fundingSequence
            // initialize the _fundingSequence array
            _fundingSequence.push(legacyState.fundingSequence(legacyFundingSequenceLength));
            // get fundingSequence offset
            legacyFundinSequenceOffset = legacyFundingSequenceLength;
        } else {
            // Initialise the funding sequence with 0 initially accrued, so that the first usable funding index is 1.
            _fundingSequence.push(0);
            fundingRateLastRecomputed = 0;
        }

        // set legacyConfigured
        initialized = true;
        // emit event
        emit MarketStateInitialized(marketKey, _legacyContractExists, address(legacyState), legacyFundinSequenceOffset);
    }

    function entryDebtCorrection() external view returns (int128) {
        return _entryDebtCorrection;
    }

    function nextPositionId() external view returns (uint64) {
        return _nextPositionId;
    }

    function fundingSequence(uint index) external view returns (int128) {
        if (_legacyContractExists && index < legacyFundinSequenceOffset) {
            return legacyState.fundingSequence(index);
        }

        return _fundingSequence[index - legacyFundinSequenceOffset];
    }

    function fundingSequenceLength() external view returns (uint) {
        return legacyFundinSequenceOffset + _fundingSequence.length;
    }

    function isFlagged(address account) external view returns (bool) {
        return positionFlagger[account] != address(0);
    }

    function positions(address account) external view returns (Position memory) {
        // If it doesn't exist here check legacy
        if (_legacyContractExists && !_positionMigrated[account] && _positions[account].id == 0) {
            (uint64 id, uint64 lastFundingIndex, uint128 margin, uint128 lastPrice, int128 size) =
                legacyState.positions(account);

            return Position(id, lastFundingIndex, margin, lastPrice, size);
        }

        return _positions[account];
    }

    function delayedOrders(address account) external view returns (DelayedOrder memory) {
        // If it doesn't exist here check legacy
        if (_legacyContractExists && !_delayedOrderMigrated[account] && _delayedOrders[account].sizeDelta == 0) {
            (
                bool isOffchain,
                int128 sizeDelta,
                uint128 desiredFillPrice,
                uint128 targetRoundId,
                uint128 commitDeposit,
                uint128 keeperDeposit,
                uint256 executableAtTime,
                uint256 intentionTime,
                bytes32 trackingCode
            ) = legacyState.delayedOrders(account);
            return
                DelayedOrder(
                    isOffchain,
                    sizeDelta,
                    desiredFillPrice,
                    targetRoundId,
                    commitDeposit,
                    keeperDeposit,
                    executableAtTime,
                    intentionTime,
                    trackingCode
                );
        }

        return _delayedOrders[account];
    }

    /*
     * helper function for migration and analytics. Not linked to legacy state
     */
    function getPositionAddressesPage(uint index, uint pageSize)
        external
        view
        onlyAssociatedContracts
        returns (address[] memory)
    {
        return _positionAddresses.getPage(index, pageSize);
    }

    /*
     * helper function for migration and analytics. Not linked to legacy state
     */
    function getDelayedOrderAddressesPage(uint index, uint pageSize) external view returns (address[] memory) {
        return _delayedOrderAddresses.getPage(index, pageSize);
    }

    /*
     * helper function for migration and analytics. Not linked to legacy state
     */
    function getFlaggedAddressesPage(uint index, uint pageSize) external view returns (address[] memory) {
        return _flaggedAddresses.getPage(index, pageSize);
    }

    /*
     * helper function for migration and analytics. Not linked to legacy state
     */
    function getPositionAddressesLength() external view returns (uint) {
        return _positionAddresses.elements.length;
    }

    /*
     * helper function for migration and analytics. Not linked to legacy state
     */
    function getDelayedOrderAddressesLength() external view returns (uint) {
        return _delayedOrderAddresses.elements.length;
    }

    /*
     * helper function for migration and analytics. Not linked to legacy state
     */
    function getFlaggedAddressesLength() external view returns (uint) {
        return _flaggedAddresses.elements.length;
    }

    function setMarketKey(bytes32 _marketKey) external onlyIfInitialized onlyAssociatedContracts {
        require(marketKey == bytes32(0) || _marketKey == marketKey, "Cannot change market key");
        marketKey = _marketKey;
    }

    function setBaseAsset(bytes32 _baseAsset) external onlyIfInitialized onlyAssociatedContracts {
        require(baseAsset == bytes32(0) || _baseAsset == baseAsset, "Cannot change base asset");
        baseAsset = _baseAsset;
    }

    function setMarketSize(uint128 _marketSize) external onlyIfInitialized onlyAssociatedContracts {
        marketSize = _marketSize;
    }

    function setEntryDebtCorrection(int128 entryDebtCorrection) external onlyIfInitialized onlyAssociatedContracts {
        _entryDebtCorrection = entryDebtCorrection;
    }

    function setNextPositionId(uint64 nextPositionId) external onlyIfInitialized onlyAssociatedContracts {
        _nextPositionId = nextPositionId;
    }

    function setMarketSkew(int128 _marketSkew) external onlyIfInitialized onlyAssociatedContracts {
        marketSkew = _marketSkew;
    }

    function setFundingLastRecomputed(uint32 lastRecomputed) external onlyIfInitialized onlyAssociatedContracts {
        fundingLastRecomputed = lastRecomputed;
    }

    function pushFundingSequence(int128 fundingSequence) external onlyIfInitialized onlyAssociatedContracts {
        _fundingSequence.push(fundingSequence);
    }

    // TODO: Perform this update when maxFundingVelocity and skewScale are modified.
    function setFundingRateLastRecomputed(int128 _fundingRateLastRecomputed)
        external
        onlyIfInitialized
        onlyAssociatedContracts
    {
        fundingRateLastRecomputed = _fundingRateLastRecomputed;
    }

    /**
     * @notice Set the position of a given account
     * @dev Only the associated contract may call this.
     * @param account The account whose value to set.
     * @param id position id.
     * @param lastFundingIndex position lastFundingIndex.
     * @param margin position margin.
     * @param lastPrice position lastPrice.
     * @param size position size.
     */
    function updatePosition(
        address account,
        uint64 id,
        uint64 lastFundingIndex,
        uint128 margin,
        uint128 lastPrice,
        int128 size
    ) external onlyIfInitialized onlyAssociatedContracts {
        if (_legacyContractExists && !_positionMigrated[account]) {
            // Delete (if needed) from legacy state
            legacyState.deletePosition(account);

            // flag as already migrated
            _positionMigrated[account] = true;
        }

        _positions[account] = Position(id, lastFundingIndex, margin, lastPrice, size);
        _positionAddresses.add(account);
    }

    /**
     * @notice Store a delayed order at the specified account
     * @dev Only the associated contract may call this.
     * @param account The account whose value to set.
     * @param sizeDelta Difference in position to pass to modifyPosition
     * @param desiredFillPrice Desired fill price as usd used on fillPrice at execution
     * @param targetRoundId Price oracle roundId using which price this order needs to executed
     * @param commitDeposit The commitDeposit paid upon submitting that needs to be refunded if order succeeds
     * @param keeperDeposit The keeperDeposit paid upon submitting that needs to be paid / refunded on tx confirmation
     * @param executableAtTime The timestamp at which this order is executable at
     * @param isOffchain Flag indicating if the order is offchain
     * @param trackingCode Tracking code to emit on execution for volume source fee sharing
     */
    function updateDelayedOrder(
        address account,
        bool isOffchain,
        int128 sizeDelta,
        uint128 desiredFillPrice,
        uint128 targetRoundId,
        uint128 commitDeposit,
        uint128 keeperDeposit,
        uint256 executableAtTime,
        uint256 intentionTime,
        bytes32 trackingCode
    ) external onlyIfInitialized onlyAssociatedContracts {
        if (_legacyContractExists && !_delayedOrderMigrated[account]) {
            // Delete (if needed) from legacy state
            legacyState.deleteDelayedOrder(account);

            // flag as already migrated
            _delayedOrderMigrated[account] = true;
        }

        _delayedOrders[account] = DelayedOrder(
            isOffchain,
            sizeDelta,
            desiredFillPrice,
            targetRoundId,
            commitDeposit,
            keeperDeposit,
            executableAtTime,
            intentionTime,
            trackingCode
        );
        _delayedOrderAddresses.add(account);
    }

    /**
     * @notice Delete the position of a given account
     * @dev Only the associated contract may call this.
     * @param account The account whose position should be deleted.
     */
    function deletePosition(address account) external onlyIfInitialized onlyAssociatedContracts {
        delete _positions[account];
        if (_positionAddresses.contains(account)) {
            _positionAddresses.remove(account);
        }

        if (_legacyContractExists && !_positionMigrated[account]) {
            legacyState.deletePosition(account);

            // flag as already migrated
            _positionMigrated[account] = true;
        }
    }

    function deleteDelayedOrder(address account) external onlyIfInitialized onlyAssociatedContracts {
        delete _delayedOrders[account];
        if (_delayedOrderAddresses.contains(account)) {
            _delayedOrderAddresses.remove(account);
        }

        // attempt to delete on legacy
        if (_legacyContractExists && !_delayedOrderMigrated[account]) {
            legacyState.deleteDelayedOrder(account);

            // flag as already migrated
            _delayedOrderMigrated[account] = true;
        }
    }

    function flag(address account, address flagger) external onlyIfInitialized onlyAssociatedContracts {
        positionFlagger[account] = flagger;
        _flaggedAddresses.add(account);
    }

    function unflag(address account) external onlyIfInitialized onlyAssociatedContracts {
        delete positionFlagger[account];
        if (_flaggedAddresses.contains(account)) {
            _flaggedAddresses.remove(account);
        }
    }

    modifier onlyIfInitialized() {
        require(initialized, "State not initialized");
        _;
    }

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

    event MarketStateInitialized(
        bytes32 indexed marketKey,
        bool legacyContractExists,
        address legacyState,
        uint legacyFundinSequenceOffset
    );
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address[]","name":"_associatedContracts","type":"address[]"},{"internalType":"bytes32","name":"_baseAsset","type":"bytes32"},{"internalType":"bytes32","name":"_marketKey","type":"bytes32"},{"internalType":"address","name":"_legacyState","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"associatedContract","type":"address"}],"name":"AssociatedContractAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"associatedContract","type":"address"}],"name":"AssociatedContractRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"marketKey","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"legacyContractExists","type":"bool"},{"indexed":false,"internalType":"address","name":"legacyState","type":"address"},{"indexed":false,"internalType":"uint256","name":"legacyFundinSequenceOffset","type":"uint256"}],"name":"MarketStateInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"associatedContracts","type":"address[]"}],"name":"addAssociatedContracts","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"associatedContracts","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"baseAsset","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"delayedOrders","outputs":[{"components":[{"internalType":"bool","name":"isOffchain","type":"bool"},{"internalType":"int128","name":"sizeDelta","type":"int128"},{"internalType":"uint128","name":"desiredFillPrice","type":"uint128"},{"internalType":"uint128","name":"targetRoundId","type":"uint128"},{"internalType":"uint128","name":"commitDeposit","type":"uint128"},{"internalType":"uint128","name":"keeperDeposit","type":"uint128"},{"internalType":"uint256","name":"executableAtTime","type":"uint256"},{"internalType":"uint256","name":"intentionTime","type":"uint256"},{"internalType":"bytes32","name":"trackingCode","type":"bytes32"}],"internalType":"struct IPerpsV2MarketBaseTypes.DelayedOrder","name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"deleteDelayedOrder","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"deletePosition","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"entryDebtCorrection","outputs":[{"internalType":"int128","name":"","type":"int128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"flagger","type":"address"}],"name":"flag","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"fundingLastRecomputed","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fundingRateLastRecomputed","outputs":[{"internalType":"int128","name":"","type":"int128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"fundingSequence","outputs":[{"internalType":"int128","name":"","type":"int128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fundingSequenceLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getDelayedOrderAddressesLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"getDelayedOrderAddressesPage","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getFlaggedAddressesLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"getFlaggedAddressesPage","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPositionAddressesLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"getPositionAddressesPage","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isFlagged","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"legacyFundinSequenceOffset","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"legacyState","outputs":[{"internalType":"contract PerpsV2MarketStateLegacyR1","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"linkOrInitializeState","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"marketKey","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"marketSize","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"marketSkew","outputs":[{"internalType":"int128","name":"","type":"int128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"nextPositionId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"positionFlagger","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"positions","outputs":[{"components":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint64","name":"lastFundingIndex","type":"uint64"},{"internalType":"uint128","name":"margin","type":"uint128"},{"internalType":"uint128","name":"lastPrice","type":"uint128"},{"internalType":"int128","name":"size","type":"int128"}],"internalType":"struct IPerpsV2MarketBaseTypes.Position","name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"int128","name":"fundingSequence","type":"int128"}],"name":"pushFundingSequence","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"associatedContracts","type":"address[]"}],"name":"removeAssociatedContracts","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"_baseAsset","type":"bytes32"}],"name":"setBaseAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"int128","name":"entryDebtCorrection","type":"int128"}],"name":"setEntryDebtCorrection","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint32","name":"lastRecomputed","type":"uint32"}],"name":"setFundingLastRecomputed","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"int128","name":"_fundingRateLastRecomputed","type":"int128"}],"name":"setFundingRateLastRecomputed","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"_marketKey","type":"bytes32"}],"name":"setMarketKey","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint128","name":"_marketSize","type":"uint128"}],"name":"setMarketSize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"int128","name":"_marketSkew","type":"int128"}],"name":"setMarketSkew","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint64","name":"nextPositionId","type":"uint64"}],"name":"setNextPositionId","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"unflag","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"isOffchain","type":"bool"},{"internalType":"int128","name":"sizeDelta","type":"int128"},{"internalType":"uint128","name":"desiredFillPrice","type":"uint128"},{"internalType":"uint128","name":"targetRoundId","type":"uint128"},{"internalType":"uint128","name":"commitDeposit","type":"uint128"},{"internalType":"uint128","name":"keeperDeposit","type":"uint128"},{"internalType":"uint256","name":"executableAtTime","type":"uint256"},{"internalType":"uint256","name":"intentionTime","type":"uint256"},{"internalType":"bytes32","name":"trackingCode","type":"bytes32"}],"name":"updateDelayedOrder","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint64","name":"lastFundingIndex","type":"uint64"},{"internalType":"uint128","name":"margin","type":"uint128"},{"internalType":"uint128","name":"lastPrice","type":"uint128"},{"internalType":"int128","name":"size","type":"int128"}],"name":"updatePosition","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061028a5760003560e01c80635af0d81f1161015c578063b3a3444e116100ce578063d7103a4611610087578063d7103a4614610559578063e44c84c214610561578063eb56105d14610569578063edd6aa881461057e578063fc6bb1f214610591578063fef48a99146105a45761028a565b8063b3a3444e146104fb578063b545f7121461050e578063c8b809aa14610521578063cded0cea14610541578063cdf456e114610549578063d0a514b3146105515761028a565b806389789e961161012057806389789e961461049d578063899346c7146104b05780638da5cb5b146104c557806395e76562146104cd5780639866471a146104e0578063a720184e146104f35761028a565b80635af0d81f146104545780636938dc0e146104675780636eda00e51461047a57806379ba509714610482578063884fc1821461048a5761028a565b80632bd11f221161020057806342a449be116101b957806342a449be146103d157806345d65e31146103e4578063460af7a6146104045780634eb6b7ac1461041757806353a47bb71461042c57806355f57510146104345761028a565b80632bd11f2214610368578063312d6b731461037b5780633b8d1e7f146103905780633ef3461a146103a357806340aa8c4e146103ab57806341108cf2146103be5761028a565b80632118aa90116102525780632118aa90146102fb57806322d3090a1461030e578063230ee97b1461032357806323393c0d1461033657806327b9a2361461034b5780632b58ecef146103605761028a565b806307369b0b1461028f578063104d46f7146102a4578063158ef93e146102b75780631627540c146102d55780631d2c6717146102e8575b600080fd5b6102a261029d366004612703565b6105b7565b005b6102a26102b23660046129de565b610715565b6102bf61078b565b6040516102cc9190612f9d565b60405180910390f35b6102a26102e3366004612703565b610794565b6102a26102f6366004612721565b6107f2565b6102a26103093660046129c0565b61087e565b6103166108fe565b6040516102cc9190612fef565b6102a26103313660046128bb565b610907565b61033e61094b565b6040516102cc9190612fe1565b61035361095a565b6040516102cc91906130a8565b61031661096d565b6102a26103763660046129de565b61097d565b6103836109f3565b6040516102cc9190612f8c565b6102a261039e3660046129c0565b610a11565b6102a2610a91565b6102a26103b936600461275b565b6110d8565b6103166103cc3660046129c0565b6113b8565b6102a26103df3660046128bb565b61149d565b6103f76103f2366004612703565b61157e565b6040516102cc9190612f63565b6102a2610412366004612a1a565b611599565b61041f61160a565b6040516102cc9190612fd3565b6103f7611610565b610447610442366004612703565b61161f565b6040516102cc919061308c565b6102a2610462366004612834565b6117de565b6102a2610475366004612703565b611a60565b61041f611afc565b6102a2611b02565b610383610498366004612a74565b611b9e565b6103836104ab366004612a74565b611bbb565b6104b8611bfc565b6040516102cc91906130b6565b6103f7611c0b565b6102a26104db366004612aa4565b611c1a565b6102a26104ee366004612703565b611c8f565b61041f611e14565b610383610509366004612a74565b611e1a565b6102a261051c3660046129de565b611e2e565b61053461052f366004612703565b611ea2565b6040516102cc919061307d565b61041f6120ac565b61041f6120b6565b61041f6120bc565b61041f6120c2565b6103166120c8565b6105716120d1565b6040516102cc919061309a565b6102a261058c366004612ae0565b6120e0565b6102a261059f3660046129de565b612152565b6102bf6105b2366004612703565b612209565b60045460ff166105e25760405162461bcd60e51b81526004016105d99061301d565b60405180910390fd5b6105f360023363ffffffff61222916565b61060f5760405162461bcd60e51b81526004016105d99061303d565b6001600160a01b0381166000908152600f602052604081208181556001015561063f60108263ffffffff61222916565b156106555761065560108263ffffffff61229716565b600654600160a01b900460ff16801561068757506001600160a01b03811660009081526007602052604090205460ff16155b15610712576006546040516307369b0b60e01b81526001600160a01b03909116906307369b0b906106bc908490600401612f63565b600060405180830381600087803b1580156106d657600080fd5b505af11580156106ea573d6000803e3d6000fd5b5050506001600160a01b0382166000908152600760205260409020805460ff19166001179055505b50565b60045460ff166107375760405162461bcd60e51b81526004016105d99061301d565b61074860023363ffffffff61222916565b6107645760405162461bcd60e51b81526004016105d99061303d565b600c8054600f9290920b6001600160801b03166001600160801b0319909216919091179055565b60045460ff1681565b61079c6123ad565b600180546001600160a01b0319166001600160a01b0383161790556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906107e7908390612f63565b60405180910390a150565b60045460ff166108145760405162461bcd60e51b81526004016105d99061301d565b61082560023363ffffffff61222916565b6108415760405162461bcd60e51b81526004016105d99061303d565b6001600160a01b03828116600090815260166020526040902080546001600160a01b03191691831691909117905561087a6017836123d9565b5050565b60045460ff166108a05760405162461bcd60e51b81526004016105d99061301d565b6108b160023363ffffffff61222916565b6108cd5760405162461bcd60e51b81526004016105d99061303d565b600a5415806108dd5750600a5481145b6108f95760405162461bcd60e51b81526004016105d99061302d565b600a55565b600c54600f0b90565b61090f6123ad565b61087a82828080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061242b92505050565b6006546001600160a01b031681565b600c54600160801b900463ffffffff1681565b600b54600160801b9004600f0b81565b60045460ff1661099f5760405162461bcd60e51b81526004016105d99061301d565b6109b060023363ffffffff61222916565b6109cc5760405162461bcd60e51b81526004016105d99061303d565b600e8054600f9290920b6001600160801b03166001600160801b0319909216919091179055565b60028054606091610a0c9160009063ffffffff6124dc16565b905090565b60045460ff16610a335760405162461bcd60e51b81526004016105d99061301d565b610a4460023363ffffffff61222916565b610a605760405162461bcd60e51b81526004016105d99061303d565b6009541580610a70575060095481145b610a8c5760405162461bcd60e51b81526004016105d99061306d565b600955565b610a996123ad565b60045460ff1615610abc5760405162461bcd60e51b81526004016105d99061304d565b600654600160a01b900460ff161561100f57600660009054906101000a90046001600160a01b03166001600160a01b031663eb56105d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b1c57600080fd5b505afa158015610b30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b549190810190612a38565b600b80546001600160801b0319166001600160801b039290921691909117905560065460408051632b58ecef60e01b815290516001600160a01b0390921691632b58ecef91600480820192602092909190829003018186803b158015610bb957600080fd5b505afa158015610bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610bf191908101906129fc565b600b60106101000a8154816001600160801b030219169083600f0b6001600160801b03160217905550600660009054906101000a90046001600160a01b03166001600160a01b03166322d3090a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c6857600080fd5b505afa158015610c7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ca091908101906129fc565b600c8054600f9290920b6001600160801b03166001600160801b03199092169190911790556006546040805163899346c760e01b815290516001600160a01b039092169163899346c791600480820192602092909190829003018186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610d429190810190612afe565b6014805467ffffffffffffffff19166001600160401b0392909216919091179055600654604080516313dcd11b60e11b815290516001600160a01b03909216916327b9a23691600480820192602092909190829003018186803b158015610da857600080fd5b505afa158015610dbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610de09190810190612ac2565b600c60106101000a81548163ffffffff021916908363ffffffff160217905550600660009054906101000a90046001600160a01b03166001600160a01b031663e44c84c26040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4e57600080fd5b505afa158015610e62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610e8691908101906129fc565b600e60006101000a8154816001600160801b030219169083600f0b6001600160801b0316021790555060006001600660009054906101000a90046001600160a01b03166001600160a01b031663cded0cea6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0157600080fd5b505afa158015610f15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f399190810190612a56565b600654604051632088467960e11b8152929091039250600d916001600160a01b03909116906341108cf290610f72908590600401612fd3565b60206040518083038186803b158015610f8a57600080fd5b505afa158015610f9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610fc291908101906129fc565b8154600180820184556000938452602090932060028204018054939091166010026101000a6001600160801b0381810219909416600f9390930b9390931692909202179055600555611073565b600d8054600180820183556000929092527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb560028204018054929091166010026101000a6001600160801b0302199091169055600e80546001600160801b03191690555b6004805460ff191660011790556009546006546005546040517f7b65f444d88d87070324049cb0a854897564e3039d5cd94238a1a7fbc799a112926110ce92600160a01b820460ff16926001600160a01b0390921691612fab565b60405180910390a2565b60045460ff166110fa5760405162461bcd60e51b81526004016105d99061301d565b61110b60023363ffffffff61222916565b6111275760405162461bcd60e51b81526004016105d99061303d565b600654600160a01b900460ff16801561115957506001600160a01b038a1660009081526008602052604090205460ff16155b156111e457600654604051634c33238d60e11b81526001600160a01b0390911690639866471a9061118e908d90600401612f63565b600060405180830381600087803b1580156111a857600080fd5b505af11580156111bc573d6000803e3d6000fd5b5050506001600160a01b038b166000908152600860205260409020805460ff19166001179055505b6040518061012001604052808a1515815260200189600f0b8152602001886001600160801b03168152602001876001600160801b03168152602001866001600160801b03168152602001856001600160801b0316815260200184815260200183815260200182815250601560008c6001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154816001600160801b030219169083600f0b6001600160801b0316021790555060408201518160010160006101000a8154816001600160801b0302191690836001600160801b0316021790555060608201518160010160106101000a8154816001600160801b0302191690836001600160801b0316021790555060808201518160020160006101000a8154816001600160801b0302191690836001600160801b0316021790555060a08201518160020160106101000a8154816001600160801b0302191690836001600160801b0316021790555060c0820151816003015560e0820151816004015561010082015181600501559050506113ac8a60126123d990919063ffffffff16565b50505050505050505050565b600654600090600160a01b900460ff1680156113d5575060055482105b1561146157600654604051632088467960e11b81526001600160a01b03909116906341108cf29061140a908590600401612fd3565b60206040518083038186803b15801561142257600080fd5b505afa158015611436573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061145a91908101906129fc565b9050611498565b600d60055483038154811061147257fe5b90600052602060002090600291828204019190066010029054906101000a9004600f0b90505b919050565b6114a56123ad565b60005b81811015611579576114e28383838181106114bf57fe5b90506020020160206114d49190810190612703565b60029063ffffffff61222916565b15611571576115198383838181106114f657fe5b905060200201602061150b9190810190612703565b60029063ffffffff61229716565b7f9faa24f7f20c2e0f689165e6886278f3005b15b94407109799ead3257067a66a83838381811061154657fe5b905060200201602061155b9190810190612703565b6040516115689190612f63565b60405180910390a15b6001016114a8565b505050565b6016602052600090815260409020546001600160a01b031681565b60045460ff166115bb5760405162461bcd60e51b81526004016105d99061301d565b6115cc60023363ffffffff61222916565b6115e85760405162461bcd60e51b81526004016105d99061303d565b600b80546001600160801b0319166001600160801b0392909216919091179055565b60125490565b6001546001600160a01b031681565b6116276125b2565b600654600160a01b900460ff16801561165957506001600160a01b03821660009081526007602052604090205460ff16155b801561168457506001600160a01b0382166000908152600f60205260409020546001600160401b0316155b1561175f5760065460405163055f575160e41b815260009182918291829182916001600160a01b0316906355f57510906116c2908a90600401612f63565b60a06040518083038186803b1580156116da57600080fd5b505afa1580156116ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506117129190810190612b1c565b6040805160a0810182526001600160401b0396871681529590941660208601526001600160801b0392831693850193909352166060830152600f0b60808201529550611498945050505050565b506001600160a01b03166000908152600f6020818152604092839020835160a08101855281546001600160401b03808216835268010000000000000000820416938201939093526001600160801b03600160801b9384900481169582019590955260019091015493841660608201529204810b810b900b608082015290565b60045460ff166118005760405162461bcd60e51b81526004016105d99061301d565b61181160023363ffffffff61222916565b61182d5760405162461bcd60e51b81526004016105d99061303d565b600654600160a01b900460ff16801561185f57506001600160a01b03861660009081526007602052604090205460ff16155b156118ea576006546040516307369b0b60e01b81526001600160a01b03909116906307369b0b90611894908990600401612f63565b600060405180830381600087803b1580156118ae57600080fd5b505af11580156118c2573d6000803e3d6000fd5b5050506001600160a01b0387166000908152600760205260409020805460ff19166001179055505b6040518060a00160405280866001600160401b03168152602001856001600160401b03168152602001846001600160801b03168152602001836001600160801b0316815260200182600f0b815250600f6000886001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160401b0302191690836001600160401b0316021790555060208201518160000160086101000a8154816001600160401b0302191690836001600160401b0316021790555060408201518160000160106101000a8154816001600160801b0302191690836001600160801b0316021790555060608201518160010160006101000a8154816001600160801b0302191690836001600160801b0316021790555060808201518160010160106101000a8154816001600160801b030219169083600f0b6001600160801b03160217905550905050611a588660106123d990919063ffffffff16565b505050505050565b60045460ff16611a825760405162461bcd60e51b81526004016105d99061301d565b611a9360023363ffffffff61222916565b611aaf5760405162461bcd60e51b81526004016105d99061303d565b6001600160a01b038116600090815260166020526040902080546001600160a01b0319169055611ae660178263ffffffff61222916565b156107125761071260178263ffffffff61229716565b60055481565b6001546001600160a01b03163314611b2c5760405162461bcd60e51b81526004016105d990612ffd565b6000546001546040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c92611b6f926001600160a01b0391821692911690612f71565b60405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6060611bb26012848463ffffffff6124dc16565b90505b92915050565b6060611bce60023363ffffffff61222916565b611bea5760405162461bcd60e51b81526004016105d99061303d565b611bb26010848463ffffffff6124dc16565b6014546001600160401b031690565b6000546001600160a01b031681565b60045460ff16611c3c5760405162461bcd60e51b81526004016105d99061301d565b611c4d60023363ffffffff61222916565b611c695760405162461bcd60e51b81526004016105d99061303d565b600c805463ffffffff909216600160801b0263ffffffff60801b19909216919091179055565b60045460ff16611cb15760405162461bcd60e51b81526004016105d99061301d565b611cc260023363ffffffff61222916565b611cde5760405162461bcd60e51b81526004016105d99061303d565b6001600160a01b0381166000908152601560205260408120805470ffffffffffffffffffffffffffffffffff191681556001810182905560028101829055600381018290556004810182905560050155611d3f60128263ffffffff61222916565b15611d5557611d5560128263ffffffff61229716565b600654600160a01b900460ff168015611d8757506001600160a01b03811660009081526008602052604090205460ff16155b1561071257600654604051634c33238d60e11b81526001600160a01b0390911690639866471a90611dbc908490600401612f63565b600060405180830381600087803b158015611dd657600080fd5b505af1158015611dea573d6000803e3d6000fd5b5050506001600160a01b0382166000908152600860205260409020805460ff191660011790555050565b60175490565b6060611bb26017848463ffffffff6124dc16565b60045460ff16611e505760405162461bcd60e51b81526004016105d99061301d565b611e6160023363ffffffff61222916565b611e7d5760405162461bcd60e51b81526004016105d99061303d565b600b8054600f9290920b6001600160801b03908116600160801b029216919091179055565b611eaa6125e0565b600654600160a01b900460ff168015611edc57506001600160a01b03821660009081526008602052604090205460ff16155b8015611f0a57506001600160a01b0382166000908152601560205260409020546101009004600f90810b900b155b1561200a5760065460405163645c04d560e11b8152600091829182918291829182918291829182916001600160a01b03169063c8b809aa90611f50908e90600401612f63565b6101206040518083038186803b158015611f6957600080fd5b505afa158015611f7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611fa191908101906128fc565b60408051610120810182529915158a52600f9890980b60208a01526001600160801b03968716978901979097529385166060880152918416608087015290921660a085015260c084019190915260e0830152610100820152995061149898505050505050505050565b506001600160a01b0316600090815260156020908152604091829020825161012081018452815460ff81161515825261010090819004600f90810b810b900b9382019390935260018201546001600160801b0380821695830195909552600160801b9081900485166060830152600283015480861660808401520490931660a0840152600381015460c0840152600481015460e0840152600501549082015290565b600d546005540190565b600a5481565b60105490565b60095481565b600e54600f0b81565b600b546001600160801b031681565b60045460ff166121025760405162461bcd60e51b81526004016105d99061301d565b61211360023363ffffffff61222916565b61212f5760405162461bcd60e51b81526004016105d99061303d565b6014805467ffffffffffffffff19166001600160401b0392909216919091179055565b60045460ff166121745760405162461bcd60e51b81526004016105d99061301d565b61218560023363ffffffff61222916565b6121a15760405162461bcd60e51b81526004016105d99061303d565b600d805460018082018355600092909252600281047fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb5018054600f9490940b6001600160801b03908116601094909316939093026101000a9182029290910219909216179055565b6001600160a01b0390811660009081526016602052604090205416151590565b815460009061223a57506000611bb5565b6001600160a01b03821660009081526001840160205260409020548015158061228f5750826001600160a01b03168460000160008154811061227857fe5b6000918252602090912001546001600160a01b0316145b949350505050565b6122a18282612229565b6122bd5760405162461bcd60e51b81526004016105d99061300d565b6001600160a01b038116600090815260018301602052604090205482546000190180821461235c5760008460000182815481106122f657fe5b60009182526020909120015485546001600160a01b039091169150819086908590811061231f57fe5b600091825260208083209190910180546001600160a01b0319166001600160a01b0394851617905592909116815260018601909152604090208290555b835484908061236757fe5b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b0394909416815260019490940190925250506040812055565b6000546001600160a01b031633146123d75760405162461bcd60e51b81526004016105d99061305d565b565b6123e38282612229565b61087a5781546001600160a01b038216600081815260018086016020908152604083208590559084018655858252902090910180546001600160a01b03191690911790555050565b60005b815181101561087a5761245e82828151811061244657fe5b6020026020010151600261222990919063ffffffff16565b6124d45761248982828151811061247157fe5b602002602001015160026123d990919063ffffffff16565b7f326fb9158ce5b588ffd9c639338d799b5aab6f47ee92ea9abb914a05724d050f8282815181106124b657fe5b60200260200101516040516124cb9190612f63565b60405180910390a15b60010161242e565b8254606090838301908111156124f0575083545b83811161250d5750506040805160008152602081019091526125ab565b60408051858303808252602080820283010190925260609082801561253c578160200160208202803883390190505b50905060005b828110156125a557876000018782018154811061255b57fe5b9060005260206000200160009054906101000a90046001600160a01b031682828151811061258557fe5b6001600160a01b0390921660209283029190910190910152600101612542565b50925050505b9392505050565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081019190915290565b8035611bb581613128565b60008083601f84011261264957600080fd5b5081356001600160401b0381111561266057600080fd5b60208301915083602082028301111561267857600080fd5b9250929050565b8035611bb58161313c565b8051611bb58161313c565b8035611bb581613145565b8051611bb581613145565b8035611bb58161314e565b8051611bb58161314e565b8035611bb581613157565b8051611bb581613157565b8035611bb581613160565b8051611bb581613160565b8035611bb581613169565b8051611bb581613169565b60006020828403121561271557600080fd5b600061228f848461262c565b6000806040838503121561273457600080fd5b6000612740858561262c565b92505060206127518582860161262c565b9150509250929050565b6000806000806000806000806000806101408b8d03121561277b57600080fd5b60006127878d8d61262c565b9a505060206127988d828e0161267f565b99505060406127a98d828e016126ab565b98505060606127ba8d828e016126c1565b97505060806127cb8d828e016126c1565b96505060a06127dc8d828e016126c1565b95505060c06127ed8d828e016126c1565b94505060e06127fe8d828e01612695565b9350506101006128108d828e01612695565b9250506101206128228d828e01612695565b9150509295989b9194979a5092959850565b60008060008060008060c0878903121561284d57600080fd5b6000612859898961262c565b965050602061286a89828a016126ed565b955050604061287b89828a016126ed565b945050606061288c89828a016126c1565b935050608061289d89828a016126c1565b92505060a06128ae89828a016126ab565b9150509295509295509295565b600080602083850312156128ce57600080fd5b82356001600160401b038111156128e457600080fd5b6128f085828601612637565b92509250509250929050565b60008060008060008060008060006101208a8c03121561291b57600080fd5b60006129278c8c61268a565b99505060206129388c828d016126b6565b98505060406129498c828d016126cc565b975050606061295a8c828d016126cc565b965050608061296b8c828d016126cc565b95505060a061297c8c828d016126cc565b94505060c061298d8c828d016126a0565b93505060e061299e8c828d016126a0565b9250506101006129b08c828d016126a0565b9150509295985092959850929598565b6000602082840312156129d257600080fd5b600061228f8484612695565b6000602082840312156129f057600080fd5b600061228f84846126ab565b600060208284031215612a0e57600080fd5b600061228f84846126b6565b600060208284031215612a2c57600080fd5b600061228f84846126c1565b600060208284031215612a4a57600080fd5b600061228f84846126cc565b600060208284031215612a6857600080fd5b600061228f84846126a0565b60008060408385031215612a8757600080fd5b6000612a938585612695565b925050602061275185828601612695565b600060208284031215612ab657600080fd5b600061228f84846126d7565b600060208284031215612ad457600080fd5b600061228f84846126e2565b600060208284031215612af257600080fd5b600061228f84846126ed565b600060208284031215612b1057600080fd5b600061228f84846126f8565b600080600080600060a08688031215612b3457600080fd5b6000612b4088886126f8565b9550506020612b51888289016126f8565b9450506040612b62888289016126cc565b9350506060612b73888289016126cc565b9250506080612b84888289016126b6565b9150509295509295909350565b6000612b9d8383612ba5565b505060200190565b612bae816130d7565b82525050565b6000612bbf826130ca565b612bc981856130ce565b9350612bd4836130c4565b8060005b83811015612c02578151612bec8882612b91565b9750612bf7836130c4565b925050600101612bd8565b509495945050505050565b612bae816130e2565b612bae816130e7565b612bae8161311d565b612bae816130ea565b6000612c3e6035836130ce565b7f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7581527402063616e20616363657074206f776e65727368697605c1b602082015260400192915050565b6000612c956013836130ce565b7222b632b6b2b73a103737ba1034b71039b2ba1760691b815260200192915050565b6000612cc46015836130ce565b7414dd185d19481b9bdd081a5b9a5d1a585b1a5e9959605a1b815260200192915050565b6000612cf56018836130ce565b7f43616e6e6f74206368616e676520626173652061737365740000000000000000815260200192915050565b6000612d2e6033836130ce565b7f4f6e6c7920616e206173736f63696174656420636f6e74726163742063616e208152723832b93337b936903a3434b99030b1ba34b7b760691b602082015260400192915050565b6000612d836019836130ce565b7f537461746520616c726561647920696e697469616c697a656400000000000000815260200192915050565b6000612dbc602f836130ce565b7f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726681526e37b936903a3434b99030b1ba34b7b760891b602082015260400192915050565b6000612e0d6018836130ce565b7f43616e6e6f74206368616e6765206d61726b6574206b65790000000000000000815260200192915050565b8051610120830190612e4b8482612c0d565b506020820151612e5e6020850182612c28565b506040820151612e716040850182612f48565b506060820151612e846060850182612f48565b506080820151612e976080850182612f48565b5060a0820151612eaa60a0850182612f48565b5060c0820151612ebd60c0850182612c16565b5060e0820151612ed060e0850182612c16565b50610100820151612ee5610100850182612c16565b50505050565b805160a0830190612efc8482612f5a565b506020820151612f0f6020850182612f5a565b506040820151612f226040850182612f48565b506060820151612f356060850182612f48565b506080820151612ee56080850182612c28565b612bae816130f0565b612bae81613108565b612bae81613111565b60208101611bb58284612ba5565b60408101612f7f8285612ba5565b6125ab6020830184612ba5565b60208082528101611bb28184612bb4565b60208101611bb58284612c0d565b60608101612fb98286612c0d565b612fc66020830185612ba5565b61228f6040830184612c16565b60208101611bb58284612c16565b60208101611bb58284612c1f565b60208101611bb58284612c28565b60208082528101611bb581612c31565b60208082528101611bb581612c88565b60208082528101611bb581612cb7565b60208082528101611bb581612ce8565b60208082528101611bb581612d21565b60208082528101611bb581612d76565b60208082528101611bb581612daf565b60208082528101611bb581612e00565b6101208101611bb58284612e39565b60a08101611bb58284612eeb565b60208101611bb58284612f48565b60208101611bb58284612f51565b60208101611bb58284612f5a565b60200190565b5190565b90815260200190565b6000611bb5826130fc565b151590565b90565b600f0b90565b6001600160801b031690565b6001600160a01b031690565b63ffffffff1690565b6001600160401b031690565b6000611bb5826130d7565b613131816130d7565b811461071257600080fd5b613131816130e2565b613131816130e7565b613131816130ea565b613131816130f0565b61313181613108565b6131318161311156fea365627a7a72315820b7f1ea02ef40c27a7bee4a1221977ad57a607ff8342b645c87ebd57752d38d956c6578706572696d656e74616cf564736f6c63430005100040

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.