Skip to content

Commit

Permalink
Add deployment files
Browse files Browse the repository at this point in the history
  • Loading branch information
tensojka committed Sep 20, 2024
1 parent 721a392 commit b6317b9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
37 changes: 33 additions & 4 deletions src/contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 =
Expand All @@ -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
}

Expand Down
8 changes: 5 additions & 3 deletions tests/deploy.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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<felt252> = 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');
}

0 comments on commit b6317b9

Please sign in to comment.