From 07770aa14253c0ea4cd4d069611d4fe4645b7741 Mon Sep 17 00:00:00 2001 From: DaveVodrazka Date: Thu, 21 Dec 2023 08:59:26 +0100 Subject: [PATCH] feat: proposal can change amm address --- src/proposals.cairo | 2 +- src/upgrades.cairo | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/proposals.cairo b/src/proposals.cairo index ba0ac4e9..947ef874 100644 --- a/src/proposals.cairo +++ b/src/proposals.cairo @@ -58,7 +58,7 @@ mod Proposals { fn assert_correct_contract_type(contract_type: ContractType) { let contract_type_u: u64 = contract_type.try_into().unwrap(); - assert(contract_type_u <= 4, 'invalid contract type') + assert(contract_type_u <= 5, 'invalid contract type') } fn assert_voting_in_progress(prop_id: felt252) { diff --git a/src/upgrades.cairo b/src/upgrades.cairo index cccaa211..fdad28fb 100644 --- a/src/upgrades.cairo +++ b/src/upgrades.cairo @@ -22,6 +22,7 @@ mod Upgrades { use governance::contract::Governance::unsafe_new_contract_state; use governance::contract::Governance::proposal_appliedContractMemberStateTrait; use governance::contract::Governance::proposal_detailsContractMemberStateTrait; + use governance::contract::Governance::amm_addressContractMemberStateTrait; use governance::contract::Governance::airdrop_component::UnsafeNewContractStateTraitForAirdropImpl; use governance::contract::Governance::airdrop_component; use governance::contract::Governance::airdrop_component::ComponentState; @@ -66,10 +67,14 @@ mod Upgrades { let mut airdrop_component_state: ComponentState = Governance::airdrop_component::unsafe_new_component_state(); airdrop_component_state.merkle_root.write(impl_hash); + } else if (contract_type == 4) { + let new_amm_address: ContractAddress = impl_hash.try_into().unwrap(); + let mut state = Governance::unsafe_new_contract_state(); + state.amm_address.write(new_amm_address); } else { assert( - contract_type == 4, 'invalid contract_type' - ); // type 4 is no-op, signal vote + contract_type == 5, 'invalid contract_type' + ); // type 5 is no-op, signal vote } } }