You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ink! doesn't support generics and default implementation inside of trait definition. It causes us to introduce a separate trait Erc20 on rust level with a default implementation and reuse it in the impl section. It causes the user to declare the implementation of two traits.
We already have a feature that allows us to get trait definition by indent of the trait. So, we can add support of generics and default implementations to brush trait definition. We will save this trait definition to file and will replace brush trait definition with trait definition from the ink!. But in the case of ink! trait definition we will only use definition without generics and default implementations.
During the implementation of the trait defined via brush, we will paste the default implementation from the trait definition if the user didn't override that.
It will allow us:
Removed derive for IErc20, IOwnable and etc traits.
Will remove internal trait with according naming Erc20, Ownable and etc. It will simplify usage and will avoid two methods with the same signature(for example Erc20 and IErc20 have the same public methods).
It simplifies understanding how it works. The user only must derive storage traits, add an impl section for helper function, and add an impl section for an external trait.
xgreenx
changed the title
#[ink::trait_definition] doesn't support generics and default implementation
#[ink::trait_definition] doesn't support super trait and default implementation
Jun 25, 2021
ink! doesn't support generics and default implementation inside of trait definition. It causes us to introduce a separate trait
Erc20
on rust level with a default implementation and reuse it in the impl section. It causes the user to declare the implementation of two traits.instead of
The text was updated successfully, but these errors were encountered: