Internals ​
Fluid "VaultT1" (Vault Type 1). Fluid vault protocol main contract. T1 -> Normal collateral | Normal debt Fluid Vault protocol is a borrow / lending protocol, allowing users to create collateral / borrow positions. All funds are deposited into / borrowed from Fluid Liquidity layer. Positions are represented through NFTs minted by the VaultFactory. Deployed by "VaultFactory" and linked together with Vault AdminModule ADMIN_IMPLEMENTATION
and FluidVaultSecondary (main2.sol) SECONDARY_IMPLEMENTATION
. AdminModule & FluidVaultSecondary methods are delegateCalled, if the msg.sender has the required authorization. This contract links to an Oracle, which is used to assess collateral / debt value. Oracles implement the "FluidOracle" base contract and return the price in 1e27 precision.
For view methods / accessing data, use the "VaultResolver" periphery contract.
constructor ​
constructor(struct Structs.ConstantViews constants_) internal
FluidVaultT1_Not_For_Prod ​
operate ​
function operate(uint256 nftId_, int256 newCol_, int256 newDebt_, address to_) external payable returns (uint256, int256, int256)
Performs operations on a vault position
This function allows users to modify their vault position by adjusting collateral and debt
Parameters ​
Name | Type | Description |
---|---|---|
nftId_ | uint256 | The ID of the NFT representing the vault position |
newCol_ | int256 | The change in collateral amount (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) |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | nftId_ The ID of the NFT representing the updated vault position |
[1] | int256 | Final supply amount (negative if withdrawal occurred) |
[2] | int256 | Final borrow amount (negative if repayment occurred) |
liquidate ​
function liquidate(uint256 debtAmt_, uint256 colPerUnitDebt_, address to_, bool absorb_) external payable returns (uint256 actualDebt_, uint256 actualCol_)
Liquidates a vault position
This function allows the liquidation of a vault position by paying back the debt with the collateral
Parameters ​
Name | Type | Description |
---|---|---|
debtAmt_ | uint256 | The amount of debt to be liquidated |
colPerUnitDebt_ | uint256 | The collateral per unit of debt |
to_ | address | The address to receive the liquidated collateral |
absorb_ | bool | If true, the liquidation absorbs the debt and the collateral is sent to the to_ address |
Return Values ​
Name | Type | Description |
---|---|---|
actualDebt_ | uint256 | The actual amount of debt that was liquidated |
actualCol_ | uint256 | The actual amount of collateral that was sent to the to_ address |
constructor ​
constructor(struct Structs.ConstantViews constants_) public