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

Add event logging to SRC-20 and SRC-7 standards #130

Merged
merged 17 commits into from
Aug 26, 2024
Merged

Add event logging to SRC-20 and SRC-7 standards #130

merged 17 commits into from
Aug 26, 2024

Conversation

bitzoic
Copy link
Member

@bitzoic bitzoic commented Aug 21, 2024

Type of change

  • New feature

Description

At the moment, it's not possible for indexers to access token metadata like name, symbol, decimals, bridged Ethereum address, etc.

Logs have been added to both the SRC-20 standard and the SRC-7 metadata standard, emitted when these values are updated.

Changes

The following changes have been made:

  • Adds the SetNameEvent event to the SRC-20 specification
  • Adds the SetSymbolEvent event to the SRC-20 specification
  • Adds the SetDecimalsEvent event to the SRC-20 specification
  • Adds the TotalSupplyEvent event to the SRC-20 specification
  • Adds the SetMetadataEvent event to the SRC-7 specification

Notes

  • While SetNameEvent, SetSymbolEvent, and SetMetadataEvent use an Option for the updated value, the SetDecimalsEvent and TotalSupplyEvent do not
  • Examples have been split into separate workspace projects to speed up CI and resolve issues with hitting GitHub internal limits

Related Issues

Closes #128

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.
  • I have updated the changelog to reflect the changes on this PR.

@bitzoic bitzoic added Enhancement New feature or request SRC 20 Label used to filter for the standard issue SRC-7 Label used to filter for the standard issue labels Aug 21, 2024
@bitzoic bitzoic self-assigned this Aug 21, 2024
@bitzoic bitzoic requested a review from a team as a code owner August 21, 2024 06:23
@bitzoic bitzoic linked an issue Aug 21, 2024 that may be closed by this pull request
@bitzoic bitzoic requested a review from dmihal August 21, 2024 06:25
@K1-R1
Copy link
Member

K1-R1 commented Aug 21, 2024

The standard does not specify that the event MUST be emitted upon contract deployment, only when the metadata is updated in a function call. This means that for any metadata embedded into the contract as a configurable or constant, the event will never be emitted and picked up by the indexer

I think if we're adding these events to the standards then the standards should require embedded values be logged; I assume many assets will use embedded metadata that doesn't change and I don't think this would reliably solve the issue indexers are facing

@bitzoic
Copy link
Member Author

bitzoic commented Aug 22, 2024

The standard does not specify that the event MUST be emitted upon contract deployment, only when the metadata is updated in a function call. This means that for any metadata embedded into the contract as a configurable or constant, the event will never be emitted and picked up by the indexer

I think if we're adding these events to the standards then the standards should require embedded values be logged; I assume many assets will use embedded metadata that doesn't change and I don't think this would reliably solve the issue indexers are facing

The only issue I see here is the assumption that metadata is static. If metadata is algorithmically determined then a log would need to be emitted every block.

