Skip to content

Commit

Permalink
Add token-merge-factory & token-merge-minter
Browse files Browse the repository at this point in the history
  • Loading branch information
MightOfOaks committed Oct 30, 2024
1 parent 5fb3404 commit 266a953
Show file tree
Hide file tree
Showing 41 changed files with 3,412 additions and 0 deletions.
50 changes: 50 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ vending-factory = { version = "3.14.0", path = "contracts/factories/vending
vending-minter = { version = "3.14.0", path = "contracts/minters/vending-minter" }
open-edition-factory = { version = "3.14.0", path = "contracts/factories/open-edition-factory" }
open-edition-minter = { version = "3.14.0", path = "contracts/minters/open-edition-minter" }
token-merge-factory = { version = "3.14.0", path = "contracts/factories/token-merge-factory" }
token-merge-minter = { version = "3.14.0", path = "contracts/minters/token-merge-minter" }
whitelist-immutable = { version = "3.14.0", path = "contracts/whitelists/whitelist-immutable" }
sg-whitelist-flex = { version = "3.14.0", path = "contracts/whitelists/whitelist-flex" }
ethereum-verify = { version = "3.14.0", path = "packages/ethereum-verify" }
Expand Down
4 changes: 4 additions & 0 deletions contracts/factories/token-merge-factory/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[alias]
wasm = "build --release --lib --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --example schema"
15 changes: 15 additions & 0 deletions contracts/factories/token-merge-factory/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build results
/target

# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327)
.cargo-ok

# Text file backups
**/*.rs.bk

# macOS
.DS_Store

# IDEs
*.iml
.idea
42 changes: 42 additions & 0 deletions contracts/factories/token-merge-factory/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[package]
name = "token-merge-factory"
authors = ["Shane Vitarana <[email protected]>"]
description = "Stargaze token merge factory contract"
version = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
repository = { workspace = true }
license = { workspace = true }

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

[dependencies]
base-factory = { workspace = true, features = ["library"] }
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw2 = { workspace = true }
cw-storage-plus = { workspace = true }
cw-utils = { workspace = true }
schemars = { workspace = true }
semver = { workspace = true }
serde = { workspace = true }
sg1 = { workspace = true }
sg2 = { workspace = true }
sg721 = { workspace = true }
sg-std = { workspace = true }
thiserror = { workspace = true }
7 changes: 7 additions & 0 deletions contracts/factories/token-merge-factory/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Token Merge Minter Factory

A contract that maintains all token merge minter governance parameters.

It's responsible for creating new minters with the latest governance parameters.

It also maintains status lists for token merge minters. This is inherited from sg4.
17 changes: 17 additions & 0 deletions contracts/factories/token-merge-factory/examples/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use std::env::current_dir;
use std::fs::create_dir_all;

use cosmwasm_schema::{export_schema, remove_schemas, schema_for};

use sg2::query::Sg2QueryMsg;
use token_merge_factory::msg::InstantiateMsg;

fn main() {
let mut out_dir = current_dir().unwrap();
out_dir.push("schema");
create_dir_all(&out_dir).unwrap();
remove_schemas(&out_dir).unwrap();

export_schema(&schema_for!(InstantiateMsg), &out_dir);
export_schema(&schema_for!(Sg2QueryMsg), &out_dir);
}
123 changes: 123 additions & 0 deletions contracts/factories/token-merge-factory/schema/instantiate_msg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"type": "object",
"required": [
"params"
],
"properties": {
"params": {
"$ref": "#/definitions/MinterParams_for_ParamsExtension"
}
},
"additionalProperties": false,
"definitions": {
"Coin": {
"type": "object",
"required": [
"amount",
"denom"
],
"properties": {
"amount": {
"$ref": "#/definitions/Uint128"
},
"denom": {
"type": "string"
}
}
},
"MinterParams_for_ParamsExtension": {
"description": "Common params for all minters used for storage",
"type": "object",
"required": [
"allowed_sg721_code_ids",
"code_id",
"creation_fee",
"extension",
"frozen",
"max_trading_offset_secs",
"min_mint_price",
"mint_fee_bps"
],
"properties": {
"allowed_sg721_code_ids": {
"type": "array",
"items": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"code_id": {
"description": "The minter code id",
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"creation_fee": {
"$ref": "#/definitions/Coin"
},
"extension": {
"$ref": "#/definitions/ParamsExtension"
},
"frozen": {
"type": "boolean"
},
"max_trading_offset_secs": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"min_mint_price": {
"$ref": "#/definitions/Coin"
},
"mint_fee_bps": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
},
"ParamsExtension": {
"description": "Parameters common to all vending minters, as determined by governance",
"type": "object",
"required": [
"airdrop_mint_fee_bps",
"airdrop_mint_price",
"max_per_address_limit",
"max_token_limit",
"shuffle_fee"
],
"properties": {
"airdrop_mint_fee_bps": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"airdrop_mint_price": {
"$ref": "#/definitions/Coin"
},
"max_per_address_limit": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"max_token_limit": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"shuffle_fee": {
"$ref": "#/definitions/Coin"
}
},
"additionalProperties": false
},
"Uint128": {
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
"type": "string"
}
}
}
47 changes: 47 additions & 0 deletions contracts/factories/token-merge-factory/schema/sg2_query_msg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Sg2QueryMsg",
"oneOf": [
{
"description": "Returns `ParamsResponse`",
"type": "object",
"required": [
"params"
],
"properties": {
"params": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"allowed_collection_code_ids"
],
"properties": {
"allowed_collection_code_ids": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"allowed_collection_code_id"
],
"properties": {
"allowed_collection_code_id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
}
]
}
Loading

0 comments on commit 266a953

Please sign in to comment.