Skip to main content

IDomFiVault

IDomFiVault

Combined interface: IVault and IERC4626.

Addresses

ChainAddress

IVault

External interface implemented by DomFiVault.

Addresses

ChainAddress

Functions

addReferralFee

Deposit a referral fee from FeeDistributor.

function addReferralFee(uint256 amount, address user) external returns (Shares shares)
Dev note

Does not apply deposit fees; only can be called by feeDistributor.

Parameters

NameTypeDescription
amountuint256Referral fee to deposit on behalf of user
useraddressAddress to credit with this referral fee

distributeDecrease

Pay out any claimed PnL, and distribute trade fee, when a position is decreased.

function distributeDecrease(
uint256 margin,
address owner,
address recipient,
uint256 totalFee,
int256 netPnl
) external
Dev note

Only callable by DomFiPerp. Decreases balance by PnL.

Parameters

NameTypeDescription
marginuint256Margin amount being decreased
owneraddressOwner of position being decreased; for fee redirect.
recipientaddressAddress to receive any realized positive PnL
totalFeeuint256Fee amount paid by the position's owner
netPnlint256PnL, with fee already applied, realized by decrease

withdrawWithoutFee

Remove collateral from the Vault and send it to recipient.

function withdrawWithoutFee(address recipient, uint256 amount) external
Dev note

Only callable by DomFiPerp. Does not update balance; this is for adjusting position margin (which does not contribute to balance).

Parameters

NameTypeDescription
recipientaddressAddress to receive collateral
amountuint256Collateral amount to remove

approveAndUpdateLiquidatorReward

Process a liquidation

function approveAndUpdateLiquidatorReward(
uint256 remainingReward,
uint256 liquidatorReward,
uint256 increaseBalance,
address liquidator
) external
Dev note

Only callable by DomFiPerp

Parameters

NameTypeDescription
remainingRewarduint256Leftover margin after liquidator reward and PnL
liquidatorRewarduint256Collateral amount paid out to liquidator
increaseBalanceuint256Increase vault balance by this much
liquidatoraddressAddress which will be approved for liquidatorReward

redeem

function redeem(
Shares shares,
address receiver,
address account,
uint256 minAssets
) external returns (
uint256 assets
)

withdraw

function withdraw(
uint256 assets,
address receiver,
address account,
Shares maxShares
) external returns (
Shares shares
)

deposit

function deposit(uint256 amount, address user, Shares minShares) external returns (Shares shares)

mint

function mint(Shares shares, address receiver, uint256 maxAssets) external returns (uint256 assets)

Types

Signature

EIP-712 signature

struct Signature {
uint8 v;
bytes32 r;
bytes32 s;
}

WithdrawRequest

A request to withdraw or redeem shares

Fields

NameTypeDescription
assetsuint256The asset value of shares when the request was made. Redemptions will be processed at a rate no better than this.
sharesSharesSize of the request
sharesRedeemedSharesNumber of shares that have been redeemed using this request
penaltyuint64Seconds of penalty which were applied to this request
beginsAtuint64Timestamp when this request will become available
durationuint64Length (after beginsAt) until 100% of shares can be redeemed
struct WithdrawRequest {
uint256 assets;
Shares shares;
Shares sharesRedeemed;
uint64 penalty;
uint64 beginsAt;
uint64 duration;
}