swap-ui icon indicating copy to clipboard operation
swap-ui copied to clipboard

Display minimum tradeable token quantity and disable swap button if too small

Open secretshardul opened this issue 4 years ago • 3 comments

Unable to swap USDC for KIN. Users reported issues with some other pairs as well.

I created a KIN SPL account beforehand, but it still fails.

  1. From browser console:
Transaction simulation failed: Error processing Instruction 1: custom program error: 0x66 
    Program 11111111111111111111111111111111 invoke [1]
    Program 11111111111111111111111111111111 success
    Program 22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD invoke [1]
    Program 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin invoke [2]
    Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]
    Program log: Instruction: Transfer
    Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3402 of 162985 compute units
    Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success
    Program 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin consumed 17384 of 173542 compute units
    Program 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin success
    Program 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin invoke [2]
    Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]
    Program log: Instruction: Transfer
    Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3402 of 136362 compute units
    Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success
    Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]
    Program log: Instruction: Transfer
    Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3402 of 130123 compute units
    Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success
    Program 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin consumed 19451 of 145281 compute units
    Program 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin success
    Program log: 4ZfIrPLY4R4QJwAAAAAAAIdJYQsAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADG+nrzvtutOj1l82qryXQxsbvkwtL24OR8pgIDRS9dYQszOKCrLMhB1bAUvGo891YpGHSzGclRfZu/qeTpZh75xvp6877brTo9ZfNqq8l0MbG75MLS9uDkfKYCA0UvXWFL+Ym56BXUNmJn50I5czFKmd7/+oJBhPsNNSUASy49Dg==
    Program log: Custom program error: 0x66
    Program 22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD consumed 85188 of 200000 compute units
    Program 22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD failed: custom program error: 0x66
  1. A 'custom program error 0x66' notification is also displayed.

image

  1. The transaction doesn't show up on Solana explorer

secretshardul avatar Jun 12 '21 10:06 secretshardul

0x66 is the zero swap error, meaning the size of the trade was probably too low. See https://github.com/project-serum/swap/blob/master/programs/swap/src/lib.rs#L723.

Did you try swapping for more?

armaniferrante avatar Jun 12 '21 16:06 armaniferrante

0x66 is the zero swap error, meaning the size of the trade was probably too low. See https://github.com/project-serum/swap/blob/master/programs/swap/src/lib.rs#L723.

Did you try swapping for more?

Resolved, token quantity was the issue. Consider this a feature request, that minimum required amounts should be displayed.

secretshardul avatar Jun 12 '21 17:06 secretshardul

Additionally, we should disable the swap button if the token quantity is too small.

armaniferrante avatar Jun 12 '21 17:06 armaniferrante