FluidDexT1OperationsCol ​
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()
deposit ​
solidity
function deposit(uint256 token0Amt_, uint256 token1Amt_, uint256 minSharesAmt_, bool estimate_) public payable returns (uint256 shares_)
This function allows users to deposit tokens in any proportion into the col pool
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 |
Return Values ​
Name | Type | Description |
---|---|---|
shares_ | uint256 | The amount of shares minted for the deposit |
withdraw ​
solidity
function withdraw(uint256 token0Amt_, uint256 token1Amt_, uint256 maxSharesAmt_, address to_) public returns (uint256 shares_)
This function allows users to withdraw tokens in any proportion from the col pool
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* == ADDRESSDEAD then function will revert with shares |
Return Values ​
Name | Type | Description |
---|---|---|
shares_ | uint256 | The number of shares burned for the withdrawal |
withdrawPerfectInOneToken ​
solidity
function withdrawPerfectInOneToken(uint256 shares_, uint256 minToken0_, uint256 minToken1_, address to_) public returns (uint256 withdrawAmt_)
This function allows users to withdraw their collateral with perfect shares in one token
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* == ADDRESSDEAD then function will revert with shares |
Return Values ​
Name | Type | Description |
---|---|---|
withdrawAmt_ | uint256 | The amount of tokens withdrawn in the chosen token |