feat(target_chains/starknet): create project
This commit is contained in:
parent
b4ed825cd6
commit
2c7dfa92dd
|
@ -0,0 +1 @@
|
|||
target
|
|
@ -0,0 +1,6 @@
|
|||
# Code generated by scarb DO NOT EDIT.
|
||||
version = 1
|
||||
|
||||
[[package]]
|
||||
name = "pyth"
|
||||
version = "0.1.0"
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "pyth"
|
||||
version = "0.1.0"
|
||||
edition = "2023_11"
|
||||
|
||||
[dependencies]
|
||||
starknet = ">=2.5.4"
|
||||
|
||||
[[target.starknet-contract]]
|
|
@ -0,0 +1,2 @@
|
|||
mod pyth;
|
||||
mod wormhole;
|
|
@ -0,0 +1,29 @@
|
|||
#[starknet::interface]
|
||||
trait IPyth<T> {
|
||||
fn get_name(self: @T) -> felt252;
|
||||
fn set_name(ref self: T, name: felt252);
|
||||
}
|
||||
|
||||
#[starknet::contract]
|
||||
mod pyth {
|
||||
#[storage]
|
||||
struct Storage {
|
||||
name: felt252,
|
||||
}
|
||||
|
||||
#[constructor]
|
||||
fn constructor(ref self: ContractState, name: felt252) {
|
||||
self.name.write(name);
|
||||
}
|
||||
|
||||
#[abi(embed_v0)]
|
||||
impl HelloImpl of super::IPyth<ContractState> {
|
||||
fn get_name(self: @ContractState) -> felt252 {
|
||||
self.name.read() + 1
|
||||
}
|
||||
|
||||
fn set_name(ref self: ContractState, name: felt252) {
|
||||
self.name.write(name - 1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#[starknet::interface]
|
||||
trait IWormhole<T> {
|
||||
fn get_value(self: @T) -> felt252;
|
||||
fn set_value(ref self: T, name: felt252);
|
||||
}
|
||||
|
||||
#[starknet::contract]
|
||||
mod wormhole {
|
||||
#[storage]
|
||||
struct Storage {
|
||||
name: felt252,
|
||||
}
|
||||
|
||||
#[constructor]
|
||||
fn constructor(ref self: ContractState, name: felt252) {
|
||||
self.name.write(name);
|
||||
}
|
||||
|
||||
#[abi(embed_v0)]
|
||||
impl HelloImpl of super::IWormhole<ContractState> {
|
||||
fn get_value(self: @ContractState) -> felt252 {
|
||||
self.name.read() + 2
|
||||
}
|
||||
|
||||
fn set_value(ref self: ContractState, name: felt252) {
|
||||
self.name.write(name - 2);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue