FluidDexT1OperationsCol ​
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
Name | Type | Description |
---|---|---|
token0Amt_ | uint256 | The amount of token0 to deposit |
token1Amt_ | uint256 | The amount of token1 to deposit |
minSharesAmt_ | uint256 | The minimum amount of shares the user expects to receive |
estimate_ | bool | If true, function will revert with estimated shares without executing the deposit |
Returns
Name | Type | Description |
---|---|---|
shares_ | uint256 | The 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
Name | Type | Description |
---|---|---|
token0Amt_ | uint256 | The amount of token0 to withdraw |
token1Amt_ | uint256 | The amount of token1 to withdraw |
maxSharesAmt_ | uint256 | The maximum number of shares the user is willing to burn |
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 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
Name | Type | Description |
---|---|---|
shares_ | uint256 | The number of shares to burn for withdrawal |
minToken0_ | uint256 | The minimum amount of token0 the user expects to receive (set to 0 if withdrawing in token1) |
minToken1_ | uint256 | The minimum amount of token1 the user expects to receive (set to 0 if withdrawing in token0) |
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 |
---|---|---|
withdrawAmt_ | uint256 | The amount of tokens withdrawn in the chosen token |