-
Notifications
You must be signed in to change notification settings - Fork 354
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
Support new ink!
contract events
#5789
Comments
I'm uploading a zip with two contracts here: erc20-4.0-vs-5.0.zip. It contains:
The diff comes down to "events": [
{
"args": [ ... ],
"docs": [ ... ],
"label": "...",
+ "module_path": "erc20::erc20",
+ "signature_topic": "0xb5b61a3e6a21a16be4f044b517c28ac692492f73c5bfd3f60178ad98c767f4cb"
},
...
] |
@jacogr We would be very grateful if you could tackle this soonish. The context is that we're about to release ink! 5.0 and just now realized that |
@ascjones Is this actually |
I'm not sure what the current state is, but we would expect them to emit events in this way in the future i.e. have the first topic be the signature topic and include that in the metadata. /cc @xermicus |
Would be a bit of a hassle to not only treat contract compiled with different ink version differently but also languages. Is there something like an language overarching specification how pallet-contracts wasm contracts should behave? |
That's basically the ink! metadata. Solang & co just implement the same metadata format as ink!, Solang also uses the ink! crates for parts of that. I think Solang is still on the Metadata v4. When interpreting the metadata there should be no language-specific logic needed. |
Yes as soon as ink! 5.0 is released I'll keep Solang up and make a new release. As for the events, this shouldn't be any issue to adapt. In general the metadata is mostly compatible. The only compromise so far is about how Solang Solidity contracts make use of |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query. |
I'm submitting a ...
ink!
events are changing in version5.0
. See use-ink/ink#1827, and https://use.ink/5.x/basics/events/.The most important change is that there is a new field on each event definition in the metadata:
signature_topic
which must now be used to identify the type of event being received. Previously the index of the event i.e its position in the json array was used to determine which event to decode.Now when handling an event, the first topic of the substrate event is matched to that signature topic in the metadata. If the event is anonymous, there is no signature topic in that case the raw hex bytes of the event can be returned and leave it up to the user what to do there.
Event decoding here:
api/packages/api-contract/src/Abi/index.ts
Line 236 in 3bdf49b
The text was updated successfully, but these errors were encountered: