Skip to content

FluidVaultT2Operate ​

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

solidity
function operate(
    uint256 nftId_,
    int256 newColToken0_,
    int256 newColToken1_,
    int256 colSharesMinMax_,
    int256 newDebt_,
    address to_
) external payable _delegateCallCheck returns (uint256, int256, int256);

Parameters

NameTypeDescription
nftId_uint256The ID of the NFT representing the vault position
newColToken0_int256The change in collateral amount of token0 (positive for deposit, negative for withdrawal)
newColToken1_int256The change in collateral amount of token1 (positive for deposit, negative for withdrawal)
colSharesMinMax_int256min or max collateral shares to mint or burn (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>int256supplyAmt_ Final supply amount (negative if withdrawal occurred)
<none>int256borrowAmt_ 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 _delegateCallCheck returns (uint256, int256[] memory r_);

Parameters

NameTypeDescription
nftId_uint256The ID of the NFT representing the vault position
perfectColShares_int256The change in collateral shares (positive for deposit, negative for withdrawal)
colToken0MinMax_int256min or max collateral amount of token0 to withdraw or deposit (positive for deposit, negative for withdrawal)
colToken1MinMax_int256min or max collateral amount of token1 to withdraw or deposit (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
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

constructor ​

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

Structs ​

SmartOperate ​

solidity
struct SmartOperate {
    uint256 initialEth;
    int256 colShares;
    int256 debtShares;
    uint256 vaultVariables;
}

SmartOperatePerfect ​

solidity
struct SmartOperatePerfect {
    uint256 initialEth;
    int256 newColToken0;
    int256 newColToken1;
    int256 newDebtToken0;
    int256 newDebtToken1;
    uint256 vaultVariables;
}