metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.32k stars 6.26k forks source link

Candy UI should display the discount price when a presale is active #1465

Closed epomatti closed 2 years ago

epomatti commented 2 years ago

Candy Machine UI frontend is not displaying the appropriate discountPrice when a presale is active.

The price should be displayed 0.33, but the UI shows 0.5. Transactions are working fine ✌️

mint

Presale confirmed to be true:

 ts-node ./js/packages/cli/src/candy-machine-v2-cli.ts show --env $ENV --keypair $KEYPAIR --rpc-url $RPC
wallet public key: 3cdToHdD5ryv3VGiySzikWMox7qRCordoYX4HFtMb4Bd
USING CUSTOM URL https://api.devnet.solana.com
...Candy Machine...
Key: 2vtvSK2eLC21xaEQdtvo1B2r1PJKUw2Xv3t2KcSwNyty
authority:  3cdToHdD5ryv3VGiySzikWMox7qRCordoYX4HFtMb4Bd
wallet:  3cdToHdD5ryv3VGiySzikWMox7qRCordoYX4HFtMb4Bd
tokenMint:  null
uuid:  2vtvSK
price:  500000000
itemsAvailable:  10
itemsRedeemed:  3
goLiveDate:  2022-01-30T00:00:00.000Z
symbol:  NB
sellerFeeBasisPoints:  500
creators:
3cdToHdD5ryv3VGiySzikWMox7qRCordoYX4HFtMb4Bd at 100 %
maxSupply:  0
retainAuthority:  true
isMutable:  true
hidden settings:  null
No end settings detected
No captcha for this candy machine
whitelist settings:
Mint:  LEC5vC2ncgYREbMqUZaY6MEQCqTg4LpqWmfNbW7Ysdq
Mode:  { burnEveryTime: {} }
Presale:  true
Discounted Price:  330000000

My config.json:

{
  "price": 0.5,
  "number": 10,
  "gatekeeper": null,
  "solTreasuryAccount": "3cdToHdD5ryv3VGiySzikWMox7qRCordoYX4HFtMb4Bd",
  "splTokenAccount": null,
  "splToken": null,
  "goLiveDate": "30 Jan 2022 00:00:00 UTC",
  "endSettings": null,
  "whitelistMintSettings": {
    "mode": {
      "burnEveryTime": true
    },
    "mint": "LEC5vC2ncgYREbMqUZaY6MEQCqTg4LpqWmfNbW7Ysdq",
    "presale": true,
    "discountPrice": 0.33  <--price that should be displayed
  },
  "hiddenSettings": null,
  "storage": "arweave",
  "ipfsInfuraProjectId": null,
  "ipfsInfuraSecret": null,
  "awsS3Bucket": null,
  "noRetainAuthority": false,
  "noMutable": false
}
Blueberry94 commented 2 years ago

Yes i have the same issue with the presale price and the latest master release.

My token is not burned after the whitelisted pukey is buying with the discountedPrice. So the whitlisted users can buy as much NFTs as they want with the discountPrice.

{ "price": 0.3, "number": 10, "gatekeeper": null, "solTreasuryAccount": "C1SgPtFxwwrR6YDGmLr6ZpsRtmTfcH3Zugqr8znzcEs6", "splTokenAccount": null, "splToken": null, "goLiveDate": "08 Jan 2022 13:30:00 GMT", "endSettings": null, "whitelistMintSettings": { "mode": { "burnEveryTime": true }, "mint" : "8qsXxZFwviYizH38CTzHzY64W1b3ozmrQiUCp3239JXV", "presale" : true, "discountPrice" : 0.1 }, "hiddenSettings": null, "storage": "arweave", "ipfsInfuraProjectId": null, "ipfsInfuraSecret": null, "awsS3Bucket": null, "noRetainAuthority": false, "noMutable": false }

and this my candy machine show output:

wallet public key: C1SgPtFxwwrR6YDGmLr6ZpsRtmTfcH3Zugqr8znzcEs6 ...Candy Machine... Key: 8VKczzXMtBpDZFN9Wpba9J7kmCzeQQDH28mmixzGSJrn authority: C1SgPtFxwwrR6YDGmLr6ZpsRtmTfcH3Zugqr8znzcEs6 wallet: C1SgPtFxwwrR6YDGmLr6ZpsRtmTfcH3Zugqr8znzcEs6 tokenMint: null uuid: 8VKczz price: 300000000 itemsAvailable: 10 itemsRedeemed: 0 goLiveDate: 2022-01-08T13:30:00.000Z symbol: CLEAF sellerFeeBasisPoints: 500 creators: 3kRKUjVuYQQKBDysnckpWSaeuhtmAdjPzEfeafgwMUUV at 100 % maxSupply: 0 retainAuthority: true isMutable: true hidden settings: null No end settings detected No captcha for this candy machine whitelist settings: Mint: 8qsXxZFwviYizH38CTzHzY64W1b3ozmrQiUCp3239JXV Mode: { burnEveryTime: {} } Presale: true Discounted Price: 100000000

Thanks for helping me. Looks that its working in the gif from the open issue above.

epomatti commented 2 years ago

@Blueberry94

My token is not burned after the whitelisted pukey is buying with the discountedPrice. So the whitlisted users can buy as much NFTs as they want with the discountPrice.

I only get the behavior you described when this "neverBurn": true is set (token remains in the user's wallet).

With "burnEveryTime": true tokens are being burn on my tests.

needman0914 commented 2 years ago

@epomatti How did you minted whitelist token? Can you share the cli command you used?

epomatti commented 2 years ago

@needman0914 you'll find it all here: https://hackmd.io/@epomatti/B1kUsyEhF

kelvin2180 commented 2 years ago

My token is not burned after the whitelisted pukey is buying with the discountedPrice. So the whitlisted users can buy as much NFTs as they want with the discountPrice.

I have the same issue on mainnet. It only burns for a very small amount. (close to zero)

epomatti commented 2 years ago

@kelvin2180 did you create your token using --decimals 0? If not, try that, and open a separate issue for that behavior.

kelvin2180 commented 2 years ago

@kelvin2180 did you create your token using --decimals 0? If not, try that, and open a separate issue for that behavior.

Thanks @epomatti ! That fixed the issue :)!

epomatti commented 2 years ago

@kelvin2180 awesome man! happy to help.

Don't forget to reproduce the issue and submit so the team can track and fix it.

It should behave the same regardless the decimals, or have some warning/constraint to prevent such issues.