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

Standardize protocol events #823

Closed
uint opened this issue Oct 11, 2022 · 2 comments · Fixed by #845
Closed

Standardize protocol events #823

uint opened this issue Oct 11, 2022 · 2 comments · Fixed by #845
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@uint
Copy link
Contributor

uint commented Oct 11, 2022

As far as I understand, our README.md files like this one are protocol specs. Events emitted don't seem to be part of the protocol spec, and yet client software like a cw20 wallet or block explorer might rely on the format of emitted events to index transactions.

It might be tempting to change the events emitted in a concrete implementation like cw20-base to suit clients, but the whole point of having a specification is to assume cw20-base isn't the only implementation. IMO any changes to the protocol should be well communicated and start with the specification, not our "minimal examples".

@uint uint added the documentation Improvements or additions to documentation label Oct 11, 2022
@ethanfrey
Copy link
Member

I agree to standardise and freeze these (we may want to review them again and refine them first)

Note there was some discussion ages ago to make some sort of structs that represent events, that could also emit some "json-schema-like" format to describe what to expect. This is a bonus task, but may want to investigate when you formalise these.

One rough idea:

// embedded in 'wasm' event, via add_attribute
#[event]
pub struct TransferEvent {
  pub sender: String,
  pub recipient: String,
  // question: String or Uint128
  pub amount: String,
}

// complete event, created via add_event
#[event(type="add_member")]
pub struct AddMemberEvent {
  pub address: String,
  // question: String or u64
  pub weight: String,
}

@uint
Copy link
Contributor Author

uint commented Oct 11, 2022

That looks like a good thing to include in the new schema format. I think filling out the specs comes first, but will definitely have a go at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants