-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hard-nett
authored and
Jake Hartnell
committed
Aug 14, 2024
1 parent
c255d1e
commit 0cc80ce
Showing
21 changed files
with
428 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
mod cw_fund_distributor; | ||
mod dao_rewards_distributor; | ||
|
||
pub use cw_fund_distributor::CwFundDistributor; | ||
pub use cw_fund_distributor::DaoFundsDistributor; | ||
pub use dao_rewards_distributor::DaoRewardsDistributor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use cw_orch::prelude::*; | ||
use dao_cw_orch::*; | ||
|
||
// cw-funds-distributor | ||
pub struct DaoDistributionSuite<Chain> { | ||
pub fund_distr: DaoFundsDistributor<Chain>, | ||
pub reward_distr: DaoRewardsDistributor<Chain>, | ||
} | ||
|
||
impl<Chain: CwEnv> DaoDistributionSuite<Chain> { | ||
pub fn new(chain: Chain) -> DaoDistributionSuite<Chain> { | ||
DaoDistributionSuite::<Chain> { | ||
fund_distr: DaoFundsDistributor::new("cw_funds_distributor", chain.clone()), | ||
reward_distr: DaoRewardsDistributor::new("dao_rewards_distributor", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.fund_distr.upload()?; | ||
self.reward_distr.upload()?; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
use cw_orch::prelude::*; | ||
use dao_cw_orch::*; | ||
|
||
pub struct DaoPreProposeSuite<Chain> { | ||
pub pre_prop_approval_single: DaoPreProposeApprovalSingle<Chain>, | ||
pub pre_prop_approver: DaoPreProposeApprover<Chain>, | ||
pub pre_prop_multiple: DaoPreProposeMultiple<Chain>, | ||
pub pre_prop_single: DaoPreProposeSingle<Chain>, | ||
} | ||
|
||
impl<Chain: CwEnv> DaoPreProposeSuite<Chain> { | ||
pub fn new(chain: Chain) -> DaoPreProposeSuite<Chain> { | ||
DaoPreProposeSuite::<Chain> { | ||
pre_prop_approval_single: DaoPreProposeApprovalSingle::new( | ||
"dao_pre_propose_approval_single", | ||
chain.clone(), | ||
), | ||
pre_prop_approver: DaoPreProposeApprover::new( | ||
"dao_pre_propose_approver", | ||
chain.clone(), | ||
), | ||
pre_prop_multiple: DaoPreProposeMultiple::new( | ||
"dao_pre_propose_multiple", | ||
chain.clone(), | ||
), | ||
pre_prop_single: DaoPreProposeSingle::new("dao_pre_propose_single", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.pre_prop_approval_single.upload()?; | ||
self.pre_prop_approver.upload()?; | ||
self.pre_prop_multiple.upload()?; | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
pub struct DaoProposalSuite<Chain> { | ||
pub prop_single: DaoProposalSingle<Chain>, | ||
pub prop_multiple: DaoProposalMultiple<Chain>, | ||
pub prop_condocert: DaoProposalCondorcet<Chain>, | ||
} | ||
|
||
impl<Chain: CwEnv> DaoProposalSuite<Chain> { | ||
pub fn new(chain: Chain) -> DaoProposalSuite<Chain> { | ||
DaoProposalSuite::<Chain> { | ||
prop_single: DaoProposalSingle::new("dao_proposal_single", chain.clone()), | ||
prop_multiple: DaoProposalMultiple::new("dao_proposal_multiple", chain.clone()), | ||
prop_condocert: DaoProposalCondorcet::new("dao_proposal_condocert", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.prop_single.upload()?; | ||
self.prop_multiple.upload()?; | ||
self.prop_condocert.upload()?; | ||
Ok(()) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use cw_orch::prelude::*; | ||
use dao_cw_orch::*; | ||
|
||
pub struct DaoStakingSuite<Chain> { | ||
pub cw20_stake: DaoStakingCw20<Chain>, | ||
pub exteral_rewards: DaoStakingCw20ExternalRewards<Chain>, | ||
pub rewards_distributor: DaoStakingCw20RewardDistributor<Chain>, | ||
} | ||
|
||
impl<Chain: CwEnv> DaoStakingSuite<Chain> { | ||
pub fn new(chain: Chain) -> DaoStakingSuite<Chain> { | ||
DaoStakingSuite::<Chain> { | ||
cw20_stake: DaoStakingCw20::new("cw20_stake", chain.clone()), | ||
exteral_rewards: DaoStakingCw20ExternalRewards::new( | ||
"cw20_external_rewards", | ||
chain.clone(), | ||
), | ||
rewards_distributor: DaoStakingCw20RewardDistributor::new( | ||
"cw20_reward_distributor", | ||
chain.clone(), | ||
), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.cw20_stake.upload()?; | ||
self.exteral_rewards.upload()?; | ||
self.rewards_distributor.upload()?; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use crate::DaoDistributionSuite; | ||
use cw_orch::prelude::*; | ||
|
||
// distribution suite | ||
impl<Chain: CwEnv> cw_orch::contract::Deploy<Chain> for DaoDistributionSuite<Chain> { | ||
// We don't have a custom error type | ||
type Error = CwOrchError; | ||
type DeployData = Addr; | ||
|
||
fn store_on(chain: Chain) -> Result<Self, Self::Error> { | ||
let suite = DaoDistributionSuite::new(chain.clone()); | ||
suite.upload()?; | ||
Ok(suite) | ||
} | ||
|
||
fn deployed_state_file_path() -> Option<String> { | ||
None | ||
} | ||
|
||
fn get_contracts_mut(&mut self) -> Vec<Box<&mut dyn ContractInstance<Chain>>> { | ||
vec![ | ||
Box::new(&mut self.fund_distr), | ||
Box::new(&mut self.reward_distr), | ||
] | ||
} | ||
|
||
fn load_from(chain: Chain) -> Result<Self, Self::Error> { | ||
let suite = Self::new(chain.clone()); | ||
Ok(suite) | ||
} | ||
|
||
fn deploy_on(chain: Chain, _data: Self::DeployData) -> Result<Self, Self::Error> { | ||
// ########### Upload ############## | ||
let suite: DaoDistributionSuite<Chain> = DaoDistributionSuite::store_on(chain.clone())?; | ||
Ok(suite) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
mod external; | ||
mod distribution; | ||
mod voting; | ||
mod propose; | ||
mod staking; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
use crate::propose::*; | ||
use cw_orch::prelude::*; | ||
|
||
|
||
// pre-proposal suite | ||
impl<Chain: CwEnv> cw_orch::contract::Deploy<Chain> for DaoPreProposeSuite<Chain> { | ||
// We don't have a custom error type | ||
type Error = CwOrchError; | ||
type DeployData = Addr; | ||
|
||
fn store_on(chain: Chain) -> Result<Self, Self::Error> { | ||
let suite = DaoPreProposeSuite::new(chain.clone()); | ||
suite.upload()?; | ||
Ok(suite) | ||
} | ||
|
||
fn deployed_state_file_path() -> Option<String> { | ||
None | ||
} | ||
|
||
fn get_contracts_mut(&mut self) -> Vec<Box<&mut dyn ContractInstance<Chain>>> { | ||
vec![ | ||
Box::new(&mut self.pre_prop_approval_single), | ||
Box::new(&mut self.pre_prop_approver), | ||
Box::new(&mut self.pre_prop_multiple), | ||
Box::new(&mut self.pre_prop_single), | ||
] | ||
} | ||
|
||
fn load_from(chain: Chain) -> Result<Self, Self::Error> { | ||
let factory = Self::new(chain.clone()); | ||
Ok(factory) | ||
} | ||
|
||
fn deploy_on(chain: Chain, _data: Self::DeployData) -> Result<Self, Self::Error> { | ||
// ########### Upload ############## | ||
let suite: DaoPreProposeSuite<Chain> = DaoPreProposeSuite::store_on(chain.clone())?; | ||
Ok(suite) | ||
} | ||
} | ||
|
||
// proposal suite | ||
impl<Chain: CwEnv> cw_orch::contract::Deploy<Chain> for DaoProposalSuite<Chain> { | ||
// We don't have a custom error type | ||
type Error = CwOrchError; | ||
type DeployData = Addr; | ||
|
||
fn store_on(chain: Chain) -> Result<Self, Self::Error> { | ||
let suite = DaoProposalSuite::new(chain.clone()); | ||
suite.upload()?; | ||
Ok(suite) | ||
} | ||
|
||
fn deployed_state_file_path() -> Option<String> { | ||
None | ||
} | ||
|
||
fn get_contracts_mut(&mut self) -> Vec<Box<&mut dyn ContractInstance<Chain>>> { | ||
vec![ | ||
Box::new(&mut self.prop_single), | ||
Box::new(&mut self.prop_multiple), | ||
Box::new(&mut self.prop_condocert), | ||
] | ||
} | ||
|
||
fn load_from(chain: Chain) -> Result<Self, Self::Error> { | ||
let factory = Self::new(chain.clone()); | ||
Ok(factory) | ||
} | ||
|
||
fn deploy_on(chain: Chain, _data: Self::DeployData) -> Result<Self, Self::Error> { | ||
// ########### Upload ############## | ||
let suite: DaoProposalSuite<Chain> = DaoProposalSuite::store_on(chain.clone())?; | ||
Ok(suite) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use crate::staking::*; | ||
use cw_orch::prelude::*; | ||
|
||
// staking suite | ||
impl<Chain: CwEnv> cw_orch::contract::Deploy<Chain> for DaoStakingSuite<Chain> { | ||
// We don't have a custom error type | ||
type Error = CwOrchError; | ||
type DeployData = Addr; | ||
|
||
fn store_on(chain: Chain) -> Result<Self, Self::Error> { | ||
let suite = DaoStakingSuite::new(chain.clone()); | ||
suite.upload()?; | ||
Ok(suite) | ||
} | ||
|
||
fn deployed_state_file_path() -> Option<String> { | ||
None | ||
} | ||
|
||
fn get_contracts_mut(&mut self) -> Vec<Box<&mut dyn ContractInstance<Chain>>> { | ||
vec![ | ||
Box::new(&mut self.cw20_stake), | ||
Box::new(&mut self.exteral_rewards), | ||
Box::new(&mut self.rewards_distributor), | ||
] | ||
} | ||
|
||
fn load_from(chain: Chain) -> Result<Self, Self::Error> { | ||
let factory = Self::new(chain.clone()); | ||
Ok(factory) | ||
} | ||
|
||
fn deploy_on(chain: Chain, _data: Self::DeployData) -> Result<Self, Self::Error> { | ||
// ########### Upload ############## | ||
let suite: DaoStakingSuite<Chain> = DaoStakingSuite::store_on(chain.clone())?; | ||
Ok(suite) | ||
} | ||
} |
Oops, something went wrong.