Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion starknet_contracts/Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies = [
]

[[package]]
name = "Starknet_contracts"
name = "starknet_contracts"
version = "0.1.0"
dependencies = [
"snforge_std",
Expand Down
6 changes: 3 additions & 3 deletions starknet_contracts/Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[package]
name = "Starknet_contracts"
name = "starknet_contracts"
version = "0.1.0"
edition = "2024_07"

# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html

[dependencies]
Starknet = "2.11.4"
starknet = "2.11.4"

[dev-dependencies]
snforge_std = "0.43.1"
assert_macros = "2.11.4"

[[target.Starknet-contract]]
[[target.starknet-contract]]
sierra = true

[scripts]
Expand Down
12 changes: 6 additions & 6 deletions starknet_contracts/src/contracts/HelloStarknet.cairo
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// Simple contract for managing balance.
#[Starknet::contract]
#[starknet::contract]
pub mod HelloStarknet {

use Starknet_contracts::interfaces::IHelloStarknet::IHelloStarknet;
use starknet_contracts::interfaces::IHelloStarknet::IHelloStarknet;
// use Starknet::storage::{StoragePointerReadAccess, StoragePathEntry, StoragePointerWriteAccess, Map };
use Starknet::storage::{Map, StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess };
use Starknet::{ContractAddress, get_caller_address};
use starknet::storage::{Map, StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess };
use starknet::{ContractAddress, get_caller_address};

#[storage]
struct Storage {
Expand All @@ -14,12 +14,12 @@ pub mod HelloStarknet {
}

#[event]
#[derive(Drop, Starknet::Event)]
#[derive(Drop, starknet::Event)]
pub enum Event {
Balance : BalanceIncreased,
}

#[derive(Drop, Starknet::Event)]
#[derive(Drop, starknet::Event)]
pub struct BalanceIncreased {
pub caller: ContractAddress,
pub amount: felt252,
Expand Down
10 changes: 5 additions & 5 deletions starknet_contracts/src/contracts/counter.cairo
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#[Starknet::contract]
#[starknet::contract]
pub mod Counter {
// use Starknet::ContractAddress;
// use Starknet::get_caller_address;
use Starknet_contracts::interfaces::ICounter::ICounter;
use Starknet::storage::{StoragePointerReadAccess, StoragePointerWriteAccess};
use starknet_contracts::interfaces::ICounter::ICounter;
use starknet::storage::{StoragePointerReadAccess, StoragePointerWriteAccess};

#[storage]
struct Storage {
count: u32,
}

#[event]
#[derive(Drop, Starknet::Event)]
#[derive(Drop, starknet::Event)]
pub enum Event {
CountUpdated : CountUpdated,
}

#[derive(Drop, Starknet::Event)]
#[derive(Drop, starknet::Event)]
struct CountUpdated {
old_value: u32,
new_value: u32,
Expand Down
2 changes: 1 addition & 1 deletion starknet_contracts/src/interfaces/ICounter.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[Starknet::interface]
#[starknet::interface]
pub trait ICounter<TContractState> {
fn get_count(self: @TContractState) -> u32;
fn increment(ref self: TContractState);
Expand Down
2 changes: 1 addition & 1 deletion starknet_contracts/src/interfaces/IHelloStarknet.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Interface representing `HelloContract`.
/// This interface allows modification and retrieval of the contract balance.
#[Starknet::interface]
#[starknet::interface]
pub trait IHelloStarknet<TContractState> {
/// Increase contract balance.
fn increase_balance(ref self: TContractState, amount: felt252);
Expand Down
47 changes: 0 additions & 47 deletions starknet_contracts/tests/test_contract.cairo

This file was deleted.

5 changes: 5 additions & 0 deletions testing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target
.snfoundry_cache/
snfoundry_trace/
coverage/
profile/
2 changes: 2 additions & 0 deletions testing/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scarb 2.12.2
starknet-foundry 0.49.0
143 changes: 143 additions & 0 deletions testing/Scarb.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Code generated by scarb DO NOT EDIT.
version = 1

[[package]]
name = "openzeppelin"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:05fd9365be85a4a3e878135d5c52229f760b3861ce4ed314cb1e75b178b553da"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_governance",
"openzeppelin_introspection",
"openzeppelin_merkle_tree",
"openzeppelin_presets",
"openzeppelin_security",
"openzeppelin_token",
"openzeppelin_upgrades",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_access"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:7734901a0ca7a7065e69416fea615dd1dc586c8dc9e76c032f25ee62e8b2a06c"
dependencies = [
"openzeppelin_introspection",
]

[[package]]
name = "openzeppelin_account"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:1aa3a71e2f40f66f98d96aa9bf9f361f53db0fd20fa83ef7df04426a3c3a926a"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_finance"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:f0c507fbff955e4180ea3fa17949c0ff85518c40101f4948948d9d9a74143d6c"
dependencies = [
"openzeppelin_access",
"openzeppelin_token",
]

[[package]]
name = "openzeppelin_governance"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:c0fb60fad716413d537fabd5fcbb2c499ca6beb95af5f0d1699955ecec4c6f63"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_introspection"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:13e04a2190684e6804229a77a6c56de7d033db8b9ef519e5e8dee400a70d8a3d"

[[package]]
name = "openzeppelin_merkle_tree"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:039608900e92f3dcf479bf53a49a1fd76452acd97eb86e390d1eb92cacdaf3af"

[[package]]
name = "openzeppelin_presets"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:5c07a8de32e5d9abe33988c7927eaa8b5f83bc29dc77302d9c8c44c898611042"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_upgrades",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_security"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:27155597019ecf971c48d7bfb07fa58cdc146d5297745570071732abca17f19f"

[[package]]
name = "openzeppelin_token"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:4452f449dc6c1ea97cf69d1d9182749abd40e85bd826cd79652c06a627eafd91"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_upgrades"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:15fdd63f6b50a0fda7b3f8f434120aaf7637bcdfe6fd8d275ad57343d5ede5e1"

[[package]]
name = "openzeppelin_utils"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:44f32d242af1e43982decc49c563e613a9b67ade552f5c3d5cde504e92f74607"

[[package]]
name = "snforge_scarb_plugin"
version = "0.49.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:903150f0e9542e4277d417029eea4c03af0db398b581f9f7ae3ebbdac9afc657"

[[package]]
name = "snforge_std"
version = "0.49.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:73d73653cc4356ec51b92a6bec9d8385b20318170c2f2ade7891e5185a0e7e64"
dependencies = [
"snforge_scarb_plugin",
]

[[package]]
name = "test"
version = "0.1.0"
dependencies = [
"openzeppelin",
"snforge_std",
]
53 changes: 53 additions & 0 deletions testing/Scarb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[package]
name = "test"
version = "0.1.0"
edition = "2024_07"

# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html

[dependencies]
starknet = "2.12.2"
openzeppelin = "0.20.0"

[dev-dependencies]
snforge_std = "0.49.0"
assert_macros = "2.12.2"

[[target.starknet-contract]]
sierra = true

[scripts]
test = "snforge test"

[tool.scarb]
allow-prebuilt-plugins = ["snforge_std"]

# Visit https://foundry-rs.github.io/starknet-foundry/appendix/scarb-toml.html for more information

# [tool.snforge] # Define `snforge` tool section
# exit_first = true # Stop tests execution immediately upon the first failure
# fuzzer_runs = 1234 # Number of runs of the random fuzzer
# fuzzer_seed = 1111 # Seed for the random fuzzer

# [[tool.snforge.fork]] # Used for fork testing
# name = "SOME_NAME" # Fork name
# url = "http://your.rpc.url" # Url of the RPC provider
# block_id.tag = "latest" # Block to fork from (block tag)

# [[tool.snforge.fork]]
# name = "SOME_SECOND_NAME"
# url = "http://your.second.rpc.url"
# block_id.number = "123" # Block to fork from (block number)

# [[tool.snforge.fork]]
# name = "SOME_THIRD_NAME"
# url = "http://your.third.rpc.url"
# block_id.hash = "0x123" # Block to fork from (block hash)

# [profile.dev.cairo] # Configure Cairo compiler
# unstable-add-statements-code-locations-debug-info = true # Should be used if you want to use coverage
# unstable-add-statements-functions-debug-info = true # Should be used if you want to use coverage/profiler
# inlining-strategy = "avoid" # Should be used if you want to use coverage

# [features] # Used for conditional compilation
# enable_for_tests = [] # Feature name and list of other features that should be enabled with it
11 changes: 11 additions & 0 deletions testing/snfoundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Visit https://foundry-rs.github.io/starknet-foundry/appendix/snfoundry-toml.html
# and https://foundry-rs.github.io/starknet-foundry/projects/configuration.html for more information

# [sncast.default] # Define a profile name
# url = "https://starknet-sepolia.public.blastapi.io/rpc/v0_8" # Url of the RPC provider
# accounts-file = "../account-file" # Path to the file with the account data
# account = "mainuser" # Account from `accounts_file` or default account file that will be used for the transactions
# keystore = "~/keystore" # Path to the keystore file
# wait-params = { timeout = 300, retry-interval = 10 } # Wait for submitted transaction parameters
# block-explorer = "StarkScan" # Block explorer service used to display links to transaction details
# show-explorer-links = true # Print links pointing to pages with transaction details in the chosen block explorer
Loading