Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ManyChainMultiSig #517

Merged
merged 26 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading