FluidDexT1OperationsCol ​
Inherits:SecondaryHelpers
Title: FluidDexT1
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_);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 |
depositPerfect ​
Deposit tokens in equal proportion to the current pool ratio
solidity
function depositPerfect(uint256 shares_, uint256 maxToken0Deposit_, uint256 maxToken1Deposit_, bool estimate_)
public
payable
_onlyDelegateCall
returns (uint256 token0Amt_, uint256 token1Amt_);Parameters
| Name | Type | Description |
|---|---|---|
shares_ | uint256 | The number of shares to mint |
maxToken0Deposit_ | uint256 | Maximum amount of token0 to deposit |
maxToken1Deposit_ | uint256 | Maximum amount of token1 to deposit |
estimate_ | bool | If true, function will revert with estimated deposit amounts without executing the deposit |
Returns
| Name | Type | Description |
|---|---|---|
token0Amt_ | uint256 | Amount of token0 deposited |
token1Amt_ | uint256 | Amount of token1 deposited |
withdrawPerfect ​
This function allows users to withdraw a perfect amount of collateral liquidity
solidity
function withdrawPerfect(uint256 shares_, uint256 minToken0Withdraw_, uint256 minToken1Withdraw_, address to_)
public
_onlyDelegateCall
returns (uint256 token0Amt_, uint256 token1Amt_);Parameters
| Name | Type | Description |
|---|---|---|
shares_ | uint256 | The number of shares to withdraw |
minToken0Withdraw_ | uint256 | The minimum amount of token0 the user is willing to accept |
minToken1Withdraw_ | uint256 | The minimum amount of token1 the user is willing to accept |
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 token0Amt_ & token1Amt_ |
Returns
| Name | Type | Description |
|---|---|---|
token0Amt_ | uint256 | The amount of token0 withdrawn |
token1Amt_ | uint256 | The amount of token1 withdrawn |

