zink icon indicating copy to clipboard operation
zink copied to clipboard

Inherit contract methods from traits

Open clearloop opened this issue 11 months ago • 0 comments

Describe the feature

pretty like interface in solidity, in zink we use the built-in rust trait

Solution

// we need to export all methods from ERC20 & override the function `name` in this macro
#[zink::interface]
impl ERC20 for MyContract {
  fn name() -> String32 {
    "foo"
  }
}

clearloop avatar Oct 30 '24 20:10 clearloop