diff --git a/README.md b/README.md index 508e24d7..73655981 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Governance -**TODO:** Remove 'target' from instantiate msg an update this README. - This is a base implementation of governance contract for Harbor Protocol . The contract can be extended to be used by other protocol with relatively same proposal execution behaviour. The contract uses the binding from package/bindings in the root directory to interact with Comdex Native Modules for Queries and Messages. @@ -16,7 +14,6 @@ instantiate this contract. pub struct InstantiateMsg { pub threshold: Threshold, pub locking_contract: Addr, - pub target: String, } ``` @@ -404,4 +401,4 @@ AppGovConfig { * `proposal_count` - Count of proposals for the application. * `current_supply` - Total supply of the governance token. -* `active_participation_supply` - Total weight of the participated votes. \ No newline at end of file +* `active_participation_supply` - Total weight of the participated votes. diff --git a/contracts/governance/src/contract.rs b/contracts/governance/src/contract.rs index 088ff8d9..3204dbfe 100644 --- a/contracts/governance/src/contract.rs +++ b/contracts/governance/src/contract.rs @@ -64,7 +64,6 @@ pub fn instantiate( set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; let cfg = Config { threshold: msg.threshold, - target: msg.target, locking_contract: deps.api.addr_validate(msg.locking_contract.as_str())?, }; CONFIG.save(deps.storage, &cfg)?; @@ -1001,7 +1000,6 @@ mod tests { threshold: Decimal::one(), quorum: Decimal::one(), }, - target: String::new(), locking_contract: Addr::unchecked(""), }; let result = @@ -1018,7 +1016,6 @@ mod tests { let not_acceptable_msg1 = InstantiateMsg { threshold: Threshold::AbsoluteCount { weight: 10 }, - target: Duration::Height(3).to_string(), locking_contract: Addr::unchecked("locking_contract"), }; @@ -1026,7 +1023,6 @@ mod tests { threshold: Threshold::AbsolutePercentage { percentage: Decimal::percent(50), }, - target: Duration::Height(3).to_string(), locking_contract: Addr::unchecked("locking_contract"), }; @@ -1035,7 +1031,6 @@ mod tests { threshold: Decimal::percent(50), quorum: Decimal::percent(33), }, - target: Duration::Height(3).to_string(), locking_contract: Addr::unchecked("locking_contract"), }; @@ -1425,7 +1420,6 @@ mod tests { threshold: Decimal::percent(50), quorum: Decimal::percent(33), }, - target: Duration::Height(3).to_string(), locking_contract: Addr::unchecked("locking_contract"), }; instantiate(deps.as_mut(), mock_env(), info.clone(), expected_msg).unwrap(); @@ -1502,7 +1496,6 @@ mod tests { threshold: Decimal::percent(50), quorum: Decimal::percent(33), }, - target: Duration::Height(3).to_string(), locking_contract: Addr::unchecked("locking_contract"), }; instantiate(deps.as_mut(), mock_env(), info.clone(), expected_msg).unwrap(); @@ -1630,7 +1623,6 @@ mod tests { threshold: Decimal::percent(50), quorum: Decimal::percent(33), }, - target: Duration::Height(3).to_string(), locking_contract: Addr::unchecked("locking_contract"), }; _ = CONFIG.save(&mut deps.storage, &cfg); @@ -1687,7 +1679,6 @@ mod tests { threshold: Decimal::one(), quorum: Decimal::one(), }, - target: String::new(), locking_contract: Addr::unchecked("locking-contract"), }; let sender = Addr::unchecked("sender"); @@ -1774,7 +1765,6 @@ mod tests { threshold: Decimal::one(), quorum: Decimal::one(), }, - target: String::new(), locking_contract: Addr::unchecked("locking-contract"), }; let sender = Addr::unchecked("sender"); @@ -1843,7 +1833,6 @@ mod tests { threshold: Decimal::one(), quorum: Decimal::one(), }, - target: String::new(), locking_contract: Addr::unchecked("locking-contract"), }; let sender = Addr::unchecked("sender"); diff --git a/contracts/governance/src/msg.rs b/contracts/governance/src/msg.rs index c5bdb564..e4ceb6f7 100644 --- a/contracts/governance/src/msg.rs +++ b/contracts/governance/src/msg.rs @@ -1,6 +1,6 @@ use crate::state::Votes; use comdex_bindings::ComdexMessages; -use cosmwasm_std::{Addr, Decimal, Timestamp,Uint128}; +use cosmwasm_std::{Addr, Decimal, Timestamp, Uint128}; use cw3::{Status, Vote}; use cw_utils::{Duration, Expiration, Threshold}; use schemars::JsonSchema; @@ -10,10 +10,9 @@ use serde::{Deserialize, Serialize}; pub struct InstantiateMsg { pub threshold: Threshold, pub locking_contract: Addr, - pub target: String, } -#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug,Eq)] +#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Eq)] pub struct Voter { pub addr: String, pub weight: u64, diff --git a/contracts/governance/src/state.rs b/contracts/governance/src/state.rs index ac36f44d..c335fd4e 100644 --- a/contracts/governance/src/state.rs +++ b/contracts/governance/src/state.rs @@ -16,10 +16,9 @@ const PRECISION_FACTOR: u128 = 1_000_000_000; pub struct Config { pub threshold: Threshold, pub locking_contract: Addr, - pub target: String, } -#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug,Eq)] +#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Eq)] pub struct AppGovConfig { pub proposal_count: u64, @@ -35,7 +34,7 @@ pub struct AppProposalConfig { pub proposal: Proposal, } -#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug,Eq)] +#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Eq)] #[serde(rename_all = "snake_case")] pub struct TokenSupply { // total token in the system. @@ -194,7 +193,7 @@ impl Proposal { } // weight of votes for each option -#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug,Eq)] +#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Eq)] pub struct Votes { pub yes: u128, pub no: u128,