Skip to content

Commit

Permalink
next
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Feb 16, 2024
1 parent 30ae08d commit 3bf3c61
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ dependencies = [

[[package]]
name = "openzeppelin"
version = "0.8.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.8.0#c23e8e96de60e6e3159b1ff8591a1187269c0eb7"
version = "0.9.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.9.0#861fc416f87addbe23a3b47f9d19ab27c10d5dc8"
4 changes: 2 additions & 2 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ version = "0.1.0"
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest

[dependencies]
starknet = ">=2.4.0"
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.8.0" }
starknet = ">=2.5.0"
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.9.0" }

[[target.starknet-contract]]

Expand Down
8 changes: 4 additions & 4 deletions src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use array::SpanTrait;
use option::OptionTrait;
use serde::Serde;
use starknet::account::Call;

use starknet::ContractAddress;

mod account;
mod utils;
Expand Down Expand Up @@ -92,7 +92,7 @@ mod Account {
}


#[external(v0)]
#[abi(embed_v0)]
impl MasterControlImpl of IMasterControl<ContractState> {
fn update_whitelisted_contracts(
ref self: ContractState, data: Array<(ContractAddress, bool)>
Expand Down Expand Up @@ -251,7 +251,7 @@ mod Account {
assert(false, 'Account: Permission denied');
}

starknet::call_contract_syscall(to, selector, calldata.span()).unwrap()
starknet::call_contract_syscall(to, selector, calldata).unwrap()
}


Expand All @@ -272,6 +272,6 @@ mod Account {

fn _execute_single_master_call(self: @ContractState, call: Call) -> Span<felt252> {
let Call{to, selector, calldata } = call;
starknet::call_contract_syscall(to, selector, calldata.span()).unwrap()
starknet::call_contract_syscall(to, selector, calldata).unwrap()
}
}
38 changes: 25 additions & 13 deletions src/tests/account/test_account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,16 @@ mod account_generic_tests {
use arcade_account::Account;

use arcade_account::account::interface::{
IMasterControl, IMasterControlDispatcher, IMasterControlDispatcherTrait, ArcadeAccountABIDispatcher, ArcadeAccountABIDispatcherTrait, ArcadeAccountCamelABIDispatcher,
ArcadeAccountCamelABIDispatcherTrait,
};
use openzeppelin::account::interface::{
AccountABIDispatcher, AccountABIDispatcherTrait, AccountCamelABIDispatcher,
AccountCamelABIDispatcherTrait,
IMasterControl, IMasterControlDispatcher, IMasterControlDispatcherTrait,
ArcadeAccountABIDispatcher, ArcadeAccountABIDispatcherTrait,
ArcadeAccountCamelABIDispatcher, ArcadeAccountCamelABIDispatcherTrait,
};
use openzeppelin::account::interface::{AccountABIDispatcher, AccountABIDispatcherTrait};
use openzeppelin::account::interface::Call;
use openzeppelin::account::interface::ISRC6_ID;
use openzeppelin::introspection::interface::{
ISRC5Camel, ISRC5CamelDispatcher, ISRC5CamelDispatcherTrait
};
use arcade_account::QUERY_VERSION;
use arcade_account::TRANSACTION_VERSION;
use arcade_account::tests::utils::helper_contracts::{
Expand Down Expand Up @@ -153,7 +154,7 @@ mod account_generic_tests {
#[test]
#[available_gas(2000000)]
fn test_supportsInterface() {
let arcade_account = AccountCamelABIDispatcher {
let arcade_account = ISRC5CamelDispatcher {
contract_address: deploy_arcade_account(Option::None(()))
};
let supports_default_interface = arcade_account.supportsInterface(ISRC5_ID);
Expand Down Expand Up @@ -209,7 +210,7 @@ mod account_generic_tests {
bad_signature.append(0x987);
bad_signature.append(0x564);

let arcade_account = AccountCamelABIDispatcher {
let arcade_account = ArcadeAccountCamelABIDispatcher {
contract_address: deploy_arcade_account(Option::None(()))
};
arcade_account.setPublicKey(data.public_key);
Expand Down Expand Up @@ -237,7 +238,9 @@ mod account_generic_tests {
// testing context are decoupled from the signature and have no effect on the test.
assert(
arcade_account
.__validate_deploy__(AA_CLASS_HASH(), SALT, PUBLIC_KEY, starknet::get_contract_address()) == starknet::VALIDATED,
.__validate_deploy__(
AA_CLASS_HASH(), SALT, PUBLIC_KEY, starknet::get_contract_address()
) == starknet::VALIDATED,
'Should validate correctly'
);
}
Expand All @@ -254,7 +257,10 @@ mod account_generic_tests {
contract_address: deploy_arcade_account(Option::Some(@data))
};

arcade_account.__validate_deploy__(AA_CLASS_HASH(), SALT, PUBLIC_KEY, starknet::get_contract_address());
arcade_account
.__validate_deploy__(
AA_CLASS_HASH(), SALT, PUBLIC_KEY, starknet::get_contract_address()
);
}


Expand All @@ -270,7 +276,10 @@ mod account_generic_tests {
signature.append(0x1);
testing::set_signature(signature.span());

arcade_account.__validate_deploy__(AA_CLASS_HASH(), SALT, PUBLIC_KEY, starknet::get_contract_address());
arcade_account
.__validate_deploy__(
AA_CLASS_HASH(), SALT, PUBLIC_KEY, starknet::get_contract_address()
);
}

#[test]
Expand All @@ -283,7 +292,10 @@ mod account_generic_tests {
let empty_sig = array![];

testing::set_signature(empty_sig.span());
arcade_account.__validate_deploy__(AA_CLASS_HASH(), SALT, PUBLIC_KEY, starknet::get_contract_address());
arcade_account
.__validate_deploy__(
AA_CLASS_HASH(), SALT, PUBLIC_KEY, starknet::get_contract_address()
);
}


Expand Down Expand Up @@ -361,7 +373,7 @@ mod account_generic_tests {
.update_whitelisted_contracts(array![(simple_test_contract.contract_address, true)]);

// Craft call and add to calls array
let mut calldata = array![true.into()];
let mut calldata = array![true];
let call = Call {
to: simple_test_contract.contract_address,
selector: simple_test_contract::SelectorImpl::set_cold_selector(),
Expand Down
2 changes: 1 addition & 1 deletion src/tests/utils/helper_contracts.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod simple_test_contract {
#[constructor]
fn constructor(ref self: ContractState) {}

#[external(v0)]
#[abi(embed_v0)]
impl SimpleTestContractImpl of super::ISimpleTestContract<ContractState> {
fn is_cold(self: @ContractState) -> bool {
self.cold.read()
Expand Down

0 comments on commit 3bf3c61

Please sign in to comment.