Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contractWithCallback.js #13

Open
mkpuig opened this issue Sep 14, 2022 · 0 comments
Open

contractWithCallback.js #13

mkpuig opened this issue Sep 14, 2022 · 0 comments

Comments

@mkpuig
Copy link
Collaborator

mkpuig commented Sep 14, 2022

Hello, what is the content of tokenSatoshis ? On the first if seems its the whole "budget", but on the second if seems it's the number of tokens to issue, which fails with totalSupply > 1 .In addition on the throw error message seems it's the whole "budget" again.
Are we misunderstanding something?
(This forces our customers to use the old version of stas-js , as next commit added the second if) :
"stas-js": "github:TAAL-GmbH/stas-js#b0beee4253018f3514b2bae1980f06f2cbf6878f"

if (tokenSatoshis % schema.satsPerToken !== 0) {
    throw new Error(`Token amount ${tokenSatoshis} must be divisible by satsPerToken ${schema.satsPerToken}`)
  }
if ((tokenSatoshis * schema.satsPerToken) > inputUtxos[0].amount) {
    throw new Error(`Token Supply of ${tokenSatoshis} with satsPerToken of ${schema.satsPerToken} is greater than input amount of ${inputUtxos[0].amount}`)
  }

If we change the if into this, we got it running ok

if ((schema.totalSupply * schema.satsPerToken) > inputUtxos[0].amount) {
    throw new Error(`Token Supply of ${tokenSatoshis} with satsPerToken of ${schema.satsPerToken} is greater than input amount of ${inputUtxos[0].amount}`)
}

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant