Skip to content

Commit

Permalink
feat: add arbitrary proposal to add options
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveVodrazka committed Sep 30, 2024
1 parent 8dce4d7 commit d82b3cb
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/arbitrary_proposal_add_options.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
use starknet::contract_address::{ContractAddress};

#[starknet::interface]
trait IArbitraryProposalAddOptions<TContractState> {
fn execute_arbitrary_proposal(ref self: TContractState);
}

#[starknet::contract]
pub mod ArbitraryProposalAddOptions {
use amm_governance::proposals::proposals as proposals_component;
use amm_governance::proposals::proposals::InternalTrait;
use konoha::types::{CustomProposalConfig};
use konoha::contract::IGovernanceDispatcher;
use konoha::contract::IGovernanceDispatcherTrait;
use starknet::{ContractAddress, ClassHash, get_contract_address};

component!(path: proposals_component, storage: proposals, event: ProposalsEvent);

#[storage]
struct Storage {
#[substorage(v0)]
proposals: proposals_component::Storage,
}

#[derive(starknet::Event, Drop)]
#[event]
enum Event {
ProposalsEvent: proposals_component::Event,
}

#[constructor]
fn constructor(ref self: ContractState) {}

#[abi(embed_v0)]
impl ArbitraryProposalAddOptions of super::IArbitraryProposalAddOptions<ContractState> {
fn execute_arbitrary_proposal(ref self: ContractState) {
let option_deployer_class_hash: felt252 =
0x004e19b87b7777e6e7032ca325794cd793a4d6e9591a8c4e60e0d1b27e4da3d7;

let add_options = CustomProposalConfig {
target: option_deployer_class_hash,
selector: selector!("add_options"),
library_call: true
};

self.proposals.add_custom_proposal_config(add_options);
}
}
}
1 change: 1 addition & 0 deletions src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ mod traits;
mod types;
mod upgrades;
pub mod vecarm;
mod arbitrary_proposal_add_options;

0 comments on commit d82b3cb

Please sign in to comment.