S Price: $0.438925 (+2.56%)

Contract

0x9b54501a6BAc6F62197fB63a15C9b749709cc3E0

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Advance Epoch36846482025-01-13 3:01:0458 days ago1736737264IN
0x9b54501a...9709cc3E0
7 wei0.007498655.5
Advance Epoch36793532025-01-13 2:01:0658 days ago1736733666IN
0x9b54501a...9709cc3E0
7 wei0.007333945.5
Advance Epoch36732292025-01-13 1:01:0758 days ago1736730067IN
0x9b54501a...9709cc3E0
7 wei0.007335925.5
Advance Epoch36589872025-01-12 23:01:0558 days ago1736722865IN
0x9b54501a...9709cc3E0
7 wei0.007406255.5
Advance Epoch36517172025-01-12 22:01:0558 days ago1736719265IN
0x9b54501a...9709cc3E0
7 wei0.007405385.5
Advance Epoch36447922025-01-12 21:01:2158 days ago1736715681IN
0x9b54501a...9709cc3E0
7 wei0.007389345.5
Advance Epoch36447732025-01-12 21:01:1358 days ago1736715673IN
0x9b54501a...9709cc3E0
7 wei0.007409075.5
Advance Epoch36369462025-01-12 20:01:1358 days ago1736712073IN
0x9b54501a...9709cc3E0
7 wei0.007334765.5
Advance Epoch36369262025-01-12 20:01:0458 days ago1736712064IN
0x9b54501a...9709cc3E0
7 wei0.007408665.5
Advance Epoch36295862025-01-12 19:01:1059 days ago1736708470IN
0x9b54501a...9709cc3E0
7 wei0.007334285.5
Advance Epoch35946892025-01-12 15:01:1059 days ago1736694070IN
0x9b54501a...9709cc3E0
7 wei0.007395285.5
Advance Epoch35866262025-01-12 14:01:1259 days ago1736690472IN
0x9b54501a...9709cc3E0
7 wei0.007335345.5
Advance Epoch35866072025-01-12 14:01:0459 days ago1736690464IN
0x9b54501a...9709cc3E0
7 wei0.007406735.5
Advance Epoch35784142025-01-12 13:01:0659 days ago1736686866IN
0x9b54501a...9709cc3E0
7 wei0.007332685.5
Advance Epoch35467402025-01-12 9:01:0559 days ago1736672465IN
0x9b54501a...9709cc3E0
7 wei0.007389145.5
Advance Epoch35390522025-01-12 8:01:1259 days ago1736668872IN
0x9b54501a...9709cc3E0
7 wei0.007333815.5
Advance Epoch35390372025-01-12 8:01:0459 days ago1736668864IN
0x9b54501a...9709cc3E0
7 wei0.007413095.5
Advance Epoch35315932025-01-12 7:01:0659 days ago1736665266IN
0x9b54501a...9709cc3E0
7 wei0.007332425.5
Advance Epoch35000832025-01-12 3:01:0559 days ago1736650865IN
0x9b54501a...9709cc3E0
7 wei0.007394775.5
Advance Epoch34935962025-01-12 2:01:1759 days ago1736647277IN
0x9b54501a...9709cc3E0
7 wei0.007335855.5
Advance Epoch34935822025-01-12 2:01:0859 days ago1736647268IN
0x9b54501a...9709cc3E0
7 wei0.007409855.5
Advance Epoch34860532025-01-12 1:01:0759 days ago1736643667IN
0x9b54501a...9709cc3E0
7 wei0.007334715.5
Advance Epoch34544022025-01-11 21:06:0659 days ago1736629566IN
0x9b54501a...9709cc3E0
7 wei0.007386915.5
Advance Epoch34453682025-01-11 20:01:1359 days ago1736625673IN
0x9b54501a...9709cc3E0
7 wei0.007332115.5
Advance Epoch34453482025-01-11 20:01:0559 days ago1736625665IN
0x9b54501a...9709cc3E0
7 wei0.007412615.5
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
36846482025-01-13 3:01:0458 days ago1736737264
0x9b54501a...9709cc3E0
1 wei
36846482025-01-13 3:01:0458 days ago1736737264
0x9b54501a...9709cc3E0
1 wei
36846482025-01-13 3:01:0458 days ago1736737264
0x9b54501a...9709cc3E0
1 wei
36846482025-01-13 3:01:0458 days ago1736737264
0x9b54501a...9709cc3E0
1 wei
36846482025-01-13 3:01:0458 days ago1736737264
0x9b54501a...9709cc3E0
1 wei
36846482025-01-13 3:01:0458 days ago1736737264
0x9b54501a...9709cc3E0
1 wei
36846482025-01-13 3:01:0458 days ago1736737264
0x9b54501a...9709cc3E0
1 wei
36793532025-01-13 2:01:0658 days ago1736733666
0x9b54501a...9709cc3E0
1 wei
36793532025-01-13 2:01:0658 days ago1736733666
0x9b54501a...9709cc3E0
1 wei
36793532025-01-13 2:01:0658 days ago1736733666
0x9b54501a...9709cc3E0
1 wei
36793532025-01-13 2:01:0658 days ago1736733666
0x9b54501a...9709cc3E0
1 wei
36793532025-01-13 2:01:0658 days ago1736733666
0x9b54501a...9709cc3E0
1 wei
36793532025-01-13 2:01:0658 days ago1736733666
0x9b54501a...9709cc3E0
1 wei
36793532025-01-13 2:01:0658 days ago1736733666
0x9b54501a...9709cc3E0
1 wei
36732292025-01-13 1:01:0758 days ago1736730067
0x9b54501a...9709cc3E0
1 wei
36732292025-01-13 1:01:0758 days ago1736730067
0x9b54501a...9709cc3E0
1 wei
36732292025-01-13 1:01:0758 days ago1736730067
0x9b54501a...9709cc3E0
1 wei
36732292025-01-13 1:01:0758 days ago1736730067
0x9b54501a...9709cc3E0
1 wei
36732292025-01-13 1:01:0758 days ago1736730067
0x9b54501a...9709cc3E0
1 wei
36732292025-01-13 1:01:0758 days ago1736730067
0x9b54501a...9709cc3E0
1 wei
36732292025-01-13 1:01:0758 days ago1736730067
0x9b54501a...9709cc3E0
1 wei
36589872025-01-12 23:01:0558 days ago1736722865
0x9b54501a...9709cc3E0
1 wei
36589872025-01-12 23:01:0558 days ago1736722865
0x9b54501a...9709cc3E0
1 wei
36589872025-01-12 23:01:0558 days ago1736722865
0x9b54501a...9709cc3E0
1 wei
36589872025-01-12 23:01:0558 days ago1736722865
0x9b54501a...9709cc3E0
1 wei
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PNLR

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 14 : PNLR.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

import "../../interfaces/ILexPoolV1.sol";
import "../../interfaces/IPoolAccountantV1.sol";
import "../../interfaces/IPriceValidatorV1.sol";
import "../../Triggers/TriggersPermissionBase.sol";
import "../../../AdministrationContracts/ClaimableAdmin.sol";

struct PairPrice {
  uint256 pairId;
  bytes[] priceData;
}

/**
 * @title PNLR
 * @notice In charge of the epoch advancement of the pool and the calculation of the unrealized price PnL
 */
