FCT_Lib_UniswapV2
FCT_Lib_UniswapV2 adds the ability to do a swaps and add liquidity when not all params are known in advance. It also supports simulating swaps without doing any change on the blockchain.
It is needed because swap and add liquidity needs inputs that are dependent on dynamic data.
The ability to simulate actions like swaps extends the capabilities and possible uses cases for FCTs.
It is not safe to use the "*X*_no*Y*Protection" named functions without adding a validator the checks return values or better to have a validator/s at the end of the FCT that ensures the desired outcome
Main Functions
addLiquidity_noMinProtection
Adds liquidity directly from the FCT_Runner without any min amount protection, meaning that the actual amounts that will be used are not assured.
Method
The method field indicates what type of assets to use.
Method can be used as string or as bytes32 in the EIP712 FCT message. When string is used the FCT engine can be informed to hash the value before calling this function.
addLiquidityTo_noMinProtection
The same as addLiquidity_noMinProtection except that the "to" address gets the liquidity token instead and the FCT_Runner
swap_noSlippageProtection
Swaps tokens or eth directly from the FCT_Runner without any slippage protection, meaning that the actual amounts that will be used are not assured (except the amount that was defined as "exact" according to the chosen method)
Method
The method field indicates what type of assets to use and whether the input or output amount will be assured (exact value)
Method can be used as string or as bytes32 in the EIP712 FCT message. When string is used the FCT engine can be informed to hash the value before calling this function.
swapTo_noSlippageProtection
The same as swap_noSlippageProtection except that the "to" address gets the liquidity token instead and the FCT_Runner
simulateSwap
The same as swap_noSlippageProtection except that the actual swap is not executed.
It is safe to run swap_noSliipageProtection directly after simulateSwap (on the same FCT), using the same inputs, the values will be the same.
Last updated