Skip to content

Commit

Permalink
Revert support for initial supply
Browse files Browse the repository at this point in the history
  • Loading branch information
ismellike committed Apr 23, 2024
1 parent 29ab264 commit c8f686f
Show file tree
Hide file tree
Showing 19 changed files with 117 additions and 610 deletions.
169 changes: 20 additions & 149 deletions contracts/external/cw-abc/schema/cw-abc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"curve_type",
"phase_config",
"reserve",
"supply"
"supply",
"token_issuer_code_id"
],
"properties": {
"curve_type": {
Expand Down Expand Up @@ -61,14 +62,16 @@
"$ref": "#/definitions/SupplyToken"
}
]
},
"token_issuer_code_id": {
"description": "The code id of the cw-tokenfactory-issuer contract",
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false,
"definitions": {
"Binary": {
"description": "Binary is a wrapper around Vec<u8> to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec<u8>. See also <https://github.com/CosmWasm/cosmwasm/blob/main/docs/MESSAGE_TYPES.md>.",
"type": "string"
},
"ClosedConfig": {
"type": "object",
"additionalProperties": false
Expand Down Expand Up @@ -336,22 +339,6 @@
},
"additionalProperties": false
},
"InitialBalance": {
"type": "object",
"required": [
"address",
"amount"
],
"properties": {
"address": {
"type": "string"
},
"amount": {
"$ref": "#/definitions/Uint128"
}
},
"additionalProperties": false
},
"MinMax": {
"description": "Struct for minimum and maximum values",
"type": "object",
Expand Down Expand Up @@ -407,56 +394,6 @@
},
"additionalProperties": false
},
"NewTokenInfo": {
"type": "object",
"required": [
"initial_balances",
"subdenom",
"token_issuer_code_id"
],
"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"
}
]
},
"metadata": {
"description": "Optional metadata for the token, this can additionally be set later.",
"anyOf": [
{
"$ref": "#/definitions/NewDenomMetadata"
},
{
"type": "null"
}
]
},
"subdenom": {
"description": "The subdenom of the token to create, will also be used as an alias for the denom. The Token Factory denom will have the format of factory/{contract_address}/{subdenom}",
"type": "string"
},
"token_issuer_code_id": {
"description": "The code id of the cw-tokenfactory-issuer contract",
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
},
"OpenConfig": {
"type": "object",
"required": [
Expand Down Expand Up @@ -507,7 +444,7 @@
"type": "object",
"required": [
"decimals",
"token_info"
"subdenom"
],
"properties": {
"decimals": {
Expand All @@ -526,70 +463,24 @@
}
]
},
"token_info": {
"description": "New or existing native token NOTE: If using an existing token, then the ABC must be given mint and burn permissions after creation",
"allOf": [
"metadata": {
"description": "Metadata for the supply token to create",
"anyOf": [
{
"$ref": "#/definitions/TokenInfo"
"$ref": "#/definitions/NewDenomMetadata"
},
{
"type": "null"
}
]
},
"subdenom": {
"description": "The denom to create for the supply token",
"type": "string"
}
},
"additionalProperties": false
},
"TokenInfo": {
"oneOf": [
{
"description": "Uses an existing Token Factory token and creates a new issuer contract. Full setup, such as transferring ownership or setting up MsgSetBeforeSendHook, must be done manually.",
"type": "object",
"required": [
"existing"
],
"properties": {
"existing": {
"type": "object",
"required": [
"denom"
],
"properties": {
"denom": {
"description": "Token factory denom",
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Creates a new Token Factory token via the issue contract with the DAO automatically setup as admin and owner.",
"type": "object",
"required": [
"new"
],
"properties": {
"new": {
"$ref": "#/definitions/NewTokenInfo"
}
},
"additionalProperties": false
},
{
"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"
],
"properties": {
"factory": {
"$ref": "#/definitions/Binary"
}
},
"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"
Expand Down Expand Up @@ -1447,20 +1338,6 @@
},
"additionalProperties": false
},
{
"description": "Returns the Initial Supply of the supply token when the ABC was created",
"type": "object",
"required": [
"initial_supply"
],
"properties": {
"initial_supply": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Returns the Maximum Supply of the supply token",
"type": "object",
Expand Down Expand Up @@ -1921,12 +1798,6 @@
}
}
},
"initial_supply": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "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"
},
"is_paused": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Boolean",
Expand Down
9 changes: 5 additions & 4 deletions contracts/external/cw-abc/src/abc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ use cw_curves::{
utils::decimal,
Curve, DecimalPlaces,
};
use dao_interface::token::TokenInfo;
use dao_interface::token::NewDenomMetadata;

use crate::ContractError;

#[cw_serde]
pub struct SupplyToken {
/// New or existing native token
/// NOTE: If using an existing token, then the ABC must be given mint and burn permissions after creation
pub token_info: TokenInfo,
/// The denom to create for the supply token
pub subdenom: String,
/// Metadata for the supply token to create
pub metadata: Option<NewDenomMetadata>,
/// Number of decimal places for the supply token, needed for proper curve math.
/// Default for token factory is 6
pub decimals: u8,
Expand Down
Loading

0 comments on commit c8f686f

Please sign in to comment.