Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

Commit

Permalink
cleaup and add contract
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Nov 1, 2023
1 parent 720ef8b commit 8a5c506
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 17 deletions.
6 changes: 6 additions & 0 deletions contracts/Scarb.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Code generated by scarb DO NOT EDIT.
version = 1

[[package]]
name = "contracts"
version = "0.1.0"
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@
},
{
"type": "event",
"name": "scarb_pg::abigen_demo::abigen_demo::Event",
"name": "contracts::simple_get_set::simple_get_set::Event",
"kind": "enum",
"variants": []
}
]

13 changes: 0 additions & 13 deletions contracts/data/katana_account.json

This file was deleted.

1 change: 0 additions & 1 deletion contracts/data/katana_key.json

This file was deleted.

2 changes: 2 additions & 0 deletions contracts/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
mod basic;
mod gen;
mod event;
mod simple_get_set;

28 changes: 28 additions & 0 deletions contracts/src/simple_get_set.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#[starknet::contract]
mod simple_get_set {
#[storage]
struct Storage {
a: felt252,
b: u256,
}

#[external(v0)]
fn get_a(self: @ContractState) -> felt252 {
self.a.read()
}

#[external(v0)]
fn set_a(ref self: ContractState, a: felt252) {
self.a.write(a);
}

#[external(v0)]
fn get_b(self: @ContractState) -> u256 {
self.b.read()
}

#[external(v0)]
fn set_b(ref self: ContractState, b: u256) {
self.b.write(b);
}
}
2 changes: 1 addition & 1 deletion examples/abigen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use url::Url;
// same name.
// It's usually a good idea to place the macro call into a separate module
// to avoid name clashes.
abigen!(MyContract, "./examples/abi/simple_get_set.abi.json");
abigen!(MyContract, "./contracts/abi/simple_get_set.json");

#[tokio::main]
async fn main() {
Expand Down

0 comments on commit 8a5c506

Please sign in to comment.