-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: psp22 trait contract example with drink tests #300
Conversation
# This is the 1st commit message: refactor: general # This is the commit message #2: init # This is the commit message #3: begin refactor # This is the commit message #4: refactor: error handling # This is the commit message #5: tests: add error handling tests # This is the commit message #6: WIP # This is the commit message #7: finalise error handling # This is the commit message #8: refactor: easier review
Co-authored-by: Frank Bell <frank@r0gue.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some improvements. Also, the contract was now incorrect in terms of capabilities, if the token was constructed with existing
the contract would not necessarily be able to mint and burn tokens. This is also what we had discussed so I am suprised to still see it in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last nitpicks but then good to go. Not sure whether we need multiple owners to make the contract more safe for a lost owner account but I leave that to the next reviewer to decide. This example has taken us long enough and we should move on, we can always add examples
Co-authored-by: Daan van der Plas <93204684+Daanvdplas@users.noreply.github.com>
Co-authored-by: Daan van der Plas <93204684+Daanvdplas@users.noreply.github.com>
Co-authored-by: Daan van der Plas <93204684+Daanvdplas@users.noreply.github.com>
Co-authored-by: Daan van der Plas <93204684+Daanvdplas@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The contract gives a nice example on how to use the fungibles api and the tests are pretty cool.
What I have tried and failed to do was deploying this example locally. The contract kept on trapping.
This is what I could see on my logs
2024-11-06 13:38:29.579 DEBUG tokio-runtime-worker runtime::contracts: Execution finished with debug buffer: seal0::input(out_ptr: 69250, out_len_ptr: 65416) = Ok(())
seal0::caller(out_ptr: 69250, out_len_ptr: 65124) = Ok(())
seal0::address(out_ptr: 69250, out_len_ptr: 65124) = Ok(())
seal0::call_chain_extension(id: 194379776, input_ptr: 69250, input_len: 52, output_ptr: 69302, output_len_ptr: 65132) = Ok(133635)
seal0::seal_return(flags: 1, data_ptr: 69250, data_len: 10) = Err(<wasm:stripped>)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, thank you!
Various typos and fixes suggested. I also think that we need a simple comment on the functions around allowances to make it easier to follow.
I successfully instantiated the contract and mint a new token on testnet: https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc2.paseo.popnetwork.xyz#/explorer/query/0xeb474f72660ef9879f2a3c2f30a28d56b5d250e8945fb8a6c9aa8a0f05cd3947 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving as @chungquantin has shown that the issue in my comment might just be something on my side.
👍
Description
Example contract for the fungible use case that applies the PSP22 traits from #297. The PR includes:
pop-drink
andpop-sandbox
: https://github.com/r0gue-io/pop-drink