-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from hard-nett/feat/external-cw-orch
external cw-orch suites
- Loading branch information
Showing
23 changed files
with
1,786 additions
and
49 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,20 @@ | ||
use cw_orch::{interface, prelude::*}; | ||
|
||
use btsg_ft_factory::contract::{execute, instantiate, query, reply}; | ||
use btsg_ft_factory::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; | ||
|
||
#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, Empty)] | ||
pub struct DaoExternalFantokenFactory; | ||
|
||
impl<Chain> Uploadable for DaoExternalFantokenFactory<Chain> { | ||
/// Return the path to the wasm file corresponding to the contract | ||
fn wasm(_chain: &ChainInfoOwned) -> WasmPath { | ||
artifacts_dir_from_workspace!() | ||
.find_wasm_path("btsg_ft_factory") | ||
.unwrap() | ||
} | ||
/// Returns a CosmWasm contract wrapper | ||
fn wrapper() -> Box<dyn MockContract<Empty>> { | ||
Box::new(ContractWrapper::new_with_empty(execute, instantiate, query).with_reply(reply)) | ||
} | ||
} |
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,29 @@ | ||
[package] | ||
name = "scripts" | ||
edition.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
version.workspace = true | ||
|
||
[dependencies] | ||
cw-orch = { workspace = true, features = ["daemon"] } | ||
dao-cw-orch = { path = "../packages/cw-orch", version = "2.5.0" } | ||
# scripts specific | ||
dotenv = { version = "0.15.0" } | ||
pretty_env_logger = { version = "0.5.0" } | ||
|
||
# cw-orch enabled DAO DAO deps | ||
[dev-dependencies] | ||
dao-interface-master = { package = "dao-interface", git = "https://github.com/DA0-DA0/dao-contracts", branch = "main" } | ||
dao-proposal-sudo = { workspace = true, features = ["library"] } | ||
dao-proposal-single = { workspace = true, features = ["library"] } | ||
dao-interface = { workspace = true } | ||
dao-voting = { workspace = true } | ||
cw-payroll-factory = { workspace = true } | ||
cw-token-swap = { workspace = true } | ||
cw-admin-factory = { workspace = true } | ||
cw-tokenfactory-issuer = { workspace = true } | ||
cw-vesting = { workspace = true } | ||
cw721-roles = { workspace = true } | ||
dao-migrator = { workspace = true } | ||
btsg-ft-factory = { workspace = true } |
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,27 @@ | ||
use cw_orch::prelude::*; | ||
use dao_cw_orch::{DaoDaoCore, DaoProposalSingle, DaoProposalSudo}; | ||
|
||
// minimal dao | ||
pub struct DaoDao<Chain> { | ||
pub dao_core: DaoDaoCore<Chain>, | ||
pub dao_proposal_single: DaoProposalSingle<Chain>, | ||
pub dao_proposal_sudo: DaoProposalSudo<Chain>, | ||
} | ||
|
||
impl<Chain: CwEnv> DaoDao<Chain> { | ||
pub fn new(chain: Chain) -> DaoDao<Chain> { | ||
DaoDao::<Chain> { | ||
dao_core: DaoDaoCore::new("dao_dao_core", chain.clone()), | ||
dao_proposal_single: DaoProposalSingle::new("dao_proposal_single", chain.clone()), | ||
dao_proposal_sudo: DaoProposalSudo::new("dao_proposal_sudo", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.dao_core.upload()?; | ||
self.dao_proposal_single.upload()?; | ||
self.dao_proposal_sudo.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,152 @@ | ||
use cw_orch::prelude::*; | ||
use dao_cw_orch::*; | ||
|
||
// admin factory | ||
pub struct AdminFactorySuite<Chain> { | ||
pub factory: DaoExternalAdminFactory<Chain>, | ||
} | ||
impl<Chain: CwEnv> AdminFactorySuite<Chain> { | ||
pub fn new(chain: Chain) -> AdminFactorySuite<Chain> { | ||
AdminFactorySuite::<Chain> { | ||
factory: DaoExternalAdminFactory::new("cw_admin_factory", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.factory.upload()?; | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
// bitsong fantoken factory | ||
pub struct FantokenFactorySuite<Chain> { | ||
pub factory: DaoExternalFantokenFactory<Chain>, | ||
} | ||
|
||
impl<Chain: CwEnv> FantokenFactorySuite<Chain> { | ||
pub fn new(chain: Chain) -> FantokenFactorySuite<Chain> { | ||
FantokenFactorySuite::<Chain> { | ||
factory: DaoExternalFantokenFactory::new("btsg_ft_factory", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.factory.upload()?; | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
// payroll factory | ||
pub struct PayrollSuite<Chain> { | ||
pub payroll: DaoExternalPayrollFactory<Chain>, | ||
pub vesting: DaoExternalCwVesting<Chain>, | ||
} | ||
impl<Chain: CwEnv> PayrollSuite<Chain> { | ||
pub fn new(chain: Chain) -> PayrollSuite<Chain> { | ||
PayrollSuite::<Chain> { | ||
payroll: DaoExternalPayrollFactory::new("cw_payroll", chain.clone()), | ||
vesting: DaoExternalCwVesting::new("cw_vesting", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.payroll.upload()?; | ||
self.vesting.upload()?; | ||
Ok(()) | ||
} | ||
} | ||
|
||
// cw tokenswap | ||
pub struct TokenSwapSuite<Chain> { | ||
pub tokenswap: DaoExternalTokenSwap<Chain>, | ||
} | ||
impl<Chain: CwEnv> TokenSwapSuite<Chain> { | ||
pub fn new(chain: Chain) -> TokenSwapSuite<Chain> { | ||
TokenSwapSuite::<Chain> { | ||
tokenswap: DaoExternalTokenSwap::new("cw_tokenswap", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.tokenswap.upload()?; | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
// cw-tokenfactory issuer | ||
pub struct TokenFactorySuite<Chain> { | ||
pub tokenfactory: DaoExternalTokenfactoryIssuer<Chain>, | ||
} | ||
impl<Chain: CwEnv> TokenFactorySuite<Chain> { | ||
pub fn new(chain: Chain) -> TokenFactorySuite<Chain> { | ||
TokenFactorySuite::<Chain> { | ||
tokenfactory: DaoExternalTokenfactoryIssuer::new("cw_tokenfactory", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.tokenfactory.upload()?; | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
// cw-vesting | ||
pub struct VestingSuite<Chain> { | ||
pub vesting: DaoExternalCwVesting<Chain>, | ||
} | ||
|
||
impl<Chain: CwEnv> VestingSuite<Chain> { | ||
pub fn new(chain: Chain) -> VestingSuite<Chain> { | ||
VestingSuite::<Chain> { | ||
vesting: DaoExternalCwVesting::new("dao_dao_core", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.vesting.upload()?; | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
// cw721 roles | ||
pub struct Cw721RolesSuite<Chain> { | ||
pub roles: DaoExternalCw721Roles<Chain>, | ||
} | ||
|
||
impl<Chain: CwEnv> Cw721RolesSuite<Chain> { | ||
pub fn new(chain: Chain) -> Cw721RolesSuite<Chain> { | ||
Cw721RolesSuite::<Chain> { | ||
roles: DaoExternalCw721Roles::new("cw721_roles", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.roles.upload()?; | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
// migrator | ||
pub struct DaoMigrationSuite<Chain> { | ||
pub migrator: DaoExternalMigrator<Chain>, | ||
} | ||
|
||
impl<Chain: CwEnv> DaoMigrationSuite<Chain> { | ||
pub fn new(chain: Chain) -> DaoMigrationSuite<Chain> { | ||
DaoMigrationSuite::<Chain> { | ||
migrator: DaoExternalMigrator::new("dao_migrator", chain.clone()), | ||
} | ||
} | ||
|
||
pub fn upload(&self) -> Result<(), CwOrchError> { | ||
self.migrator.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,10 @@ | ||
#[allow(clippy::collapsible_if)] | ||
fn main() {} | ||
|
||
mod dao; | ||
mod external; | ||
pub use dao::*; | ||
pub use external::*; | ||
|
||
#[cfg(test)] | ||
mod tests; |
Oops, something went wrong.