alpha-wallet-ios icon indicating copy to clipboard operation
alpha-wallet-ios copied to clipboard

Issue with native swap

Open hboon opened this issue 3 years ago • 7 comments

  • [ ] If I choose MATIC Polygon -> WETH, it says "Swap Pair Not Found".
  • [ ] MATIC Polygon -> USDC is better, and the Fees/Current Price/Minimum Received appears, but the To amount for USDC remains 0 and "Minimum Received" is "0.0000 USDC" too

If I choose ETH Ethereum -> USDC,

  • [ ] the fees says "0.1050 ETH". That sounds too high to be correct (my ETH balance is 0.1065, not sure if it's related)
  • [ ] "Current Price" shows "1 ETH = 0.0000 USDC"

Does the spillage and transaction deadline settings work?

hboon avatar Jul 25 '22 04:07 hboon

Sorry, took a while to get back to testing this again

hboon avatar Jul 25 '22 04:07 hboon

not quite sure, i guess we pass these values as request params, will double check it

oa-s avatar Jul 25 '22 05:07 oa-s

  • If I choose MATIC Polygon -> WETH, it says "Swap Pair Not Found". we got this error, as api call returns the next error:
{
    errors =     (
    );
    message = "Unable to find a quote for the requested transfer.";
}

oa-s avatar Jul 25 '22 05:07 oa-s

params we trying to send:

["toChain": 137, "fromToken": "0x0000000000000000000000000000000000000000", "fromAmount": "300000000000000000", "fromChain": 137, "toToken": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", "fromAddress": "0xbbce83173d5c1D122AE64856b4Af0D5AE07Fa362", "slippage": "1.0"]

oa-s avatar Jul 25 '22 05:07 oa-s

  • MATIC Polygon -> USDC is better, and the Fees/Current Price/Minimum Received appears, but the To amount for USDC remains 0 and "Minimum Received" is "0.0000 USDC" too

when we receive estimate response, we can't make BigInt value from next values. we can actually, but value is too small: **"0,000000000000184897"**

 toAmount = 168239; toAmountMin = 168239; toAmountUSD = "0.17";

Here is full response: resp.txt

oa-s avatar Jul 25 '22 05:07 oa-s

If we are already doing it, can you point me to where I can find the debugLog() output for the URLs. If we aren't, add those? Then I can look at the URL and compare with what is observed in the UI while I test.

hboon avatar Jul 25 '22 06:07 hboon

If we are already doing it, can you point me to where I can find the debugLog() output for the URLs. If we aren't, add those? Then I can look at the URL and compare with what is observed in the UI while I test.

func fetchSwapQuote(fromToken: TokenToSwap, toToken: TokenToSwap, wallet: AlphaWallet.Address, slippage: Double, fromAmount: BigUInt) -> AnyPublisher<SwapQuote, SwapError> {

oa-s avatar Jul 25 '22 06:07 oa-s

If I choose MATIC Polygon -> WETH, it says "Swap Pair Not Found".

looks like it happens because of parameter slippage, we send string value 1.0, but with 1 works ok, will update code with removing trailing zeros from number.

oa-s avatar Aug 19 '22 07:08 oa-s

MATIC Polygon -> USDC is better, and the Fees/Current Price/Minimum Received appears, but the To amount for USDC remains 0 and "Minimum Received" is "0.0000 USDC" too

there was an issue with formatting, missed case that some of tokens, has different decimals value.

oa-s avatar Aug 19 '22 07:08 oa-s

Does the spillage and transaction deadline settings work?

we use spillage value, but not transaction deadline, didn't find request param for transaction deadline

oa-s avatar Aug 19 '22 07:08 oa-s