-
Notifications
You must be signed in to change notification settings - Fork 1.1k
implement IERC20Metadata for pallet-assets-precompiles
#10949
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
base: master
Are you sure you want to change the base?
implement IERC20Metadata for pallet-assets-precompiles
#10949
Conversation
|
fixes #8658 |
pgherveou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good thanks 🙏
Co-authored-by: 0xRVE <[email protected]>
|
/cmd fmt |
|
/cmd prdoc --audience runtime_dev --bump minor |
|
Command "fmt" has failed ❌! See logs here |
|
Command "prdoc --audience runtime_dev --bump minor" has failed ❌! See logs here |
|
Commands won't run because it's on my fork |
|
Thanks for the fast progress on #10949 metadata views are a big win! This will fix frontend crashes and metadata UX for DEXes. Just confirming: will standard ERC-20 events (Transfer/Approval) be added in a future PR? For lending (Compound/Aave forks), full events are needed for accrual tracking, liquidations, and subgraphs. Happy to test on testnet when available. Thanks again this is accelerating DeFi adoption on Hub! |
Summary
Implements the missing ERC20 metadata functions (
name,symbol,decimals) for the pallet-assets precompile to provide full ERC20 compatibility. These functions were missing from the original implementation and are essential for proper EVM wallet and tooling integration.Changes
Solidity Interface
substrate/primitives/ethereum-standards/src/IERC20.solname() external view returns (string memory)symbol() external view returns (string memory)decimals() external view returns (uint8)Precompile Implementation
substrate/frame/assets/precompiles/src/lib.rsname()- reads metadata from pallet-assets storage and returns UTF-8 stringsymbol()- reads metadata from pallet-assets storage and returns UTF-8 stringdecimals()- reads metadata from pallet-assets storage and returns uint8 valueBenchmarks
substrate/frame/assets/src/benchmarking.rsget_namebenchmark - measures metadata read for name fieldget_symbolbenchmark - measures metadata read for symbol fieldget_decimalsbenchmark - measures metadata read for decimals fieldWeight Functions
substrate/frame/assets/src/weights.rsget_name() -> Weightto WeightInfo traitget_symbol() -> Weightto WeightInfo traitget_decimals() -> Weightto WeightInfo traitSubstrateWeight<T>and()(fallback)Assets::Metadata(~12-12.5ms, 2615 bytes proof size)Closes #8658