metaplex-foundation / sugar

Candy Machine Rust CLI.
Apache License 2.0
203 stars 116 forks source link

[Bug]: Sugar doesn't resolve Token decimal places #436

Open blockiosaurus opened 1 year ago

blockiosaurus commented 1 year ago

Issue description

  1. Input 3,000,000 BONK for token payment guard config
  2. Deploy Candy Machine
  3. Mint cost is 30 BONK instead of 3M as expected

It seems like Sugar doesn't resolve decimal places for token payments the same way it does for SOL. Ideally the handling should be same.

Relevant log output

No response

Priority this issue should have

Low (slightly annoying)

samuelvanderwaal commented 1 year ago

This is actually a really annoying refactor as it requires passing a Program object from the main function processing guards through multiple levels of nesting to the TokenPayment to_guard_format implementation. Or we have to know in that function which cluster we're on so we can build a RPC client and a make a network call to find out the number of decimal places in the mint.

The SOL implementation works because we know SOL always has nine decimal places.