Skip to content

PerpsV2MarketBase

Description

Source: contracts/PerpsV2MarketBase.sol

Structs

TradeParams

Source

Field Type Description
sizeDelta int256 TBA
oraclePrice uint256 TBA
fillPrice uint256 TBA
desiredFillPrice uint256 TBA
takerFee uint256 TBA
makerFee uint256 TBA
trackingCode bytes32 TBA

Variables

marketState

Source

Type: contract IPerpsV2MarketState

Constructor

constructor

Source

Details

Signature

constructor(address _marketState, address _owner, address _resolver)

Visibility

public

State Mutability

``

Views

resolverAddressesRequired

Source

Details

Signature

resolverAddressesRequired() view returns (bytes32[] addresses)

Visibility

public

State Mutability

view

Internal Functions

_abs

Source

Details

Signature

_abs(int256 x) pure returns (uint256)

Visibility

internal

State Mutability

pure

_accessibleMargin

Source

Details

Signature

_accessibleMargin(struct IPerpsV2MarketBaseTypes.Position position, uint256 price) view returns (uint256)

Visibility

internal

State Mutability

view

_accruedFunding

Source

Details

Signature

_accruedFunding(struct IPerpsV2MarketBaseTypes.Position position, uint256 price) view returns (int256 funding)

Visibility

internal

State Mutability

view

_assetPrice

Source

Details

Signature

_assetPrice() view returns (uint256 price, bool invalid)

Visibility

internal

State Mutability

view

_baseAsset

Source

Details

Signature

_baseAsset() view returns (bytes32)

Visibility

internal

State Mutability

view

_canLiquidate

Source

Details

Signature

_canLiquidate(struct IPerpsV2MarketBaseTypes.Position position, uint256 price) view returns (bool)

Visibility

internal

State Mutability

view

_currentFundingRate

Source

Details

Signature

_currentFundingRate() view returns (int256)

Visibility

internal

State Mutability

view

_currentFundingVelocity

Source

Details

Signature

_currentFundingVelocity() view returns (int256)

Visibility

internal

State Mutability

view

_currentLeverage

Source

Details

Signature

_currentLeverage(struct IPerpsV2MarketBaseTypes.Position position, uint256 price, uint256 remainingMargin_) pure returns (int256 leverage)

Visibility

internal

State Mutability

pure

_dynamicFeeRate

Source

Details

Signature

_dynamicFeeRate() view returns (uint256 feeRate, bool tooVolatile)

Visibility

internal

State Mutability

view

_exchangeRates

Source

Details

Signature

_exchangeRates() view returns (contract IExchangeRates)

Visibility

internal

State Mutability

view

_exchanger

Source

Details

Signature

_exchanger() view returns (contract IExchanger)

Visibility

internal

State Mutability

view

_fillPrice

Source

Details

Signature

_fillPrice(int256 size, uint256 price) view returns (uint256)

Visibility

internal

State Mutability

view

_isError

Source

Details

Signature

_isError(enum IPerpsV2MarketBaseTypes.Status status) pure returns (bool)

Visibility

internal

State Mutability

pure

_latestFundingIndex

Source

Details

Signature

_latestFundingIndex() view returns (uint256)

Visibility

internal

State Mutability

view

_liquidationFee

Source

Details

Signature

_liquidationFee(int256 positionSize, uint256 price) view returns (uint256 lFee)

Visibility

internal

State Mutability

view

_liquidationMargin

Source

Details

Signature

_liquidationMargin(int256 positionSize, uint256 price) view returns (uint256 lMargin)

Visibility

internal

State Mutability

view

_liquidationPremium

Source

Details

Signature

_liquidationPremium(int256 positionSize, uint256 currentPrice) view returns (uint256)

Visibility

internal

State Mutability

view

_manager

Source

Details

Signature

_manager() view returns (contract IFuturesMarketManagerInternal)

Visibility

internal

State Mutability

view

_marginPlusProfitFunding

Source

Details

Signature

_marginPlusProfitFunding(struct IPerpsV2MarketBaseTypes.Position position, uint256 price) view returns (int256)

Visibility

internal

State Mutability

view

_marketKey

Source

Details

Signature

_marketKey() view returns (bytes32)

Visibility

internal

State Mutability

view

_max

Source

Details

Signature

_max(int256 x, int256 y) pure returns (int256)

Visibility

internal

State Mutability

pure

_min

Source

Details

Signature

_min(int256 x, int256 y) pure returns (int256)

Visibility

internal

State Mutability

pure

_netFundingPerUnit

Source

Details

Signature

_netFundingPerUnit(uint256 startIndex, uint256 price) view returns (int256)

Visibility

internal

State Mutability

view

_nextFundingEntry

Source

Details

Signature

_nextFundingEntry(uint256 price) view returns (int256)

Visibility

internal

State Mutability

view

_notionalValue

Source

Details

Signature

_notionalValue(int256 positionSize, uint256 price) pure returns (int256 value)

Visibility

internal

State Mutability

pure

_orderFee

Source

Details

Signature

_orderFee(struct PerpsV2MarketBase.TradeParams params, uint256 dynamicFeeRate) view returns (uint256 fee)

Visibility

internal

State Mutability

view

_orderSizeTooLarge

Source

Details

Signature

_orderSizeTooLarge(uint256 maxSize, int256 oldSize, int256 newSize) view returns (bool)

Visibility

internal

State Mutability

view

_postTradeDetails

Source

Details

Signature

_postTradeDetails(struct IPerpsV2MarketBaseTypes.Position oldPos, struct PerpsV2MarketBase.TradeParams params) view returns (struct IPerpsV2MarketBaseTypes.Position newPosition, uint256 fee, enum IPerpsV2MarketBaseTypes.Status tradeStatus)

Visibility

internal

State Mutability

view

_profitLoss

Source

Details

Signature

_profitLoss(struct IPerpsV2MarketBaseTypes.Position position, uint256 price) pure returns (int256 pnl)

Visibility

internal

State Mutability

pure

_proportionalElapsed

Source

Details

Signature

_proportionalElapsed() view returns (int256)

Visibility

internal

State Mutability

view

_proportionalSkew

Source

Details

Signature

_proportionalSkew() view returns (int256)

Visibility

internal

State Mutability

view

_recomputeMarginWithDelta

Source

Details

Signature

_recomputeMarginWithDelta(struct IPerpsV2MarketBaseTypes.Position position, uint256 price, int256 marginDelta) view returns (uint256 margin, enum IPerpsV2MarketBaseTypes.Status statusCode)

Visibility

internal

State Mutability

view

_remainingLiquidatableMargin

Source

Details

Signature

_remainingLiquidatableMargin(struct IPerpsV2MarketBaseTypes.Position position, uint256 price) view returns (uint256)

Visibility

internal

State Mutability

view

_remainingMargin

Source

Details

Signature

_remainingMargin(struct IPerpsV2MarketBaseTypes.Position position, uint256 price) view returns (uint256)

Visibility

internal

State Mutability

view

_revertIfError

Source

Details

Signature

_revertIfError(bool isError, enum IPerpsV2MarketBaseTypes.Status status) view

Visibility

internal

State Mutability

view

_sameSide

Source

Details

Signature

_sameSide(int256 a, int256 b) pure returns (bool)

Visibility

internal

State Mutability

pure

_settings

Source

Details

Signature

_settings() view returns (address)

Visibility

internal

State Mutability

view

_signedAbs

Source

Details

Signature

_signedAbs(int256 x) pure returns (int256)

Visibility

internal

State Mutability

pure

_systemStatus

Source

Details

Signature

_systemStatus() view returns (contract ISystemStatus)

Visibility

internal

State Mutability

view

_unrecordedFunding

Source

Details

Signature

_unrecordedFunding(uint256 price) view returns (int256)

Visibility

internal

State Mutability

view