Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BitSong FanToken (x/fantoken) factory for token staking voting module #845

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Cargo.lock

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

41 changes: 41 additions & 0 deletions contracts/external/btsg-ft-factory/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[package]
name = "btsg-ft-factory"
authors = ["noah <noah@daodao.zone>"]
description = "A CosmWasm factory contract for issuing fantokens on BitSong."
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
version = { workspace = true }

[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]
cosmwasm-std = { workspace = true }
cosmwasm-schema = { workspace = true }
cw-storage-plus = { workspace = true }
cw2 = { workspace = true }
dao-interface = { workspace = true }
osmosis-std-derive = { workspace = true }
prost = { workspace = true }
prost-types = { workspace = true }
schemars = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
anyhow = { workspace = true }
cosmwasm-schema = { workspace = true }
cw-multi-test = { workspace = true }
cw-utils = { workspace = true }
dao-dao-core = { workspace = true, features = ["library"] }
dao-proposal-single = { workspace = true, features = ["library"] }
dao-testing = { workspace = true }
dao-voting-token-staked = { workspace = true, features = ["library"] }
dao-voting = { workspace = true }
11 changes: 11 additions & 0 deletions contracts/external/btsg-ft-factory/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# btsg-ft-factory

Serves as a factory that issues new
[fantokens](https://github.com/bitsongofficial/go-bitsong/tree/main/x/fantoken)
on BitSong and returns their denom for use with the
[dao-voting-token-staked](../../voting/dao-voting-token-staked) voting module
contract.

Instantiation and execution are permissionless. All DAOs will use the same
factory and execute `Issue` to create new fantokens through `TokenInfo::Factory`
during voting module instantiation.
11 changes: 11 additions & 0 deletions contracts/external/btsg-ft-factory/examples/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use btsg_ft_factory::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use cosmwasm_schema::write_api;

fn main() {
write_api! {
instantiate: InstantiateMsg,
query: QueryMsg,
execute: ExecuteMsg,
migrate: MigrateMsg,
}
}
117 changes: 117 additions & 0 deletions contracts/external/btsg-ft-factory/schema/btsg-ft-factory.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"contract_name": "btsg-ft-factory",
"contract_version": "2.5.0",
"idl_version": "1.0.0",
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"type": "object",
"additionalProperties": false
},
"execute": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ExecuteMsg",
"oneOf": [
{
"description": "Issues a new fantoken.",
"type": "object",
"required": [
"issue"
],
"properties": {
"issue": {
"$ref": "#/definitions/NewFanToken"
}
},
"additionalProperties": false
}
],
"definitions": {
"InitialBalance": {
"type": "object",
"required": [
"address",
"amount"
],
"properties": {
"address": {
"type": "string"
},
"amount": {
"$ref": "#/definitions/Uint128"
}
},
"additionalProperties": false
},
"NewFanToken": {
"type": "object",
"required": [
"initial_balances",
"max_supply",
"name",
"symbol",
"uri"
],
"properties": {
"initial_balances": {
"description": "The initial balances to set for the token, cannot be empty.",
"type": "array",
"items": {
"$ref": "#/definitions/InitialBalance"
}
},
"initial_dao_balance": {
"description": "Optional balance to mint for the DAO.",
"anyOf": [
{
"$ref": "#/definitions/Uint128"
},
{
"type": "null"
}
]
},
"max_supply": {
"description": "Fan token max supply.",
"allOf": [
{
"$ref": "#/definitions/Uint128"
}
]
},
"name": {
"description": "Fan token name.",
"type": "string"
},
"symbol": {
"description": "Fan token symbol.",
"type": "string"
},
"uri": {
"description": "Fan token URI.",
"type": "string"
}
},
"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"
}
}
},
"query": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "QueryMsg",
"type": "string",
"enum": []
},
"migrate": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MigrateMsg",
"type": "object",
"additionalProperties": false
},
"sudo": null,
"responses": {}
}
Loading
Loading