From 1bfd5417663e098ccaefc28095b48f904d5f5b1a Mon Sep 17 00:00:00 2001 From: seun Date: Sun, 29 Sep 2024 05:04:37 -0700 Subject: [PATCH 1/3] feat:scarb & foundry update --- contracts/Scarb.lock | 12 ++++++++++-- contracts/Scarb.toml | 4 ++-- contracts/scripts/Scarb.toml | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/contracts/Scarb.lock b/contracts/Scarb.lock index 7cf1e79..3669de5 100644 --- a/contracts/Scarb.lock +++ b/contracts/Scarb.lock @@ -95,7 +95,15 @@ name = "openzeppelin_utils" version = "0.15.0" source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.0#f57642960f1c8cffafefb88bfff418eca8510634" +[[package]] +name = "snforge_scarb_plugin" +version = "0.31.0" +source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.31.0#72ea785ca354e9e506de3e5d687da9fb2c1b3c67" + [[package]] name = "snforge_std" -version = "0.27.0" -source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de" +version = "0.31.0" +source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.31.0#72ea785ca354e9e506de3e5d687da9fb2c1b3c67" +dependencies = [ + "snforge_scarb_plugin", +] diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index 89bcbda..7cdc4dc 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -3,8 +3,8 @@ name = "contracts" version = "0.1.0" [dependencies] -starknet = "2.7.0" -snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.27.0" } +starknet = "2.8.2" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.31.0" } openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.0" } [[target.starknet-contract]] diff --git a/contracts/scripts/Scarb.toml b/contracts/scripts/Scarb.toml index 655b3ee..5a81a7c 100644 --- a/contracts/scripts/Scarb.toml +++ b/contracts/scripts/Scarb.toml @@ -6,8 +6,8 @@ edition = "2023_11" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html [dependencies] -sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.27.0" } -starknet = "2.7.0" +sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.31.0" } +starknet = "2.8.2" contracts = { path = "../" } [lib] From 8515da84214db13e666ecc53215d64d8ac752693 Mon Sep 17 00:00:00 2001 From: seun Date: Thu, 3 Oct 2024 07:06:52 -0700 Subject: [PATCH 2/3] feat:test fix --- .github/workflows/test_contract.yml | 2 +- contracts/tests/test_contract.cairo | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_contract.yml b/.github/workflows/test_contract.yml index 18a179e..e6b71fc 100644 --- a/.github/workflows/test_contract.yml +++ b/.github/workflows/test_contract.yml @@ -11,6 +11,6 @@ jobs: - uses: software-mansion/setup-scarb@v1 - uses: foundry-rs/setup-snfoundry@v3 with: - starknet-foundry-version: 0.25.0 + starknet-foundry-version: 0.31.0 - name: Run cairo tests run: cd contracts && snforge test diff --git a/contracts/tests/test_contract.cairo b/contracts/tests/test_contract.cairo index e6f251a..6fbad90 100644 --- a/contracts/tests/test_contract.cairo +++ b/contracts/tests/test_contract.cairo @@ -1,11 +1,15 @@ use core::starknet::SyscallResultTrait; -use snforge_std::{declare, ContractClassTrait}; +use snforge_std::{declare, ContractClassTrait, DeclareResultTrait, DeclareResult}; use contracts::{IHelloStarknetDispatcher, IHelloStarknetDispatcherTrait}; #[test] fn test_balance() { - let contract = declare("HelloStarknet").unwrap(); - let (contract_address, _) = contract.deploy(@ArrayTrait::new()).unwrap_syscall(); + let contract = match declare("HelloStarknet").unwrap(){ + DeclareResult::Success(class) => class, + DeclareResult::AlreadyDeclared(class) => class, + }; + + let (contract_address, _) = contract.deploy(@ArrayTrait::new()).unwrap(); let dispatcher = IHelloStarknetDispatcher { contract_address }; From c711ce3a347a88ea96bde3425778c7bee134a4fb Mon Sep 17 00:00:00 2001 From: seun Date: Thu, 3 Oct 2024 07:17:26 -0700 Subject: [PATCH 3/3] feat: build fix --- contracts/tests/test_contract.cairo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/tests/test_contract.cairo b/contracts/tests/test_contract.cairo index 6fbad90..9632275 100644 --- a/contracts/tests/test_contract.cairo +++ b/contracts/tests/test_contract.cairo @@ -4,7 +4,7 @@ use contracts::{IHelloStarknetDispatcher, IHelloStarknetDispatcherTrait}; #[test] fn test_balance() { - let contract = match declare("HelloStarknet").unwrap(){ + let contract = match declare("HelloStarknet").unwrap() { DeclareResult::Success(class) => class, DeclareResult::AlreadyDeclared(class) => class, };