contract PNLR is ClaimableAdmin, TriggersPermissionBase {
  IPriceValidatorV1 public priceValidator;
  uint256 public maxPriceDelay; // seconds

  // ***** Errors *****
  error InvalidPairsAmount(uint256 expectedPairsAmount, uint256 actualParisAmount);
  error InvalidPairId(uint256 pairId);
  error OutdatedPrice(uint256 pairId);

  // ***** Admin functions *****

  function allowEpochAdvancingAccount(address account) external onlyAdmin {
    allowTriggerAccountInternal(account);
  }

  function disallowEpochAdvancingAccount(address account) external onlyAdmin {
    disallowTriggerAccountInternal(account);
  }

  function setMaxPriceDelay(uint256 _maxPriceDelay) external onlyAdmin {
    maxPriceDelay = _maxPriceDelay;
  }

  // ***** Constructor *****

  constructor(IPriceValidatorV1 _priceValidator) {
    priceValidator = _priceValidator;
  }

  // ****** Epoch advancement ******

  /**
   * @notice Advances the epoch of the pool
   * @param pool Target pool
   * @param pairPrices The prices payloads of the pairs
   */
  function advanceEpoch(
    ILexPoolV1 pool,
    PairPrice[] calldata pairPrices
  ) external payable onlyAllowedTriggerAccount {
    pool.nextEpoch(
      calculateUnrealizedPricePnl(
        IPoolAccountantFunctionality(pool.poolAccountant()),
        pairPrices
      )
    );
  }

  /**
   * @notice Calculates the unrealized PnL of the pool
   * @param poolAccountant Target pool accountant
   * @param pairPrices The prices payloads of the pairs
   * @return The unrealized price PnL of the pool
   */
  function calculateUnrealizedPricePnl(
    IPoolAccountantFunctionality poolAccountant,
    PairPrice[] calldata pairPrices
  ) public payable returns (int256) {
    int256 pairsPricePnl = -pairsTradersPricePnl(poolAccountant, pairPrices);
    return pairsPricePnl;
  }

  /**
   * @notice Sums the PnL for all the pairs traders
   * @param poolAccountant Target pool accountant
   * @param pairPrices The prices payloads of the pairs
   * @return pricePnl the pnl of the pairs traders based on the prices
   */
  function pairsTradersPricePnl(
    IPoolAccountantFunctionality poolAccountant,
    PairPrice[] calldata pairPrices
  ) public payable returns (int256 pricePnl) {
    require(maxPriceDelay > 0, "MAX_PRICE_DELAY_NOT_SET");

    uint16[] memory supportedPairIds = poolAccountant.getAllSupportedPairIds();

    if (supportedPairIds.length != pairPrices.length) {
      revert InvalidPairsAmount(supportedPairIds.length, pairPrices.length);
    }

    for (uint256 index = 0; index < pairPrices.length; index++) {
      PairPrice memory pairPrice = pairPrices[index];

      // Find in supportedPairIds
      bool found = false;
      for (uint256 j = 0; j < supportedPairIds.length; j++) {
        if (supportedPairIds[j] == pairPrices[index].pairId) {
          found = true;
          delete supportedPairIds[j]; // Ensuring no duplicates
          break;
        }
      }
      if (!found) {
        revert InvalidPairId(pairPrices[index].pairId);
      }

      // Validate the price
      uint256 feeAmount = priceValidator.getUpdateFee(pairPrice.priceData);
      IPriceValidatorV1.ValidatedPrice memory validatedPrice = priceValidator
        .validatePrice{value: feeAmount}(pairPrice.pairId, pairPrice.priceData);

      // Max price delay check
      if (block.timestamp > validatedPrice.timestamp + maxPriceDelay) {
        revert OutdatedPrice(pairPrice.pairId);
      }

      // Calculate the price PnL
      pricePnl += poolAccountant.pricePnL(
        pairPrice.pairId,
        validatedPrice.price
      );
    }
  }
}

File 2 of 14 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

File 3 of 14 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position is the index of the value in the `values` array plus 1.
        // Position 0 is used to mean a value is not in the set.
        mapping(bytes32 value => uint256) _positions;
    }

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

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

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

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

            if (valueIndex != lastIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

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

            // Delete the tracked position for the deleted slot
            delete set._positions[value];

            return true;
        } else {
            return false;
        }
    }

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 4 of 14 : AcceptableImplementationClaimableAdminStorage.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

contract ClaimableAdminStorage {
  /**
   * @notice Administrator for this contract
   */
  address public admin;

  /**
   * @notice Pending administrator for this contract
   */
  address public pendingAdmin;

  /*** Modifiers ***/

  modifier onlyAdmin() {
    require(msg.sender == admin, "ONLY_ADMIN");
    _;
  }

  /*** Constructor ***/

  constructor() {
    // Set admin to caller
    admin = msg.sender;
  }
}

contract AcceptableImplementationClaimableAdminStorage is
  ClaimableAdminStorage
{
  /**
   * @notice Active logic
   */
  address public implementation;

  /**
   * @notice Pending logic
   */
  address public pendingImplementation;
}

contract AcceptableRegistryImplementationClaimableAdminStorage is
  AcceptableImplementationClaimableAdminStorage
{
  /**
   * @notice System Registry
   */
  address public registry;
}

File 5 of 14 : ClaimableAdmin.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

import "./AcceptableImplementationClaimableAdminStorage.sol";

/**
 * @title Claimable Admin
 */
contract ClaimableAdmin is ClaimableAdminStorage {
  /**
   * @notice Emitted when pendingAdmin is changed
   */
  event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);

  /**
   * @notice Emitted when pendingAdmin is accepted, which means admin is updated
   */
  event NewAdmin(address oldAdmin, address newAdmin);

  /*** Admin Functions ***/

  /**
   * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
   * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
   * @param newPendingAdmin New pending admin.
   */
  function _setPendingAdmin(address newPendingAdmin) public {
    // Check caller = admin
    require(msg.sender == admin, "Not Admin");

    // Save current value, if any, for inclusion in log
    address oldPendingAdmin = pendingAdmin;

    // Store pendingAdmin with value newPendingAdmin
    pendingAdmin = newPendingAdmin;

    // Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
    emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
  }

  /**
   * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin
   * @dev Admin function for pending admin to accept role and update admin
   */
  function _acceptAdmin() public {
    // Check caller is pendingAdmin and pendingAdmin ≠ address(0)
    require(
      msg.sender == pendingAdmin && pendingAdmin != address(0),
      "Not the EXISTING pending admin"
    );

    // Save current values for inclusion in log
    address oldAdmin = admin;
    address oldPendingAdmin = pendingAdmin;

    // Store admin with value pendingAdmin
    admin = pendingAdmin;

    // Clear the pending value
    pendingAdmin = address(0);

    emit NewAdmin(oldAdmin, admin);
    emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);
  }
}

File 6 of 14 : IFundingRateModel.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

interface IFundingRateModel {
  // return value is the "funding paid by heavier side" in PRECISION per OI (heavier side) per second
  // e.g : (0.01 * PRECISION) = Paying (heavier) side (as a whole) pays 1% of funding per second for each OI unit
  function getFundingRate(
    uint256 pairId,
    uint256 openInterestLong,
    uint256 openInterestShort,
    uint256 pairMaxOpenInterest
  ) external view returns (uint256);
}

