Skip to content

FluidVaultT1_Not_For_Prod ​

Git Source

Inherits:Internals

Functions ​

operate ​

Performs operations on a vault position

This function allows users to modify their vault position by adjusting collateral and debt

Notes:

  • security: Re-entrancy protection is implemented

  • security: ETH balance is validated before and after operation

solidity
function operate(uint256 nftId_, int256 newCol_, int256 newDebt_, address to_)
    external
    payable
    returns (uint256, int256, int256);

Parameters

NameTypeDescription
nftId_uint256The ID of the NFT representing the vault position
newCol_int256The change in collateral amount (positive for deposit, negative for withdrawal)
newDebt_int256The change in debt amount (positive for borrowing, negative for repayment)
to_addressThe address to receive withdrawn collateral or borrowed tokens (if address(0), defaults to msg.sender)

Returns

NameTypeDescription
<none>uint256nftId_ The ID of the NFT representing the updated vault position
<none>int256Final supply amount (negative if withdrawal occurred)
<none>int256Final borrow amount (negative if repayment occurred)

liquidate ​

Liquidates a vault position

This function allows the liquidation of a vault position by paying back the debt with the collateral

solidity
function liquidate(uint256 debtAmt_, uint256 colPerUnitDebt_, address to_, bool absorb_)
    external
    payable
    returns (uint256 actualDebt_, uint256 actualCol_);

Parameters

NameTypeDescription
debtAmt_uint256The amount of debt to be liquidated
colPerUnitDebt_uint256The collateral per unit of debt
to_addressThe address to receive the liquidated collateral
absorb_boolIf true, the liquidation absorbs the debt and the collateral is sent to the to_ address

Returns

NameTypeDescription
actualDebt_uint256The actual amount of debt that was liquidated
actualCol_uint256The actual amount of collateral that was sent to the to_ address

constructor ​

solidity
constructor(ConstantViews memory constants_) Internals(constants_);