diff --git a/contracts/vesting-lp-pcl/examples/vesting-lp_schema.rs b/contracts/vesting-lp-pcl/examples/vesting-lp_schema.rs index 6f1967f3..6f61959b 100644 --- a/contracts/vesting-lp-pcl/examples/vesting-lp_schema.rs +++ b/contracts/vesting-lp-pcl/examples/vesting-lp_schema.rs @@ -1,6 +1,6 @@ use cosmwasm_schema::write_api; -use vesting_base_pcl::msg::{ExecuteMsg, MigrateMsg, QueryMsg}; -use vesting_lp_pcl::msg::InstantiateMsg; +use vesting_base::msg::{MigrateMsg, QueryMsg}; +use vesting_lp_pcl::msg::{InstantiateMsg,ExecuteMsg}; fn main() { write_api! { diff --git a/contracts/vesting-lp-pcl/schema/raw/execute.json b/contracts/vesting-lp-pcl/schema/raw/execute.json index e5aa732d..3a625610 100644 --- a/contracts/vesting-lp-pcl/schema/raw/execute.json +++ b/contracts/vesting-lp-pcl/schema/raw/execute.json @@ -1,44 +1,20 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "ExecuteMsg", - "description": "This structure describes the execute messages available in a vesting contract.", "oneOf": [ { - "description": "Claim claims vested tokens and sends them to a recipient", "type": "object", "required": [ - "claim" + "base" ], "properties": { - "claim": { - "type": "object", - "properties": { - "amount": { - "description": "The amount of tokens to claim", - "anyOf": [ - { - "$ref": "#/definitions/Uint128" - }, - { - "type": "null" - } - ] - }, - "recipient": { - "description": "The address that receives the vested tokens", - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": false + "base": { + "$ref": "#/definitions/ExecuteMsg" } }, "additionalProperties": false }, { - "description": "Receives a message of type [`Cw20ReceiveMsg`] and processes it depending on the received template", "type": "object", "required": [ "receive" @@ -49,202 +25,235 @@ } }, "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" }, - { - "description": "RegisterVestingAccounts registers vesting targets/accounts", - "type": "object", - "required": [ - "register_vesting_accounts" - ], - "properties": { - "register_vesting_accounts": { + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", "type": "object", "required": [ - "vesting_accounts" + "token" ], "properties": { - "vesting_accounts": { - "type": "array", - "items": { - "$ref": "#/definitions/VestingAccount" - } + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Creates a request to change contract ownership ## Executor Only the current owner can execute this", - "type": "object", - "required": [ - "propose_new_owner" - ], - "properties": { - "propose_new_owner": { + }, + { + "description": "Native token", "type": "object", "required": [ - "expires_in", - "owner" + "native_token" ], "properties": { - "expires_in": { - "description": "The validity period of the offer to change the owner", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "owner": { - "description": "The newly proposed owner", - "type": "string" + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false } }, "additionalProperties": false } - }, - "additionalProperties": false + ] }, - { - "description": "Removes a request to change contract ownership ## Executor Only the current owner can execute this", + "Binary": { + "description": "Binary is a wrapper around Vec 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. See also .", + "type": "string" + }, + "Cw20ReceiveMsg": { + "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg", "type": "object", "required": [ - "drop_ownership_proposal" + "amount", + "msg", + "sender" ], "properties": { - "drop_ownership_proposal": { - "type": "object", - "additionalProperties": false + "amount": { + "$ref": "#/definitions/Uint128" + }, + "msg": { + "$ref": "#/definitions/Binary" + }, + "sender": { + "type": "string" } }, "additionalProperties": false }, - { - "description": "Claims contract ownership ## Executor Only the newly proposed owner can execute this", - "type": "object", - "required": [ - "claim_ownership" - ], - "properties": { - "claim_ownership": { + "ExecuteMsg": { + "description": "This structure describes the execute messages available in a vesting contract.", + "oneOf": [ + { + "description": "Claim claims vested tokens and sends them to a recipient", "type": "object", + "required": [ + "claim" + ], + "properties": { + "claim": { + "type": "object", + "properties": { + "amount": { + "description": "The amount of tokens to claim", + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "recipient": { + "description": "The address that receives the vested tokens", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Sets vesting token ## Executor Only the current owner or token info manager can execute this", - "type": "object", - "required": [ - "set_vesting_token" - ], - "properties": { - "set_vesting_token": { + }, + { + "description": "Receives a message of type [`Cw20ReceiveMsg`] and processes it depending on the received template", "type": "object", "required": [ - "vesting_token" + "receive" ], "properties": { - "vesting_token": { - "$ref": "#/definitions/AssetInfo" + "receive": { + "$ref": "#/definitions/Cw20ReceiveMsg" } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the managed extension for vesting contracts.", - "type": "object", - "required": [ - "managed_extension" - ], - "properties": { - "managed_extension": { + }, + { + "description": "RegisterVestingAccounts registers vesting targets/accounts", "type": "object", "required": [ - "msg" + "register_vesting_accounts" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgManaged" + "register_vesting_accounts": { + "type": "object", + "required": [ + "vesting_accounts" + ], + "properties": { + "vesting_accounts": { + "type": "array", + "items": { + "$ref": "#/definitions/VestingAccount" + } + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the with_managers extension for vesting contracts.", - "type": "object", - "required": [ - "with_managers_extension" - ], - "properties": { - "with_managers_extension": { + }, + { + "description": "Creates a request to change contract ownership ## Executor Only the current owner can execute this", "type": "object", "required": [ - "msg" + "propose_new_owner" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgWithManagers" + "propose_new_owner": { + "type": "object", + "required": [ + "expires_in", + "owner" + ], + "properties": { + "expires_in": { + "description": "The validity period of the offer to change the owner", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "owner": { + "description": "The newly proposed owner", + "type": "string" + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the historical extension for vesting contracts.", - "type": "object", - "required": [ - "historical_extension" - ], - "properties": { - "historical_extension": { + }, + { + "description": "Removes a request to change contract ownership ## Executor Only the current owner can execute this", "type": "object", "required": [ - "msg" + "drop_ownership_proposal" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgHistorical" + "drop_ownership_proposal": { + "type": "object", + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - } - ], - "definitions": { - "Addr": { - "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", - "type": "string" - }, - "AssetInfo": { - "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", - "oneOf": [ + }, { - "description": "Non-native Token", + "description": "Claims contract ownership ## Executor Only the newly proposed owner can execute this", "type": "object", "required": [ - "token" + "claim_ownership" ], "properties": { - "token": { + "claim_ownership": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Sets vesting token ## Executor Only the current owner or token info manager can execute this", + "type": "object", + "required": [ + "set_vesting_token" + ], + "properties": { + "set_vesting_token": { "type": "object", "required": [ - "contract_addr" + "vesting_token" ], "properties": { - "contract_addr": { - "$ref": "#/definitions/Addr" + "vesting_token": { + "$ref": "#/definitions/AssetInfo" } }, "additionalProperties": false @@ -253,53 +262,72 @@ "additionalProperties": false }, { - "description": "Native token", + "description": "Contains messages associated with the managed extension for vesting contracts.", "type": "object", "required": [ - "native_token" + "managed_extension" ], "properties": { - "native_token": { + "managed_extension": { "type": "object", "required": [ - "denom" + "msg" ], "properties": { - "denom": { - "type": "string" + "msg": { + "$ref": "#/definitions/ExecuteMsgManaged" } }, "additionalProperties": false } }, "additionalProperties": false - } - ] - }, - "Binary": { - "description": "Binary is a wrapper around Vec 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. See also .", - "type": "string" - }, - "Cw20ReceiveMsg": { - "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg", - "type": "object", - "required": [ - "amount", - "msg", - "sender" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" }, - "msg": { - "$ref": "#/definitions/Binary" + { + "description": "Contains messages associated with the with_managers extension for vesting contracts.", + "type": "object", + "required": [ + "with_managers_extension" + ], + "properties": { + "with_managers_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgWithManagers" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false }, - "sender": { - "type": "string" + { + "description": "Contains messages associated with the historical extension for vesting contracts.", + "type": "object", + "required": [ + "historical_extension" + ], + "properties": { + "historical_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgHistorical" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false } - }, - "additionalProperties": false + ] }, "ExecuteMsgHistorical": { "description": "This structure describes the execute messages available in a historical vesting contract.", diff --git a/contracts/vesting-lp-pcl/schema/raw/instantiate.json b/contracts/vesting-lp-pcl/schema/raw/instantiate.json index 044bc78c..cf950c42 100644 --- a/contracts/vesting-lp-pcl/schema/raw/instantiate.json +++ b/contracts/vesting-lp-pcl/schema/raw/instantiate.json @@ -6,7 +6,9 @@ "required": [ "owner", "token_info_manager", - "vesting_managers" + "vesting_managers", + "vesting_token", + "xyk_vesting_lp_contract" ], "properties": { "owner": { @@ -23,7 +25,68 @@ "items": { "type": "string" } + }, + "vesting_token": { + "$ref": "#/definitions/AssetInfo" + }, + "xyk_vesting_lp_contract": { + "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } } diff --git a/contracts/vesting-lp-pcl/schema/vesting-lp.json b/contracts/vesting-lp-pcl/schema/vesting-lp-pcl.json similarity index 82% rename from contracts/vesting-lp-pcl/schema/vesting-lp.json rename to contracts/vesting-lp-pcl/schema/vesting-lp-pcl.json index 395775f8..b3d8a16b 100644 --- a/contracts/vesting-lp-pcl/schema/vesting-lp.json +++ b/contracts/vesting-lp-pcl/schema/vesting-lp-pcl.json @@ -1,5 +1,5 @@ { - "contract_name": "vesting-lp", + "contract_name": "vesting-lp-pcl", "contract_version": "1.1.0", "idl_version": "1.0.0", "instantiate": { @@ -10,7 +10,9 @@ "required": [ "owner", "token_info_manager", - "vesting_managers" + "vesting_managers", + "vesting_token", + "xyk_vesting_lp_contract" ], "properties": { "owner": { @@ -27,51 +29,88 @@ "items": { "type": "string" } + }, + "vesting_token": { + "$ref": "#/definitions/AssetInfo" + }, + "xyk_vesting_lp_contract": { + "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } }, "execute": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "ExecuteMsg", - "description": "This structure describes the execute messages available in a vesting contract.", "oneOf": [ { - "description": "Claim claims vested tokens and sends them to a recipient", "type": "object", "required": [ - "claim" + "base" ], "properties": { - "claim": { - "type": "object", - "properties": { - "amount": { - "description": "The amount of tokens to claim", - "anyOf": [ - { - "$ref": "#/definitions/Uint128" - }, - { - "type": "null" - } - ] - }, - "recipient": { - "description": "The address that receives the vested tokens", - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": false + "base": { + "$ref": "#/definitions/ExecuteMsg" } }, "additionalProperties": false }, { - "description": "Receives a message of type [`Cw20ReceiveMsg`] and processes it depending on the received template", "type": "object", "required": [ "receive" @@ -82,202 +121,235 @@ } }, "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" }, - { - "description": "RegisterVestingAccounts registers vesting targets/accounts", - "type": "object", - "required": [ - "register_vesting_accounts" - ], - "properties": { - "register_vesting_accounts": { + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", "type": "object", "required": [ - "vesting_accounts" + "token" ], "properties": { - "vesting_accounts": { - "type": "array", - "items": { - "$ref": "#/definitions/VestingAccount" - } + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Creates a request to change contract ownership ## Executor Only the current owner can execute this", - "type": "object", - "required": [ - "propose_new_owner" - ], - "properties": { - "propose_new_owner": { + }, + { + "description": "Native token", "type": "object", "required": [ - "expires_in", - "owner" + "native_token" ], "properties": { - "expires_in": { - "description": "The validity period of the offer to change the owner", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "owner": { - "description": "The newly proposed owner", - "type": "string" + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false } }, "additionalProperties": false } - }, - "additionalProperties": false + ] }, - { - "description": "Removes a request to change contract ownership ## Executor Only the current owner can execute this", + "Binary": { + "description": "Binary is a wrapper around Vec 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. See also .", + "type": "string" + }, + "Cw20ReceiveMsg": { + "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg", "type": "object", "required": [ - "drop_ownership_proposal" + "amount", + "msg", + "sender" ], "properties": { - "drop_ownership_proposal": { - "type": "object", - "additionalProperties": false + "amount": { + "$ref": "#/definitions/Uint128" + }, + "msg": { + "$ref": "#/definitions/Binary" + }, + "sender": { + "type": "string" } }, "additionalProperties": false }, - { - "description": "Claims contract ownership ## Executor Only the newly proposed owner can execute this", - "type": "object", - "required": [ - "claim_ownership" - ], - "properties": { - "claim_ownership": { + "ExecuteMsg": { + "description": "This structure describes the execute messages available in a vesting contract.", + "oneOf": [ + { + "description": "Claim claims vested tokens and sends them to a recipient", "type": "object", + "required": [ + "claim" + ], + "properties": { + "claim": { + "type": "object", + "properties": { + "amount": { + "description": "The amount of tokens to claim", + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "recipient": { + "description": "The address that receives the vested tokens", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Sets vesting token ## Executor Only the current owner or token info manager can execute this", - "type": "object", - "required": [ - "set_vesting_token" - ], - "properties": { - "set_vesting_token": { + }, + { + "description": "Receives a message of type [`Cw20ReceiveMsg`] and processes it depending on the received template", "type": "object", "required": [ - "vesting_token" + "receive" ], "properties": { - "vesting_token": { - "$ref": "#/definitions/AssetInfo" + "receive": { + "$ref": "#/definitions/Cw20ReceiveMsg" } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the managed extension for vesting contracts.", - "type": "object", - "required": [ - "managed_extension" - ], - "properties": { - "managed_extension": { + }, + { + "description": "RegisterVestingAccounts registers vesting targets/accounts", "type": "object", "required": [ - "msg" + "register_vesting_accounts" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgManaged" + "register_vesting_accounts": { + "type": "object", + "required": [ + "vesting_accounts" + ], + "properties": { + "vesting_accounts": { + "type": "array", + "items": { + "$ref": "#/definitions/VestingAccount" + } + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the with_managers extension for vesting contracts.", - "type": "object", - "required": [ - "with_managers_extension" - ], - "properties": { - "with_managers_extension": { + }, + { + "description": "Creates a request to change contract ownership ## Executor Only the current owner can execute this", "type": "object", "required": [ - "msg" + "propose_new_owner" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgWithManagers" + "propose_new_owner": { + "type": "object", + "required": [ + "expires_in", + "owner" + ], + "properties": { + "expires_in": { + "description": "The validity period of the offer to change the owner", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "owner": { + "description": "The newly proposed owner", + "type": "string" + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the historical extension for vesting contracts.", - "type": "object", - "required": [ - "historical_extension" - ], - "properties": { - "historical_extension": { + }, + { + "description": "Removes a request to change contract ownership ## Executor Only the current owner can execute this", "type": "object", "required": [ - "msg" + "drop_ownership_proposal" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgHistorical" + "drop_ownership_proposal": { + "type": "object", + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - } - ], - "definitions": { - "Addr": { - "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", - "type": "string" - }, - "AssetInfo": { - "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", - "oneOf": [ + }, { - "description": "Non-native Token", + "description": "Claims contract ownership ## Executor Only the newly proposed owner can execute this", "type": "object", "required": [ - "token" + "claim_ownership" ], "properties": { - "token": { + "claim_ownership": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Sets vesting token ## Executor Only the current owner or token info manager can execute this", + "type": "object", + "required": [ + "set_vesting_token" + ], + "properties": { + "set_vesting_token": { "type": "object", "required": [ - "contract_addr" + "vesting_token" ], "properties": { - "contract_addr": { - "$ref": "#/definitions/Addr" + "vesting_token": { + "$ref": "#/definitions/AssetInfo" } }, "additionalProperties": false @@ -286,53 +358,72 @@ "additionalProperties": false }, { - "description": "Native token", + "description": "Contains messages associated with the managed extension for vesting contracts.", "type": "object", "required": [ - "native_token" + "managed_extension" ], "properties": { - "native_token": { + "managed_extension": { "type": "object", "required": [ - "denom" + "msg" ], "properties": { - "denom": { - "type": "string" + "msg": { + "$ref": "#/definitions/ExecuteMsgManaged" } }, "additionalProperties": false } }, "additionalProperties": false - } - ] - }, - "Binary": { - "description": "Binary is a wrapper around Vec 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. See also .", - "type": "string" - }, - "Cw20ReceiveMsg": { - "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg", - "type": "object", - "required": [ - "amount", - "msg", - "sender" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" }, - "msg": { - "$ref": "#/definitions/Binary" + { + "description": "Contains messages associated with the with_managers extension for vesting contracts.", + "type": "object", + "required": [ + "with_managers_extension" + ], + "properties": { + "with_managers_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgWithManagers" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false }, - "sender": { - "type": "string" + { + "description": "Contains messages associated with the historical extension for vesting contracts.", + "type": "object", + "required": [ + "historical_extension" + ], + "properties": { + "historical_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgHistorical" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false } - }, - "additionalProperties": false + ] }, "ExecuteMsgHistorical": { "description": "This structure describes the execute messages available in a historical vesting contract.", diff --git a/contracts/vesting-lp-pcl/src/lib.rs b/contracts/vesting-lp-pcl/src/lib.rs index b88f5887..4934c19d 100644 --- a/contracts/vesting-lp-pcl/src/lib.rs +++ b/contracts/vesting-lp-pcl/src/lib.rs @@ -1,6 +1,3 @@ pub mod contract; pub mod msg; pub mod state; - -#[cfg(test)] -mod tests; diff --git a/contracts/vesting-lp-pcl/src/msg.rs b/contracts/vesting-lp-pcl/src/msg.rs index c6e3a529..77df5e01 100644 --- a/contracts/vesting-lp-pcl/src/msg.rs +++ b/contracts/vesting-lp-pcl/src/msg.rs @@ -18,6 +18,7 @@ pub struct InstantiateMsg { pub vesting_token: AssetInfo, } +#[cw_serde] pub enum ExecuteMsg { Base(BaseExecute), Receive(Cw20ReceiveMsg), diff --git a/contracts/vesting-lp-pcl/src/tests/integration.rs b/contracts/vesting-lp-pcl/src/tests/integration.rs deleted file mode 100644 index 70e164ac..00000000 --- a/contracts/vesting-lp-pcl/src/tests/integration.rs +++ /dev/null @@ -1,1265 +0,0 @@ -use crate::msg::InstantiateMsg; -use astroport::asset::{native_asset_info, token_asset_info}; -use astroport::querier::query_balance; -use astroport::token::InstantiateMsg as TokenInstantiateMsg; -use cosmwasm_std::{coin, coins, to_binary, Addr, StdResult, Timestamp, Uint128}; -use cw20::{BalanceResponse, Cw20ExecuteMsg, Cw20QueryMsg, MinterResponse}; -use cw_multi_test::{App, ContractWrapper, Executor}; -use cw_utils::PaymentError; -use vesting_base_pcl::error::ContractError; -use vesting_base_pcl::msg::{ - Cw20HookMsg, ExecuteMsg, ExecuteMsgWithManagers, QueryMsg, QueryMsgHistorical, - QueryMsgWithManagers, -}; -use vesting_base_pcl::types::{ - Config, VestingAccount, VestingAccountResponse, VestingSchedule, VestingSchedulePoint, -}; - -const OWNER1: &str = "owner1"; -const TOKEN_MANAGER: &str = "token_manager"; -const USER1: &str = "user1"; -const USER2: &str = "user2"; -const TOKEN_INITIAL_AMOUNT: u128 = 1_000_000_000_000_000; -const VESTING_TOKEN: &str = "vesting_token"; -const BLOCK_TIME: u64 = 5; - -#[test] -fn claim() { - let user1 = Addr::unchecked(USER1); - let owner = Addr::unchecked(OWNER1); - - let mut app = mock_app(&owner); - - let token_code_id = store_token_code(&mut app); - - let cw20_token_instance = - instantiate_token(&mut app, token_code_id, "NTRN", Some(1_000_000_000_000_000)); - - let vesting_instance = instantiate_vesting(&mut app, &cw20_token_instance); - - let msg = Cw20ExecuteMsg::Send { - contract: vesting_instance.to_string(), - msg: to_binary(&Cw20HookMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![ - VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(101).seconds(), - amount: Uint128::new(200), - }), - }, - VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(110).seconds(), - amount: Uint128::new(100), - }), - }, - VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(200).seconds(), - amount: Uint128::new(100), - }), - }, - ], - }], - }) - .unwrap(), - amount: Uint128::from(300u128), - }; - - let res = app - .execute_contract(owner.clone(), cw20_token_instance.clone(), &msg, &[]) - .unwrap_err(); - assert_eq!(res.root_cause().to_string(), "Vesting schedule amount error. The total amount should be equal to the CW20 receive amount."); - - let msg = Cw20ExecuteMsg::Send { - contract: vesting_instance.to_string(), - msg: to_binary(&Cw20HookMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![ - VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(101).seconds(), - amount: Uint128::new(100), - }), - }, - VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(110).seconds(), - amount: Uint128::new(100), - }), - }, - VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(200).seconds(), - amount: Uint128::new(100), - }), - }, - ], - }], - }) - .unwrap(), - amount: Uint128::from(300u128), - }; - - app.execute_contract(owner.clone(), cw20_token_instance.clone(), &msg, &[]) - .unwrap(); - - let msg = QueryMsg::AvailableAmount { - address: user1.to_string(), - }; - - let user1_vesting_amount: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &msg) - .unwrap(); - assert_eq!(user1_vesting_amount.clone(), Uint128::new(300u128)); - - // Check owner balance - check_token_balance( - &mut app, - &cw20_token_instance, - &owner, - TOKEN_INITIAL_AMOUNT - 300u128, - ); - - // Check vesting balance - check_token_balance(&mut app, &cw20_token_instance, &vesting_instance, 300u128); - - let msg = ExecuteMsg::Claim { - recipient: None, - amount: None, - }; - let _res = app - .execute_contract(user1.clone(), vesting_instance.clone(), &msg, &[]) - .unwrap(); - - let msg = QueryMsg::VestingAccount { - address: user1.to_string(), - }; - - let vesting_res: VestingAccountResponse = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &msg) - .unwrap(); - assert_eq!(vesting_res.info.released_amount, Uint128::from(300u128)); - - // Check vesting balance - check_token_balance(&mut app, &cw20_token_instance, &vesting_instance, 0u128); - - // Check user balance - check_token_balance(&mut app, &cw20_token_instance, &user1, 300u128); - - // Owner balance mustn't change after claim - check_token_balance( - &mut app, - &cw20_token_instance, - &owner.clone(), - TOKEN_INITIAL_AMOUNT - 300u128, - ); - - let msg = QueryMsg::AvailableAmount { - address: user1.to_string(), - }; - - // Check user balance after claim - let user1_vesting_amount: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &msg) - .unwrap(); - - assert_eq!(user1_vesting_amount.clone(), Uint128::new(0u128)); -} - -#[test] -fn claim_native() { - let user1 = Addr::unchecked(USER1); - let owner = Addr::unchecked(OWNER1); - - let mut app = mock_app(&owner); - - let token_code_id = store_token_code(&mut app); - - let random_token_instance = - instantiate_token(&mut app, token_code_id, "RND", Some(1_000_000_000)); - - mint_tokens(&mut app, &random_token_instance, &owner, 1_000_000_000); - - let vesting_instance = instantiate_vesting_remote_chain(&mut app); - - let msg = Cw20ExecuteMsg::Send { - contract: vesting_instance.to_string(), - msg: to_binary(&Cw20HookMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(101).seconds(), - amount: Uint128::new(200), - }), - }], - }], - }) - .unwrap(), - amount: Uint128::from(300u128), - }; - - let err = app - .execute_contract(owner.clone(), random_token_instance.clone(), &msg, &[]) - .unwrap_err(); - assert_eq!(ContractError::Unauthorized {}, err.downcast().unwrap()); - - let msg = ExecuteMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![ - VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(101).seconds(), - amount: Uint128::new(100), - }), - }, - VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(110).seconds(), - amount: Uint128::new(100), - }), - }, - VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(200).seconds(), - amount: Uint128::new(100), - }), - }, - ], - }], - }; - - app.execute_contract( - owner.clone(), - vesting_instance.clone(), - &msg, - &coins(300, VESTING_TOKEN), - ) - .unwrap(); - - let msg = QueryMsg::AvailableAmount { - address: user1.to_string(), - }; - - let user1_vesting_amount: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &msg) - .unwrap(); - assert_eq!(user1_vesting_amount.clone(), Uint128::new(300u128)); - - // Check owner balance - let bal = query_balance(&app.wrap(), &owner, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, TOKEN_INITIAL_AMOUNT - 300u128); - - // Check vesting balance - let bal = query_balance(&app.wrap(), &vesting_instance, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, 300u128); - - let msg = ExecuteMsg::Claim { - recipient: None, - amount: None, - }; - app.execute_contract(user1.clone(), vesting_instance.clone(), &msg, &[]) - .unwrap(); - - let vesting_res: VestingAccountResponse = app - .wrap() - .query_wasm_smart( - vesting_instance.clone(), - &QueryMsg::VestingAccount { - address: user1.to_string(), - }, - ) - .unwrap(); - assert_eq!(vesting_res.info.released_amount, Uint128::from(300u128)); - - // Check vesting balance - let bal = query_balance(&app.wrap(), &vesting_instance, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, 0); - - // Check user balance - let bal = query_balance(&app.wrap(), &user1, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, 300); - - // Owner balance mustn't change after claim - let bal = query_balance(&app.wrap(), &owner, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, TOKEN_INITIAL_AMOUNT - 300u128); - - let msg = QueryMsg::AvailableAmount { - address: user1.to_string(), - }; - - // Check user balance after claim - let user1_vesting_amount: Uint128 = - app.wrap().query_wasm_smart(vesting_instance, &msg).unwrap(); - - assert_eq!(user1_vesting_amount.clone(), Uint128::new(0u128)); -} - -#[test] -fn register_vesting_accounts() { - let user1 = Addr::unchecked(USER1); - let user2 = Addr::unchecked(USER2); - let owner = Addr::unchecked(OWNER1); - - let mut app = mock_app(&owner); - - let token_code_id = store_token_code(&mut app); - - let cw20_token_instance = - instantiate_token(&mut app, token_code_id, "NTRN", Some(1_000_000_000_000_000)); - - let noname_token_instance = instantiate_token( - &mut app, - token_code_id, - "NONAME", - Some(1_000_000_000_000_000), - ); - - mint_tokens( - &mut app, - &noname_token_instance, - &owner, - TOKEN_INITIAL_AMOUNT, - ); - - let vesting_instance = instantiate_vesting(&mut app, &cw20_token_instance); - - let msg = Cw20ExecuteMsg::Send { - contract: vesting_instance.to_string(), - msg: to_binary(&Cw20HookMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(150).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::new(100), - }), - }], - }], - }) - .unwrap(), - amount: Uint128::from(100u128), - }; - - let res = app - .execute_contract(owner.clone(), cw20_token_instance.clone(), &msg, &[]) - .unwrap_err(); - assert_eq!(res.root_cause().to_string(), "Vesting schedule error on addr: user1. Should satisfy: (start < end and at_start < total) or (start = end and at_start = total)"); - - let msg = Cw20ExecuteMsg::Send { - contract: vesting_instance.to_string(), - msg: to_binary(&Cw20HookMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(150).seconds(), - amount: Uint128::new(100), - }), - }], - }], - }) - .unwrap(), - amount: Uint128::from(100u128), - }; - - let res = app - .execute_contract( - user1.clone(), - cw20_token_instance.clone(), - &msg.clone(), - &[], - ) - .unwrap_err(); - assert_eq!(res.root_cause().to_string(), "Cannot Sub with 0 and 100"); - - let res = app - .execute_contract(owner.clone(), noname_token_instance.clone(), &msg, &[]) - .unwrap_err(); - assert_eq!(res.root_cause().to_string(), "Unauthorized"); - - // Checking that execute endpoint with native coin is unreachable if the asset is a cw20 token - let native_msg = ExecuteMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(150).seconds(), - amount: Uint128::new(100), - }), - }], - }], - }; - - let err = app - .execute_contract( - owner.clone(), - vesting_instance.clone(), - &native_msg, - &coins(100u128, "random_coin"), - ) - .unwrap_err(); - assert_eq!(ContractError::Unauthorized {}, err.downcast().unwrap()); - - let _res = app - .execute_contract(owner.clone(), cw20_token_instance.clone(), &msg, &[]) - .unwrap(); - - let msg = QueryMsg::AvailableAmount { - address: user1.to_string(), - }; - - let user1_vesting_amount: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &msg) - .unwrap(); - - assert_eq!(user1_vesting_amount.clone(), Uint128::new(100u128)); - check_token_balance( - &mut app, - &cw20_token_instance, - &owner.clone(), - TOKEN_INITIAL_AMOUNT - 100u128, - ); - check_token_balance(&mut app, &cw20_token_instance, &vesting_instance, 100u128); - - // Let's check user1's final vesting amount after add schedule for a new one - let msg = Cw20ExecuteMsg::Send { - contract: vesting_instance.to_string(), - msg: to_binary(&Cw20HookMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user2.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(150).seconds(), - amount: Uint128::new(200), - }), - }], - }], - }) - .unwrap(), - amount: Uint128::from(200u128), - }; - - let _res = app - .execute_contract(owner.clone(), cw20_token_instance.clone(), &msg, &[]) - .unwrap(); - - let msg = QueryMsg::AvailableAmount { - address: user2.to_string(), - }; - - let user2_vesting_amount: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &msg) - .unwrap(); - - check_token_balance( - &mut app, - &cw20_token_instance, - &owner.clone(), - TOKEN_INITIAL_AMOUNT - 300u128, - ); - check_token_balance(&mut app, &cw20_token_instance, &vesting_instance, 300u128); - // A new schedule has been added successfully and an old one hasn't changed. - // The new schedule doesn't have the same value as the old one. - assert_eq!(user2_vesting_amount, Uint128::new(200u128)); - assert_eq!(user1_vesting_amount, Uint128::from(100u128)); - - // Add one more vesting schedule; final amount to vest must increase - let msg = Cw20ExecuteMsg::Send { - contract: vesting_instance.to_string(), - msg: to_binary(&Cw20HookMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(200).seconds(), - amount: Uint128::new(10), - }), - }], - }], - }) - .unwrap(), - amount: Uint128::from(10u128), - }; - - let _res = app - .execute_contract(owner.clone(), cw20_token_instance.clone(), &msg, &[]) - .unwrap(); - - let msg = QueryMsg::AvailableAmount { - address: user1.to_string(), - }; - - let vesting_res: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &msg) - .unwrap(); - - assert_eq!(vesting_res, Uint128::new(110u128)); - check_token_balance( - &mut app, - &cw20_token_instance, - &owner.clone(), - TOKEN_INITIAL_AMOUNT - 310u128, - ); - check_token_balance(&mut app, &cw20_token_instance, &vesting_instance, 310u128); - - let msg = ExecuteMsg::Claim { - recipient: None, - amount: None, - }; - let _res = app - .execute_contract(user1.clone(), vesting_instance.clone(), &msg, &[]) - .unwrap(); - - let msg = QueryMsg::VestingAccount { - address: user1.to_string(), - }; - - let vesting_res: VestingAccountResponse = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &msg) - .unwrap(); - assert_eq!(vesting_res.info.released_amount, Uint128::from(110u128)); - check_token_balance(&mut app, &cw20_token_instance, &vesting_instance, 200u128); - check_token_balance(&mut app, &cw20_token_instance, &user1, 110u128); - - // Owner balance mustn't change after claim - check_token_balance( - &mut app, - &cw20_token_instance, - &owner.clone(), - TOKEN_INITIAL_AMOUNT - 310u128, - ); -} - -#[test] -fn register_vesting_accounts_native() { - let user1 = Addr::unchecked(USER1); - let user2 = Addr::unchecked(USER2); - let owner = Addr::unchecked(OWNER1); - - let mut app = mock_app(&owner); - - let token_code_id = store_token_code(&mut app); - - let random_token_instance = - instantiate_token(&mut app, token_code_id, "RND", Some(1_000_000_000_000_000)); - - mint_tokens( - &mut app, - &random_token_instance, - &owner, - TOKEN_INITIAL_AMOUNT, - ); - - let vesting_instance = instantiate_vesting_remote_chain(&mut app); - - let msg = Cw20ExecuteMsg::Send { - contract: vesting_instance.to_string(), - msg: to_binary(&Cw20HookMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(150).seconds(), - amount: Uint128::new(100), - }), - }], - }], - }) - .unwrap(), - amount: Uint128::from(100u128), - }; - - let err = app - .execute_contract(owner.clone(), random_token_instance.clone(), &msg, &[]) - .unwrap_err(); - assert_eq!(ContractError::Unauthorized {}, err.downcast().unwrap()); - - // Checking that execute endpoint with random native coin is unreachable - let native_msg = ExecuteMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(150).seconds(), - amount: Uint128::new(100), - }), - }], - }], - }; - - let err = app - .execute_contract( - owner.clone(), - vesting_instance.clone(), - &native_msg, - &coins(100u128, "random_coin"), - ) - .unwrap_err(); - assert_eq!( - ContractError::PaymentError(PaymentError::MissingDenom("vesting_token".to_string())), - err.downcast().unwrap() - ); - - app.execute_contract( - owner.clone(), - vesting_instance.clone(), - &native_msg, - &coins(100u128, VESTING_TOKEN), - ) - .unwrap(); - - let msg = QueryMsg::AvailableAmount { - address: user1.to_string(), - }; - - let user1_vesting_amount: Uint128 = app - .wrap() - .query_wasm_smart(&vesting_instance, &msg) - .unwrap(); - assert_eq!(user1_vesting_amount.u128(), 100u128); - - let bal = query_balance(&app.wrap(), &owner, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, TOKEN_INITIAL_AMOUNT - 100u128); - - let bal = query_balance(&app.wrap(), &vesting_instance, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, 100); - - // Let's check user1's final vesting amount after add schedule for a new one - let msg = ExecuteMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user2.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(150).seconds(), - amount: Uint128::new(200), - }), - }], - }], - }; - - app.execute_contract( - owner.clone(), - vesting_instance.clone(), - &msg, - &coins(200, VESTING_TOKEN), - ) - .unwrap(); - - let msg = QueryMsg::AvailableAmount { - address: user2.to_string(), - }; - - let user2_vesting_amount: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &msg) - .unwrap(); - - let bal = query_balance(&app.wrap(), &owner, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, TOKEN_INITIAL_AMOUNT - 300u128); - let bal = query_balance(&app.wrap(), &vesting_instance, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, 300u128); - - // A new schedule has been added successfully and an old one hasn't changed. - // The new schedule doesn't have the same value as the old one. - assert_eq!(user2_vesting_amount, Uint128::new(200u128)); - assert_eq!(user1_vesting_amount, Uint128::from(100u128)); - - // Add one more vesting schedule; final amount to vest must increase - let msg = ExecuteMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: Timestamp::from_seconds(100).seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: Timestamp::from_seconds(200).seconds(), - amount: Uint128::new(10), - }), - }], - }], - }; - - app.execute_contract( - owner.clone(), - vesting_instance.clone(), - &msg, - &coins(10, VESTING_TOKEN), - ) - .unwrap(); - - let msg = QueryMsg::AvailableAmount { - address: user1.to_string(), - }; - - let vesting_res: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &msg) - .unwrap(); - assert_eq!(vesting_res, Uint128::new(110u128)); - - let bal = query_balance(&app.wrap(), &owner, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, TOKEN_INITIAL_AMOUNT - 310u128); - let bal = query_balance(&app.wrap(), &vesting_instance, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, 310u128); - - let msg = ExecuteMsg::Claim { - recipient: None, - amount: None, - }; - let _res = app - .execute_contract(user1.clone(), vesting_instance.clone(), &msg, &[]) - .unwrap(); - - let msg = QueryMsg::VestingAccount { - address: user1.to_string(), - }; - - let vesting_res: VestingAccountResponse = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &msg) - .unwrap(); - assert_eq!(vesting_res.info.released_amount, Uint128::from(110u128)); - - let bal = query_balance(&app.wrap(), &vesting_instance, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, 200); - let bal = query_balance(&app.wrap(), &user1, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, 110u128); - - let bal = query_balance(&app.wrap(), &owner, VESTING_TOKEN) - .unwrap() - .u128(); - assert_eq!(bal, TOKEN_INITIAL_AMOUNT - 310u128); -} - -#[test] -fn query_at_height() { - let user1 = Addr::unchecked(USER1); - let user2 = Addr::unchecked(USER2); - let owner = Addr::unchecked(OWNER1); - - let mut app = mock_app(&owner); - let start_block_height = app.block_info().height; - - let vesting_instance = instantiate_vesting_remote_chain(&mut app); - - let native_msg = ExecuteMsg::RegisterVestingAccounts { - vesting_accounts: vec![ - VestingAccount { - address: user1.to_string(), - schedules: vec![ - VestingSchedule { - start_point: VestingSchedulePoint { - time: app.block_info().time.seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: app - .block_info() - .time - .plus_seconds(100 * BLOCK_TIME) - .seconds(), - amount: Uint128::new(50), - }), - }, - VestingSchedule { - start_point: VestingSchedulePoint { - time: app.block_info().time.seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: app - .block_info() - .time - .plus_seconds(100 * BLOCK_TIME) - .seconds(), - amount: Uint128::new(150), - }), - }, - ], - }, - VestingAccount { - address: user2.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: app.block_info().time.seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: app - .block_info() - .time - .plus_seconds(100 * BLOCK_TIME) - .seconds(), - amount: Uint128::new(1000), - }), - }], - }, - ], - }; - - app.execute_contract( - owner, - vesting_instance.clone(), - &native_msg, - &coins(1200, VESTING_TOKEN), - ) - .unwrap(); - - let query = QueryMsg::AvailableAmount { - address: user1.to_string(), - }; - - for _ in 1..=10 { - let vesting_res: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &query) - .unwrap(); - assert_eq!(vesting_res, Uint128::new(0u128)); - - app.update_block(|b| { - b.height += 10; - b.time = b.time.plus_seconds(10 * BLOCK_TIME) - }); - - let vesting_res: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &query) - .unwrap(); - assert_eq!(vesting_res, Uint128::new(20u128)); - - let msg = ExecuteMsg::Claim { - recipient: None, - amount: None, - }; - let _res = app - .execute_contract(user1.clone(), vesting_instance.clone(), &msg, &[]) - .unwrap(); - - let vesting_res: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &query) - .unwrap(); - assert_eq!(vesting_res, Uint128::new(0u128)); - } - app.update_block(|b| { - b.height += 100; - b.time = b.time.plus_seconds(100 * BLOCK_TIME) - }); - let vesting_res: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &query) - .unwrap(); - assert_eq!(vesting_res, Uint128::new(0u128)); - - let query_user_unclamed = QueryMsg::HistoricalExtension { - msg: QueryMsgHistorical::UnclaimedAmountAtHeight { - address: user1.to_string(), - height: start_block_height - 1, - }, - }; - let vesting_res: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &query_user_unclamed) - .unwrap(); - assert_eq!(vesting_res, Uint128::new(0u128)); - - let query_total_unclamed = QueryMsg::HistoricalExtension { - msg: QueryMsgHistorical::UnclaimedTotalAmountAtHeight { - height: start_block_height - 1, - }, - }; - let vesting_res: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &query_total_unclamed) - .unwrap(); - assert_eq!(vesting_res, Uint128::new(0u128)); - let max_unclaimed_user1: u128 = 200; - let max_unclaimed_total: u128 = 1200; - for i in 0..=10 { - let query = QueryMsg::HistoricalExtension { - msg: QueryMsgHistorical::UnclaimedAmountAtHeight { - address: user1.to_string(), - height: start_block_height + 1 + i * 10, - }, - }; - let vesting_res: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &query) - .unwrap(); - assert_eq!( - vesting_res, - Uint128::new(max_unclaimed_user1 - (i as u128) * 20) - ); - - let query_total_unclamed = QueryMsg::HistoricalExtension { - msg: QueryMsgHistorical::UnclaimedTotalAmountAtHeight { - height: start_block_height + 1 + i * 10, - }, - }; - let vesting_res: Uint128 = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &query_total_unclamed) - .unwrap(); - assert_eq!( - vesting_res, - Uint128::new(max_unclaimed_total - (i as u128) * 20) - ); - } -} - -#[test] -fn vesting_managers() { - let user1 = Addr::unchecked(USER1); - let user2 = Addr::unchecked(USER2); - let owner = Addr::unchecked(OWNER1); - - let mut app = mock_app(&owner); - let vesting_instance = instantiate_vesting_remote_chain(&mut app); - - let query = QueryMsg::WithManagersExtension { - msg: QueryMsgWithManagers::VestingManagers {}, - }; - let vesting_res: Vec = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &query) - .unwrap(); - assert_eq!(vesting_res.len(), 0,); - - let native_msg = ExecuteMsg::RegisterVestingAccounts { - vesting_accounts: vec![VestingAccount { - address: user1.to_string(), - schedules: vec![VestingSchedule { - start_point: VestingSchedulePoint { - time: app.block_info().time.seconds(), - amount: Uint128::zero(), - }, - end_point: Some(VestingSchedulePoint { - time: app - .block_info() - .time - .plus_seconds(100 * BLOCK_TIME) - .seconds(), - amount: Uint128::new(50), - }), - }], - }], - }; - let err = app - .execute_contract(user1.clone(), vesting_instance.clone(), &native_msg, &[]) - .unwrap_err(); - assert_eq!(ContractError::Unauthorized {}, err.downcast().unwrap()); - - let add_manager_msg = ExecuteMsg::WithManagersExtension { - msg: ExecuteMsgWithManagers::AddVestingManagers { - managers: vec![user1.to_string()], - }, - }; - - let err = app - .execute_contract( - user1.clone(), - vesting_instance.clone(), - &add_manager_msg, - &[], - ) - .unwrap_err(); - assert_eq!(ContractError::Unauthorized {}, err.downcast().unwrap()); - - let _res = app - .execute_contract( - owner.clone(), - vesting_instance.clone(), - &add_manager_msg, - &[], - ) - .unwrap(); - - let vesting_res: Vec = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &query) - .unwrap(); - assert_eq!(vesting_res, vec![Addr::unchecked(user1.clone())]); - - app.send_tokens(owner.clone(), user1.clone(), &coins(50, VESTING_TOKEN)) - .unwrap(); - - let _res = app - .execute_contract( - user1.clone(), - vesting_instance.clone(), - &native_msg, - &coins(50, VESTING_TOKEN), - ) - .unwrap(); - let err = app - .execute_contract(user2, vesting_instance.clone(), &native_msg, &[]) - .unwrap_err(); - assert_eq!(ContractError::Unauthorized {}, err.downcast().unwrap()); - - let remove_manager_msg = ExecuteMsg::WithManagersExtension { - msg: ExecuteMsgWithManagers::RemoveVestingManagers { - managers: vec![user1.to_string()], - }, - }; - let err = app - .execute_contract(user1, vesting_instance.clone(), &remove_manager_msg, &[]) - .unwrap_err(); - assert_eq!(ContractError::Unauthorized {}, err.downcast().unwrap()); - - let _res = app - .execute_contract(owner, vesting_instance.clone(), &remove_manager_msg, &[]) - .unwrap(); - - let vesting_res: Vec = app - .wrap() - .query_wasm_smart(vesting_instance, &query) - .unwrap(); - assert_eq!(vesting_res.len(), 0); -} - -fn mock_app(owner: &Addr) -> App { - App::new(|app, _, storage| { - app.bank - .init_balance( - storage, - owner, - vec![ - coin(TOKEN_INITIAL_AMOUNT, VESTING_TOKEN), - coin(10_000_000_000u128, "random_coin"), - ], - ) - .unwrap() - }) -} - -fn store_token_code(app: &mut App) -> u64 { - let cw20_token_contract = Box::new(ContractWrapper::new_with_empty( - astroport_token::contract::execute, - astroport_token::contract::instantiate, - astroport_token::contract::query, - )); - - app.store_code(cw20_token_contract) -} - -fn instantiate_token(app: &mut App, token_code_id: u64, name: &str, cap: Option) -> Addr { - let name = String::from(name); - - let msg = TokenInstantiateMsg { - name: name.clone(), - symbol: name.clone(), - decimals: 6, - initial_balances: vec![], - mint: Some(MinterResponse { - minter: String::from(OWNER1), - cap: cap.map(Uint128::from), - }), - marketing: None, - }; - - app.instantiate_contract( - token_code_id, - Addr::unchecked(OWNER1), - &msg, - &[], - name, - None, - ) - .unwrap() -} - -fn instantiate_vesting(app: &mut App, cw20_token_instance: &Addr) -> Addr { - let vesting_contract = Box::new(ContractWrapper::new_with_empty( - crate::contract::execute, - crate::contract::instantiate, - crate::contract::query, - )); - let owner = Addr::unchecked(OWNER1); - let vesting_code_id = app.store_code(vesting_contract); - - let init_msg = InstantiateMsg { - owner: OWNER1.to_string(), - token_info_manager: TOKEN_MANAGER.to_string(), - xyk_vesting_lp_contract: "test".to_string(), - vesting_managers: vec![], - vesting_token: token_asset_info(cw20_token_instance.clone()), - }; - - let vesting_instance = app - .instantiate_contract( - vesting_code_id, - owner.clone(), - &init_msg, - &[], - "Vesting", - None, - ) - .unwrap(); - let res: Config = app - .wrap() - .query_wasm_smart(vesting_instance.clone(), &QueryMsg::Config {}) - .unwrap(); - assert_eq!( - cw20_token_instance.to_string(), - res.vesting_token.unwrap().to_string() - ); - - mint_tokens(app, cw20_token_instance, &owner, TOKEN_INITIAL_AMOUNT); - - check_token_balance(app, cw20_token_instance, &owner, TOKEN_INITIAL_AMOUNT); - - vesting_instance -} - -fn instantiate_vesting_remote_chain(app: &mut App) -> Addr { - let vesting_contract = Box::new(ContractWrapper::new_with_empty( - crate::contract::execute, - crate::contract::instantiate, - crate::contract::query, - )); - let owner = Addr::unchecked(OWNER1); - let vesting_code_id = app.store_code(vesting_contract); - - let init_msg = InstantiateMsg { - owner: OWNER1.to_string(), - token_info_manager: TOKEN_MANAGER.to_string(), - vesting_managers: vec![], - vesting_token: native_asset_info(VESTING_TOKEN.to_string()), - xyk_vesting_lp_contract: "test".to_string(), - }; - - app.instantiate_contract(vesting_code_id, owner, &init_msg, &[], "Vesting", None) - .unwrap() -} - -fn mint_tokens(app: &mut App, token: &Addr, recipient: &Addr, amount: u128) { - let msg = Cw20ExecuteMsg::Mint { - recipient: recipient.to_string(), - amount: Uint128::from(amount), - }; - - app.execute_contract(Addr::unchecked(OWNER1), token.to_owned(), &msg, &[]) - .unwrap(); -} - -fn check_token_balance(app: &mut App, token: &Addr, address: &Addr, expected: u128) { - let msg = Cw20QueryMsg::Balance { - address: address.to_string(), - }; - let res: StdResult = app.wrap().query_wasm_smart(token, &msg); - assert_eq!(res.unwrap().balance, Uint128::from(expected)); -} diff --git a/contracts/vesting-lp-pcl/src/tests/mod.rs b/contracts/vesting-lp-pcl/src/tests/mod.rs deleted file mode 100644 index 6d3bbe60..00000000 --- a/contracts/vesting-lp-pcl/src/tests/mod.rs +++ /dev/null @@ -1 +0,0 @@ -mod integration; diff --git a/contracts/vesting-lp/examples/vesting-lp_schema.rs b/contracts/vesting-lp/examples/vesting-lp_schema.rs index 90284134..9f654a21 100644 --- a/contracts/vesting-lp/examples/vesting-lp_schema.rs +++ b/contracts/vesting-lp/examples/vesting-lp_schema.rs @@ -1,6 +1,6 @@ use cosmwasm_schema::write_api; -use vesting_base::msg::{ExecuteMsg, MigrateMsg, QueryMsg}; -use vesting_lp::msg::InstantiateMsg; +use vesting_lp::msg::{ExecuteMsg, MigrateMsg, InstantiateMsg}; +use vesting_base::msg:: QueryMsg; fn main() { write_api! { diff --git a/contracts/vesting-lp/examples/vesting_schema.rs b/contracts/vesting-lp/examples/vesting_schema.rs index 90284134..9be67c43 100644 --- a/contracts/vesting-lp/examples/vesting_schema.rs +++ b/contracts/vesting-lp/examples/vesting_schema.rs @@ -1,6 +1,6 @@ use cosmwasm_schema::write_api; -use vesting_base::msg::{ExecuteMsg, MigrateMsg, QueryMsg}; -use vesting_lp::msg::InstantiateMsg; +use vesting_lp::msg::{ExecuteMsg, MigrateMsg, InstantiateMsg}; +use vesting_base::msg::QueryMsg; fn main() { write_api! { diff --git a/contracts/vesting-lp/schema/raw/execute.json b/contracts/vesting-lp/schema/raw/execute.json index e5aa732d..c981b115 100644 --- a/contracts/vesting-lp/schema/raw/execute.json +++ b/contracts/vesting-lp/schema/raw/execute.json @@ -1,31 +1,29 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "ExecuteMsg", - "description": "This structure describes the execute messages available in a vesting contract.", "oneOf": [ { - "description": "Claim claims vested tokens and sends them to a recipient", "type": "object", "required": [ - "claim" + "base" ], "properties": { - "claim": { + "base": { + "$ref": "#/definitions/ExecuteMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "migrate_liquidity_to_pcl_pool" + ], + "properties": { + "migrate_liquidity_to_pcl_pool": { "type": "object", "properties": { - "amount": { - "description": "The amount of tokens to claim", - "anyOf": [ - { - "$ref": "#/definitions/Uint128" - }, - { - "type": "null" - } - ] - }, - "recipient": { - "description": "The address that receives the vested tokens", + "user": { "type": [ "string", "null" @@ -38,213 +36,369 @@ "additionalProperties": false }, { - "description": "Receives a message of type [`Cw20ReceiveMsg`] and processes it depending on the received template", + "description": "Callbacks; only callable by the contract itself.", "type": "object", "required": [ - "receive" + "callback" ], "properties": { - "receive": { - "$ref": "#/definitions/Cw20ReceiveMsg" + "callback": { + "$ref": "#/definitions/CallbackMsg" } }, "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" }, - { - "description": "RegisterVestingAccounts registers vesting targets/accounts", - "type": "object", - "required": [ - "register_vesting_accounts" - ], - "properties": { - "register_vesting_accounts": { + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", "type": "object", "required": [ - "vesting_accounts" + "token" ], "properties": { - "vesting_accounts": { - "type": "array", - "items": { - "$ref": "#/definitions/VestingAccount" - } + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Creates a request to change contract ownership ## Executor Only the current owner can execute this", - "type": "object", - "required": [ - "propose_new_owner" - ], - "properties": { - "propose_new_owner": { + }, + { + "description": "Native token", "type": "object", "required": [ - "expires_in", - "owner" + "native_token" ], "properties": { - "expires_in": { - "description": "The validity period of the offer to change the owner", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "owner": { - "description": "The newly proposed owner", - "type": "string" + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false } }, "additionalProperties": false } - }, - "additionalProperties": false + ] }, - { - "description": "Removes a request to change contract ownership ## Executor Only the current owner can execute this", - "type": "object", - "required": [ - "drop_ownership_proposal" - ], - "properties": { - "drop_ownership_proposal": { + "Binary": { + "description": "Binary is a wrapper around Vec 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. See also .", + "type": "string" + }, + "CallbackMsg": { + "oneOf": [ + { + "type": "object", + "required": [ + "migrate_liquidity_to_cl_pair" + ], + "properties": { + "migrate_liquidity_to_cl_pair": { + "type": "object", + "required": [ + "amount", + "cl_pair", + "ntrn_denom", + "paired_asset_denom", + "slippage_tolerance", + "user", + "xyk_lp_token", + "xyk_pair" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "cl_pair": { + "$ref": "#/definitions/Addr" + }, + "ntrn_denom": { + "type": "string" + }, + "paired_asset_denom": { + "type": "string" + }, + "slippage_tolerance": { + "$ref": "#/definitions/Decimal" + }, + "user": { + "$ref": "#/definitions/VestingAccountResponse" + }, + "xyk_lp_token": { + "$ref": "#/definitions/Addr" + }, + "xyk_pair": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { "type": "object", + "required": [ + "provide_liquidity_to_cl_pair_after_withdrawal" + ], + "properties": { + "provide_liquidity_to_cl_pair_after_withdrawal": { + "type": "object", + "required": [ + "cl_pair", + "ntrn_denom", + "ntrn_init_balance", + "paired_asset_denom", + "paired_asset_init_balance", + "slippage_tolerance", + "user" + ], + "properties": { + "cl_pair": { + "$ref": "#/definitions/Addr" + }, + "ntrn_denom": { + "type": "string" + }, + "ntrn_init_balance": { + "$ref": "#/definitions/Uint128" + }, + "paired_asset_denom": { + "type": "string" + }, + "paired_asset_init_balance": { + "$ref": "#/definitions/Uint128" + }, + "slippage_tolerance": { + "$ref": "#/definitions/Decimal" + }, + "user": { + "$ref": "#/definitions/VestingAccountResponse" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "post_migration_vesting_reschedule" + ], + "properties": { + "post_migration_vesting_reschedule": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "$ref": "#/definitions/VestingAccountResponse" + } + }, + "additionalProperties": false + } + }, "additionalProperties": false } - }, - "additionalProperties": false + ] }, - { - "description": "Claims contract ownership ## Executor Only the newly proposed owner can execute this", + "Cw20ReceiveMsg": { + "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg", "type": "object", "required": [ - "claim_ownership" + "amount", + "msg", + "sender" ], "properties": { - "claim_ownership": { - "type": "object", - "additionalProperties": false + "amount": { + "$ref": "#/definitions/Uint128" + }, + "msg": { + "$ref": "#/definitions/Binary" + }, + "sender": { + "type": "string" } }, "additionalProperties": false }, - { - "description": "Sets vesting token ## Executor Only the current owner or token info manager can execute this", - "type": "object", - "required": [ - "set_vesting_token" - ], - "properties": { - "set_vesting_token": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "ExecuteMsg": { + "description": "This structure describes the execute messages available in a vesting contract.", + "oneOf": [ + { + "description": "Claim claims vested tokens and sends them to a recipient", "type": "object", "required": [ - "vesting_token" + "claim" ], "properties": { - "vesting_token": { - "$ref": "#/definitions/AssetInfo" + "claim": { + "type": "object", + "properties": { + "amount": { + "description": "The amount of tokens to claim", + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "recipient": { + "description": "The address that receives the vested tokens", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the managed extension for vesting contracts.", - "type": "object", - "required": [ - "managed_extension" - ], - "properties": { - "managed_extension": { + }, + { + "description": "Receives a message of type [`Cw20ReceiveMsg`] and processes it depending on the received template", "type": "object", "required": [ - "msg" + "receive" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgManaged" + "receive": { + "$ref": "#/definitions/Cw20ReceiveMsg" } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the with_managers extension for vesting contracts.", - "type": "object", - "required": [ - "with_managers_extension" - ], - "properties": { - "with_managers_extension": { + }, + { + "description": "RegisterVestingAccounts registers vesting targets/accounts", "type": "object", "required": [ - "msg" + "register_vesting_accounts" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgWithManagers" + "register_vesting_accounts": { + "type": "object", + "required": [ + "vesting_accounts" + ], + "properties": { + "vesting_accounts": { + "type": "array", + "items": { + "$ref": "#/definitions/VestingAccount" + } + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the historical extension for vesting contracts.", - "type": "object", - "required": [ - "historical_extension" - ], - "properties": { - "historical_extension": { + }, + { + "description": "Creates a request to change contract ownership ## Executor Only the current owner can execute this", "type": "object", "required": [ - "msg" + "propose_new_owner" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgHistorical" + "propose_new_owner": { + "type": "object", + "required": [ + "expires_in", + "owner" + ], + "properties": { + "expires_in": { + "description": "The validity period of the offer to change the owner", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "owner": { + "description": "The newly proposed owner", + "type": "string" + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - } - ], - "definitions": { - "Addr": { - "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", - "type": "string" - }, - "AssetInfo": { - "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", - "oneOf": [ + }, { - "description": "Non-native Token", + "description": "Removes a request to change contract ownership ## Executor Only the current owner can execute this", "type": "object", "required": [ - "token" + "drop_ownership_proposal" ], "properties": { - "token": { + "drop_ownership_proposal": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Claims contract ownership ## Executor Only the newly proposed owner can execute this", + "type": "object", + "required": [ + "claim_ownership" + ], + "properties": { + "claim_ownership": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Sets vesting token ## Executor Only the current owner or token info manager can execute this", + "type": "object", + "required": [ + "set_vesting_token" + ], + "properties": { + "set_vesting_token": { "type": "object", "required": [ - "contract_addr" + "vesting_token" ], "properties": { - "contract_addr": { - "$ref": "#/definitions/Addr" + "vesting_token": { + "$ref": "#/definitions/AssetInfo" } }, "additionalProperties": false @@ -253,53 +407,72 @@ "additionalProperties": false }, { - "description": "Native token", + "description": "Contains messages associated with the managed extension for vesting contracts.", "type": "object", "required": [ - "native_token" + "managed_extension" ], "properties": { - "native_token": { + "managed_extension": { "type": "object", "required": [ - "denom" + "msg" ], "properties": { - "denom": { - "type": "string" + "msg": { + "$ref": "#/definitions/ExecuteMsgManaged" } }, "additionalProperties": false } }, "additionalProperties": false - } - ] - }, - "Binary": { - "description": "Binary is a wrapper around Vec 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. See also .", - "type": "string" - }, - "Cw20ReceiveMsg": { - "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg", - "type": "object", - "required": [ - "amount", - "msg", - "sender" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" }, - "msg": { - "$ref": "#/definitions/Binary" + { + "description": "Contains messages associated with the with_managers extension for vesting contracts.", + "type": "object", + "required": [ + "with_managers_extension" + ], + "properties": { + "with_managers_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgWithManagers" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false }, - "sender": { - "type": "string" + { + "description": "Contains messages associated with the historical extension for vesting contracts.", + "type": "object", + "required": [ + "historical_extension" + ], + "properties": { + "historical_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgHistorical" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false } - }, - "additionalProperties": false + ] }, "ExecuteMsgHistorical": { "description": "This structure describes the execute messages available in a historical vesting contract.", @@ -422,6 +595,59 @@ }, "additionalProperties": false }, + "VestingAccountResponse": { + "description": "This structure describes a custom struct used to return vesting data about a specific vesting target.", + "type": "object", + "required": [ + "address", + "info" + ], + "properties": { + "address": { + "description": "The address that's vesting tokens", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "info": { + "description": "Vesting information", + "allOf": [ + { + "$ref": "#/definitions/VestingInfo" + } + ] + } + }, + "additionalProperties": false + }, + "VestingInfo": { + "description": "This structure stores parameters for a batch of vesting schedules.", + "type": "object", + "required": [ + "released_amount", + "schedules" + ], + "properties": { + "released_amount": { + "description": "The total amount of vested tokens already claimed", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "schedules": { + "description": "The vesting schedules", + "type": "array", + "items": { + "$ref": "#/definitions/VestingSchedule" + } + } + }, + "additionalProperties": false + }, "VestingSchedule": { "description": "This structure stores parameters for a specific vesting schedule", "type": "object", diff --git a/contracts/vesting-lp/schema/raw/migrate.json b/contracts/vesting-lp/schema/raw/migrate.json index 1b9dcecf..c8134b6c 100644 --- a/contracts/vesting-lp/schema/raw/migrate.json +++ b/contracts/vesting-lp/schema/raw/migrate.json @@ -3,5 +3,43 @@ "title": "MigrateMsg", "description": "This structure describes a migration message. We currently take no arguments for migrations.", "type": "object", - "additionalProperties": false + "required": [ + "cl_pair", + "max_slippage", + "new_lp_token", + "ntrn_denom", + "paired_denom", + "pcl_vesting", + "xyk_pair" + ], + "properties": { + "cl_pair": { + "type": "string" + }, + "max_slippage": { + "$ref": "#/definitions/Decimal" + }, + "new_lp_token": { + "type": "string" + }, + "ntrn_denom": { + "type": "string" + }, + "paired_denom": { + "type": "string" + }, + "pcl_vesting": { + "type": "string" + }, + "xyk_pair": { + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + } + } } diff --git a/contracts/vesting-lp/schema/vesting-lp.json b/contracts/vesting-lp/schema/vesting-lp.json index 395775f8..8a8f1873 100644 --- a/contracts/vesting-lp/schema/vesting-lp.json +++ b/contracts/vesting-lp/schema/vesting-lp.json @@ -34,31 +34,29 @@ "execute": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "ExecuteMsg", - "description": "This structure describes the execute messages available in a vesting contract.", "oneOf": [ { - "description": "Claim claims vested tokens and sends them to a recipient", "type": "object", "required": [ - "claim" + "base" ], "properties": { - "claim": { + "base": { + "$ref": "#/definitions/ExecuteMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "migrate_liquidity_to_pcl_pool" + ], + "properties": { + "migrate_liquidity_to_pcl_pool": { "type": "object", "properties": { - "amount": { - "description": "The amount of tokens to claim", - "anyOf": [ - { - "$ref": "#/definitions/Uint128" - }, - { - "type": "null" - } - ] - }, - "recipient": { - "description": "The address that receives the vested tokens", + "user": { "type": [ "string", "null" @@ -71,213 +69,369 @@ "additionalProperties": false }, { - "description": "Receives a message of type [`Cw20ReceiveMsg`] and processes it depending on the received template", + "description": "Callbacks; only callable by the contract itself.", "type": "object", "required": [ - "receive" + "callback" ], "properties": { - "receive": { - "$ref": "#/definitions/Cw20ReceiveMsg" + "callback": { + "$ref": "#/definitions/CallbackMsg" } }, "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" }, - { - "description": "RegisterVestingAccounts registers vesting targets/accounts", - "type": "object", - "required": [ - "register_vesting_accounts" - ], - "properties": { - "register_vesting_accounts": { + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", "type": "object", "required": [ - "vesting_accounts" + "token" ], "properties": { - "vesting_accounts": { - "type": "array", - "items": { - "$ref": "#/definitions/VestingAccount" - } + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Creates a request to change contract ownership ## Executor Only the current owner can execute this", - "type": "object", - "required": [ - "propose_new_owner" - ], - "properties": { - "propose_new_owner": { + }, + { + "description": "Native token", "type": "object", "required": [ - "expires_in", - "owner" + "native_token" ], "properties": { - "expires_in": { - "description": "The validity period of the offer to change the owner", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "owner": { - "description": "The newly proposed owner", - "type": "string" + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false } }, "additionalProperties": false } - }, - "additionalProperties": false + ] }, - { - "description": "Removes a request to change contract ownership ## Executor Only the current owner can execute this", - "type": "object", - "required": [ - "drop_ownership_proposal" - ], - "properties": { - "drop_ownership_proposal": { + "Binary": { + "description": "Binary is a wrapper around Vec 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. See also .", + "type": "string" + }, + "CallbackMsg": { + "oneOf": [ + { "type": "object", + "required": [ + "migrate_liquidity_to_cl_pair" + ], + "properties": { + "migrate_liquidity_to_cl_pair": { + "type": "object", + "required": [ + "amount", + "cl_pair", + "ntrn_denom", + "paired_asset_denom", + "slippage_tolerance", + "user", + "xyk_lp_token", + "xyk_pair" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "cl_pair": { + "$ref": "#/definitions/Addr" + }, + "ntrn_denom": { + "type": "string" + }, + "paired_asset_denom": { + "type": "string" + }, + "slippage_tolerance": { + "$ref": "#/definitions/Decimal" + }, + "user": { + "$ref": "#/definitions/VestingAccountResponse" + }, + "xyk_lp_token": { + "$ref": "#/definitions/Addr" + }, + "xyk_pair": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "provide_liquidity_to_cl_pair_after_withdrawal" + ], + "properties": { + "provide_liquidity_to_cl_pair_after_withdrawal": { + "type": "object", + "required": [ + "cl_pair", + "ntrn_denom", + "ntrn_init_balance", + "paired_asset_denom", + "paired_asset_init_balance", + "slippage_tolerance", + "user" + ], + "properties": { + "cl_pair": { + "$ref": "#/definitions/Addr" + }, + "ntrn_denom": { + "type": "string" + }, + "ntrn_init_balance": { + "$ref": "#/definitions/Uint128" + }, + "paired_asset_denom": { + "type": "string" + }, + "paired_asset_init_balance": { + "$ref": "#/definitions/Uint128" + }, + "slippage_tolerance": { + "$ref": "#/definitions/Decimal" + }, + "user": { + "$ref": "#/definitions/VestingAccountResponse" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "post_migration_vesting_reschedule" + ], + "properties": { + "post_migration_vesting_reschedule": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "$ref": "#/definitions/VestingAccountResponse" + } + }, + "additionalProperties": false + } + }, "additionalProperties": false } - }, - "additionalProperties": false + ] }, - { - "description": "Claims contract ownership ## Executor Only the newly proposed owner can execute this", + "Cw20ReceiveMsg": { + "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg", "type": "object", "required": [ - "claim_ownership" + "amount", + "msg", + "sender" ], "properties": { - "claim_ownership": { - "type": "object", - "additionalProperties": false + "amount": { + "$ref": "#/definitions/Uint128" + }, + "msg": { + "$ref": "#/definitions/Binary" + }, + "sender": { + "type": "string" } }, "additionalProperties": false }, - { - "description": "Sets vesting token ## Executor Only the current owner or token info manager can execute this", - "type": "object", - "required": [ - "set_vesting_token" - ], - "properties": { - "set_vesting_token": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "ExecuteMsg": { + "description": "This structure describes the execute messages available in a vesting contract.", + "oneOf": [ + { + "description": "Claim claims vested tokens and sends them to a recipient", "type": "object", "required": [ - "vesting_token" + "claim" ], "properties": { - "vesting_token": { - "$ref": "#/definitions/AssetInfo" + "claim": { + "type": "object", + "properties": { + "amount": { + "description": "The amount of tokens to claim", + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "recipient": { + "description": "The address that receives the vested tokens", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the managed extension for vesting contracts.", - "type": "object", - "required": [ - "managed_extension" - ], - "properties": { - "managed_extension": { + }, + { + "description": "Receives a message of type [`Cw20ReceiveMsg`] and processes it depending on the received template", "type": "object", "required": [ - "msg" + "receive" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgManaged" + "receive": { + "$ref": "#/definitions/Cw20ReceiveMsg" } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the with_managers extension for vesting contracts.", - "type": "object", - "required": [ - "with_managers_extension" - ], - "properties": { - "with_managers_extension": { + }, + { + "description": "RegisterVestingAccounts registers vesting targets/accounts", "type": "object", "required": [ - "msg" + "register_vesting_accounts" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgWithManagers" + "register_vesting_accounts": { + "type": "object", + "required": [ + "vesting_accounts" + ], + "properties": { + "vesting_accounts": { + "type": "array", + "items": { + "$ref": "#/definitions/VestingAccount" + } + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contains messages associated with the historical extension for vesting contracts.", - "type": "object", - "required": [ - "historical_extension" - ], - "properties": { - "historical_extension": { + }, + { + "description": "Creates a request to change contract ownership ## Executor Only the current owner can execute this", "type": "object", "required": [ - "msg" + "propose_new_owner" ], "properties": { - "msg": { - "$ref": "#/definitions/ExecuteMsgHistorical" + "propose_new_owner": { + "type": "object", + "required": [ + "expires_in", + "owner" + ], + "properties": { + "expires_in": { + "description": "The validity period of the offer to change the owner", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "owner": { + "description": "The newly proposed owner", + "type": "string" + } + }, + "additionalProperties": false } }, "additionalProperties": false - } - }, - "additionalProperties": false - } - ], - "definitions": { - "Addr": { - "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", - "type": "string" - }, - "AssetInfo": { - "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", - "oneOf": [ + }, { - "description": "Non-native Token", + "description": "Removes a request to change contract ownership ## Executor Only the current owner can execute this", "type": "object", "required": [ - "token" + "drop_ownership_proposal" ], "properties": { - "token": { + "drop_ownership_proposal": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Claims contract ownership ## Executor Only the newly proposed owner can execute this", + "type": "object", + "required": [ + "claim_ownership" + ], + "properties": { + "claim_ownership": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Sets vesting token ## Executor Only the current owner or token info manager can execute this", + "type": "object", + "required": [ + "set_vesting_token" + ], + "properties": { + "set_vesting_token": { "type": "object", "required": [ - "contract_addr" + "vesting_token" ], "properties": { - "contract_addr": { - "$ref": "#/definitions/Addr" + "vesting_token": { + "$ref": "#/definitions/AssetInfo" } }, "additionalProperties": false @@ -286,53 +440,72 @@ "additionalProperties": false }, { - "description": "Native token", + "description": "Contains messages associated with the managed extension for vesting contracts.", "type": "object", "required": [ - "native_token" + "managed_extension" ], "properties": { - "native_token": { + "managed_extension": { "type": "object", "required": [ - "denom" + "msg" ], "properties": { - "denom": { - "type": "string" + "msg": { + "$ref": "#/definitions/ExecuteMsgManaged" } }, "additionalProperties": false } }, "additionalProperties": false - } - ] - }, - "Binary": { - "description": "Binary is a wrapper around Vec 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. See also .", - "type": "string" - }, - "Cw20ReceiveMsg": { - "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg", - "type": "object", - "required": [ - "amount", - "msg", - "sender" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" }, - "msg": { - "$ref": "#/definitions/Binary" + { + "description": "Contains messages associated with the with_managers extension for vesting contracts.", + "type": "object", + "required": [ + "with_managers_extension" + ], + "properties": { + "with_managers_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgWithManagers" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false }, - "sender": { - "type": "string" + { + "description": "Contains messages associated with the historical extension for vesting contracts.", + "type": "object", + "required": [ + "historical_extension" + ], + "properties": { + "historical_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgHistorical" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false } - }, - "additionalProperties": false + ] }, "ExecuteMsgHistorical": { "description": "This structure describes the execute messages available in a historical vesting contract.", @@ -455,6 +628,59 @@ }, "additionalProperties": false }, + "VestingAccountResponse": { + "description": "This structure describes a custom struct used to return vesting data about a specific vesting target.", + "type": "object", + "required": [ + "address", + "info" + ], + "properties": { + "address": { + "description": "The address that's vesting tokens", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "info": { + "description": "Vesting information", + "allOf": [ + { + "$ref": "#/definitions/VestingInfo" + } + ] + } + }, + "additionalProperties": false + }, + "VestingInfo": { + "description": "This structure stores parameters for a batch of vesting schedules.", + "type": "object", + "required": [ + "released_amount", + "schedules" + ], + "properties": { + "released_amount": { + "description": "The total amount of vested tokens already claimed", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "schedules": { + "description": "The vesting schedules", + "type": "array", + "items": { + "$ref": "#/definitions/VestingSchedule" + } + } + }, + "additionalProperties": false + }, "VestingSchedule": { "description": "This structure stores parameters for a specific vesting schedule", "type": "object", @@ -806,7 +1032,45 @@ "title": "MigrateMsg", "description": "This structure describes a migration message. We currently take no arguments for migrations.", "type": "object", - "additionalProperties": false + "required": [ + "cl_pair", + "max_slippage", + "new_lp_token", + "ntrn_denom", + "paired_denom", + "pcl_vesting", + "xyk_pair" + ], + "properties": { + "cl_pair": { + "type": "string" + }, + "max_slippage": { + "$ref": "#/definitions/Decimal" + }, + "new_lp_token": { + "type": "string" + }, + "ntrn_denom": { + "type": "string" + }, + "paired_denom": { + "type": "string" + }, + "pcl_vesting": { + "type": "string" + }, + "xyk_pair": { + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + } + } }, "sudo": null, "responses": {