File 7 of 14 : IInterestRateModel.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

interface IInterestRateModel {
  // Returns asset/second of interest per borrowed unit
  // e.g : (0.01 * PRECISION) = 1% of interest per second
  function getBorrowRate(uint256 utilization) external view returns (uint256);
}

File 8 of 14 : ILexPoolV1.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

import "./LexErrors.sol";
import "./LexPoolAdminEnums.sol";
import "./IPoolAccountantV1.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface LexPoolStructs {
  struct PendingDeposit {
    uint256 amount;
    uint256 minAmountOut;
  }

  struct PendingRedeem {
    uint256 amount;
    uint256 minAmountOut;
    uint256 maxAmountOut;
  }
}

interface LexPoolEvents is LexPoolAdminEnums {
  event NewEpoch(
    uint256 epochId,
    int256 reportedUnrealizedPricePnL,
    uint256 exchangeRate,
    uint256 virtualUnderlyingBalance,
    uint256 totalSupply
  );

  event AddressUpdated(LexPoolAddressesEnum indexed enumCode, address a);
  event NumberUpdated(LexPoolNumbersEnum indexed enumCode, uint value);
  event DepositRequest(
    address indexed user,
    uint256 amount,
    uint256 minAmountOut,
    uint256 processingEpoch
  );
  event RedeemRequest(
    address indexed user,
    uint256 amount,
    uint256 minAmountOut,
    uint256 processingEpoch
  );
  event ProcessedDeposit(
    address indexed user,
    bool deposited,
    uint256 depositedAmount
  );
  event ProcessedRedeem(
    address indexed user,
    bool redeemed,
    uint256 withdrawnAmount // Underlying amount
  );
  event CanceledDeposit(
    address indexed user,
    uint256 epoch,
    uint256 cancelledAmount
  );
  event CanceledRedeem(
    address indexed user,
    uint256 epoch,
    uint256 cancelledAmount
  );
  event ImmediateDepositAllowedToggled(bool indexed value);
  event ImmediateDeposit(
    address indexed depositor,
    uint256 depositAmount,
    uint256 mintAmount
  );
  event ReservesWithdrawn(
    address _to,
    uint256 interestShare,
    uint256 totalFundingShare
  );
}

interface ILexPoolFunctionality is
  IERC20,
  LexPoolStructs,
  LexPoolEvents,
  LexErrors
{
  function setPoolAccountant(
    IPoolAccountantFunctionality _poolAccountant
  ) external;

  function setPnlRole(address pnl) external;

  function setMaxExtraWithdrawalAmountF(uint256 maxExtra) external;

  function setEpochsDelayDeposit(uint256 delay) external;

  function setEpochsDelayRedeem(uint256 delay) external;

  function setEpochDuration(uint256 duration) external;

  function setMinDepositAmount(uint256 amount) external;

  function toggleImmediateDepositAllowed() external;

  function reduceReserves(
    address _to
  ) external returns (uint256 interestShare, uint256 totalFundingShare);

  function requestDeposit(
    uint256 amount,
    uint256 minAmountOut,
    bytes32 domain,
    bytes32 referralCode
  ) external;

  function requestDepositViaIntent(
    address user,
    uint256 amount,
    uint256 minAmountOut,
    bytes32 domain,
    bytes32 referralCode
  ) external;

  function requestRedeem(uint256 amount, uint256 minAmountOut) external;

  function requestRedeemViaIntent(
    address user,
    uint256 amount,
    uint256 minAmountOut
  ) external;

  function processDeposit(
    address[] memory users
  )
    external
    returns (
      uint256 amountDeposited,
      uint256 amountCancelled,
      uint256 counterDeposited,
      uint256 counterCancelled
    );

  function cancelDeposits(
    address[] memory users,
    uint256[] memory epochs
  ) external;

  function processRedeems(
    address[] memory users
  )
    external
    returns (
      uint256 amountRedeemed,
      uint256 amountCancelled,
      uint256 counterDeposited,
      uint256 counterCancelled
    );

  function cancelRedeems(
    address[] memory users,
    uint256[] memory epochs
  ) external;

  function nextEpoch(
    int256 totalUnrealizedPricePnL
  ) external returns (uint256 newExchangeRate);

  function currentVirtualUtilization() external view returns (uint256);

  function currentVirtualUtilization(
    uint256 totalBorrows,
    uint256 totalReserves,
    int256 unrealizedFunding
  ) external view returns (uint256);

  function virtualBalanceForUtilization() external view returns (uint256);

  function virtualBalanceForUtilization(
    uint256 extraAmount,
    int256 unrealizedFunding
  ) external view returns (uint256);

  function underlyingBalanceForExchangeRate() external view returns (uint256);

  function sendAssetToTrader(address to, uint256 amount) external;

  function isUtilizationForLPsValid() external view returns (bool);
}

interface ILexPoolV1 is ILexPoolFunctionality {
  function name() external view returns (string memory);

  function symbol() external view returns (string memory);

  function SELF_UNIT_SCALE() external view returns (uint);

  function underlyingDecimals() external view returns (uint256);

  function poolAccountant() external view returns (address);

  function underlying() external view returns (IERC20);

  function tradingFloor() external view returns (address);

  function currentEpoch() external view returns (uint256);

  function currentExchangeRate() external view returns (uint256);

  function nextEpochStartMin() external view returns (uint256);

  function epochDuration() external view returns (uint256);

  function minDepositAmount() external view returns (uint256);

  function epochsDelayDeposit() external view returns (uint256);

  function epochsDelayRedeem() external view returns (uint256);

  function immediateDepositAllowed() external view returns (bool);

  function pendingDeposits(
    uint epoch,
    address account
  ) external view returns (PendingDeposit memory);

  function pendingRedeems(
    uint epoch,
    address account
  ) external view returns (PendingRedeem memory);

  function pendingDepositAmount() external view returns (uint256);

  function pendingWithdrawalAmount() external view returns (uint256);
}

File 9 of 14 : IPoolAccountantV1.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

import "./LexErrors.sol";
import "./ILexPoolV1.sol";
import "./IInterestRateModel.sol";
import "./IFundingRateModel.sol";
import "./TradingEnumsV1.sol";

interface PoolAccountantStructs {
  // @note To be used for passing information in function calls
  struct PositionRegistrationParams {
    uint256 collateral;
    uint32 leverage;
    bool long;
    uint64 openPrice;
    uint64 tp;
  }

  struct PairFunding {
    // Slot 0
    int256 accPerOiLong; // 32 bytes -- Underlying Decimals
    // Slot 1
    int256 accPerOiShort; // 32 bytes -- Underlying Decimals
    // Slot 2
    uint256 lastUpdateTimestamp; // 32 bytes
  }

  struct TradeInitialAccFees {
    // Slot 0
    uint256 borrowIndex; // 32 bytes
    // Slot 1
    int256 funding; // 32 bytes -- underlying units -- Underlying Decimals
  }

  struct PairOpenInterest {
    // Slot 0
    uint256 long; // 32 bytes -- underlying units -- Dynamic open interest for long positions
    // Slot 1
    uint256 short; // 32 bytes -- underlying units -- Dynamic open interest for short positions
  }

