IDomFiVault
IDomFiVault
Combined interface: IVault
and IERC4626
.
Addresses
Chain | Address |
---|
IVault
External interface implemented by DomFiVault.
Addresses
Chain | Address |
---|
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
Name | Type | Description |
---|---|---|
amount | uint256 | Referral fee to deposit on behalf of user |
user | address | Address 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
Name | Type | Description |
---|---|---|
margin | uint256 | Margin amount being decreased |
owner | address | Owner of position being decreased; for fee redirect. |
recipient | address | Address to receive any realized positive PnL |
totalFee | uint256 | Fee amount paid by the position's owner |
netPnl | int256 | PnL, 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
Name | Type | Description |
---|---|---|
recipient | address | Address to receive collateral |
amount | uint256 | Collateral 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
Name | Type | Description |
---|---|---|
remainingReward | uint256 | Leftover margin after liquidator reward and PnL |
liquidatorReward | uint256 | Collateral amount paid out to liquidator |
increaseBalance | uint256 | Increase vault balance by this much |
liquidator | address | Address 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
Name | Type | Description |
---|---|---|
assets | uint256 | The asset value of shares when the request was made. Redemptions will be processed at a rate no better than this. |
shares | Shares | Size of the request |
sharesRedeemed | Shares | Number of shares that have been redeemed using this request |
penalty | uint64 | Seconds of penalty which were applied to this request |
beginsAt | uint64 | Timestamp when this request will become available |
duration | uint64 | Length (after beginsAt ) until 100% of shares can be redeemed |
struct WithdrawRequest {
uint256 assets;
Shares shares;
Shares sharesRedeemed;
uint64 penalty;
uint64 beginsAt;
uint64 duration;
}