Skip to main content

FundingManager

FundingManager

Funding manager for Domination Finance perpetual exchange

Computes a “funding rate” for products based on open interest, stores an integral, and updates it whenever a position is touched. Also integrates a flat base interest rate. Given a position with a historical snapshot of cumulative funding and interest, the current stored integrals allow DomFiPerp to compute how much the owner owes (or receives).

These rates are intended to incentivize even long/short orders (minimizing LP exposure) and collect fees for LPs.

Addresses

ChainAddress
Arbitrum Sepolia0xE413363cf8E2dd59ed4A36151CE0e46454B18F88
Base Sepolia0x16E3a83939216b6625A57665209Ff25d470e2D00
Base Mainnet0x65734F47870Fe907367Fab6984228B5810a55211

Functions

initialize

function initialize(struct StorageInstance _store) external

domFiPerp

function domFiPerp() external view returns (contract IDomFiPerp)

updateFunding

Update cumulative sums with the integral of the current funding and interest rates since last update.

function updateFunding(ProductId _productId) external
Dev note

Called whenever a product's funding and interest rates change. Only callable by DomFiPerp

Parameters

NameTypeDescription
_productIdProductIdproduct to update

getFundingRate

get funding rate for the given product

function getFundingRate(ProductId _productId) public view returns (FPSigned fundingRate)

Parameters

NameTypeDescription
_productIdProductIdproduct to get funding rate for

Return Values

NameTypeDescription
fundingRateFPSigned% per year charged for long and paid to short orders

getInterestRate

get interest rate for the given product

function getInterestRate(ProductId _productId) public view returns (FPUnsigned _interestRate)

Parameters

NameTypeDescription
_productIdProductIdproduct to get interest rate for

Return Values

NameTypeDescription
_interestRateFPUnsigned

getCumulativeFunding

Get cumulative funding, as a percent, for a product since it was added. Compare this to a previous cumulative funding value to see the net funding accrued between the two measurements.

function getCumulativeFunding(ProductId _productId) external view returns (FPSigned)

Parameters

NameTypeDescription
_productIdProductIdproduct in question

Return Values

NameTypeDescription
[0]FPSigned

getCumulativeInterest

Get cumulative interest, as a percent, for a product since it was added. Compare this to a previous cumulative interest value to see the interest accrued between the two measurements. Note that unlike funding, interest rate is always positive; cumulative interest will never decrease.

function getCumulativeInterest(ProductId _productId) external view returns (FPUnsigned)

Parameters

NameTypeDescription
_productIdProductIdproduct in question

Return Values

NameTypeDescription
[0]FPUnsigned

minFundingMultiplier

function minFundingMultiplier() external view returns (FPUnsigned)

setMinFundingMultiplier

function setMinFundingMultiplier(FPUnsigned _minFundingMultiplier) external

fundingMultipliers

function fundingMultipliers(ProductId _productId) external view returns (FPUnsigned)

setFundingMultiplier

function setFundingMultiplier(ProductId _productId, FPUnsigned _fundingMultiplier) external

baseInterestRates

function baseInterestRates(ProductId _productId) external view returns (FPUnsigned)

setInterestRate

function setInterestRate(ProductId _productId, FPUnsigned _interestRate) external

maxInterestRate

function maxInterestRate() external view returns (FPUnsigned)

setMaxInterestRate

function setMaxInterestRate(FPUnsigned _maxInterestRate) external

maxFundingRate

function maxFundingRate() external view returns (FPUnsigned)

setMaxFundingRate

function setMaxFundingRate(FPUnsigned _maxFundingRate) external

lastUpdateTimes

function lastUpdateTimes(ProductId _productId) external view returns (uint64)

Events

FundingUpdated

event FundingUpdated(
ProductId productId,
FPSigned fundingRate,
FPSigned fundingChange,
FPSigned cumulativeFunding,
FPUnsigned interestRate,
FPUnsigned interestChange,
FPUnsigned cumulativeBaseInterests
)

MinFundingMultiplierSet

event MinFundingMultiplierSet(FPUnsigned minFundingMultiplier)

FundingMultiplierSet

event FundingMultiplierSet(ProductId productId, FPUnsigned fundingMultiplier)

BaseInterestRateSet

event BaseInterestRateSet(ProductId productId, FPUnsigned baseInterestRate)

MaxFundingRateSet

event MaxFundingRateSet(FPUnsigned maxFundingRate)

MaxInterestRateSet

event MaxInterestRateSet(FPUnsigned maxInterestRate)

Variables

funding