feat(1748): first draft of saucerswap plugin#1754
Conversation
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
| [SupportedNetwork.MAINNET]: { | ||
| routerContractId: '0.0.3045981', | ||
| factoryContractId: '0.0.2895920', // UniswapV2Factory | ||
| whbarTokenId: '0.0.1456986', |
There was a problem hiding this comment.
and should we not have some definitions set in the config of the default contracts https://docs.saucerswap.finance/developerx/contract-deployments ? Probably I should also add the possiblity to override the defualt values here, but I think the default values could be set here
| This detection affects which Solidity function is called: | ||
|
|
||
| | Operation | Both tokens are HTS | One token is HBAR | | ||
| | ------------------ | -------------------------- | -------------------------------------------------- | | ||
| | Create pool | `addLiquidityNewPool` | `addLiquidityETHNewPool` | | ||
| | Deposit | `addLiquidity` | `addLiquidityETH` | | ||
| | Withdraw | `removeLiquidity` | `removeLiquidityETH` | | ||
| | Swap (exact input) | `swapExactTokensForTokens` | `swapExactETHForTokens` or `swapExactTokensForETH` | | ||
| | Buy (exact output) | `swapTokensForExactTokens` | `swapETHForExactTokens` or `swapTokensForExactETH` | | ||
|
|
There was a problem hiding this comment.
I think for now we just need:
swapExactETHForTokensorswapExactTokensForETHswapETHForExactTokensorswapTokensForExactETH
There was a problem hiding this comment.
I think for monitoring and trading you are right that we need only those probably, but maybe also we should add these creation of liquidity pool, deposit and withtdraw also? Just to have more manageable plugin for saucerswap?
| const functionParameters = new ContractFunctionParameters() | ||
| .addUint256(params.amountIn) | ||
| .addUint256(params.amountOutMin) | ||
| .addAddressArray(path) | ||
| .addAddress(params.recipientEvm) | ||
| .addUint256(deadline); | ||
|
|
There was a problem hiding this comment.
why don't you use: the abi + encodeFunctionData from ethers?
There was a problem hiding this comment.
but is that necessary. I think for erc-20 and erc-721 we did it through the contract parameters defined in that way. One place where we defined the parameters through ethers + abi was for mirror node call, because we didn't want query fees present. Could we leave like that?
|
|
||
| ```ts | ||
| async buildTransaction(args, params): Promise<BuildTransactionResult> { | ||
| const path = [params.fromEvmAddress, params.toEvmAddress]; |
There was a problem hiding this comment.
don't you also need the pool fees?
There was a problem hiding this comment.
I think in V1 we do not need to inlcude the pool fees as it always is 0.3%, but I am not quite sure about it. Can provide more detail in your comment?
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
Signed-off-by: mmyslblocky <michal.myslinski@blockydevs.com>
Issue #1748