Created
August 4, 2023 14:43
-
-
Save DavideSilva/6fe404960555cb7c738fa4f9f2793813 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[starknet::interface] | |
trait IMyFirstContract<ContractState> { | |
fn get_value(self: @ContractState) -> u64; | |
} | |
#[starknet::contract] | |
mod MyFirstContract { | |
#[storage] | |
struct Storage { | |
value: u64 | |
} | |
#[constructor] | |
fn constructor(ref self: ContractState) { | |
self.value.write(1) | |
} | |
#[external(v0)] | |
impl PublicFunctions of super::IMyFirstContract<ContractState> { | |
fn get_value(self: @ContractState) -> u64 { | |
self.value.read() | |
} | |
} | |
#[external(v0)] | |
impl OtherTraitImplementation of super::IMyFirstContract<ContractState> { | |
fn get_value(self: @ContractState) -> u64 { | |
self.value.read() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment