Skip to content

FluidDexT1OperationsCol ​

Git Source

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();

deposit ​

This function allows users to deposit tokens in any proportion into the col pool

solidity
function deposit(uint256 token0Amt_, uint256 token1Amt_, uint256 minSharesAmt_, bool estimate_)
    public
    payable
    _onlyDelegateCall
    returns (uint256 shares_);

Parameters

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

Returns

NameTypeDescription
shares_uint256The amount of shares minted for the deposit

withdraw ​

This function allows users to withdraw tokens in any proportion from the col pool

solidity
function withdraw(uint256 token0Amt_, uint256 token1Amt_, uint256 maxSharesAmt_, address to_)
    public
    _onlyDelegateCall
    returns (uint256 shares_);

Parameters

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

NameTypeDescription
shares_uint256The number of shares burned for the withdrawal

withdrawPerfectInOneToken ​

This function allows users to withdraw their collateral with perfect shares in one token

solidity
function withdrawPerfectInOneToken(uint256 shares_, uint256 minToken0_, uint256 minToken1_, address to_)
    public
    _onlyDelegateCall
    returns (uint256 withdrawAmt_);

Parameters

NameTypeDescription
shares_uint256The number of shares to burn for withdrawal
minToken0_uint256The minimum amount of token0 the user expects to receive (set to 0 if withdrawing in token1)
minToken1_uint256The minimum amount of token1 the user expects to receive (set to 0 if withdrawing in token0)
to_addressRecipient 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

NameTypeDescription
withdrawAmt_uint256The amount of tokens withdrawn in the chosen token