zink-lang / zink

Rustic programming language that targets the Ethereum Virtual Machine
https://zink-lang.org
GNU General Public License v3.0
139 stars 13 forks source link

Inherit contract methods from traits #259

Open clearloop opened 1 month ago

clearloop commented 1 month ago

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"
  }
}