@bitzoic bitzoic requested a review from a team August 26, 2024 07:15
@bitzoic bitzoic merged commit 69217c2 into master Aug 26, 2024
14 checks passed
@bitzoic bitzoic mentioned this pull request Aug 27, 2024
bitzoic added a commit that referenced this pull request Aug 27, 2024
* Hotfix: Update Cargo.toml to v0.5.1 (#115)

* Hotfix: Update Cargo.toml to v0.5.1

* Udpate CHANGELOG

* fix vault reads

* add changelog

* move changelog to new empty changelog

* add "unreleased" to changelog heads

* remove date

* add  v0.5.1

* SRC-6 example contract does not update managed assets (#122)

* Update SRC-6 example with decrementation of managed assets

* Update CHANGELOG

* Fix link on CHANGELOG.md

* Update CHANGELOG to resolve markdown error with duplicate headers

* Write to storage

* Use new namespace syntax for storage (#120)

* chore: fix compiler warnings

* remove for examples

* Update changelog

* Prepare master for v0.5.2 release (#126)

* Prepare for v0.5.2 release

* Update CHANGELOG

* Update CHANGELOG formatting

* Make the `SubId` an `Option` in SRC-3's `mint()` function  (#131)

* Update specifications to change SRC-3 mint sub_id to an Option

* Update SRC-3 standard for option in mint

* Update examples

* Udpate CHANGELOG

* Run formatter

* Fix spelling

* Add event logging to SRC-20 and SRC-7 standards (#130)

* Add event logging to SRC-20 and SRC-7 specification

* Add event logging structs to SRC-20 and SRC-7

* Update CHANGELOG

* Add inline docs to SRC-20 events

* Fix CI

* Require that logs of metadata are emitted even with contants

* Update standards with additional log and ordering

* Update examples to follow new specs

* Add custom word to spell checker

* Run formatter

* Fix markdown formatting

* Resolve warnings in examples

* Build CI with release

* Store srv7 metadata to storage

* Remove cancel in progress from CI

* Update name for TotalSupplyEvent

* Split examples into seperate workspace projects

* Prepare for v0.6.0 release

* Update CHANGELOG

* Add trailing line in CHANGELOG

---------

Co-authored-by: SwayStar123 <[email protected]>
Co-authored-by: SwayStar123 <[email protected]>
Co-authored-by: IGI-111 <[email protected]>
Co-authored-by: Sophie <[email protected]>
Co-authored-by: K1-R1 <[email protected]>
bitzoic added a commit that referenced this pull request Sep 10, 2024
* Hotfix: Update Cargo.toml to v0.5.1 (#115)

* Hotfix: Update Cargo.toml to v0.5.1

* Udpate CHANGELOG

* fix vault reads

* add changelog

* move changelog to new empty changelog

* add "unreleased" to changelog heads

* remove date

* add  v0.5.1

* SRC-6 example contract does not update managed assets (#122)

* Update SRC-6 example with decrementation of managed assets

* Update CHANGELOG

* Fix link on CHANGELOG.md

* Update CHANGELOG to resolve markdown error with duplicate headers

* Write to storage

* Use new namespace syntax for storage (#120)

* chore: fix compiler warnings

* remove for examples

* Update changelog

* Prepare master for v0.5.2 release (#126)

* Prepare for v0.5.2 release

* Update CHANGELOG

* Update CHANGELOG formatting

* Make the `SubId` an `Option` in SRC-3's `mint()` function  (#131)

* Update specifications to change SRC-3 mint sub_id to an Option

* Update SRC-3 standard for option in mint

* Update examples

* Udpate CHANGELOG

* Run formatter

* Fix spelling

* Add event logging to SRC-20 and SRC-7 standards (#130)

* Add event logging to SRC-20 and SRC-7 specification

* Add event logging structs to SRC-20 and SRC-7

* Update CHANGELOG

* Add inline docs to SRC-20 events

* Fix CI

* Require that logs of metadata are emitted even with contants

* Update standards with additional log and ordering

* Update examples to follow new specs

* Add custom word to spell checker

* Run formatter

* Fix markdown formatting

* Resolve warnings in examples

* Build CI with release

* Store srv7 metadata to storage

* Remove cancel in progress from CI

* Update name for TotalSupplyEvent

* Split examples into seperate workspace projects

* Prepare for v0.6.0 release

* Update CHANGELOG

* Resolve warnings in examples (#137)

* Resolve warnings

* Update CHANGELOG

* Run formatter

* Remove cancel in progress from CI

* Revert remove cancel in progress from CI

* fix max_depositable and max_withdrawable examples

---------

Co-authored-by: SwayStar123 <[email protected]>

* chore: update to forc 0.63.3 (#135)

* chore: update to forc 0.63.1

* chore: updated changelog

* Update to forc v0.63.3

---------

Co-authored-by: bitzoic <[email protected]>

* docs: update src14 storage recommendation and general typos (#136)

* chore: update to forc 0.63.1

* chore: updated changelog

* docs: update src14 and general typos

* Apply PR review comments

* Fix markdown

* Update CHANGELOG

* Improve CHANGELOG comment

---------

Co-authored-by: bitzoic <[email protected]>

* Add helper functions to SRC7 standard's `Metadata` (#144)

* Add helper functions to SRC7 standard

* Update CHANGELOG

* Remove metadata functions (#148)

* Fix Sway Standards inline docs (#142)

* Update sway standards inline docs

* Update CHANGELOG

* Fix typo

* Prepare for Sway-Standards `v0.6.1` release (#147)

* Prepare for Sway-Standards v0.6.1 release

* Update CHANGELOG

* Add helper functions to struct types and `Eq` implementations for all types (#149)

* Add helper functions to struct types and Eq implementations

* Add checks to enum types

* Update CHANGELOG

---------

Co-authored-by: SwayStar123 <[email protected]>
Co-authored-by: SwayStar123 <[email protected]>
Co-authored-by: IGI-111 <[email protected]>
Co-authored-by: Sophie <[email protected]>
Co-authored-by: K1-R1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request SRC 20 Label used to filter for the standard issue SRC-7 Label used to filter for the standard issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emit logs when token metadata is set
3 participants