FluidDexT1OperationsDebt ​
Inherits:SecondaryHelpers
Implements core logics for Fluid Dex protocol. Note Token transfers happen directly from user to Liquidity contract and vice-versa.
Functions ​
constructor ​
solidity
constructor(ConstantViews memory constantViews_) SecondaryHelpers(constantViews_);_onlyDelegateCall ​
solidity
modifier _onlyDelegateCall();borrow ​
This function allows users to borrow tokens in any proportion from the debt pool
solidity
function borrow(uint256 token0Amt_, uint256 token1Amt_, uint256 maxSharesAmt_, address to_)
    public
    _onlyDelegateCall
    returns (uint256 shares_);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_ == ADDRESS_DEAD then function will revert with shares_ | 
Returns
| Name | Type | Description | 
|---|---|---|
| shares_ | uint256 | The amount of borrow shares minted to represent the borrowed amount | 
payback ​
This function allows users to payback tokens in any proportion to the debt pool
solidity
function payback(uint256 token0Amt_, uint256 token1Amt_, uint256 minSharesAmt_, bool estimate_)
    public
    payable
    _onlyDelegateCall
    returns (uint256 shares_);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 | 
Returns
| Name | Type | Description | 
|---|---|---|
| shares_ | uint256 | The amount of borrow shares burned for the payback | 
paybackPerfectInOneToken ​
This function allows users to payback their debt with perfect shares in one token
solidity
function paybackPerfectInOneToken(uint256 shares_, uint256 maxToken0_, uint256 maxToken1_, bool estimate_)
    public
    payable
    _onlyDelegateCall
    returns (uint256 paybackAmt_);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 | 
Returns
| Name | Type | Description | 
|---|---|---|
| paybackAmt_ | uint256 | The amount of tokens paid back in the chosen token | 

