Skip to content

Commit

Permalink
Rename package from 'governance' to 'konoha'
Browse files Browse the repository at this point in the history
  • Loading branch information
tensojka committed May 14, 2024
1 parent a8340d7 commit 164a3ca
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 76 deletions.
4 changes: 2 additions & 2 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
15 changes: 7 additions & 8 deletions src/airdrop.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,22 @@ trait IAirdrop<TContractState> {

#[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 {
Expand Down
16 changes: 8 additions & 8 deletions src/contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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<TContractState> {
Expand All @@ -25,13 +25,13 @@ trait IGovernance<TContractState> {

#[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;

Expand Down
18 changes: 9 additions & 9 deletions src/options.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<FutureOption>) {
// 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() {
Expand Down
20 changes: 10 additions & 10 deletions src/proposals.cairo
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -20,7 +20,7 @@ trait IProposals<TContractState> {

#[starknet::component]
mod proposals {
use governance::contract::IGovernance;
use konoha::contract::IGovernance;
use traits::TryInto;
use option::OptionTrait;
use traits::Into;
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/traits.cairo
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
6 changes: 3 additions & 3 deletions src/treasury.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use starknet::ContractAddress;
use governance::types::OptionType;
use konoha::types::OptionType;

#[starknet::interface]
trait ITreasury<TContractState> {
Expand Down Expand Up @@ -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);
Expand Down
26 changes: 13 additions & 13 deletions src/upgrades.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions src/vesting.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ trait IVesting<TContractState> {
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 {
Expand Down
10 changes: 4 additions & 6 deletions tests/add_options.cairo
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
12 changes: 6 additions & 6 deletions tests/basic.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
6 changes: 2 additions & 4 deletions tests/test_treasury.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down

0 comments on commit 164a3ca

Please sign in to comment.