From b6317b9ab2521f3c0669808f373e5fa657a891d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sojka?= Date: Fri, 20 Sep 2024 15:51:31 +0000 Subject: [PATCH] Add deployment files --- src/contract.cairo | 37 +++++++++++++++++++++++++++++++++---- tests/deploy.cairo | 8 +++++--- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/contract.cairo b/src/contract.cairo index 32acf8f7..d26c2870 100644 --- a/src/contract.cairo +++ b/src/contract.cairo @@ -43,6 +43,7 @@ mod Governance { use konoha::types::VoteStatus; use konoha::upgrades::upgrades as upgrades_component; use konoha::vesting::vesting as vesting_component; + use konoha::vesting::{IVestingDispatcher, IVestingDispatcherTrait}; use starknet::get_contract_address; use starknet::syscalls::deploy_syscall; @@ -178,19 +179,38 @@ mod Governance { treasury_calldata.append(governance_address.into()); treasury_calldata.append(0x1); // carmine amm addr treasury_calldata.append(0x1); // zklend addr + treasury_calldata.append(0x027994c503bd8C32525FBDAf9d398bDd4e86757988C64581B055A06c5955eA49); // first guardian let (treasury_address, _) = deploy_syscall( - treasury_classhash, 42, treasury_calldata.span(), true + treasury_classhash, 42, treasury_calldata.span(), false ) .unwrap(); let send_tokens_custom_proposal_config: CustomProposalConfig = CustomProposalConfig { target: treasury_address.into(), - selector: selector!("send_tokens_to_address"), + selector: selector!("add_transfer"), library_call: false, - proposal_voting_time: 0 // use global default + proposal_voting_time: 86400 // 1 day, to accelerate testing }; proposals.add_custom_proposal_config(send_tokens_custom_proposal_config); + + let add_guardian_custom_proposal_config: CustomProposalConfig = CustomProposalConfig { + target: treasury_address.into(), + selector: selector!("add_guardian"), + library_call: false, + proposal_voting_time: 0 // use global default + }; + + proposals.add_custom_proposal_config(add_guardian_custom_proposal_config); + + let remove_guardian_custom_proposal_config: CustomProposalConfig = CustomProposalConfig { + target: treasury_address.into(), + selector: selector!("remove_guardian"), + library_call: false, + proposal_voting_time: 0 // use global default + }; + + proposals.add_custom_proposal_config(remove_guardian_custom_proposal_config); } let set_default_proposal_params_custom_proposal_config: CustomProposalConfig = @@ -203,9 +223,18 @@ mod Governance { proposals.add_custom_proposal_config(set_default_proposal_params_custom_proposal_config); + let vesting = IVestingDispatcher { contract_address: governance_address }; + + let first_vest = 1726858800; // Fri Sep 20 2024 19:00:00 GMT+0000 + let period = 21600; // 6 hours + let increments_count = 56; + let total_amount = 56000000000000000000; // 56 * 10**18 meaning 56 KONOHA tokens + vesting.add_linear_vesting_schedule(first_vest, period, increments_count, total_amount, 0x027994c503bd8C32525FBDAf9d398bDd4e86757988C64581B055A06c5955eA49.try_into().unwrap()); + vesting.add_linear_vesting_schedule(first_vest, period, increments_count, total_amount, recipient); + proposals .set_default_proposal_params( - quorum: 10, proposal_voting_seconds: consteval_int!(60 * 60 * 24 * 7) + quorum: 10, proposal_voting_seconds: consteval_int!(60 * 60 * 24 * 3) ); // can be omitted to keep the default values } diff --git a/tests/deploy.cairo b/tests/deploy.cairo index a5e75cc1..ccde884d 100644 --- a/tests/deploy.cairo +++ b/tests/deploy.cairo @@ -6,16 +6,18 @@ use snforge_std::{ //useful for debugging -//#[test] -//#[fork("SEPOLIA")] +#[test] +#[fork("SEPOLIA")] fn test_deploy() { let gov_contract = declare("Governance").expect('unable to declare governance'); + let treasury_class = 0x035ef05673259eca09f55fce176a195d110bdbc6b145c08811d0e252ea8adadb; + //let treasury_contract = declare("Treasury").expect('unable to declare treasury'); let voting_token_class = 0x01d388b7b8976172e22d8707bb6d493f8a0edb6f701bb9282ed59c66c30e1e4f; let floating_token_class = 0x071d8c81a12d19c196712bdcb65789a90ed87415f9c36cc6cd3553ed5b796c85; let mut args: Array = ArrayTrait::new(); args.append(voting_token_class); args.append(floating_token_class); - args.append(0); + args.append(treasury_class); args.append(0x03f37e36c20E85e6F39b2C6F6e7ECEB2e3aAb40b94064f20983588cfe9f6fc60); gov_contract.deploy(@args).expect('unable to deploy governance'); }