Skip to content

Commit

Permalink
Merge pull request #38 from TeddyNotBear/main
Browse files Browse the repository at this point in the history
chore: upgrade contracts to cairo v2.6.0, snfoundry 0.19.0
  • Loading branch information
Darlington02 authored Mar 11, 2024
2 parents 8ad8068 + 07f1582 commit c41c299
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test_contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1
- uses: foundry-rs/setup-snfoundry@v2
- uses: foundry-rs/setup-snfoundry@v3
with:
starknet-foundry-version: 0.14.0
starknet-foundry-version: 0.19.0
- name: Run cairo tests
run: snforge test
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scarb 2.5.4
starknet-foundry 0.18.0
scarb 2.6.0
starknet-foundry 0.19.0
4 changes: 2 additions & 2 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ version = 1

[[package]]
name = "snforge_std"
version = "0.18.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.18.0#48f909a56b08cbdc5ca6a21a836b0fbc6c36d55b"
version = "0.19.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.19.0#a3391dce5bdda51c63237032e6cfc64fb7a346d4"

[[package]]
name = "token_bound_accounts"
Expand Down
4 changes: 2 additions & 2 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ sierra = true
casm = true

[dependencies]
starknet = "2.5.4"
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.18.0" }
starknet = "2.6.0"
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.19.0" }

[tool.snforge]
# exit_first = true
16 changes: 8 additions & 8 deletions tests/test_account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn SIGNED_TX_DATA() -> SignedTransactionData {

fn __setup__() -> (ContractAddress, ContractAddress) {
// deploy erc721 helper contract
let erc721_contract = declare('ERC721');
let erc721_contract = declare("ERC721");
let mut erc721_constructor_calldata = array!['tokenbound', 'TBA'];
let erc721_contract_address = erc721_contract.deploy(@erc721_constructor_calldata).unwrap();

Expand All @@ -66,7 +66,7 @@ fn __setup__() -> (ContractAddress, ContractAddress) {
dispatcher.mint(recipient, u256_from_felt252(1));

// deploy account contract
let account_contract = declare('Account');
let account_contract = declare("Account");
let mut acct_constructor_calldata = array![
contract_address_to_felt252(erc721_contract_address), 1, 0
];
Expand Down Expand Up @@ -114,7 +114,7 @@ fn test_execute() {
let dispatcher = IAccountDispatcher { contract_address };

// deploy `HelloStarknet` contract for testing
let test_contract = declare('HelloStarknet');
let test_contract = declare("HelloStarknet");
let test_address = test_contract.deploy(@array![]).unwrap();

// craft calldata for call array
Expand Down Expand Up @@ -150,7 +150,7 @@ fn test_execute_multicall() {
let dispatcher = IAccountDispatcher { contract_address };

// deploy `HelloStarknet` contract for testing
let test_contract = declare('HelloStarknet');
let test_contract = declare("HelloStarknet");
let test_address = test_contract.deploy(@array![]).unwrap();

// craft calldata and create call array
Expand Down Expand Up @@ -211,7 +211,7 @@ fn test_owner() {
fn test_upgrade() {
let (contract_address, erc721_contract_address) = __setup__();

let new_class_hash = declare('UpgradedAccount').class_hash;
let new_class_hash = declare("UpgradedAccount").class_hash;

// get token owner
let token_dispatcher = IERC721Dispatcher { contract_address: erc721_contract_address };
Expand All @@ -234,7 +234,7 @@ fn test_upgrade() {
fn test_upgrade_with_unauthorized() {
let (contract_address, _) = __setup__();

let new_class_hash = declare('UpgradedAccount').class_hash;
let new_class_hash = declare("UpgradedAccount").class_hash;

// call upgrade function with an unauthorized address
start_prank(CheatTarget::One(contract_address), ACCOUNT2.try_into().unwrap());
Expand Down Expand Up @@ -286,7 +286,7 @@ fn test_should_not_execute_when_locked() {
stop_warp(CheatTarget::One(contract_address));

// deploy `HelloStarknet` contract for testing purposes
let test_contract = declare('HelloStarknet');
let test_contract = declare("HelloStarknet");
let test_address = test_contract.deploy(@array![]).unwrap();

// confirm call to execute fails
Expand Down Expand Up @@ -326,7 +326,7 @@ fn test_should_not_upgrade_when_locked() {
dispatcher.lock(lock_duration);
stop_warp(CheatTarget::One(contract_address));

let new_class_hash = declare('UpgradedAccount').class_hash;
let new_class_hash = declare("UpgradedAccount").class_hash;

// call the upgrade function
let dispatcher_upgradable = IUpgradeableDispatcher { contract_address };
Expand Down
10 changes: 5 additions & 5 deletions tests/test_registry.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ACCOUNT: felt252 = 1234;

fn __setup__() -> (ContractAddress, ContractAddress) {
// deploy erc721 helper contract
let erc721_contract = declare('ERC721');
let erc721_contract = declare("ERC721");
let mut erc721_constructor_calldata = array!['tokenbound', 'TBA'];
let erc721_contract_address = erc721_contract.deploy(@erc721_constructor_calldata).unwrap();

Expand All @@ -35,7 +35,7 @@ fn __setup__() -> (ContractAddress, ContractAddress) {
dispatcher.mint(recipient, u256_from_felt252(1));

// deploy registry contract
let registry_contract = declare('Registry');
let registry_contract = declare("Registry");
let registry_contract_address = registry_contract.deploy(@array![]).unwrap();

(registry_contract_address, erc721_contract_address)
Expand All @@ -52,7 +52,7 @@ fn test_create_account() {
start_prank(CheatTarget::One(registry_contract_address), token_owner);

// create account
let acct_class_hash = declare('Account').class_hash;
let acct_class_hash = declare("Account").class_hash;
let account_address = registry_dispatcher
.create_account(
class_hash_to_felt252(acct_class_hash),
Expand Down Expand Up @@ -82,7 +82,7 @@ fn test_getting_total_deployed_accounts() {
let token_owner = token_dispatcher.ownerOf(u256_from_felt252(1));
start_prank(CheatTarget::One(registry_contract_address), token_owner);

let acct_class_hash = declare('Account').class_hash;
let acct_class_hash = declare("Account").class_hash;
// create multiple accounts for same NFT
registry_dispatcher
.create_account(
Expand Down Expand Up @@ -123,7 +123,7 @@ fn test_get_account() {
start_prank(CheatTarget::One(registry_contract_address), token_owner);

// deploy account
let acct_class_hash = declare('Account').class_hash;
let acct_class_hash = declare("Account").class_hash;
let account_address = registry_dispatcher
.create_account(
class_hash_to_felt252(acct_class_hash),
Expand Down

0 comments on commit c41c299

Please sign in to comment.