Skip to content

FluidVaultOperate ​

Git Source

Inherits:HelpersOperate

Fluid vault protocol main operate contract base.

Functions ​

_delegateCallCheck ​

solidity
modifier _delegateCallCheck() ;

_operate ​

Single function which handles supply, withdraw, borrow & payback

solidity
function _operate(
    uint256 nftId_, // if 0 then new position
    int256 newCol_, // if negative then withdraw
    int256 newDebt_, // if negative then payback
    address to_, // address at which the borrow & withdraw amount should go to. If address(0) then it'll go to msg.sender
    uint256 vaultVariables_
)
    internal
    returns (
        uint256, // nftId_
        int256, // final supply amount. if - then withdraw
        int256, // final borrow amount. if - then payback
        uint256 // vaultVariables_
    );

Parameters

NameTypeDescription
nftId_uint256NFT ID for interaction. If 0 then create new NFT/position.
newCol_int256new collateral. If positive then deposit, if negative then withdraw, if 0 then do nohing
newDebt_int256new debt. If positive then borrow, if negative then payback, if 0 then do nohing
to_addressaddress where withdraw or borrow should go. If address(0) then msg.sender
vaultVariables_uint256the current state of the vaultVariables from storage

Returns

NameTypeDescription
<none>uint256nftId_ if 0 then this returns the newly created NFT Id else returns the same NFT ID
<none>int256newCol_ final supply amount. Mainly if max withdraw using type(int).min then this is useful to get perfect amount else remain same as newCol_
<none>int256newDebt_ final borrow amount. Mainly if max payback using type(int).min then this is useful to get perfect amount else remain same as newDebt_
<none>uint256vaultVariables_ the updated state of the vaultVariables

constructor ​

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