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

How do I know how many assets are being transfered during the 'verify' callback? #2588

Closed
lock9 opened this issue Aug 25, 2021 · 2 comments
Closed
Labels
Question Used in questions

Comments

@lock9
Copy link
Contributor

lock9 commented Aug 25, 2021

Hi,

The ´verify´ method doesn't use any parameters. What is the best / recommended way that I can securely obtain the amount that the user is trying to transfer from a contract? In other words, how can I get the parameters of the ´transfer´ invocation that triggered the ´verify´ method on my smart-contract?

Thanks

@lock9 lock9 added the Question Used in questions label Aug 25, 2021
@roman-khimov
Copy link
Contributor

The ´verify´ method doesn't use any parameters

It can have parameters if you need, nothing forbids/prevents that.

What is the best / recommended way that I can securely obtain the amount that the user is trying to transfer from a contract?

The problem though is that your verify parameters and transfer parameters are completely different unrelated things, so you can only get transfer parameters if you're to very carefully parse tx.Script in verify. Related: #2577.

@lock9
Copy link
Contributor Author

lock9 commented Aug 25, 2021

Thanks @roman-khimov .
I guess that the best path is to have a custom 'withdraw' method on the smart-contract.

@lock9 lock9 closed this as completed Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Used in questions
Projects
None yet
Development

No branches or pull requests

2 participants