Config

The config contract sets key exchange parameters.

Contract

/// @notice For maker types that requires mitigation of oracle front-running, order must comes from a gateway that will execute the order in a 2-step process with a delay that's longer than `orderDelaySeconds`
function getOrderDelaySeconds() external view returns (uint256) {
    return _getConfigStorage().orderDelaySeconds;
}

/// @notice Query max order validity duration
function getMaxOrderValidDuration() external view returns (uint256) {
    return _getConfigStorage().maxOrderValidDuration;
}

/// @notice Query max relayer fee. Denominated in collateral token.
function getMaxRelayFee() external view returns (uint256) {
    return _getConfigStorage().maxRelayFee;
}

/// @notice Query the margin ratio needed to open a position.
function getInitialMarginRatio(uint256 marketId) external view returns (uint256) {
    uint256 mRatio = _getConfigStorage().initialMarginRatioMap[marketId];
    if (mRatio == 0) {
        return 1 ether; // 100%
    }
    return mRatio;
}

/// @notice Query the margin ratio required to prevent liquidation.
function getMaintenanceMarginRatio(uint256 marketId) external view returns (uint256) {
    uint256 mRatio = _getConfigStorage().maintenanceMarginRatioMap[marketId];
    if (mRatio == 0) {
        return 1 ether; // 100%
    }
    return mRatio;
}

/// @notice Query what percentage of the liquidation penalty the liquidator can receive.
function getLiquidationFeeRatio(uint256 marketId) external view returns (uint256) {
    uint256 feeRatio = _getConfigStorage().liquidationFeeRatioMap[marketId];
    return feeRatio;
}

/// @notice Query what proportion of the liquidated position may charged as penalty.
function getLiquidationPenaltyRatio(uint256 marketId) external view returns (uint256) {
    uint256 penaltyRatio = _getConfigStorage().liquidationPenaltyRatioMap[marketId];
    return penaltyRatio;
}

/// @notice Query the borrowing fee rate when utilization ratio is 100% (for all borrowing fee receivers).
function getMaxBorrowingFeeRate(uint256 marketId) external view returns (uint256, uint256) {
    return IBorrowingFee(getAddressManager().getBorrowingFee()).getMaxBorrowingFeeRate(marketId);
}

/// @notice Query Pyth's price feed id for the given market.
function getPriceFeedId(uint256 marketId) external view returns (bytes32) {
    return _getConfigStorage().marketMap[marketId];
}

/// @notice Query whether a maker can use the vault callback function and receive borrowing fees.
function isWhitelistedMaker(uint256 marketId, address trader) external view returns (bool) {
    return _getConfigStorage().whitelistedMakerMap[marketId][trader];
}

/// @notice Query the global maximum amount of deposits allowed.
function getDepositCap() external view returns (uint256) {
    return _getConfigStorage().depositCap;
}

/// #notice Query the price band ratio.
function getPriceBandRatio(uint256 marketId) external view returns (uint256) {
    return _getConfigStorage().priceBandRatioMap[marketId];
}

fundingConfig

Query market funding config for funding factor and basePool address.

struct FundingConfig {
    uint256 fundingFactor;
    uint256 fundingExponentFactor;
    address basePool;
}

function getFundingConfig(
    uint256 marketId
)
returns (
    FundingConfig memory
)

Last updated