Skip to content

Commit

Permalink
refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
augustbleeds committed Sep 17, 2024
1 parent ee75032 commit c5df72f
Show file tree
Hide file tree
Showing 6 changed files with 836 additions and 595 deletions.
23 changes: 17 additions & 6 deletions contracts/src/libraries/mocks/mock_multisig_target.cairo
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
use array::ArrayTrait;

#[starknet::interface]
trait IMockMultisigTarget<TContractState> {
fn increment(ref self: TContractState, val1: felt252, val2: felt252) -> Array<felt252>;
fn set_value(ref self: TContractState, value: felt252);
fn flip_toggle(ref self: TContractState);
fn read(self: @TContractState) -> (felt252, bool);
}

#[starknet::contract]
mod MockMultisigTarget {
use array::ArrayTrait;
use super::IMockMultisigTarget;

#[storage]
struct Storage {
value: felt252,
toggle: bool
}

#[abi(per_item)]
#[generate_trait]
impl HelperImpl of HelperTrait {
#[external(v0)]
#[abi(embed_v0)]
impl MockMultisigTargetImpl of super::IMockMultisigTarget<ContractState> {
fn increment(ref self: ContractState, val1: felt252, val2: felt252) -> Array<felt252> {
array![val1 + 1, val2 + 1]
}

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

#[external(v0)]
fn flip_toggle(ref self: ContractState) {
self.toggle.write(!self.toggle.read());
}

fn read(self: @ContractState) -> (felt252, bool) {
(self.value.read(), self.toggle.read())
}
}
}
2 changes: 0 additions & 2 deletions contracts/src/mcms.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ mod ManyChainMultiSig {
root: root, valid_until: valid_until, op_count: metadata.pre_op_count
}
);
// todo: add set root metadata
self.s_root_metadata.write(metadata);
self
.emit(
Expand Down Expand Up @@ -438,7 +437,6 @@ mod ManyChainMultiSig {
new_expiring_root_and_op_count.op_count += 1;

self.s_expiring_root_and_op_count.write(new_expiring_root_and_op_count);
// todo: execute
self._execute(op.to, op.selector, op.data);

self
Expand Down
Loading

0 comments on commit c5df72f

Please sign in to comment.