  // This struct is not kept in storage
  struct PairFromTo {
    string from;
    string to;
  }

  struct Pair {
    // Slot 0
    uint16 id; // 02 bytes
    uint16 groupId; // 02 bytes
    uint16 feeId; // 02 bytes
    uint32 minLeverage; // 04 bytes
    uint32 maxLeverage; // 04 bytes
    uint32 maxBorrowF; // 04 bytes -- FRACTION_SCALE (5)
    // Slot 1
    uint256 maxPositionSize; // 32 bytes -- underlying units
    // Slot 2
    uint256 maxGain; // 32 bytes -- underlying units
    // Slot 3
    uint256 maxOpenInterest; // 32 bytes -- Underlying units
    // Slot 4
    uint256 maxSkew; // 32 bytes -- underlying units
    // Slot 5
    uint256 minOpenFee; // 32 bytes -- underlying units. MAX_UINT means use the default group level value
    // Slot 6
    uint256 minPerformanceFee; // 32 bytes -- underlying units
  }

  struct Group {
    // Slot 0
    uint16 id; // 02 bytes
    uint32 minLeverage; // 04 bytes
    uint32 maxLeverage; // 04 bytes
    uint32 maxBorrowF; // 04 bytes -- FRACTION_SCALE (5)
    // Slot 1
    uint256 maxPositionSize; // 32 bytes (Underlying units)
    // Slot 2
    uint256 minOpenFee; // 32 bytes (Underlying uints). MAX_UINT means use the default global level value
  }

  struct Fee {
    // Slot 0
    uint16 id; // 02 bytes
    uint32 openFeeF; // 04 bytes -- FRACTION_SCALE (5) (Fraction of leveraged pos)
    uint32 closeFeeF; // 04 bytes -- FRACTION_SCALE (5) (Fraction of leveraged pos)
    uint32 performanceFeeF; // 04 bytes -- FRACTION_SCALE (5) (Fraction of performance)
  }
}

interface PoolAccountantEvents is PoolAccountantStructs {
  event PairAdded(
    uint256 indexed id,
    string indexed from,
    string indexed to,
    Pair pair
  );
  event PairUpdated(uint256 indexed id, Pair pair);

  event GroupAdded(uint256 indexed id, string indexed groupName, Group group);
  event GroupUpdated(uint256 indexed id, Group group);

  event FeeAdded(uint256 indexed id, string indexed name, Fee fee);
  event FeeUpdated(uint256 indexed id, Fee fee);

  event TradeInitialAccFeesStored(
    bytes32 indexed positionId,
    uint256 borrowIndex,
    // uint256 rollover,
    int256 funding
  );

  event AccrueFunding(
    uint256 indexed pairId,
    int256 valueLong,
    int256 valueShort
  );

  event ProtocolFundingShareAccrued(
    uint16 indexed pairId,
    uint256 protocolFundingShare
  );
  // event AccRolloverFeesStored(uint256 pairIndex, uint256 value);

  event FeesCharged(
    bytes32 indexed positionId,
    address indexed trader,
    uint16 indexed pairId,
    PositionRegistrationParams positionRegistrationParams,
    //        bool long,
    //        uint256 collateral, // Underlying Decimals
    //        uint256 leverage,
    int256 profitPrecision, // PRECISION
    uint256 interest,
    int256 funding, // Underlying Decimals
    uint256 closingFee,
    uint256 tradeValue
  );

  event PerformanceFeeCharging(
    bytes32 indexed positionId,
    uint256 performanceFee
  );

  event MaxOpenInterestUpdated(uint256 pairIndex, uint256 maxOpenInterest);

  event AccrueInterest(
    uint256 cash,
    uint256 totalInterestNew,
    uint256 borrowIndexNew,
    uint256 interestShareNew
  );

  event Borrow(
    uint256 indexed pairId,
    uint256 borrowAmount,
    uint256 newTotalBorrows
  );

  event Repay(
    uint256 indexed pairId,
    uint256 repayAmount,
    uint256 newTotalBorrows
  );
}

interface IPoolAccountantFunctionality is
  PoolAccountantStructs,
  PoolAccountantEvents,
  LexErrors,
  TradingEnumsV1
{
  function setTradeIncentivizer(address _tradeIncentivizer) external;

  function setMaxGainF(uint256 _maxGainF) external;

  function setFrm(IFundingRateModel _frm) external;

  function setMinOpenFee(uint256 min) external;

  function setLexPartF(uint256 partF) external;

  function setFundingRateMax(uint256 maxValue) external;

  function setLiquidationThresholdF(uint256 threshold) external;

  function setLiquidationFeeF(uint256 fee) external;

  function setIrm(IInterestRateModel _irm) external;

  function setIrmHard(IInterestRateModel _irm) external;

  function setInterestShareFactor(uint256 factor) external;
  
  function setFundingShareFactor(uint256 factor) external;

  function setBorrowRateMax(uint256 rate) external;

  function setMaxTotalBorrows(uint256 maxBorrows) external;

  function setMaxVirtualUtilization(uint256 _maxVirtualUtilization) external;

  function resetTradersPairGains(uint256 pairId) external;

  function addGroup(Group calldata _group) external;

  function updateGroup(Group calldata _group) external;

  function addFee(Fee calldata _fee) external;

  function updateFee(Fee calldata _fee) external;

  function addPair(Pair calldata _pair) external;

  function addPairs(Pair[] calldata _pairs) external;

  function updatePair(Pair calldata _pair) external;

  function readAndZeroReserves()
    external
    returns (uint256 accumulatedInterestShare,
             uint256 accFundingShare);

  function registerOpenTrade(
    bytes32 positionId,
    address trader,
    uint16 pairId,
    uint256 collateral,
    uint32 leverage,
    bool long,
    uint256 tp,
    uint256 openPrice
  ) external returns (uint256 fee, uint256 lexPartFee);

  function registerCloseTrade(
    bytes32 positionId,
    address trader,
    uint16 pairId,
    PositionRegistrationParams calldata positionRegistrationParams,
    uint256 closePrice,
    PositionCloseType positionCloseType
  )
    external
    returns (
      uint256 closingFee,
      uint256 tradeValue,
      int256 profitPrecision,
      uint finalClosePrice
    );

  function registerUpdateTp(
    bytes32 positionId,
    address trader,
    uint16 pairId,
    uint256 collateral,
    uint32 leverage,
    bool long,
    uint256 openPrice,
    uint256 oldTriggerPrice,
    uint256 triggerPrice
  ) external;

  // function registerUpdateSl(
  //     address trader,
  //     uint256 pairIndex,
  //     uint256 index,
  //     uint256 collateral,
  //     uint256 leverage,
  //     bool long,
  //     uint256 openPrice,
  //     uint256 triggerPrice
  // ) external returns (uint256 fee);

  function accrueInterest()
    external
    returns (
      uint256 totalInterestNew,
      uint256 interestShareNew,
      uint256 borrowIndexNew
    );

  // Limited only for the LexPool
  function accrueInterest(
    uint256 availableCash
  )
    external
    returns (
      uint256 totalInterestNew,
      uint256 interestShareNew,
      uint256 borrowIndexNew
    );

  function getTradeClosingValues(
    bytes32 positionId,
    uint16 pairId,
    PositionRegistrationParams calldata positionRegistrationParams,
    uint256 closePrice,
    bool isLiquidation
  )
    external
    returns (
      uint256 tradeValue, // Underlying Decimals
      uint256 safeClosingFee,
      int256 profitPrecision,
      uint256 interest,
      int256 funding
    );

  function getTradeLiquidationPrice(
    bytes32 positionId,
    uint16 pairId,
    uint256 openPrice, // PRICE_SCALE (8)
    uint256 tp,
    bool long,
    uint256 collateral, // Underlying Decimals
    uint32 leverage
  )
    external
    returns (
      uint256 // PRICE_SCALE (8)
    );

  function calcTradeDynamicFees(
    bytes32 positionId,
    uint16 pairId,
    bool long,
    uint256 collateral,
    uint32 leverage,
    uint256 openPrice,
    uint256 tp
  ) external returns (uint256 interest, int256 funding);

  function unrealizedFunding() external view returns (int256);

  function totalBorrows() external view returns (uint256);

  function interestShare() external view returns (uint256);
  
  function fundingShare() external view returns (uint256);

  function totalReservesView() external view returns (uint256);

  function borrowsAndInterestShare()
    external
    view
    returns (uint256 totalBorrows, uint256 totalInterestShare);

  function pairTotalOpenInterest(
    uint256 pairIndex
  ) external view returns (int256);

  function pricePnL(
    uint256 pairId,
    uint256 price
  ) external view returns (int256);

  function getAllSupportedPairIds() external view returns (uint16[] memory);

  function getAllSupportedGroupsIds() external view returns (uint16[] memory);

  function getAllSupportedFeeIds() external view returns (uint16[] memory);
}

