FluidDexT1OperationsDebt ​
Implements core logics for Fluid Dex protocol. Note Token transfers happen directly from user to Liquidity contract and vice-versa.
constructor ​
solidity
constructor(struct Structs.ConstantViews constantViews_) public
_onlyDelegateCall ​
solidity
modifier _onlyDelegateCall()
borrow ​
solidity
function borrow(uint256 token0Amt_, uint256 token1Amt_, uint256 maxSharesAmt_, address to_) public returns (uint256 shares_)
This function allows users to borrow tokens in any proportion from the debt pool
Parameters ​
Name | Type | Description |
---|---|---|
token0Amt_ | uint256 | The amount of token0 to borrow |
token1Amt_ | uint256 | The amount of token1 to borrow |
maxSharesAmt_ | uint256 | The maximum amount of shares the user is willing to receive |
to_ | address | Recipient of swapped tokens. If to* == address(0) then out tokens will be sent to msg.sender. If to* == ADDRESSDEAD then function will revert with shares |
Return Values ​
Name | Type | Description |
---|---|---|
shares_ | uint256 | The amount of borrow shares minted to represent the borrowed amount |
payback ​
solidity
function payback(uint256 token0Amt_, uint256 token1Amt_, uint256 minSharesAmt_, bool estimate_) public payable returns (uint256 shares_)
This function allows users to payback tokens in any proportion to the debt pool
Parameters ​
Name | Type | Description |
---|---|---|
token0Amt_ | uint256 | The amount of token0 to payback |
token1Amt_ | uint256 | The amount of token1 to payback |
minSharesAmt_ | uint256 | The minimum amount of shares the user expects to burn |
estimate_ | bool | If true, function will revert with estimated shares without executing the payback |
Return Values ​
Name | Type | Description |
---|---|---|
shares_ | uint256 | The amount of borrow shares burned for the payback |
paybackPerfectInOneToken ​
solidity
function paybackPerfectInOneToken(uint256 shares_, uint256 maxToken0_, uint256 maxToken1_, bool estimate_) public payable returns (uint256 paybackAmt_)
This function allows users to payback their debt with perfect shares in one token
Parameters ​
Name | Type | Description |
---|---|---|
shares_ | uint256 | The number of shares to burn for payback |
maxToken0_ | uint256 | The maximum amount of token0 the user is willing to pay (set to 0 if paying back in token1) |
maxToken1_ | uint256 | The maximum amount of token1 the user is willing to pay (set to 0 if paying back in token0) |
estimate_ | bool | If true, the function will revert with the estimated payback amount without executing the payback |
Return Values ​
Name | Type | Description |
---|---|---|
paybackAmt_ | uint256 | The amount of tokens paid back in the chosen token |