diff --git a/Cargo.lock b/Cargo.lock index 99fa992c8..284445c3d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2159,10 +2159,6 @@ dependencies = [ "dao-test-custom-factory", "dao-testing", "dao-voting 2.2.0", - "sg-multi-test", - "sg-std", - "sg721", - "sg721-base", "thiserror", ] @@ -3895,71 +3891,6 @@ dependencies = [ "unsafe-libyaml", ] -[[package]] -name = "sg-multi-test" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20744734b8049c64747bfb083bbc06a3c7204d1d34881ed3d89698e182aa9f97" -dependencies = [ - "anyhow", - "cosmwasm-std", - "cw-multi-test", - "schemars", - "serde", - "sg-std", -] - -[[package]] -name = "sg-std" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4db53aebc2b4f981dc20a51213544adde8beaace6880345627f4babe2e1bc3ab" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-utils 1.0.1", - "cw721 0.18.0", - "schemars", - "serde", - "thiserror", -] - -[[package]] -name = "sg721" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e7d8f93b519c4c95973a68c7abee2de838497974d666dddb4dabd04d9c7cbf6" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-ownable", - "cw-utils 1.0.1", - "cw721-base 0.18.0", - "serde", - "thiserror", -] - -[[package]] -name = "sg721-base" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af08801d6f50cb13be05a3d2e815fbdb9dbba82086bbab877599ed4d422e9441" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-ownable", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw721 0.18.0", - "cw721-base 0.18.0", - "serde", - "sg-std", - "sg721", - "thiserror", - "url", -] - [[package]] name = "sha1" version = "0.10.5" diff --git a/contracts/voting/dao-voting-token-staked/Cargo.toml b/contracts/voting/dao-voting-token-staked/Cargo.toml index 864b6eb23..083129510 100644 --- a/contracts/voting/dao-voting-token-staked/Cargo.toml +++ b/contracts/voting/dao-voting-token-staked/Cargo.toml @@ -19,7 +19,7 @@ library = [] # cargo test --features "test-tube" test-tube = [] # when writing tests you may wish to enable test-tube as a default feature -default = ["test-tube"] +# default = ["test-tube"] [dependencies] cosmwasm-std = { workspace = true, features = ["cosmwasm_1_1"] } diff --git a/contracts/voting/dao-voting-token-staked/README.md b/contracts/voting/dao-voting-token-staked/README.md index c9275c390..2f1b9d693 100644 --- a/contracts/voting/dao-voting-token-staked/README.md +++ b/contracts/voting/dao-voting-token-staked/README.md @@ -80,3 +80,11 @@ Example insantiation mesggage: NOTE: if using an existing Token Factory token, double check the Token Factory admin and consider changing the Token Factory to be the DAO after the DAO is created. +### Use a factory +Occassionally, more customization is needed. Maybe you want to have an Augmented Bonding Curve contract or LP pool that requires additional setup? It's possible with factory contracts! + +The `factory` pattern takes a single `WasmMsg::Execute` message that calls into a custom factory contract. + +**NOTE:** when using the factory pattern, it is important to only use a trusted factory contract, as all validation happens in the factory contract. + +The [dao-test-custom-factory contract](../test/dao-test-custom-factory) provides an example of how this can be done and is used for tests. It is NOT production ready, but meant to serve as an example for building factory contracts. diff --git a/contracts/voting/dao-voting-token-staked/schema/dao-voting-token-staked.json b/contracts/voting/dao-voting-token-staked/schema/dao-voting-token-staked.json index b3e7c2bb1..99b6ec837 100644 --- a/contracts/voting/dao-voting-token-staked/schema/dao-voting-token-staked.json +++ b/contracts/voting/dao-voting-token-staked/schema/dao-voting-token-staked.json @@ -305,7 +305,7 @@ "additionalProperties": false }, { - "description": "Uses a factory pattern that must return the denom, optionally a Token Contract address. The binary must serialize to a `WasmMsg::Execute` message.", + "description": "Uses a factory contract that must return the denom, optionally a Token Contract address. The binary must serialize to a `WasmMsg::Execute` message. Validation happens in the factory contract itself, so be sure to use a trusted factory contract.", "type": "object", "required": [ "factory" diff --git a/contracts/voting/dao-voting-token-staked/src/msg.rs b/contracts/voting/dao-voting-token-staked/src/msg.rs index a5210ba9c..90ac64f02 100644 --- a/contracts/voting/dao-voting-token-staked/src/msg.rs +++ b/contracts/voting/dao-voting-token-staked/src/msg.rs @@ -17,8 +17,10 @@ pub enum TokenInfo { /// Creates a new Token Factory token via the issue contract with the DAO automatically /// setup as admin and owner. New(NewTokenInfo), - /// Uses a factory pattern that must return the denom, optionally a Token Contract address. + /// Uses a factory contract that must return the denom, optionally a Token Contract address. /// The binary must serialize to a `WasmMsg::Execute` message. + /// Validation happens in the factory contract itself, so be sure to use a + /// trusted factory contract. Factory(Binary), } diff --git a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs index c70924958..79126454c 100644 --- a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs +++ b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs @@ -416,12 +416,5 @@ fn test_factory() { // Query token contract let token_contract: Addr = voting.query(&QueryMsg::TokenContract {}).unwrap(); - assert_eq!( - denom, - format!( - "factory/{}/{}", - token_contract.to_string(), - DENOM.to_string() - ) - ); + assert_eq!(denom, format!("factory/{}/{}", token_contract, DENOM)); }