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

Provide event-specific event classes for use in WASM handlers #41

Closed
Jannis opened this issue Jul 5, 2018 · 0 comments
Closed

Provide event-specific event classes for use in WASM handlers #41

Jannis opened this issue Jul 5, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Jannis
Copy link
Contributor

Jannis commented Jul 5, 2018

WASM-only solution

There’s an easy solution that’s purely on the WASM side: We could generate

class AuctionCreatedEvent extends EthereumEvent {
  id(): Bytes { return this.params[0].value }
  assetId(): H256 { return this.params[1].value }
  seller(): string { return this.params[2].value }
}

When people then write handlers like

handleAuctionCreatedEvent(event: AuctionCreatedEvent) { ... }

they could use event.id(), event.seller(). (edited)
That requires no magic at all in Rust.

Rust solution

We could try using generics like

Event1<T>
Event2<T,U>
Event3<T,U,V>
...

and write Asc type conversions for the. The names of the parameters don't matter, just their order and their types.

@Jannis Jannis added this to the WASM Data Sources milestone Jul 5, 2018
@Jannis Jannis self-assigned this Jul 5, 2018
@Jannis Jannis added enhancement New feature or request to do labels Jul 5, 2018
@ghost ghost added pending review and removed to do labels Jul 6, 2018
@ghost ghost removed the pending review label Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant