Skip to content

Commit

Permalink
ManyChainMultiSig (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
augustbleeds authored Sep 19, 2024
1 parent 2eb3c3b commit ddd9d54
Show file tree
Hide file tree
Showing 13 changed files with 2,756 additions and 11 deletions.
1 change: 1 addition & 0 deletions contracts/Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ version = "0.1.0"
dependencies = [
"alexandria_bytes",
"alexandria_encoding",
"alexandria_math",
"openzeppelin",
"snforge_std",
]
Expand Down
3 changes: 3 additions & 0 deletions contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.
alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "bcdca70afdf59c9976148e95cebad5cf63d75a7f" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" }

[dev-dependencies]
alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "bcdca70afdf59c9976148e95cebad5cf63d75a7f" }

[lib]

[[target.starknet-contract]]
Expand Down
1 change: 1 addition & 0 deletions contracts/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod emergency;
mod multisig;
mod token;
mod access_control;
mod mcms;

#[cfg(test)]
mod tests;
34 changes: 29 additions & 5 deletions contracts/src/libraries/mocks/mock_multisig_target.cairo
Original file line number Diff line number Diff line change
@@ -1,16 +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 {}
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]
}

fn set_value(ref self: ContractState, value: felt252) {
self.value.write(value);
}

fn flip_toggle(ref self: ContractState) {
self.toggle.write(!self.toggle.read());
}

fn read(self: @ContractState) -> (felt252, bool) {
(self.value.read(), self.toggle.read())
}
}
}
Loading

0 comments on commit ddd9d54

Please sign in to comment.