fix(docs): Fix event type definitions to use H160 for ink! v6 compatibility #537
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Corrects the Events documentation to use
H160type for account addresses, resolving type mismatch errors when developers follow the examples in ink! v6.Problem
The current documentation shows event definitions using
AccountId:When developers follow this example with ink! v6, they encounter a type mismatch error:
This occurs because
Self::env().caller()returnsH160in ink! v6's default environment (pallet-revive), notAccountId.Changes Made
Event Type Definitions
Option<AccountId>toOption<H160>in all event examplesblake2b("Transferred(Option<AccountId>,Option<AccountId>,u128)")toblake2b("Transferred(Option<H160>,Option<H160>,u128)")Files Modified
docs/basics/events.mdWhy H160 in ink! v6?
ink! v6 migrated from
pallet-contractstopallet-revive, which prioritizes Ethereum/Solidity compatibility:Addressis a type alias forH160in ink_primitives (both are interchangeable)Self::env().caller()now returnsH160by defaultVerification
Matches official example: The official ERC20 example uses
Address(alias forH160)Compiles successfully: Code examples now compile without type mismatch errors in ink! v6
Consistent with pallet-revive: Aligns with pallet-revive's H160 address type
References
Testing