Skip to content

#[ink::trait_definition] doesn't support super trait and default implementation #4

Open
@xgreenx

Description

@xgreenx

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.

impl Erc20 for Erc20Struct {}
impl IErc20 for Erc20Struct {
    #[ink(message)]
    fn token_name(&self) -> Option<String> {
        Erc20::token_name(self)
    }
...
}

instead of

impl IErc20 for Erc20Struct {
    #[ink(message)]
    fn token_name(&self) -> Option<String> {
        IErc20::token_name(self)
    }
...
}

Metadata

Metadata

Assignees

Labels

usage-simplificationResolving of this issue will simplify the usage of the library

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions