-
Notifications
You must be signed in to change notification settings - Fork 431
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
PSP22 chain extension example #1244
Conversation
It is bad that we did double work=( We could cooperate together to deliver but it is too late. But it is still good to have several implementations=) We plan to create a production-ready chains extension and define its interface in the PSP. So if you have some though regarding our implementation it will be cool to hear them here or in PSP=) I want to highlight that maybe some contract wants to transfer his tokens, so it is why we added the But we also realized the problem with |
🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑These are the results when building the
Link to the run | Last update: Tue Aug 23 14:08:39 CEST 2022 |
Codecov Report
@@ Coverage Diff @@
## master #1244 +/- ##
==========================================
- Coverage 70.52% 70.11% -0.41%
==========================================
Files 189 190 +1
Lines 5910 5940 +30
==========================================
- Hits 4168 4165 -3
- Misses 1742 1775 +33
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@xgreenx Thanks for your feedback ! I was unaware of your implementation. This is just a simple, incomplete example. My motivation was to show a more advanced chain extension example than the existing |
hi @stiiifff |
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.
I'm really sorry for taking so long to look at this! Thanks for your time though, I like the addition of this 🙇
@bidzyyys Hey, are you going to address the open comments? |
@HCastano I will resolve the comments. |
3c09865
to
3bb5786
Compare
2008862
to
94e7e87
Compare
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.
Thanks for updating this @Wiezzel!
Can you fork the substrate-contracts-node
, add this chain extension to it, and share the repo? I want to see if this code compiles. We'll need to think of a way to check with our CI in the future
pub value: Balance, | ||
} | ||
|
||
pub struct Psp22Extension; |
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.
This won't compile due to some changes with how chain extensions work. You can read more about the breaking changes here: paritytech/substrate#11874.
There's also these two PRs which you might find useful/interesting
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
6360cb6
to
13dab11
Compare
@HCastano I've made some changes according to your comments. |
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.
Here's the substarte-contratcs-node code with the extension installed: https://github.com/Wiezzel/substrate-contracts-node/pull/1
Thanks for that!
CI tests are failing, but it seems to me that is not related to any changes from this PR. I've run cargo test -p ink_lang --test compile_tests on master and it fails as well.
Can you merge master
and see if that fixes your issues?
fe56cfe
to
8dd92c4
Compare
8dd92c4
to
59ee286
Compare
@HCastano All checks passed! 😄 |
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.
Couple of small things left but we're almost here 💪
// FIXME: This is a bit of a shortcut. It was made because the documentation | ||
// for Mutate::approve does not specify the result of subsequent calls. |
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.
Please don't leave FIXME
s (or TODO
s) in the code. File an issue and we can address it in a follow up PR
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.
OK, I'll open an issue as soon as this PR is merged.
Co-authored-by: Hernando Castano <HCastano@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.
Thanks for the work on this!
Example implementation of the PSP22 Fungible Token Standard as a chain extension, supporting a multi-token system provided by the FRAME assets pallet.
It demonstrates how ink! contracts (L2) can interact with native assets (L1) from the chain runtime in a standardised way.