FluidVaultT2 ​
Inherits:Internals
Functions ​
operate ​
Performs operations on a vault position
This function allows users to modify their vault position by adjusting collateral and debt
solidity
function operate(
uint256,
int256 newColToken0_,
int256 newColToken1_,
int256 colSharesMinMax_,
int256 newDebt_,
address to_
) external payable _dexFromAddress returns (uint256, int256, int256);
Parameters
Name | Type | Description |
---|---|---|
<none> | uint256 | |
newColToken0_ | int256 | The change in collateral amount of token0 (positive for deposit, negative for withdrawal) |
newColToken1_ | int256 | The change in collateral amount of token1 (positive for deposit, negative for withdrawal) |
colSharesMinMax_ | int256 | min or max collateral shares to mint or burn (positive for deposit, negative for withdrawal) |
newDebt_ | int256 | The change in debt amount (positive for borrowing, negative for repayment) |
to_ | address | The address to receive withdrawn collateral or borrowed tokens (if address(0), defaults to msg.sender) |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | nftId_ The ID of the NFT representing the updated vault position |
<none> | int256 | supplyAmt_ Final supply amount (negative if withdrawal occurred) |
<none> | int256 | borrowAmt_ Final borrow amount (negative if repayment occurred) |
operatePerfect ​
Performs operations on a vault position with perfect collateral shares
This function allows users to modify their vault position by adjusting collateral and debt
solidity
function operatePerfect(
uint256 nftId_,
int256 perfectColShares_,
int256 colToken0MinMax_,
int256 colToken1MinMax_,
int256 newDebt_,
address to_
) external payable _dexFromAddress returns (uint256, int256[] memory r_);
Parameters
Name | Type | Description |
---|---|---|
nftId_ | uint256 | The ID of the NFT representing the vault position |
perfectColShares_ | int256 | The change in collateral shares (positive for deposit, negative for withdrawal) |
colToken0MinMax_ | int256 | min or max collateral amount of token0 to withdraw or deposit (positive for deposit, negative for withdrawal) |
colToken1MinMax_ | int256 | min or max collateral amount of token1 to withdraw or deposit (positive for deposit, negative for withdrawal) |
newDebt_ | int256 | The change in debt amount (positive for borrowing, negative for repayment) |
to_ | address | The address to receive withdrawn collateral or borrowed tokens (if address(0), defaults to msg.sender) |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | nftId_ The ID of the NFT representing the updated vault position |
r_ | int256[] | int256 array of return values: 0 - final col shares amount (can only change on max withdrawal) 1 - token0 deposit or withdraw amount 2 - token1 deposit or withdraw amount 3 - newDebt_ will only change if user sent type(int).min |
liquidate ​
Liquidates a vault position
This function allows users to liquidate a vault position by adjusting collateral and debt
solidity
function liquidate(
uint256 debtAmt_,
uint256 colPerUnitDebt_,
uint256 token0ColAmtPerUnitShares_,
uint256 token1ColAmtPerUnitShares_,
address to_,
bool absorb_
)
public
payable
_dexFromAddress
returns (uint256 actualDebt_, uint256 actualColShares_, uint256 token0Col_, uint256 token1Col_);
Parameters
Name | Type | Description |
---|---|---|
debtAmt_ | uint256 | The amount of debt to liquidate |
colPerUnitDebt_ | uint256 | The collateral shares per unit of debt |
token0ColAmtPerUnitShares_ | uint256 | The collateral amount of token0 per unit of shares to withdraw |
token1ColAmtPerUnitShares_ | uint256 | The collateral amount of token1 per unit of shares to withdraw |
to_ | address | The address to receive withdrawn collateral (if address(0), defaults to msg.sender) |
absorb_ | bool | Whether to liquidate absorbed liquidity as well |
Returns
Name | Type | Description |
---|---|---|
actualDebt_ | uint256 | The actual amount of debt liquidated |
actualColShares_ | uint256 | The actual amount of collateral shares liquidated |
token0Col_ | uint256 | The amount of token0 collateral withdrawn |
token1Col_ | uint256 | The amount of token1 collateral withdrawn |
liquidatePerfect ​
Liquidates a vault position with perfect collateral shares
This function allows users to liquidate a vault position by adjusting collateral and debt
solidity
function liquidatePerfect(
uint256 debtAmt_,
uint256 colPerUnitDebt_,
uint256 token0ColAmtPerUnitShares_,
uint256 token1ColAmtPerUnitShares_,
address to_,
bool absorb_
)
external
payable
_dexFromAddress
returns (uint256 actualDebt_, uint256 actualColShares_, uint256 token0Col_, uint256 token1Col_);
Parameters
Name | Type | Description |
---|---|---|
debtAmt_ | uint256 | The amount of debt to liquidate |
colPerUnitDebt_ | uint256 | The collateral shares per unit of debt |
token0ColAmtPerUnitShares_ | uint256 | The collateral amount of token0 per unit of shares to withdraw |
token1ColAmtPerUnitShares_ | uint256 | The collateral amount of token1 per unit of shares to withdraw |
to_ | address | The address to receive withdrawn collateral (if address(0), defaults to msg.sender) |
absorb_ | bool | Whether to liquidate absorbed liquidity as well |
Returns
Name | Type | Description |
---|---|---|
actualDebt_ | uint256 | The actual amount of debt liquidated |
actualColShares_ | uint256 | The actual amount of collateral shares liquidated |
token0Col_ | uint256 | The amount of token0 collateral withdrawn |
token1Col_ | uint256 | The amount of token1 collateral withdrawn |
constructor ​
solidity
constructor(ConstantViews memory constants_) Internals(constants_);