From 164a3caf1bb105918fa5fb8e305ca88f1a65b291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sojka?= Date: Tue, 14 May 2024 14:31:08 +0000 Subject: [PATCH] Rename package from 'governance' to 'konoha' --- Scarb.lock | 4 ++-- Scarb.toml | 6 +++--- src/airdrop.cairo | 15 +++++++-------- src/contract.cairo | 16 ++++++++-------- src/options.cairo | 18 +++++++++--------- src/proposals.cairo | 20 ++++++++++---------- src/traits.cairo | 4 ++-- src/treasury.cairo | 6 +++--- src/upgrades.cairo | 26 +++++++++++++------------- src/vesting.cairo | 4 ++-- tests/add_options.cairo | 10 ++++------ tests/basic.cairo | 12 ++++++------ tests/test_treasury.cairo | 6 ++---- 13 files changed, 71 insertions(+), 76 deletions(-) diff --git a/Scarb.lock b/Scarb.lock index f0cb3619..4af793f8 100644 --- a/Scarb.lock +++ b/Scarb.lock @@ -4,10 +4,10 @@ version = 1 [[package]] name = "cubit" version = "1.3.0" -source = "git+https://github.com/influenceth/cubit.git#62756082bf2555d7ab25c69d9c7bc30574ff1ce8" +source = "git+https://github.com/influenceth/cubit.git#8eacc2b1d952d6266f9725776445c7fb97453403" [[package]] -name = "governance" +name = "konoha" version = "0.3.0" dependencies = [ "cubit", diff --git a/Scarb.toml b/Scarb.toml index 1b813207..f04f99f7 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -1,5 +1,5 @@ [package] -name = "governance" +name = "konoha" description = "A flexible monolithic governance contract, developed for use with Carmine Options AMM" version = "0.3.0" cairo-version = "2.6.3" @@ -21,5 +21,5 @@ block_id.tag = "Latest" name = "SEPOLIA" url = "http://34.22.208.73:6062/v0_7" block_id.tag = "Latest" - -RUST_BACKTRACE=1 + +RUST_BACKTRACE = 1 diff --git a/src/airdrop.cairo b/src/airdrop.cairo index b9a934ff..fc0bfee6 100644 --- a/src/airdrop.cairo +++ b/src/airdrop.cairo @@ -11,23 +11,22 @@ trait IAirdrop { #[starknet::component] mod airdrop { - use governance::contract::IGovernance; + use konoha::contract::IGovernance; use array::ArrayTrait; use hash::LegacyHash; use traits::Into; use starknet::ContractAddressIntoFelt252; use starknet::ContractAddress; - //use starknet::event::EventEmitter; use traits::TryInto; use option::OptionTrait; - use governance::merkle_tree::MerkleTree; - use governance::merkle_tree::MerkleTreeTrait; + use konoha::merkle_tree::MerkleTree; + use konoha::merkle_tree::MerkleTreeTrait; - use governance::contract::Governance; - use governance::contract::Governance::ContractState; - use governance::traits::IGovernanceTokenDispatcher; - use governance::traits::IGovernanceTokenDispatcherTrait; + use konoha::contract::Governance; + use konoha::contract::Governance::ContractState; + use konoha::traits::IGovernanceTokenDispatcher; + use konoha::traits::IGovernanceTokenDispatcherTrait; #[storage] struct Storage { diff --git a/src/contract.cairo b/src/contract.cairo index 32f47ef8..cd2db034 100644 --- a/src/contract.cairo +++ b/src/contract.cairo @@ -2,7 +2,7 @@ // When Components arrive in Cairo 2.?, it will be refactored to take advantage of them. Random change to rerun CI use starknet::ContractAddress; -use governance::types::{ContractType, PropDetails, VoteStatus}; +use konoha::types::{ContractType, PropDetails, VoteStatus}; #[starknet::interface] trait IGovernance { @@ -25,13 +25,13 @@ trait IGovernance { #[starknet::contract] mod Governance { - use governance::types::BlockNumber; - use governance::types::VoteStatus; - use governance::types::ContractType; - use governance::types::PropDetails; - use governance::proposals::proposals as proposals_component; - use governance::upgrades::upgrades as upgrades_component; - use governance::airdrop::airdrop as airdrop_component; + use konoha::types::BlockNumber; + use konoha::types::VoteStatus; + use konoha::types::ContractType; + use konoha::types::PropDetails; + use konoha::proposals::proposals as proposals_component; + use konoha::upgrades::upgrades as upgrades_component; + use konoha::airdrop::airdrop as airdrop_component; use starknet::ContractAddress; diff --git a/src/options.cairo b/src/options.cairo index 8c45bb72..86d2b84b 100644 --- a/src/options.cairo +++ b/src/options.cairo @@ -3,7 +3,7 @@ // – first generating FutureOption, then generating everything from Pragma data mod Options { - use governance::contract::IGovernance; + use konoha::contract::IGovernance; use traits::{Into, TryInto}; use array::{ArrayTrait, SpanTrait}; use option::OptionTrait; @@ -20,22 +20,22 @@ mod Options { use cubit::f128::types::{Fixed, FixedTrait}; - use governance::contract::Governance::{amm_address, proposal_initializer_run}; - use governance::constants::{ + use konoha::contract::konoha::{amm_address, proposal_initializer_run}; + use konoha::constants::{ OPTION_CALL, OPTION_PUT, TRADE_SIDE_LONG, TRADE_SIDE_SHORT, OPTION_TOKEN_CLASS_HASH }; - use governance::traits::{ + use konoha::traits::{ IAMMDispatcher, IAMMDispatcherTrait, IOptionTokenDispatcher, IOptionTokenDispatcherTrait }; - use governance::types::OptionSide; - use governance::contract::Governance; - use governance::types::OptionType; - use governance::contract::Governance::proposal_initializer_runContractMemberStateTrait; + use konoha::types::OptionSide; + use konoha::contract::Governance; + use konoha::types::OptionType; + use konoha::contract::konoha::proposal_initializer_runContractMemberStateTrait; fn add_options(mut options: Span) { // TODO use block hash from block_hash syscall as salt // actually doable with the new syscall let governance_address = get_contract_address(); - let state = Governance::unsafe_new_contract_state(); + let state = konoha::unsafe_new_contract_state(); let amm_address = state.get_amm_address(); loop { match options.pop_front() { diff --git a/src/proposals.cairo b/src/proposals.cairo index a0a41e8f..de313220 100644 --- a/src/proposals.cairo +++ b/src/proposals.cairo @@ -1,6 +1,6 @@ // Proposals component. Does not depend on anything. Holds governance token address. -use governance::types::{ContractType, PropDetails, VoteStatus}; +use konoha::types::{ContractType, PropDetails, VoteStatus}; use starknet::ContractAddress; #[starknet::interface] @@ -20,7 +20,7 @@ trait IProposals { #[starknet::component] mod proposals { - use governance::contract::IGovernance; + use konoha::contract::IGovernance; use traits::TryInto; use option::OptionTrait; use traits::Into; @@ -47,14 +47,14 @@ mod proposals { use starknet::class_hash::class_hash_try_from_felt252; use starknet::contract_address::contract_address_to_felt252; - use governance::types::BlockNumber; - use governance::types::ContractType; - use governance::types::PropDetails; - use governance::types::VoteStatus; - use governance::traits::IERC20Dispatcher; - use governance::traits::IERC20DispatcherTrait; - use governance::traits::get_governance_token_address_self; - use governance::constants; + use konoha::types::BlockNumber; + use konoha::types::ContractType; + use konoha::types::PropDetails; + use konoha::types::VoteStatus; + use konoha::traits::IERC20Dispatcher; + use konoha::traits::IERC20DispatcherTrait; + use konoha::traits::get_governance_token_address_self; + use konoha::constants; #[storage] struct Storage { diff --git a/src/traits.cairo b/src/traits.cairo index 584f2be0..cece8097 100644 --- a/src/traits.cairo +++ b/src/traits.cairo @@ -1,7 +1,7 @@ use starknet::{ClassHash, ContractAddress}; -use governance::types::OptionSide; -use governance::types::OptionType; +use konoha::types::OptionSide; +use konoha::types::OptionType; use core::starknet::SyscallResultTrait; use cubit::f128::types::{Fixed, FixedTrait}; diff --git a/src/treasury.cairo b/src/treasury.cairo index 7ba3ca29..46e28a3b 100644 --- a/src/treasury.cairo +++ b/src/treasury.cairo @@ -1,5 +1,5 @@ use starknet::ContractAddress; -use governance::types::OptionType; +use konoha::types::OptionType; #[starknet::interface] trait ITreasury { @@ -39,8 +39,8 @@ mod Treasury { use openzeppelin::upgrades::upgradeable::UpgradeableComponent; use openzeppelin::upgrades::interface::IUpgradeable; use starknet::{ContractAddress, get_caller_address, get_contract_address, ClassHash}; - use governance::airdrop::{IAirdropDispatcher, IAirdropDispatcherTrait}; - use governance::traits::{ + use konoha::airdrop::{IAirdropDispatcher, IAirdropDispatcherTrait}; + use konoha::traits::{ IERC20Dispatcher, IERC20DispatcherTrait, IAMMDispatcher, IAMMDispatcherTrait }; component!(path: OwnableComponent, storage: ownable, event: OwnableEvent); diff --git a/src/upgrades.cairo b/src/upgrades.cairo index b7ec6f1e..114fb5eb 100644 --- a/src/upgrades.cairo +++ b/src/upgrades.cairo @@ -16,19 +16,19 @@ mod upgrades { use starknet::ContractAddress; use starknet::class_hash; - use governance::types::PropDetails; - use governance::contract::Governance; - use governance::contract::Governance::ContractState; + use konoha::types::PropDetails; + use konoha::contract::Governance; + use konoha::contract::Governance::ContractState; - use governance::proposals::proposals as proposals_component; - use governance::proposals::proposals::ProposalsImpl; - use governance::airdrop::airdrop as airdrop_component; - use governance::traits::IAMMDispatcher; - use governance::traits::IAMMDispatcherTrait; - use governance::traits::IGovernanceTokenDispatcher; - use governance::traits::IGovernanceTokenDispatcherTrait; - use governance::traits::get_amm_address_self; - use governance::traits::get_governance_token_address_self; + use konoha::proposals::proposals as proposals_component; + use konoha::proposals::proposals::ProposalsImpl; + use konoha::airdrop::airdrop as airdrop_component; + use konoha::traits::IAMMDispatcher; + use konoha::traits::IAMMDispatcherTrait; + use konoha::traits::IGovernanceTokenDispatcher; + use konoha::traits::IGovernanceTokenDispatcherTrait; + use konoha::traits::get_amm_address_self; + use konoha::traits::get_governance_token_address_self; #[storage] struct Storage { @@ -61,7 +61,7 @@ mod upgrades { let status = proposals_comp .get_proposal_status( prop_id - ); // needs use governance::proposals::proposals::ProposalsImpl; + ); // needs use konoha::proposals::proposals::ProposalsImpl; assert(status == 1, 'prop not passed'); let applied = self.proposal_applied.read(prop_id); assert(!applied, 'Proposal already applied'); diff --git a/src/vesting.cairo b/src/vesting.cairo index e0aecfe3..f62087e0 100644 --- a/src/vesting.cairo +++ b/src/vesting.cairo @@ -26,8 +26,8 @@ trait IVesting { mod vesting { use starknet::syscalls::get_block_timestamp; - use governance::traits::IGovernanceTokenDispatcher; - use governance::traits::IGovernanceTokenDispatcherTrait; + use konoha::traits::IGovernanceTokenDispatcher; + use konoha::traits::IGovernanceTokenDispatcherTrait; #[storage] struct Storage { diff --git a/tests/add_options.cairo b/tests/add_options.cairo index 488efb23..7dd985a8 100644 --- a/tests/add_options.cairo +++ b/tests/add_options.cairo @@ -1,11 +1,9 @@ use super::basic::submit_44_signal_proposals; -use governance::traits::IAMM; -use governance::contract::IGovernanceDispatcher; -use governance::contract::IGovernanceDispatcherTrait; -use governance::traits::{ - IAMMDispatcher, IAMMDispatcherTrait, IERC20Dispatcher, IERC20DispatcherTrait -}; +use konoha::traits::IAMM; +use konoha::contract::IGovernanceDispatcher; +use konoha::contract::IGovernanceDispatcherTrait; +use konoha::traits::{IAMMDispatcher, IAMMDispatcherTrait, IERC20Dispatcher, IERC20DispatcherTrait}; use starknet::{ContractAddress, get_block_timestamp}; diff --git a/tests/basic.cairo b/tests/basic.cairo index 04f238d3..a6eb631c 100644 --- a/tests/basic.cairo +++ b/tests/basic.cairo @@ -4,12 +4,12 @@ use debug::PrintTrait; use starknet::ContractAddress; use snforge_std::{BlockId, declare, ContractClassTrait, ContractClass, start_prank, CheatTarget}; -use governance::contract::IGovernanceDispatcher; -use governance::contract::IGovernanceDispatcherTrait; -use governance::proposals::IProposalsDispatcher; -use governance::proposals::IProposalsDispatcherTrait; -use governance::upgrades::IUpgradesDispatcher; -use governance::upgrades::IUpgradesDispatcherTrait; +use konoha::contract::IGovernanceDispatcher; +use konoha::contract::IGovernanceDispatcherTrait; +use konoha::proposals::IProposalsDispatcher; +use konoha::proposals::IProposalsDispatcherTrait; +use konoha::upgrades::IUpgradesDispatcher; +use konoha::upgrades::IUpgradesDispatcherTrait; //#[test] //#[fork(url: "https://rpc.starknet-testnet.lava.build", block_id: BlockId::Number(904597))] diff --git a/tests/test_treasury.cairo b/tests/test_treasury.cairo index 452944e2..4e306ae7 100644 --- a/tests/test_treasury.cairo +++ b/tests/test_treasury.cairo @@ -21,10 +21,8 @@ use snforge_std::{ BlockId, declare, ContractClassTrait, ContractClass, prank, CheatSpan, CheatTarget, start_roll, stop_roll, }; -use governance::treasury::{ITreasuryDispatcher, ITreasuryDispatcherTrait}; -use governance::traits::{ - IERC20Dispatcher, IERC20DispatcherTrait, IAMMDispatcher, IAMMDispatcherTrait -}; +use konoha::treasury::{ITreasuryDispatcher, ITreasuryDispatcherTrait}; +use konoha::traits::{IERC20Dispatcher, IERC20DispatcherTrait, IAMMDispatcher, IAMMDispatcherTrait}; use openzeppelin::access::ownable::interface::{ IOwnableTwoStep, IOwnableTwoStepDispatcherTrait, IOwnableTwoStepDispatcher };