Skip to content

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 ​

NameTypeDescription
token0Amt_uint256The amount of token0 to borrow
token1Amt_uint256The amount of token1 to borrow
maxSharesAmt_uint256The maximum amount of shares the user is willing to receive
to_addressRecipient 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 ​

NameTypeDescription
shares_uint256The 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 ​

NameTypeDescription
token0Amt_uint256The amount of token0 to payback
token1Amt_uint256The amount of token1 to payback
minSharesAmt_uint256The minimum amount of shares the user expects to burn
estimate_boolIf true, function will revert with estimated shares without executing the payback

Return Values ​

NameTypeDescription
shares_uint256The 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 ​

NameTypeDescription
shares_uint256The number of shares to burn for payback
maxToken0_uint256The maximum amount of token0 the user is willing to pay (set to 0 if paying back in token1)
maxToken1_uint256The maximum amount of token1 the user is willing to pay (set to 0 if paying back in token0)
estimate_boolIf true, the function will revert with the estimated payback amount without executing the payback

Return Values ​

NameTypeDescription
paybackAmt_uint256The amount of tokens paid back in the chosen token