interface IPoolAccountantV1 is IPoolAccountantFunctionality {
  function totalBorrows() external view returns (uint256);

  function maxTotalBorrows() external view returns (uint256);

  function pairBorrows(uint256 pairId) external view returns (uint256);

  function groupBorrows(uint256 groupId) external view returns (uint256);

  function pairMaxBorrow(uint16 pairId) external view returns (uint256);

  function groupMaxBorrow(uint16 groupId) external view returns (uint256);

  function lexPool() external view returns (ILexPoolV1);

  function maxGainF() external view returns (uint256);

  function interestShareFactor() external view returns (uint256);
  
  function fundingShareFactor() external view returns (uint256);

  function frm() external view returns (IFundingRateModel);

  function irm() external view returns (IInterestRateModel);

  function pairs(uint16 pairId) external view returns (Pair memory);

  function groups(uint16 groupId) external view returns (Group memory);

  function fees(uint16 feeId) external view returns (Fee memory);

  function openInterestInPair(
    uint pairId
  ) external view returns (PairOpenInterest memory);

  function minOpenFee() external view returns (uint256);

  function liquidationThresholdF() external view returns (uint256);

  function liquidationFeeF() external view returns (uint256);

  function lexPartF() external view returns (uint256);

  function tradersPairGains(uint256 pairId) external view returns (int256);

  function calcBorrowAmount(
    uint256 collateral,
    uint256 leverage,
    bool long,
    uint256 openPrice,
    uint256 tp
  ) external pure returns (uint256);
}

File 10 of 14 : IPriceValidatorV1.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

interface IPriceValidatorV1 {
  // uint constant PRICE_SCALE = 1e8;

  struct ValidatedPrice {
    uint256 timestamp;
    uint64 price; // Scaled to PRICE_SCALE
    uint64 confidence; // Scaled to PRICE_SCALE
  }

  function isPriceValidator() external view returns (bool);

  function getUpdateFee(
    bytes[] calldata updateData
  ) external view returns (uint256 feeAmount);

  function validatePrice(
    uint256 pairIndex,
    bytes[] calldata updateData
  ) external payable returns (ValidatedPrice memory validatedPrice);
}

File 11 of 14 : LexErrors.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

interface LexErrors {
  enum CapType {
    NONE, // 0
    MIN_OPEN_FEE, // 1
    MAX_POS_SIZE_PAIR, // 2
    MAX_POS_SIZE_GROUP, // 3
    MAX_LEVERAGE, // 4
    MIN_LEVERAGE, // 5
    MAX_VIRTUAL_UTILIZATION, // 6
    MAX_OPEN_INTEREST, // 7
    MAX_ABS_SKEW, // 8
    MAX_BORROW_PAIR, // 9
    MAX_BORROW_GROUP, // 10
    MIN_DEPOSIT_AMOUNT, // 11
    MAX_ACCUMULATED_GAINS, // 12
    BORROW_RATE_MAX, // 13
    FUNDING_RATE_MAX, // 14
    MAX_POTENTIAL_GAIN, // 15
    MAX_TOTAL_BORROW, // 16
    MIN_PERFORMANCE_FEE // 17
    //...
  }
  error CapError(CapType, uint256 value);
}

File 12 of 14 : LexPoolAdminEnums.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;

interface LexPoolAdminEnums {
  enum LexPoolAddressesEnum {
    none,
    poolAccountant,
    pnlRole
  }

  enum LexPoolNumbersEnum {
    none,
    maxExtraWithdrawalAmountF,
    epochsDelayDeposit,
    epochsDelayRedeem,
    epochDuration,
    minDepositAmount
  }
}

File 13 of 14 : TradingEnumsV1.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

interface TradingEnumsV1 {
  enum PositionPhase {
    NONE,
    OPEN_MARKET,
    OPEN_LIMIT,
    OPENED,
    CLOSE_MARKET,
    CLOSED
  }

  enum OpenOrderType {
    NONE,
    MARKET,
    LIMIT
  }
  enum CloseOrderType {
    NONE,
    MARKET
  }
  enum FeeType {
    NONE,
    OPEN_FEE,
    CLOSE_FEE,
    TRIGGER_FEE
  }
  enum LimitTrigger {
    NONE,
    TP,
    SL,
    LIQ
  }
  enum PositionField {
    NONE,
    TP,
    SL
  }

  enum PositionCloseType {
    NONE,
    TP,
    SL,
    LIQ,
    MARKET
  }
}

File 14 of 14 : TriggersPermissionBase.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

/**
 * @title TriggersPermissionBase
 * @dev Allows for a basic whitelisting mechanism
 */
