Skip to content

Commit

Permalink
Merge branch 'pr/1' into feature/cw-orch-interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ismellike committed Jul 19, 2024
2 parents 761a780 + 87847fd commit 18241d0
Show file tree
Hide file tree
Showing 25 changed files with 548 additions and 366 deletions.
719 changes: 359 additions & 360 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions contracts/external/cw-admin-factory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cosmwasm-std = { workspace = true }
cosmwasm-schema = { workspace = true }
cw-storage-plus = { workspace = true }
cw2 = { workspace = true }
cw-orch = { workspace = true }
thiserror = { workspace = true }
cw-utils = { workspace = true }

Expand Down
3 changes: 2 additions & 1 deletion contracts/external/cw-admin-factory/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub struct InstantiateMsg {
}

#[cw_serde]
#[derive(cw_orch::ExecuteFns)]
pub enum ExecuteMsg {
/// Instantiates the target contract with the provided instantiate message and code id and
/// updates the contract's admin to be itself.
Expand All @@ -20,7 +21,7 @@ pub enum ExecuteMsg {
}

#[cw_serde]
#[derive(QueryResponses)]
#[derive(QueryResponses, cw_orch::QueryFns)]
pub enum QueryMsg {
#[returns(AdminResponse)]
Admin {},
Expand Down
1 change: 1 addition & 0 deletions contracts/external/cw-payroll-factory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ cw-ownable = { workspace = true }
cw-storage-plus = { workspace = true }
cw2 = { workspace = true }
cw20 = { workspace = true }
cw-orch = { workspace = true }
thiserror = { workspace = true }
cw-vesting = { workspace = true, features = ["library"] }
cw-utils = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion contracts/external/cw-payroll-factory/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct InstantiateMsg {

#[cw_ownable_execute]
#[cw_serde]
#[derive(cw_orch::ExecuteFns)]
pub enum ExecuteMsg {
/// Instantiates a new vesting contract that is funded by a cw20 token.
Receive(Cw20ReceiveMsg),
Expand All @@ -36,7 +37,7 @@ pub enum ReceiveMsg {
}

#[cw_serde]
#[derive(QueryResponses)]
#[derive(QueryResponses,cw_orch::QueryFns)]
pub enum QueryMsg {
/// Returns list of all vesting payment contracts
#[returns(Vec<crate::state::VestingContract>)]
Expand Down
1 change: 1 addition & 0 deletions contracts/external/cw-token-swap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ cw-storage-plus = { workspace = true }
cw-utils = { workspace = true }
cw2 = { workspace = true }
cw20 = { workspace = true }
cw-orch = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
Expand Down
3 changes: 2 additions & 1 deletion contracts/external/cw-token-swap/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub struct InstantiateMsg {
}

#[cw_serde]
#[derive(cw_orch::ExecuteFns)]
pub enum ExecuteMsg {
/// Used to provide cw20 tokens to satisfy a funds promise.
Receive(cw20::Cw20ReceiveMsg),
Expand All @@ -43,7 +44,7 @@ pub enum ExecuteMsg {
}

#[cw_serde]
#[derive(QueryResponses)]
#[derive(QueryResponses, cw_orch::QueryFns)]
pub enum QueryMsg {
// Gets the current status of the escrow transaction.
#[returns(crate::msg::StatusResponse)]
Expand Down
1 change: 1 addition & 0 deletions contracts/external/cw-tokenfactory-issuer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ kujira_tokenfactory = ["cw-tokenfactory-types/kujira_tokenfactory"]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw2 = { workspace = true }
cw-orch = { workspace = true }
cw-ownable = { workspace = true }
cw-storage-plus = { workspace = true }
cw-tokenfactory-types = { workspace = true, default-features = false }
Expand Down
3 changes: 2 additions & 1 deletion contracts/external/cw-tokenfactory-issuer/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub enum InstantiateMsg {

/// State changing methods available to this smart contract.
#[cw_serde]
#[derive(cw_orch::ExecuteFns)]
pub enum ExecuteMsg {
/// Allow adds the target address to the allowlist to be able to send or recieve tokens even if the token
/// is frozen. Token Factory's BeforeSendHook listener must be set to this contract in order for this feature
Expand Down Expand Up @@ -108,7 +109,7 @@ pub struct MigrateMsg {}

/// Queries supported by this smart contract.
#[cw_serde]
#[derive(QueryResponses)]
#[derive(QueryResponses, cw_orch::QueryFns)]
pub enum QueryMsg {
/// Returns if token transfer is disabled. Response: IsFrozenResponse
#[returns(IsFrozenResponse)]
Expand Down
1 change: 1 addition & 0 deletions contracts/external/cw-vesting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ staking = ["cosmwasm-std/staking"]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw-denom = { workspace = true }
cw-orch = { workspace = true }
cw-ownable = { workspace = true }
cw-stake-tracker = { workspace = true }
cw-storage-plus = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion contracts/external/cw-vesting/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub struct InstantiateMsg {

#[cw_ownable_execute]
#[cw_serde]
#[derive(cw_orch::ExecuteFns)]
pub enum ExecuteMsg {
/// Fund the contract with a cw20 token. The `msg` field must have
/// the shape `{"fund":{}}`, and the amount sent must be the same
Expand Down Expand Up @@ -194,7 +195,7 @@ pub enum ReceiveMsg {
}

#[cw_serde]
#[derive(QueryResponses)]
#[derive(QueryResponses, cw_orch::QueryFns)]
pub enum QueryMsg {
/// Get the current ownership.
#[returns(::cw_ownable::Ownership<::cosmwasm_std::Addr>)]
Expand Down
1 change: 1 addition & 0 deletions contracts/external/cw721-roles/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ cw-storage-plus = { workspace = true }
cw-utils = { workspace = true }
cw2 = { workspace = true }
cw4 = { workspace = true }
cw-orch = { workspace = true }
cw721 = { workspace = true }
cw721-base = { workspace = true, features = ["library"] }
dao-cw721-extensions = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions contracts/external/dao-migrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ cw-utils = { workspace = true }
thiserror = { workspace = true }
cw2 = { workspace = true }
cw20 = { workspace = true }
cw-orch = { workspace = true }
dao-interface = { workspace = true }

dao-dao-core = { workspace = true, features = ["library"] }
Expand Down
7 changes: 7 additions & 0 deletions packages/cw-orch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ cw20-stake = { version = "2.4.2", path = "../../contracts/staking/cw20-stake" }
cw20-stake-external-rewards = { version = "2.4.2", path = "../../contracts/staking/cw20-stake-external-rewards" }
cw20-stake-reward-distributor = { version = "2.4.2", path = "../../contracts/staking/cw20-stake-reward-distributor" }
cw721-base.workspace = true
cw721-roles = { path = "../../contracts/external/cw721-roles", version = "2.4.2" }
cw-admin-factory = { path = "../../contracts/external/cw-admin-factory", version = "2.5.0" }
cw-vesting = { version = "2.4.2", path = "../../contracts/external/cw-vesting" }
cw-payroll-factory = { version = "2.4.2", path = "../../contracts/external/cw-payroll-factory" }
cw-token-swap = { version = "2.4.2", path = "../../contracts/external/cw-token-swap" }
cw-tokenfactory-issuer = { version = "2.4.2", path = "../../contracts/external/cw-tokenfactory-issuer" }
dao-migrator = { version = "2.4.2", path = "../../contracts/external/dao-migrator" }
dao-dao-core = { version = "2.4.2", path = "../../contracts/dao-dao-core" }
dao-interface = { version = "2.4.2", path = "../dao-interface" }
dao-pre-propose-approval-single = { version = "2.4.2", path = "../../contracts/pre-propose/dao-pre-propose-approval-single" }
Expand Down
20 changes: 20 additions & 0 deletions packages/cw-orch/src/external/admin_factory.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use cw_orch::{interface, prelude::*};

use cw_admin_factory::contract::{execute, instantiate, query, reply};
use cw_admin_factory::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, Empty)]
pub struct DaoExternalAdminFactory;

impl<Chain> Uploadable for DaoExternalAdminFactory<Chain> {
/// Return the path to the wasm file corresponding to the contract
fn wasm(_chain: &ChainInfoOwned) -> WasmPath {
artifacts_dir_from_workspace!()
.find_wasm_path("dao_admin_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))
}
}
20 changes: 20 additions & 0 deletions packages/cw-orch/src/external/cw721_roles.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use cw_orch::{interface, prelude::*};

use cw721_roles::contract::{execute, instantiate, query};
use cw721_roles::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, Empty)]
pub struct DaoExternalCw721Roles;

impl<Chain> Uploadable for DaoExternalCw721Roles<Chain> {
/// Return the path to the wasm file corresponding to the contract
fn wasm(_chain: &ChainInfoOwned) -> WasmPath {
artifacts_dir_from_workspace!()
.find_wasm_path("dao_cw721_roles")
.unwrap()
}
/// Returns a CosmWasm contract wrapper
fn wrapper() -> Box<dyn MockContract<Empty>> {
Box::new(ContractWrapper::new_with_empty(execute, instantiate, query))
}
}
20 changes: 20 additions & 0 deletions packages/cw-orch/src/external/cw_vesting.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use cw_orch::{interface, prelude::*};

use cw_vesting::contract::{execute, instantiate, query};
use cw_vesting::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, Empty)]
pub struct DaoExternalCwVesting;

impl<Chain> Uploadable for DaoExternalCwVesting<Chain> {
/// Return the path to the wasm file corresponding to the contract
fn wasm(_chain: &ChainInfoOwned) -> WasmPath {
artifacts_dir_from_workspace!()
.find_wasm_path("dao_cw_vesting")
.unwrap()
}
/// Returns a CosmWasm contract wrapper
fn wrapper() -> Box<dyn MockContract<Empty>> {
Box::new(ContractWrapper::new_with_empty(execute, instantiate, query))
}
}
20 changes: 20 additions & 0 deletions packages/cw-orch/src/external/migrator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use cw_orch::{interface, prelude::*};

use dao_migrator::contract::{execute, instantiate, query, reply};
use dao_migrator::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, Empty)]
pub struct DaoExternalMigrator;

impl<Chain> Uploadable for DaoExternalMigrator<Chain> {
/// Return the path to the wasm file corresponding to the contract
fn wasm(_chain: &ChainInfoOwned) -> WasmPath {
artifacts_dir_from_workspace!()
.find_wasm_path("dao_migrator")
.unwrap()
}
/// Returns a CosmWasm contract wrapper
fn wrapper() -> Box<dyn MockContract<Empty>> {
Box::new(ContractWrapper::new_with_empty(execute, instantiate, query).with_reply(reply))
}
}
15 changes: 15 additions & 0 deletions packages/cw-orch/src/external/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
mod admin_factory;
mod cw721_roles;
mod cw_vesting;
mod migrator;
mod payroll_factory;
mod token_swap;
mod tokenfactory_issuer;

pub use admin_factory::DaoExternalAdminFactory;
pub use cw721_roles::DaoExternalCw721Roles;
pub use cw_vesting::DaoExternalCwVesting;
pub use migrator::DaoExternalMigrator;
pub use payroll_factory::DaoExternalPayrollFactory;
pub use token_swap::DaoExternalTokenSwap;
pub use tokenfactory_issuer::DaoExternalTokenfactoryIssuer;
20 changes: 20 additions & 0 deletions packages/cw-orch/src/external/payroll_factory.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use cw_orch::{interface, prelude::*};

use cw_payroll_factory::contract::{execute, instantiate, query, reply};
use cw_payroll_factory::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, Empty)]
pub struct DaoExternalPayrollFactory;

impl<Chain> Uploadable for DaoExternalPayrollFactory<Chain> {
/// Return the path to the wasm file corresponding to the contract
fn wasm(_chain: &ChainInfoOwned) -> WasmPath {
artifacts_dir_from_workspace!()
.find_wasm_path("dao_payroll_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))
}
}
21 changes: 21 additions & 0 deletions packages/cw-orch/src/external/token_swap.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use cosmwasm_std::Reply;
use cw_orch::{interface, prelude::*};

use cw_token_swap::contract::{execute, instantiate, migrate, query};
use cw_token_swap::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};

#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, MigrateMsg)]
pub struct DaoExternalTokenSwap;

impl<Chain> Uploadable for DaoExternalTokenSwap<Chain> {
/// Return the path to the wasm file corresponding to the contract
fn wasm(_chain: &ChainInfoOwned) -> WasmPath {
artifacts_dir_from_workspace!()
.find_wasm_path("dao_tokenswap")
.unwrap()
}
/// Returns a CosmWasm contract wrapper
fn wrapper() -> Box<dyn MockContract<Empty>> {
Box::new(ContractWrapper::new_with_empty(execute, instantiate, query).with_migrate(migrate))
}
}
24 changes: 24 additions & 0 deletions packages/cw-orch/src/external/tokenfactory_issuer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use cw_orch::{interface, prelude::*};

use cw_tokenfactory_issuer::contract::{execute, instantiate, migrate, query, reply};
use cw_tokenfactory_issuer::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, Empty)]
pub struct DaoExternalTokenfactoryIssuer;

impl<Chain> Uploadable for DaoExternalTokenfactoryIssuer<Chain> {
/// Return the path to the wasm file corresponding to the contract
fn wasm(_chain: &ChainInfoOwned) -> WasmPath {
artifacts_dir_from_workspace!()
.find_wasm_path("dao_tokenfactory_issuer")
.unwrap()
}
/// Returns a CosmWasm contract wrapper
fn wrapper() -> Box<dyn MockContract<Empty>> {
Box::new(
ContractWrapper::new_with_empty(execute, instantiate, query)
.with_reply(reply)
.with_migrate(migrate),
)
}
}
2 changes: 2 additions & 0 deletions packages/cw-orch/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
mod core;
mod external;
mod pre_propose;
mod proposal;
mod staking;
mod test_contracts;
mod voting;

pub use core::*;
pub use external::*;
pub use pre_propose::*;
pub use proposal::*;
pub use staking::*;
Expand Down
1 change: 1 addition & 0 deletions packages/dao-cw721-extensions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ cosmwasm-std = { workspace = true }
cosmwasm-schema = { workspace = true }
cw-controllers = { workspace = true }
cw4 = { workspace = true }
cw-orch = { workspace = true }
3 changes: 2 additions & 1 deletion packages/dao-cw721-extensions/src/roles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct MetadataExt {
}

#[cw_serde]
#[derive(cw_orch::ExecuteFns)]
pub enum ExecuteExt {
/// Add a new hook to be informed of all membership changes.
/// Must be called by Admin
Expand All @@ -32,7 +33,7 @@ pub enum ExecuteExt {
impl CustomMsg for ExecuteExt {}

#[cw_serde]
#[derive(QueryResponses)]
#[derive(QueryResponses, cw_orch::QueryFns)]
pub enum QueryExt {
/// Total weight at a given height
#[returns(cw4::TotalWeightResponse)]
Expand Down

0 comments on commit 18241d0

Please sign in to comment.