contract TriggersPermissionBase {
  using EnumerableSet for EnumerableSet.AddressSet;

  // ***** Storage *****

  EnumerableSet.AddressSet private triggerPermissionSet;

  // ***** Modifiers *****

  modifier onlyAllowedTriggerAccount() {
    require(isAllowedToTrigger(msg.sender), "NOT_ALLOWED_TO_TRIGGER");
    _;
  }

  // ***** Events *****

  event TriggerAccountAllowed(address indexed account);
  event TriggerAccountDisallowed(address indexed account);

  // ***** View *****

  function isAllowedToTrigger(address account) public view returns (bool) {
    return triggerPermissionSet.contains(account);
  }

  function getAllTriggerPermissionedAccounts()
    public
    view
    returns (address[] memory)
  {
    return triggerPermissionSet.values();
  }

  // ***** Internal Functions *****

  function allowTriggerAccountInternal(address account) internal {
    require(!isAllowedToTrigger(account), "ACCOUNT_ALREADY_ALLOWED");
    triggerPermissionSet.add(account);
    emit TriggerAccountAllowed(account);
  }

  function disallowTriggerAccountInternal(address account) internal {
    require(isAllowedToTrigger(account), "ACCOUNT_NOT_ALLOWED");
    triggerPermissionSet.remove(account);
    emit TriggerAccountDisallowed(account);
  }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract IPriceValidatorV1","name":"_priceValidator","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"pairId","type":"uint256"}],"name":"InvalidPairId","type":"error"},{"inputs":[{"internalType":"uint256","name":"expectedPairsAmount","type":"uint256"},{"internalType":"uint256","name":"actualParisAmount","type":"uint256"}],"name":"InvalidPairsAmount","type":"error"},{"inputs":[{"internalType":"uint256","name":"pairId","type":"uint256"}],"name":"OutdatedPrice","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPendingAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newPendingAdmin","type":"address"}],"name":"NewPendingAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"TriggerAccountAllowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"TriggerAccountDisallowed","type":"event"},{"inputs":[],"name":"_acceptAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ILexPoolV1","name":"pool","type":"address"},{"components":[{"internalType":"uint256","name":"pairId","type":"uint256"},{"internalType":"bytes[]","name":"priceData","type":"bytes[]"}],"internalType":"struct PairPrice[]","name":"pairPrices","type":"tuple[]"}],"name":"advanceEpoch","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"allowEpochAdvancingAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPoolAccountantFunctionality","name":"poolAccountant","type":"address"},{"components":[{"internalType":"uint256","name":"pairId","type":"uint256"},{"internalType":"bytes[]","name":"priceData","type":"bytes[]"}],"internalType":"struct PairPrice[]","name":"pairPrices","type":"tuple[]"}],"name":"calculateUnrealizedPricePnl","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"disallowEpochAdvancingAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllTriggerPermissionedAccounts","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isAllowedToTrigger","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPriceDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IPoolAccountantFunctionality","name":"poolAccountant","type":"address"},{"components":[{"internalType":"uint256","name":"pairId","type":"uint256"},{"internalType":"bytes[]","name":"priceData","type":"bytes[]"}],"internalType":"struct PairPrice[]","name":"pairPrices","type":"tuple[]"}],"name":"pairsTradersPricePnl","outputs":[{"internalType":"int256","name":"pricePnl","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceValidator","outputs":[{"internalType":"contract IPriceValidatorV1","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxPriceDelay","type":"uint256"}],"name":"setMaxPriceDelay","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5060405161143b38038061143b83398101604081905261002f91610062565b60008054336001600160a01b031991821617909155600480549091166001600160a01b0392909216919091179055610092565b60006020828403121561007457600080fd5b81516001600160a01b038116811461008b57600080fd5b9392505050565b61139a806100a16000396000f3fe6080604052600436106100dd5760003560e01c80639057aa9f1161007f578063b71d1a0c11610059578063b71d1a0c14610230578063b81d164514610250578063e9c714f214610270578063f851a4401461028557600080fd5b80639057aa9f146101e7578063a1d627a1146101fd578063b0cf579a1461021d57600080fd5b80634a048590116100bb5780634a048590146101705780637a803da01461018557806386c7f19a146101a55780638ee2f9d1146101c757600080fd5b806324a0c541146100e2578063267822471461010857806333511e5e14610140575b600080fd5b6100f56100f0366004610dd3565b6102a5565b6040519081526020015b60405180910390f35b34801561011457600080fd5b50600154610128906001600160a01b031681565b6040516001600160a01b0390911681526020016100ff565b34801561014c57600080fd5b5061016061015b366004610e28565b61067f565b60405190151581526020016100ff565b61018361017e366004610dd3565b610692565b005b34801561019157600080fd5b506101836101a0366004610e45565b6107c2565b3480156101b157600080fd5b506101ba6107f1565b6040516100ff9190610e5e565b3480156101d357600080fd5b506101836101e2366004610e28565b610802565b3480156101f357600080fd5b506100f560055481565b34801561020957600080fd5b50600454610128906001600160a01b031681565b6100f561022b366004610dd3565b610838565b34801561023c57600080fd5b5061018361024b366004610e28565b610858565b34801561025c57600080fd5b5061018361026b366004610e28565b610900565b34801561027c57600080fd5b50610183610933565b34801561029157600080fd5b50600054610128906001600160a01b031681565b600080600554116102fd5760405162461bcd60e51b815260206004820152601760248201527f4d41585f50524943455f44454c41595f4e4f545f53455400000000000000000060448201526064015b60405180910390fd5b6000846001600160a01b0316630fc2b8f56040518163ffffffff1660e01b8152600401600060405180830381865afa15801561033d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103659190810190610f3f565b8051909150831461039657805160405163dfe3619d60e01b81526004810191909152602481018490526044016102f4565b60005b838110156106765760008585838181106103b5576103b5610fe6565b90506020028101906103c79190610ffc565b6103d09061101c565b90506000805b845181101561045d578787858181106103f1576103f1610fe6565b90506020028101906104039190610ffc565b6000013585828151811061041957610419610fe6565b602002602001015161ffff1603610455576001915084818151811061044057610440610fe6565b60200260200101600061ffff1681525061045d565b6001016103d6565b50806104a35786868481811061047557610475610fe6565b90506020028101906104879190610ffc565b6040516364e3cda960e01b8152903560048201526024016102f4565b60048054602084015160405163d47eed4560e01b81526000936001600160a01b039093169263d47eed45926104da929091016111be565b602060405180830381865afa1580156104f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051b91906111d1565b600480548551602087015160405163f4a6a09360e01b81529495506000946001600160a01b039093169363f4a6a09393879361055b9390929091016111ea565b60606040518083038185885af1158015610579573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061059e9190611228565b60055481519192506105af916112a3565b4211156105d5578351604051637d962bc160e11b815260048101919091526024016102f4565b8351602082015160405163659ef44160e01b81526001600160a01b038d169263659ef441926106199260040191825267ffffffffffffffff16602082015260400190565b602060405180830381865afa158015610636573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065a91906111d1565b61066490886112b6565b96505060019093019250610399915050565b50509392505050565b600061068c600283610a51565b92915050565b61069b3361067f565b6106e05760405162461bcd60e51b81526020600482015260166024820152752727aa2fa0a62627aba2a22faa27afaa2924a3a3a2a960511b60448201526064016102f4565b826001600160a01b0316636142895361075b856001600160a01b031663c12d636b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610730573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075491906112de565b8585610838565b6040518263ffffffff1660e01b815260040161077991815260200190565b6020604051808303816000875af1158015610798573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bc91906111d1565b50505050565b6000546001600160a01b031633146107ec5760405162461bcd60e51b81526004016102f4906112fb565b600555565b60606107fd6002610a76565b905090565b6000546001600160a01b0316331461082c5760405162461bcd60e51b81526004016102f4906112fb565b61083581610a83565b50565b6000806108468585856102a5565b61084f9061131f565b95945050505050565b6000546001600160a01b0316331461089e5760405162461bcd60e51b81526020600482015260096024820152682737ba1020b236b4b760b91b60448201526064016102f4565b600180546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a991015b60405180910390a15050565b6000546001600160a01b0316331461092a5760405162461bcd60e51b81526004016102f4906112fb565b61083581610b11565b6001546001600160a01b03163314801561095757506001546001600160a01b031615155b6109a35760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420746865204558495354494e472070656e64696e672061646d696e000060448201526064016102f4565b60008054600180546001600160a01b038082166001600160a01b031980861682179096559490911690915560408051919092168082526020820184905292917ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc910160405180910390a1600154604080516001600160a01b03808516825290921660208301527fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a991016108f4565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b60606000610a6f83610baa565b610a8c8161067f565b610ace5760405162461bcd60e51b81526020600482015260136024820152721050d0d3d5539517d393d517d0531313d5d151606a1b60448201526064016102f4565b610ad9600282610c06565b506040516001600160a01b038216907fc985d67a353004ba149a223b2b9e5c13cca6610b11cb45b4aa029c880d8f7cb590600090a250565b610b1a8161067f565b15610b675760405162461bcd60e51b815260206004820152601760248201527f4143434f554e545f414c52454144595f414c4c4f57454400000000000000000060448201526064016102f4565b610b72600282610c1b565b506040516001600160a01b038216907fc5944eab072face4b169928723314c5978080e99ed8f8527faedb18c06664c3590600090a250565b606081600001805480602002602001604051908101604052809291908181526020018280548015610bfa57602002820191906000526020600020905b815481526020019060010190808311610be6575b50505050509050919050565b6000610a6f836001600160a01b038416610c30565b6000610a6f836001600160a01b038416610d23565b60008181526001830160205260408120548015610d19576000610c5460018361133b565b8554909150600090610c689060019061133b565b9050808214610ccd576000866000018281548110610c8857610c88610fe6565b9060005260206000200154905080876000018481548110610cab57610cab610fe6565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610cde57610cde61134e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061068c565b600091505061068c565b6000818152600183016020526040812054610d6a5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561068c565b50600061068c565b6001600160a01b038116811461083557600080fd5b60008083601f840112610d9957600080fd5b50813567ffffffffffffffff811115610db157600080fd5b6020830191508360208260051b8501011115610dcc57600080fd5b9250929050565b600080600060408486031215610de857600080fd5b8335610df381610d72565b9250602084013567ffffffffffffffff811115610e0f57600080fd5b610e1b86828701610d87565b9497909650939450505050565b600060208284031215610e3a57600080fd5b8135610a6f81610d72565b600060208284031215610e5757600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015610e9f5783516001600160a01b031683529284019291840191600101610e7a565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610ee457610ee4610eab565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610f1357610f13610eab565b604052919050565b600067ffffffffffffffff821115610f3557610f35610eab565b5060051b60200190565b60006020808385031215610f5257600080fd5b825167ffffffffffffffff811115610f6957600080fd5b8301601f81018513610f7a57600080fd5b8051610f8d610f8882610f1b565b610eea565b81815260059190911b82018301908381019087831115610fac57600080fd5b928401925b82841015610fdb57835161ffff81168114610fcc5760008081fd5b82529284019290840190610fb1565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b60008235603e1983360301811261101257600080fd5b9190910192915050565b6000604080833603121561102f57600080fd5b611037610ec1565b8335815260208085013567ffffffffffffffff8082111561105757600080fd5b90860190601f368184011261106b57600080fd5b8235611079610f8882610f1b565b81815260059190911b8401850190858101903683111561109857600080fd5b8686015b83811015611121578035868111156110b45760008081fd5b870136603f8201126110c65760008081fd5b88810135878111156110da576110da610eab565b6110eb818801601f19168b01610eea565b818152368d8385010111156111005760008081fd5b818d84018c83013760009181018b019190915284525091870191870161109c565b50958701959095525093979650505050505050565b600082825180855260208086019550808260051b8401018186016000805b858110156111b057601f1980888603018b5283518051808752845b8181101561118a578281018901518882018a0152880161116f565b5086810188018590529b87019b601f019091169094018501935091840191600101611154565b509198975050505050505050565b602081526000610a6f6020830184611136565b6000602082840312156111e357600080fd5b5051919050565b8281526040602082015260006112036040830184611136565b949350505050565b805167ffffffffffffffff8116811461122357600080fd5b919050565b60006060828403121561123a57600080fd5b6040516060810181811067ffffffffffffffff8211171561125d5761125d610eab565b604052825181526112706020840161120b565b60208201526112816040840161120b565b60408201529392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561068c5761068c61128d565b80820182811260008312801582168215821617156112d6576112d661128d565b505092915050565b6000602082840312156112f057600080fd5b8151610a6f81610d72565b6020808252600a908201526927a7262cafa0a226a4a760b11b604082015260600190565b6000600160ff1b82016113345761133461128d565b5060000390565b8181038181111561068c5761068c61128d565b634e487b7160e01b600052603160045260246000fdfea264697066735822122048dcd3f46f920517017074936a89a0e5a543c4fa370af5abc7a6e6538b79f1fc64736f6c63430008180033000000000000000000000000b855b63b81f16a14121c6754325da5adc582382f

Deployed Bytecode

0x6080604052600436106100dd5760003560e01c80639057aa9f1161007f578063b71d1a0c11610059578063b71d1a0c14610230578063b81d164514610250578063e9c714f214610270578063f851a4401461028557600080fd5b80639057aa9f146101e7578063a1d627a1146101fd578063b0cf579a1461021d57600080fd5b80634a048590116100bb5780634a048590146101705780637a803da01461018557806386c7f19a146101a55780638ee2f9d1146101c757600080fd5b806324a0c541146100e2578063267822471461010857806333511e5e14610140575b600080fd5b6100f56100f0366004610dd3565b6102a5565b6040519081526020015b60405180910390f35b34801561011457600080fd5b50600154610128906001600160a01b031681565b6040516001600160a01b0390911681526020016100ff565b34801561014c57600080fd5b5061016061015b366004610e28565b61067f565b60405190151581526020016100ff565b61018361017e366004610dd3565b610692565b005b34801561019157600080fd5b506101836101a0366004610e45565b6107c2565b3480156101b157600080fd5b506101ba6107f1565b6040516100ff9190610e5e565b3480156101d357600080fd5b506101836101e2366004610e28565b610802565b3480156101f357600080fd5b506100f560055481565b34801561020957600080fd5b50600454610128906001600160a01b031681565b6100f561022b366004610dd3565b610838565b34801561023c57600080fd5b5061018361024b366004610e28565b610858565b34801561025c57600080fd5b5061018361026b366004610e28565b610900565b34801561027c57600080fd5b50610183610933565b34801561029157600080fd5b50600054610128906001600160a01b031681565b600080600554116102fd5760405162461bcd60e51b815260206004820152601760248201527f4d41585f50524943455f44454c41595f4e4f545f53455400000000000000000060448201526064015b60405180910390fd5b6000846001600160a01b0316630fc2b8f56040518163ffffffff1660e01b8152600401600060405180830381865afa15801561033d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103659190810190610f3f565b8051909150831461039657805160405163dfe3619d60e01b81526004810191909152602481018490526044016102f4565b60005b838110156106765760008585838181106103b5576103b5610fe6565b90506020028101906103c79190610ffc565b6103d09061101c565b90506000805b845181101561045d578787858181106103f1576103f1610fe6565b90506020028101906104039190610ffc565b6000013585828151811061041957610419610fe6565b602002602001015161ffff1603610455576001915084818151811061044057610440610fe6565b60200260200101600061ffff1681525061045d565b6001016103d6565b50806104a35786868481811061047557610475610fe6565b90506020028101906104879190610ffc565b6040516364e3cda960e01b8152903560048201526024016102f4565b60048054602084015160405163d47eed4560e01b81526000936001600160a01b039093169263d47eed45926104da929091016111be565b602060405180830381865afa1580156104f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051b91906111d1565b600480548551602087015160405163f4a6a09360e01b81529495506000946001600160a01b039093169363f4a6a09393879361055b9390929091016111ea565b60606040518083038185885af1158015610579573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061059e9190611228565b60055481519192506105af916112a3565b4211156105d5578351604051637d962bc160e11b815260048101919091526024016102f4565b8351602082015160405163659ef44160e01b81526001600160a01b038d169263659ef441926106199260040191825267ffffffffffffffff16602082015260400190565b602060405180830381865afa158015610636573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065a91906111d1565b61066490886112b6565b96505060019093019250610399915050565b50509392505050565b600061068c600283610a51565b92915050565b61069b3361067f565b6106e05760405162461bcd60e51b81526020600482015260166024820152752727aa2fa0a62627aba2a22faa27afaa2924a3a3a2a960511b60448201526064016102f4565b826001600160a01b0316636142895361075b856001600160a01b031663c12d636b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610730573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075491906112de565b8585610838565b6040518263ffffffff1660e01b815260040161077991815260200190565b6020604051808303816000875af1158015610798573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bc91906111d1565b50505050565b6000546001600160a01b031633146107ec5760405162461bcd60e51b81526004016102f4906112fb565b600555565b60606107fd6002610a76565b905090565b6000546001600160a01b0316331461082c5760405162461bcd60e51b81526004016102f4906112fb565b61083581610a83565b50565b6000806108468585856102a5565b61084f9061131f565b95945050505050565b6000546001600160a01b0316331461089e5760405162461bcd60e51b81526020600482015260096024820152682737ba1020b236b4b760b91b60448201526064016102f4565b600180546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a991015b60405180910390a15050565b6000546001600160a01b0316331461092a5760405162461bcd60e51b81526004016102f4906112fb565b61083581610b11565b6001546001600160a01b03163314801561095757506001546001600160a01b031615155b6109a35760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420746865204558495354494e472070656e64696e672061646d696e000060448201526064016102f4565b60008054600180546001600160a01b038082166001600160a01b031980861682179096559490911690915560408051919092168082526020820184905292917ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc910160405180910390a1600154604080516001600160a01b03808516825290921660208301527fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a991016108f4565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b60606000610a6f83610baa565b610a8c8161067f565b610ace5760405162461bcd60e51b81526020600482015260136024820152721050d0d3d5539517d393d517d0531313d5d151606a1b60448201526064016102f4565b610ad9600282610c06565b506040516001600160a01b038216907fc985d67a353004ba149a223b2b9e5c13cca6610b11cb45b4aa029c880d8f7cb590600090a250565b610b1a8161067f565b15610b675760405162461bcd60e51b815260206004820152601760248201527f4143434f554e545f414c52454144595f414c4c4f57454400000000000000000060448201526064016102f4565b610b72600282610c1b565b506040516001600160a01b038216907fc5944eab072face4b169928723314c5978080e99ed8f8527faedb18c06664c3590600090a250565b606081600001805480602002602001604051908101604052809291908181526020018280548015610bfa57602002820191906000526020600020905b815481526020019060010190808311610be6575b50505050509050919050565b6000610a6f836001600160a01b038416610c30565b6000610a6f836001600160a01b038416610d23565b60008181526001830160205260408120548015610d19576000610c5460018361133b565b8554909150600090610c689060019061133b565b9050808214610ccd576000866000018281548110610c8857610c88610fe6565b9060005260206000200154905080876000018481548110610cab57610cab610fe6565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610cde57610cde61134e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061068c565b600091505061068c565b6000818152600183016020526040812054610d6a5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561068c565b50600061068c565b6001600160a01b038116811461083557600080fd5b60008083601f840112610d9957600080fd5b50813567ffffffffffffffff811115610db157600080fd5b6020830191508360208260051b8501011115610dcc57600080fd5b9250929050565b600080600060408486031215610de857600080fd5b8335610df381610d72565b9250602084013567ffffffffffffffff811115610e0f57600080fd5b610e1b86828701610d87565b9497909650939450505050565b600060208284031215610e3a57600080fd5b8135610a6f81610d72565b600060208284031215610e5757600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015610e9f5783516001600160a01b031683529284019291840191600101610e7a565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610ee457610ee4610eab565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610f1357610f13610eab565b604052919050565b600067ffffffffffffffff821115610f3557610f35610eab565b5060051b60200190565b60006020808385031215610f5257600080fd5b825167ffffffffffffffff811115610f6957600080fd5b8301601f81018513610f7a57600080fd5b8051610f8d610f8882610f1b565b610eea565b81815260059190911b82018301908381019087831115610fac57600080fd5b928401925b82841015610fdb57835161ffff81168114610fcc5760008081fd5b82529284019290840190610fb1565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b60008235603e1983360301811261101257600080fd5b9190910192915050565b6000604080833603121561102f57600080fd5b611037610ec1565b8335815260208085013567ffffffffffffffff8082111561105757600080fd5b90860190601f368184011261106b57600080fd5b8235611079610f8882610f1b565b81815260059190911b8401850190858101903683111561109857600080fd5b8686015b83811015611121578035868111156110b45760008081fd5b870136603f8201126110c65760008081fd5b88810135878111156110da576110da610eab565b6110eb818801601f19168b01610eea565b818152368d8385010111156111005760008081fd5b818d84018c83013760009181018b019190915284525091870191870161109c565b50958701959095525093979650505050505050565b600082825180855260208086019550808260051b8401018186016000805b858110156111b057601f1980888603018b5283518051808752845b8181101561118a578281018901518882018a0152880161116f565b5086810188018590529b87019b601f019091169094018501935091840191600101611154565b509198975050505050505050565b602081526000610a6f6020830184611136565b6000602082840312156111e357600080fd5b5051919050565b8281526040602082015260006112036040830184611136565b949350505050565b805167ffffffffffffffff8116811461122357600080fd5b919050565b60006060828403121561123a57600080fd5b6040516060810181811067ffffffffffffffff8211171561125d5761125d610eab565b604052825181526112706020840161120b565b60208201526112816040840161120b565b60408201529392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561068c5761068c61128d565b80820182811260008312801582168215821617156112d6576112d661128d565b505092915050565b6000602082840312156112f057600080fd5b8151610a6f81610d72565b6020808252600a908201526927a7262cafa0a226a4a760b11b604082015260600190565b6000600160ff1b82016113345761133461128d565b5060000390565b8181038181111561068c5761068c61128d565b634e487b7160e01b600052603160045260246000fdfea264697066735822122048dcd3f46f920517017074936a89a0e5a543c4fa370af5abc7a6e6538b79f1fc64736f6c63430008180033

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

000000000000000000000000b855b63b81f16a14121c6754325da5adc582382f

-----Decoded View---------------
Arg [0] : _priceValidator (address): 0xb855B63B81F16a14121C6754325DA5aDc582382F

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


Block Transaction 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.