diff --git a/Cargo.lock b/Cargo.lock index e1863ae8..345579ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,7 +101,7 @@ dependencies = [ "astroport-token", "cosmwasm-schema", "cosmwasm-std", - "cw-multi-test", + "cw-multi-test 0.16.5", "cw-storage-plus 1.1.0", "cw2 1.1.1", "cw20 1.1.1", @@ -416,6 +416,25 @@ dependencies = [ "obi", ] +[[package]] +name = "cw-multi-test" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8e81b4a7821d5eeba0d23f737c16027b39a600742ca8c32eb980895ffd270f4" +dependencies = [ + "anyhow", + "cosmwasm-std", + "cosmwasm-storage", + "cw-storage-plus 0.15.1", + "cw-utils 0.15.1", + "derivative", + "itertools 0.10.5", + "prost", + "schemars", + "serde", + "thiserror", +] + [[package]] name = "cw-multi-test" version = "0.16.5" @@ -642,7 +661,7 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "credits", - "cw-multi-test", + "cw-multi-test 0.16.5", "cw-storage-plus 1.1.0", "cw2 1.1.1", "cw20 1.1.1", @@ -1473,7 +1492,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus 1.1.0", "cw-utils 0.15.1", - "cw20 1.1.1", + "cw20 0.15.1", "thiserror", ] @@ -1485,7 +1504,7 @@ dependencies = [ "astroport-token", "cosmwasm-schema", "cosmwasm-std", - "cw-multi-test", + "cw-multi-test 0.16.5", "cw-utils 0.15.1", "cw2 1.1.1", "cw20 1.1.1", @@ -1500,10 +1519,28 @@ dependencies = [ "astroport-token", "cosmwasm-schema", "cosmwasm-std", - "cw-multi-test", + "cw-multi-test 0.15.1", + "cw-storage-plus 0.15.1", + "cw-utils 0.15.1", + "cw2 0.15.1", + "cw20 0.15.1", + "vesting-base", + "vesting-lp-pcl", +] + +[[package]] +name = "vesting-lp-pcl" +version = "1.1.0" +dependencies = [ + "astroport 2.0.0", + "astroport-token", + "cosmwasm-schema", + "cosmwasm-std", + "cw-multi-test 0.16.5", + "cw-storage-plus 0.15.1", "cw-utils 0.15.1", "cw2 1.1.1", - "cw20 1.1.1", + "cw20 0.15.1", "vesting-base", ] @@ -1515,7 +1552,7 @@ dependencies = [ "astroport-token", "cosmwasm-schema", "cosmwasm-std", - "cw-multi-test", + "cw-multi-test 0.16.5", "cw-utils 0.15.1", "cw2 1.1.1", "cw20 1.1.1", diff --git a/Cargo.toml b/Cargo.toml index 037caaaf..d688c45e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,11 +4,12 @@ members = [ "contracts/lockdrop", "contracts/credits", "contracts/vesting-lp", + "contracts/vesting-lp-pcl", "contracts/vesting-lti", "contracts/vesting-investors", "contracts/cw20-merkle-airdrop", "contracts/price-feed", - "contracts/astroport/*" + "contracts/astroport/*", ] [profile.release] @@ -33,6 +34,7 @@ cosmwasm-schema = { version = "1.4.1", default-features = false } astroport = { path = "packages/astroport", default-features = false } astroport-periphery = { path = "packages/astroport_periphery" } vesting-base = { path = "packages/vesting-base" } +vesting-base-pcl = { path = "packages/vesting-base-pcl" } # setting cw-multi-test to 0.17.0 enables cosmwasm_1_1, we don't want that cw-multi-test = "0.16.5" itertools = "0.11.0" diff --git a/contracts/auction/README.md b/contracts/auction/README.md index c43ae90c..a4706ea5 100644 --- a/contracts/auction/README.md +++ b/contracts/auction/README.md @@ -20,7 +20,7 @@ The LP Bootstrap via auction contract facilitates cNTRN-NATIVE Neutron pool init ### Handle Messages | Message | Description | -| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `ExecuteMsg::Receive` | ReceiveCW20 Hook which facilitates cNTRN tokens delegation by lockdrop participants / airdrop recipients | | `ExecuteMsg::UpdateConfig` | Admin function to update any of the configuration parameters. | | `ExecuteMsg::DepositUst` | Facilitates UST deposits by users | @@ -32,7 +32,7 @@ The LP Bootstrap via auction contract facilitates cNTRN-NATIVE Neutron pool init ### Handle Messages :: Callback | Message | Description | -| --------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +|-----------------------------------------------------|------------------------------------------------------------------------------------------------------| | `CallbackMsg::UpdateStateOnLiquidityAdditionToPool` | Callback function to update state after liquidity is added to the cNTRN-UST Pool | | `CallbackMsg::UpdateStateOnRewardClaim` | Callback function to update state after cNTRN rewards are claimed from the generator | | `CallbackMsg::WithdrawUserRewardsCallback` | Callback function to facilitate cNTRN reward claiming and unlocked LP tokens withdrawal for the user | @@ -40,7 +40,7 @@ The LP Bootstrap via auction contract facilitates cNTRN-NATIVE Neutron pool init ### Query Messages | Message | Description | -| -------------------- | ----------------------------- | +|----------------------|-------------------------------| | `QueryMsg::Config` | Returns the config info | | `QueryMsg::State` | Returns state of the contract | | `QueryMsg::UserInfo` | Returns user position details | diff --git a/contracts/lockdrop/README.md b/contracts/lockdrop/README.md index 0bc572b1..ae990b11 100644 --- a/contracts/lockdrop/README.md +++ b/contracts/lockdrop/README.md @@ -10,24 +10,24 @@ Note - Users can open muliple lockup positions with different lockup duration fo ### Handle Messages -| Message | Description | -|-----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `ExecuteMsg::UpdateConfig` | Can only be called by the admin. Facilitates updating configuration parameters | -| `ExecuteMsg::EnableClaims` | Executed by the Bootstrap auction contract when liquidity is added to the ASTRO-UST pool. Enables ASTRO withdrawals by the lockdrop recipients. | -| `ExecuteMsg::InitializePool` | Admin function. Facilitates addition of new Pool (Terraswap Pools) whose LP tokens can then be locked in the lockdrop contract | -| `ExecuteMsg::UpdatePool` | Admin function to update any configuraton parameter for a terraswap pool whose LP tokens are currently accepted for the lockdrop | -| `ExecuteMsg::IncreaseLockup` | Facilitates opening a new user position or adding to an existing position | -| `ExecuteMsg::IncreaseAstroIncentives` | Admin function to increase the ASTRO incentives that are to be distributed | +| Message | Description | +|-----------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `ExecuteMsg::UpdateConfig` | Can only be called by the admin. Facilitates updating configuration parameters | +| `ExecuteMsg::EnableClaims` | Executed by the Bootstrap auction contract when liquidity is added to the ASTRO-UST pool. Enables ASTRO withdrawals by the lockdrop recipients. | +| `ExecuteMsg::InitializePool` | Admin function. Facilitates addition of new Pool (Terraswap Pools) whose LP tokens can then be locked in the lockdrop contract | +| `ExecuteMsg::UpdatePool` | Admin function to update any configuraton parameter for a terraswap pool whose LP tokens are currently accepted for the lockdrop | +| `ExecuteMsg::IncreaseLockup` | Facilitates opening a new user position or adding to an existing position | +| `ExecuteMsg::IncreaseAstroIncentives` | Admin function to increase the ASTRO incentives that are to be distributed | | `ExecuteMsg::WithdrawFromLockup` | Facilitates LP token withdrawals from lockup positions by users. 100% amount can be withdrawn during deposit window, which is then limited to 50% during 1st half of deposit window which then decreases linearly during 2nd half of deposit window. Only 1 withdrawal can be made by a user during the withdrawal windows | -| `ExecuteMsg::MigrateLiquidity` | Admin function. Facilitates migration of liquidity (locked terraswap LP tokens) from Terraswap to Astroport (Astroport LP tokens) | -| `ExecuteMsg::StakeLpTokens` | Admin function. Facilitates staking of Astroport LP tokens for a particular LP pool with the generator contract | -| `ExecuteMsg::DelegateAstroToAuction` | This function facilitates ASTRO tokens delegation to the Bootstrap auction contract during the bootstrap auction phase. Delegated ASTRO tokens are added to the user's position in the bootstrap auction contract | -| `ExecuteMsg::ClaimRewardsAndOptionallyUnlock` | Facilitates rewards claim by users for a particular lockup position along with unlock when possible | -| `ExecuteMsg::ClaimAssetReward` | Collects assets reward from LP and distribute reward to user if all requirements are met | -| `ExecuteMsg::TogglePoolRewards` | Admin function. Enables assets reward for specified LP | -| `ExecuteMsg::ProposeNewOwner` | Admin function. Creates an offer to change the contract ownership. The validity period of the offer is set in the `expires_in` variable. After `expires_in` seconds pass, the proposal expires and cannot be accepted anymore. | -| `ExecuteMsg::DropOwnershipProposal` | Admin function. Removes an existing offer to change the contract owner. | -| `ExecuteMsg::ClaimOwnership` | Admin function. Used to claim contract ownership. | +| `ExecuteMsg::MigrateLiquidity` | Admin function. Facilitates migration of liquidity (locked terraswap LP tokens) from Terraswap to Astroport (Astroport LP tokens) | +| `ExecuteMsg::StakeLpTokens` | Admin function. Facilitates staking of Astroport LP tokens for a particular LP pool with the generator contract | +| `ExecuteMsg::DelegateAstroToAuction` | This function facilitates ASTRO tokens delegation to the Bootstrap auction contract during the bootstrap auction phase. Delegated ASTRO tokens are added to the user's position in the bootstrap auction contract | +| `ExecuteMsg::ClaimRewardsAndOptionallyUnlock` | Facilitates rewards claim by users for a particular lockup position along with unlock when possible | +| `ExecuteMsg::ClaimAssetReward` | Collects assets reward from LP and distribute reward to user if all requirements are met | +| `ExecuteMsg::TogglePoolRewards` | Admin function. Enables assets reward for specified LP | +| `ExecuteMsg::ProposeNewOwner` | Admin function. Creates an offer to change the contract ownership. The validity period of the offer is set in the `expires_in` variable. After `expires_in` seconds pass, the proposal expires and cannot be accepted anymore. | +| `ExecuteMsg::DropOwnershipProposal` | Admin function. Removes an existing offer to change the contract owner. | +| `ExecuteMsg::ClaimOwnership` | Admin function. Used to claim contract ownership. | ### Handle Messages :: Callback diff --git a/contracts/vesting-lp-pcl/.cargo/config b/contracts/vesting-lp-pcl/.cargo/config new file mode 100644 index 00000000..f2fbc6a9 --- /dev/null +++ b/contracts/vesting-lp-pcl/.cargo/config @@ -0,0 +1,6 @@ +[alias] +wasm = "build --release --target wasm32-unknown-unknown" +wasm-debug = "build --target wasm32-unknown-unknown" +unit-test = "test --lib" +integration-test = "test --test integration" +schema = "run --example vesting-lp_schema" diff --git a/contracts/vesting-lp-pcl/Cargo.toml b/contracts/vesting-lp-pcl/Cargo.toml new file mode 100644 index 00000000..43b07451 --- /dev/null +++ b/contracts/vesting-lp-pcl/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "vesting-lp-pcl" +version = "1.1.0" +authors = ["Neutron"] +edition = "2021" +description = "Vesting contract with a voting capabilities. Provides queries to get the amount of tokens are being held by user at certain height." + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +# for more explicit tests, cargo test --features=backtraces +backtraces = ["cosmwasm-std/backtraces"] +# use library feature to disable all init/handle/query exports +library = [] + +[dependencies] +cw2 = { workspace = true } +cw20 = { version = "0.15" } +astroport = { path= "../../packages/astroport"} +vesting-base = {path = "../../packages/vesting-base"} +cosmwasm-schema = { workspace = true } +cosmwasm-std = { workspace = true } +cw-storage-plus = "0.15" + +[dev-dependencies] +cw-multi-test = { workspace = true } +astroport-token = {git = "https://github.com/astroport-fi/astroport-core.git", rev = "65ce7d1879cc5d95b09fa14202f0423bba52ae0e" } +cw-utils = "0.15" diff --git a/contracts/vesting-lp-pcl/examples/vesting-lp-pcl_schema.rs b/contracts/vesting-lp-pcl/examples/vesting-lp-pcl_schema.rs new file mode 100644 index 00000000..186bbaf1 --- /dev/null +++ b/contracts/vesting-lp-pcl/examples/vesting-lp-pcl_schema.rs @@ -0,0 +1,12 @@ +use cosmwasm_schema::write_api; +use vesting_base::msg::{MigrateMsg, QueryMsg}; +use vesting_lp_pcl::msg::{ExecuteMsg, InstantiateMsg}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + query: QueryMsg, + execute: ExecuteMsg, + migrate: MigrateMsg + } +} diff --git a/contracts/vesting-lp-pcl/schema/raw/execute.json b/contracts/vesting-lp-pcl/schema/raw/execute.json new file mode 100644 index 00000000..c70872f2 --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/execute.json @@ -0,0 +1,477 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "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 + }, + { + "description": "RegisterVestingAccounts registers vesting targets/accounts", + "type": "object", + "required": [ + "register_vesting_accounts" + ], + "properties": { + "register_vesting_accounts": { + "type": "object", + "required": [ + "vesting_accounts" + ], + "properties": { + "vesting_accounts": { + "type": "array", + "items": { + "$ref": "#/definitions/VestingAccount" + } + } + }, + "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": { + "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 + }, + { + "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": { + "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": [ + "vesting_token" + ], + "properties": { + "vesting_token": { + "$ref": "#/definitions/AssetInfo" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Contains messages associated with the managed extension for vesting contracts.", + "type": "object", + "required": [ + "managed_extension" + ], + "properties": { + "managed_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgManaged" + } + }, + "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": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgWithManagers" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "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 + }, + { + "type": "object", + "required": [ + "receive" + ], + "properties": { + "receive": { + "$ref": "#/definitions/Cw20ReceiveMsg" + } + }, + "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 + } + ] + }, + "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" + }, + "sender": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ExecuteMsgHistorical": { + "description": "This structure describes the execute messages available in a historical vesting contract.", + "type": "string", + "enum": [] + }, + "ExecuteMsgManaged": { + "description": "This structure describes the execute messages available in a managed vesting contract.", + "oneOf": [ + { + "description": "Removes vesting targets/accounts. ## Executor Only the current owner can execute this", + "type": "object", + "required": [ + "remove_vesting_accounts" + ], + "properties": { + "remove_vesting_accounts": { + "type": "object", + "required": [ + "clawback_account", + "vesting_accounts" + ], + "properties": { + "clawback_account": { + "description": "Specifies the account that will receive the funds taken from the vesting accounts.", + "type": "string" + }, + "vesting_accounts": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "ExecuteMsgWithManagers": { + "description": "This structure describes the execute messages available in a with_managers vesting contract.", + "oneOf": [ + { + "description": "Adds vesting managers ## Executor Only the current owner can execute this", + "type": "object", + "required": [ + "add_vesting_managers" + ], + "properties": { + "add_vesting_managers": { + "type": "object", + "required": [ + "managers" + ], + "properties": { + "managers": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Removes vesting managers ## Executor Only the current owner can execute this", + "type": "object", + "required": [ + "remove_vesting_managers" + ], + "properties": { + "remove_vesting_managers": { + "type": "object", + "required": [ + "managers" + ], + "properties": { + "managers": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "VestingAccount": { + "description": "This structure stores vesting information for a specific address that is getting tokens.", + "type": "object", + "required": [ + "address", + "schedules" + ], + "properties": { + "address": { + "description": "The address that is getting tokens", + "type": "string" + }, + "schedules": { + "description": "The vesting schedules targeted at the `address`", + "type": "array", + "items": { + "$ref": "#/definitions/VestingSchedule" + } + } + }, + "additionalProperties": false + }, + "VestingSchedule": { + "description": "This structure stores parameters for a specific vesting schedule", + "type": "object", + "required": [ + "start_point" + ], + "properties": { + "end_point": { + "description": "The end point for the vesting schedule", + "anyOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + }, + { + "type": "null" + } + ] + }, + "start_point": { + "description": "The start date for the vesting schedule", + "allOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + } + ] + } + }, + "additionalProperties": false + }, + "VestingSchedulePoint": { + "description": "This structure stores the parameters used to create a vesting schedule.", + "type": "object", + "required": [ + "amount", + "time" + ], + "properties": { + "amount": { + "description": "The amount of tokens being vested", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "time": { + "description": "The start time for the vesting schedule", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/vesting-lp-pcl/schema/raw/instantiate.json b/contracts/vesting-lp-pcl/schema/raw/instantiate.json new file mode 100644 index 00000000..cf950c42 --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/instantiate.json @@ -0,0 +1,92 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "description": "This structure describes the parameters used for creating a contract.", + "type": "object", + "required": [ + "owner", + "token_info_manager", + "vesting_managers", + "vesting_token", + "xyk_vesting_lp_contract" + ], + "properties": { + "owner": { + "description": "Address allowed to change contract parameters", + "type": "string" + }, + "token_info_manager": { + "description": "Token info manager address", + "type": "string" + }, + "vesting_managers": { + "description": "Initial list of whitelisted vesting managers", + "type": "array", + "items": { + "type": "string" + } + }, + "vesting_token": { + "$ref": "#/definitions/AssetInfo" + }, + "xyk_vesting_lp_contract": { + "type": "string" + } + }, + "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/raw/migrate.json b/contracts/vesting-lp-pcl/schema/raw/migrate.json new file mode 100644 index 00000000..1b9dcecf --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/migrate.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "description": "This structure describes a migration message. We currently take no arguments for migrations.", + "type": "object", + "additionalProperties": false +} diff --git a/contracts/vesting-lp-pcl/schema/raw/query.json b/contracts/vesting-lp-pcl/schema/raw/query.json new file mode 100644 index 00000000..64a0b398 --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/query.json @@ -0,0 +1,290 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "description": "This structure describes the query messages available in a vesting contract.", + "oneOf": [ + { + "description": "Returns the configuration for the contract using a [`ConfigResponse`] object.", + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about an address vesting tokens using a [`VestingAccountResponse`] object.", + "type": "object", + "required": [ + "vesting_account" + ], + "properties": { + "vesting_account": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns a list of addresses that are vesting tokens using a [`VestingAccountsResponse`] object.", + "type": "object", + "required": [ + "vesting_accounts" + ], + "properties": { + "vesting_accounts": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "order_by": { + "anyOf": [ + { + "$ref": "#/definitions/OrderBy" + }, + { + "type": "null" + } + ] + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the total unvested amount of tokens for a specific address.", + "type": "object", + "required": [ + "available_amount" + ], + "properties": { + "available_amount": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Timestamp returns the current timestamp", + "type": "object", + "required": [ + "timestamp" + ], + "properties": { + "timestamp": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "VestingState returns the current vesting state.", + "type": "object", + "required": [ + "vesting_state" + ], + "properties": { + "vesting_state": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Contains messages associated with the managed extension for vesting contracts.", + "type": "object", + "required": [ + "managed_extension" + ], + "properties": { + "managed_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/QueryMsgManaged" + } + }, + "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": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/QueryMsgWithManagers" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "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/QueryMsgHistorical" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "OrderBy": { + "description": "This enum describes the types of sorting that can be applied to some piece of data", + "type": "string", + "enum": [ + "asc", + "desc" + ] + }, + "QueryMsgHistorical": { + "description": "This structure describes the query messages available in a historical vesting contract.", + "oneOf": [ + { + "description": "Returns the total unclaimed amount of tokens for a specific address at certain height.", + "type": "object", + "required": [ + "unclaimed_amount_at_height" + ], + "properties": { + "unclaimed_amount_at_height": { + "type": "object", + "required": [ + "address", + "height" + ], + "properties": { + "address": { + "type": "string" + }, + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the total unclaimed amount of tokens for all the users at certain height.", + "type": "object", + "required": [ + "unclaimed_total_amount_at_height" + ], + "properties": { + "unclaimed_total_amount_at_height": { + "type": "object", + "required": [ + "height" + ], + "properties": { + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "QueryMsgManaged": { + "description": "This structure describes the query messages available in a managed vesting contract.", + "type": "string", + "enum": [] + }, + "QueryMsgWithManagers": { + "description": "This structure describes the query messages available in a with_managers vesting contract.", + "oneOf": [ + { + "description": "Returns list of vesting managers (the persons who are able to add/remove vesting schedules)", + "type": "object", + "required": [ + "vesting_managers" + ], + "properties": { + "vesting_managers": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/vesting-lp-pcl/schema/raw/response_to_available_amount.json b/contracts/vesting-lp-pcl/schema/raw/response_to_available_amount.json new file mode 100644 index 00000000..25b73e8f --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/response_to_available_amount.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Uint128", + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" +} diff --git a/contracts/vesting-lp-pcl/schema/raw/response_to_config.json b/contracts/vesting-lp-pcl/schema/raw/response_to_config.json new file mode 100644 index 00000000..de35d970 --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/response_to_config.json @@ -0,0 +1,128 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Config", + "description": "This structure stores the main parameters for the generator vesting contract.", + "type": "object", + "required": [ + "extensions", + "owner", + "token_info_manager" + ], + "properties": { + "extensions": { + "description": "Contains extensions information of the contract", + "allOf": [ + { + "$ref": "#/definitions/Extensions" + } + ] + }, + "owner": { + "description": "Address that's allowed to change contract parameters", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "token_info_manager": { + "description": "Address that's allowed to change vesting token", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "vesting_token": { + "description": "[`AssetInfo`] of the vested token", + "anyOf": [ + { + "$ref": "#/definitions/AssetInfo" + }, + { + "type": "null" + } + ] + } + }, + "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 + } + ] + }, + "Extensions": { + "description": "Contains extensions information for the contract.", + "type": "object", + "required": [ + "historical", + "managed", + "with_managers" + ], + "properties": { + "historical": { + "description": "Whether the historical extension is enabled for the contract.", + "type": "boolean" + }, + "managed": { + "description": "Whether the managed extension is enabled for the contract.", + "type": "boolean" + }, + "with_managers": { + "description": "Whether the with_managers extension is enabled for the contract.", + "type": "boolean" + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/vesting-lp-pcl/schema/raw/response_to_historical_extension.json b/contracts/vesting-lp-pcl/schema/raw/response_to_historical_extension.json new file mode 100644 index 00000000..83edad79 --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/response_to_historical_extension.json @@ -0,0 +1,59 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsgHistorical", + "description": "This structure describes the query messages available in a historical vesting contract.", + "oneOf": [ + { + "description": "Returns the total unclaimed amount of tokens for a specific address at certain height.", + "type": "object", + "required": [ + "unclaimed_amount_at_height" + ], + "properties": { + "unclaimed_amount_at_height": { + "type": "object", + "required": [ + "address", + "height" + ], + "properties": { + "address": { + "type": "string" + }, + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the total unclaimed amount of tokens for all the users at certain height.", + "type": "object", + "required": [ + "unclaimed_total_amount_at_height" + ], + "properties": { + "unclaimed_total_amount_at_height": { + "type": "object", + "required": [ + "height" + ], + "properties": { + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/contracts/vesting-lp-pcl/schema/raw/response_to_managed_extension.json b/contracts/vesting-lp-pcl/schema/raw/response_to_managed_extension.json new file mode 100644 index 00000000..a46573aa --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/response_to_managed_extension.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/vesting-lp-pcl/schema/raw/response_to_timestamp.json b/contracts/vesting-lp-pcl/schema/raw/response_to_timestamp.json new file mode 100644 index 00000000..7b729a7b --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/response_to_timestamp.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint64", + "type": "integer", + "format": "uint64", + "minimum": 0.0 +} diff --git a/contracts/vesting-lp-pcl/schema/raw/response_to_vesting_account.json b/contracts/vesting-lp-pcl/schema/raw/response_to_vesting_account.json new file mode 100644 index 00000000..b85fc3d3 --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/response_to_vesting_account.json @@ -0,0 +1,119 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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, + "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" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "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", + "required": [ + "start_point" + ], + "properties": { + "end_point": { + "description": "The end point for the vesting schedule", + "anyOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + }, + { + "type": "null" + } + ] + }, + "start_point": { + "description": "The start date for the vesting schedule", + "allOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + } + ] + } + }, + "additionalProperties": false + }, + "VestingSchedulePoint": { + "description": "This structure stores the parameters used to create a vesting schedule.", + "type": "object", + "required": [ + "amount", + "time" + ], + "properties": { + "amount": { + "description": "The amount of tokens being vested", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "time": { + "description": "The start time for the vesting schedule", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/vesting-lp-pcl/schema/raw/response_to_vesting_accounts.json b/contracts/vesting-lp-pcl/schema/raw/response_to_vesting_accounts.json new file mode 100644 index 00000000..6d2af531 --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/response_to_vesting_accounts.json @@ -0,0 +1,136 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VestingAccountsResponse", + "description": "This structure describes a custom struct used to return vesting data for multiple vesting targets.", + "type": "object", + "required": [ + "vesting_accounts" + ], + "properties": { + "vesting_accounts": { + "description": "A list of accounts that are vesting tokens", + "type": "array", + "items": { + "$ref": "#/definitions/VestingAccountResponse" + } + } + }, + "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" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "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", + "required": [ + "start_point" + ], + "properties": { + "end_point": { + "description": "The end point for the vesting schedule", + "anyOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + }, + { + "type": "null" + } + ] + }, + "start_point": { + "description": "The start date for the vesting schedule", + "allOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + } + ] + } + }, + "additionalProperties": false + }, + "VestingSchedulePoint": { + "description": "This structure stores the parameters used to create a vesting schedule.", + "type": "object", + "required": [ + "amount", + "time" + ], + "properties": { + "amount": { + "description": "The amount of tokens being vested", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "time": { + "description": "The start time for the vesting schedule", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/vesting-lp-pcl/schema/raw/response_to_vesting_state.json b/contracts/vesting-lp-pcl/schema/raw/response_to_vesting_state.json new file mode 100644 index 00000000..b38701e4 --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/response_to_vesting_state.json @@ -0,0 +1,35 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VestingState", + "description": "This structure stores the accumulated vesting information for all addresses.", + "type": "object", + "required": [ + "total_granted", + "total_released" + ], + "properties": { + "total_granted": { + "description": "The total amount of tokens granted to the users", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "total_released": { + "description": "The total amount of tokens already claimed", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting-lp-pcl/schema/raw/response_to_with_managers_extension.json b/contracts/vesting-lp-pcl/schema/raw/response_to_with_managers_extension.json new file mode 100644 index 00000000..bcacc2ac --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/raw/response_to_with_managers_extension.json @@ -0,0 +1,21 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsgWithManagers", + "description": "This structure describes the query messages available in a with_managers vesting contract.", + "oneOf": [ + { + "description": "Returns list of vesting managers (the persons who are able to add/remove vesting schedules)", + "type": "object", + "required": [ + "vesting_managers" + ], + "properties": { + "vesting_managers": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/contracts/vesting-lp-pcl/schema/vesting-lp-pcl.json b/contracts/vesting-lp-pcl/schema/vesting-lp-pcl.json new file mode 100644 index 00000000..d05a001f --- /dev/null +++ b/contracts/vesting-lp-pcl/schema/vesting-lp-pcl.json @@ -0,0 +1,1391 @@ +{ + "contract_name": "vesting-lp-pcl", + "contract_version": "1.1.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "description": "This structure describes the parameters used for creating a contract.", + "type": "object", + "required": [ + "owner", + "token_info_manager", + "vesting_managers", + "vesting_token", + "xyk_vesting_lp_contract" + ], + "properties": { + "owner": { + "description": "Address allowed to change contract parameters", + "type": "string" + }, + "token_info_manager": { + "description": "Token info manager address", + "type": "string" + }, + "vesting_managers": { + "description": "Initial list of whitelisted vesting managers", + "type": "array", + "items": { + "type": "string" + } + }, + "vesting_token": { + "$ref": "#/definitions/AssetInfo" + }, + "xyk_vesting_lp_contract": { + "type": "string" + } + }, + "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", + "oneOf": [ + { + "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 + }, + { + "description": "RegisterVestingAccounts registers vesting targets/accounts", + "type": "object", + "required": [ + "register_vesting_accounts" + ], + "properties": { + "register_vesting_accounts": { + "type": "object", + "required": [ + "vesting_accounts" + ], + "properties": { + "vesting_accounts": { + "type": "array", + "items": { + "$ref": "#/definitions/VestingAccount" + } + } + }, + "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": { + "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 + }, + { + "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": { + "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": [ + "vesting_token" + ], + "properties": { + "vesting_token": { + "$ref": "#/definitions/AssetInfo" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Contains messages associated with the managed extension for vesting contracts.", + "type": "object", + "required": [ + "managed_extension" + ], + "properties": { + "managed_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgManaged" + } + }, + "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": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/ExecuteMsgWithManagers" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "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 + }, + { + "type": "object", + "required": [ + "receive" + ], + "properties": { + "receive": { + "$ref": "#/definitions/Cw20ReceiveMsg" + } + }, + "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 + } + ] + }, + "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" + }, + "sender": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ExecuteMsgHistorical": { + "description": "This structure describes the execute messages available in a historical vesting contract.", + "type": "string", + "enum": [] + }, + "ExecuteMsgManaged": { + "description": "This structure describes the execute messages available in a managed vesting contract.", + "oneOf": [ + { + "description": "Removes vesting targets/accounts. ## Executor Only the current owner can execute this", + "type": "object", + "required": [ + "remove_vesting_accounts" + ], + "properties": { + "remove_vesting_accounts": { + "type": "object", + "required": [ + "clawback_account", + "vesting_accounts" + ], + "properties": { + "clawback_account": { + "description": "Specifies the account that will receive the funds taken from the vesting accounts.", + "type": "string" + }, + "vesting_accounts": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "ExecuteMsgWithManagers": { + "description": "This structure describes the execute messages available in a with_managers vesting contract.", + "oneOf": [ + { + "description": "Adds vesting managers ## Executor Only the current owner can execute this", + "type": "object", + "required": [ + "add_vesting_managers" + ], + "properties": { + "add_vesting_managers": { + "type": "object", + "required": [ + "managers" + ], + "properties": { + "managers": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Removes vesting managers ## Executor Only the current owner can execute this", + "type": "object", + "required": [ + "remove_vesting_managers" + ], + "properties": { + "remove_vesting_managers": { + "type": "object", + "required": [ + "managers" + ], + "properties": { + "managers": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "VestingAccount": { + "description": "This structure stores vesting information for a specific address that is getting tokens.", + "type": "object", + "required": [ + "address", + "schedules" + ], + "properties": { + "address": { + "description": "The address that is getting tokens", + "type": "string" + }, + "schedules": { + "description": "The vesting schedules targeted at the `address`", + "type": "array", + "items": { + "$ref": "#/definitions/VestingSchedule" + } + } + }, + "additionalProperties": false + }, + "VestingSchedule": { + "description": "This structure stores parameters for a specific vesting schedule", + "type": "object", + "required": [ + "start_point" + ], + "properties": { + "end_point": { + "description": "The end point for the vesting schedule", + "anyOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + }, + { + "type": "null" + } + ] + }, + "start_point": { + "description": "The start date for the vesting schedule", + "allOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + } + ] + } + }, + "additionalProperties": false + }, + "VestingSchedulePoint": { + "description": "This structure stores the parameters used to create a vesting schedule.", + "type": "object", + "required": [ + "amount", + "time" + ], + "properties": { + "amount": { + "description": "The amount of tokens being vested", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "time": { + "description": "The start time for the vesting schedule", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "description": "This structure describes the query messages available in a vesting contract.", + "oneOf": [ + { + "description": "Returns the configuration for the contract using a [`ConfigResponse`] object.", + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about an address vesting tokens using a [`VestingAccountResponse`] object.", + "type": "object", + "required": [ + "vesting_account" + ], + "properties": { + "vesting_account": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns a list of addresses that are vesting tokens using a [`VestingAccountsResponse`] object.", + "type": "object", + "required": [ + "vesting_accounts" + ], + "properties": { + "vesting_accounts": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "order_by": { + "anyOf": [ + { + "$ref": "#/definitions/OrderBy" + }, + { + "type": "null" + } + ] + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the total unvested amount of tokens for a specific address.", + "type": "object", + "required": [ + "available_amount" + ], + "properties": { + "available_amount": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Timestamp returns the current timestamp", + "type": "object", + "required": [ + "timestamp" + ], + "properties": { + "timestamp": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "VestingState returns the current vesting state.", + "type": "object", + "required": [ + "vesting_state" + ], + "properties": { + "vesting_state": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Contains messages associated with the managed extension for vesting contracts.", + "type": "object", + "required": [ + "managed_extension" + ], + "properties": { + "managed_extension": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/QueryMsgManaged" + } + }, + "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": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "$ref": "#/definitions/QueryMsgWithManagers" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "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/QueryMsgHistorical" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "OrderBy": { + "description": "This enum describes the types of sorting that can be applied to some piece of data", + "type": "string", + "enum": [ + "asc", + "desc" + ] + }, + "QueryMsgHistorical": { + "description": "This structure describes the query messages available in a historical vesting contract.", + "oneOf": [ + { + "description": "Returns the total unclaimed amount of tokens for a specific address at certain height.", + "type": "object", + "required": [ + "unclaimed_amount_at_height" + ], + "properties": { + "unclaimed_amount_at_height": { + "type": "object", + "required": [ + "address", + "height" + ], + "properties": { + "address": { + "type": "string" + }, + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the total unclaimed amount of tokens for all the users at certain height.", + "type": "object", + "required": [ + "unclaimed_total_amount_at_height" + ], + "properties": { + "unclaimed_total_amount_at_height": { + "type": "object", + "required": [ + "height" + ], + "properties": { + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "QueryMsgManaged": { + "description": "This structure describes the query messages available in a managed vesting contract.", + "type": "string", + "enum": [] + }, + "QueryMsgWithManagers": { + "description": "This structure describes the query messages available in a with_managers vesting contract.", + "oneOf": [ + { + "description": "Returns list of vesting managers (the persons who are able to add/remove vesting schedules)", + "type": "object", + "required": [ + "vesting_managers" + ], + "properties": { + "vesting_managers": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } + }, + "migrate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "description": "This structure describes a migration message. We currently take no arguments for migrations.", + "type": "object", + "additionalProperties": false + }, + "sudo": null, + "responses": { + "available_amount": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Uint128", + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "config": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Config", + "description": "This structure stores the main parameters for the generator vesting contract.", + "type": "object", + "required": [ + "extensions", + "owner", + "token_info_manager" + ], + "properties": { + "extensions": { + "description": "Contains extensions information of the contract", + "allOf": [ + { + "$ref": "#/definitions/Extensions" + } + ] + }, + "owner": { + "description": "Address that's allowed to change contract parameters", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "token_info_manager": { + "description": "Address that's allowed to change vesting token", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "vesting_token": { + "description": "[`AssetInfo`] of the vested token", + "anyOf": [ + { + "$ref": "#/definitions/AssetInfo" + }, + { + "type": "null" + } + ] + } + }, + "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 + } + ] + }, + "Extensions": { + "description": "Contains extensions information for the contract.", + "type": "object", + "required": [ + "historical", + "managed", + "with_managers" + ], + "properties": { + "historical": { + "description": "Whether the historical extension is enabled for the contract.", + "type": "boolean" + }, + "managed": { + "description": "Whether the managed extension is enabled for the contract.", + "type": "boolean" + }, + "with_managers": { + "description": "Whether the with_managers extension is enabled for the contract.", + "type": "boolean" + } + }, + "additionalProperties": false + } + } + }, + "historical_extension": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsgHistorical", + "description": "This structure describes the query messages available in a historical vesting contract.", + "oneOf": [ + { + "description": "Returns the total unclaimed amount of tokens for a specific address at certain height.", + "type": "object", + "required": [ + "unclaimed_amount_at_height" + ], + "properties": { + "unclaimed_amount_at_height": { + "type": "object", + "required": [ + "address", + "height" + ], + "properties": { + "address": { + "type": "string" + }, + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the total unclaimed amount of tokens for all the users at certain height.", + "type": "object", + "required": [ + "unclaimed_total_amount_at_height" + ], + "properties": { + "unclaimed_total_amount_at_height": { + "type": "object", + "required": [ + "height" + ], + "properties": { + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "managed_extension": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "timestamp": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint64", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vesting_account": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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, + "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" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "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", + "required": [ + "start_point" + ], + "properties": { + "end_point": { + "description": "The end point for the vesting schedule", + "anyOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + }, + { + "type": "null" + } + ] + }, + "start_point": { + "description": "The start date for the vesting schedule", + "allOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + } + ] + } + }, + "additionalProperties": false + }, + "VestingSchedulePoint": { + "description": "This structure stores the parameters used to create a vesting schedule.", + "type": "object", + "required": [ + "amount", + "time" + ], + "properties": { + "amount": { + "description": "The amount of tokens being vested", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "time": { + "description": "The start time for the vesting schedule", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "vesting_accounts": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VestingAccountsResponse", + "description": "This structure describes a custom struct used to return vesting data for multiple vesting targets.", + "type": "object", + "required": [ + "vesting_accounts" + ], + "properties": { + "vesting_accounts": { + "description": "A list of accounts that are vesting tokens", + "type": "array", + "items": { + "$ref": "#/definitions/VestingAccountResponse" + } + } + }, + "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" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "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", + "required": [ + "start_point" + ], + "properties": { + "end_point": { + "description": "The end point for the vesting schedule", + "anyOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + }, + { + "type": "null" + } + ] + }, + "start_point": { + "description": "The start date for the vesting schedule", + "allOf": [ + { + "$ref": "#/definitions/VestingSchedulePoint" + } + ] + } + }, + "additionalProperties": false + }, + "VestingSchedulePoint": { + "description": "This structure stores the parameters used to create a vesting schedule.", + "type": "object", + "required": [ + "amount", + "time" + ], + "properties": { + "amount": { + "description": "The amount of tokens being vested", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "time": { + "description": "The start time for the vesting schedule", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "vesting_state": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VestingState", + "description": "This structure stores the accumulated vesting information for all addresses.", + "type": "object", + "required": [ + "total_granted", + "total_released" + ], + "properties": { + "total_granted": { + "description": "The total amount of tokens granted to the users", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "total_released": { + "description": "The total amount of tokens already claimed", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "with_managers_extension": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsgWithManagers", + "description": "This structure describes the query messages available in a with_managers vesting contract.", + "oneOf": [ + { + "description": "Returns list of vesting managers (the persons who are able to add/remove vesting schedules)", + "type": "object", + "required": [ + "vesting_managers" + ], + "properties": { + "vesting_managers": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/vesting-lp-pcl/src/contract.rs b/contracts/vesting-lp-pcl/src/contract.rs new file mode 100644 index 00000000..7ad49404 --- /dev/null +++ b/contracts/vesting-lp-pcl/src/contract.rs @@ -0,0 +1,177 @@ +use crate::msg::{Cw20HookMsg, ExecuteMsg, InstantiateMsg}; +use crate::state::XYK_VESTING_LP_CONTRACT; +use astroport::asset::token_asset_info; +use cosmwasm_std::{ + entry_point, from_binary, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, + Storage, Uint128, +}; +use cw2::set_contract_version; +use cw20::Cw20ReceiveMsg; +use vesting_base::error::ContractError; +use vesting_base::handlers::{execute as base_execute, query as base_query}; +use vesting_base::handlers::{get_vesting_token, register_vesting_accounts}; +use vesting_base::msg::{ExecuteMsg as BaseExecute, QueryMsg}; +use vesting_base::state::{vesting_info, vesting_state, CONFIG, VESTING_MANAGERS}; +use vesting_base::types::{Config, Extensions, VestingInfo}; + +/// Contract name that is used for migration. +const CONTRACT_NAME: &str = "neutron-vesting-lp-pcl"; +/// Contract version that is used for migration. +const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + +/// Creates a new contract with the specified parameters packed in the `msg` variable. +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn instantiate( + deps: DepsMut, + _env: Env, + _info: MessageInfo, + msg: InstantiateMsg, +) -> StdResult { + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + let owner = deps.api.addr_validate(&msg.owner)?; + CONFIG.save( + deps.storage, + &Config { + owner, + vesting_token: Option::from(msg.vesting_token), + token_info_manager: deps.api.addr_validate(&msg.token_info_manager)?, + + extensions: Extensions { + historical: true, + managed: false, + with_managers: true, + }, + }, + )?; + for m in msg.vesting_managers.iter() { + let ma = deps.api.addr_validate(m)?; + VESTING_MANAGERS.save(deps.storage, ma, &())?; + } + XYK_VESTING_LP_CONTRACT.save( + deps.storage, + &deps + .api + .addr_validate(&msg.xyk_vesting_lp_contract.clone())?, + )?; + Ok(Response::default()) +} + +/// Exposes execute functions available in the contract. +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn execute( + deps: DepsMut, + env: Env, + info: MessageInfo, + msg: ExecuteMsg, +) -> Result { + match msg { + ExecuteMsg::Receive(msg) => receive_cw20(deps, env, info, msg), + _ => { + let base_msg: BaseExecute = msg.into(); + base_execute(deps, env, info, base_msg) + } + } +} + +/// Receives a message of type [`Cw20HookMsg`] and processes it depending on the received template. +/// +/// * **cw20_msg** CW20 message to process. +fn receive_cw20( + deps: DepsMut, + env: Env, + info: MessageInfo, + cw20_msg: Cw20ReceiveMsg, +) -> Result { + let config = CONFIG.load(deps.storage)?; + let vesting_token = get_vesting_token(&config)?; + let sender = info.sender; + + match from_binary(&cw20_msg.msg)? { + Cw20HookMsg::RegisterVestingAccounts { vesting_accounts } => { + if !is_sender_whitelisted( + deps.storage, + &config, + &deps.api.addr_validate(sender.as_str())?, + ) || token_asset_info(sender.clone()) != vesting_token + { + return Err(ContractError::Unauthorized {}); + } + register_vesting_accounts(deps, vesting_accounts, cw20_msg.amount, env.block.height) + } + Cw20HookMsg::MigrateXYKLiquidity { + user_address_raw, + user_vesting_info, + } => { + if !is_sender_xyk_vesting_lp(deps.storage, &sender) { + return Err(ContractError::Unauthorized {}); + } + handle_migrate_xyk_liquidity(deps, env, user_address_raw, user_vesting_info) + } + } +} + +fn is_sender_whitelisted(store: &mut dyn Storage, config: &Config, sender: &Addr) -> bool { + if *sender == config.owner { + return true; + } + let xyk_vesting_lp_contract = XYK_VESTING_LP_CONTRACT.load(store).unwrap(); + if *sender == xyk_vesting_lp_contract { + return true; + } + if VESTING_MANAGERS.has(store, sender.clone()) { + return true; + } + + false +} + +fn is_sender_xyk_vesting_lp(store: &mut dyn Storage, sender: &Addr) -> bool { + let xyk_vesting_lp_contract = XYK_VESTING_LP_CONTRACT.load(store).unwrap(); + if *sender == xyk_vesting_lp_contract { + return true; + } + + false +} + +fn handle_migrate_xyk_liquidity( + deps: DepsMut, + env: Env, + user_addr: Addr, + user_vesting_info: VestingInfo, +) -> Result { + let height = env.block.height; + let config = CONFIG.load(deps.storage)?; + + let mut to_deposit = Uint128::zero(); + for sch in &user_vesting_info.schedules { + let amount = if let Some(end_point) = &sch.end_point { + end_point.amount + } else { + sch.start_point.amount + }; + to_deposit = to_deposit.checked_add(amount)?; + } + + let vesting_info = vesting_info(config.extensions.historical); + + vesting_info.save(deps.storage, user_addr, &user_vesting_info, height)?; + + vesting_state(config.extensions.historical).update::<_, ContractError>( + deps.storage, + height, + |s| { + let mut state = s.unwrap_or_default(); + state.total_granted = state.total_granted.checked_add(to_deposit)?; + Ok(state) + }, + )?; + + Ok(Response::default()) +} + +/// Exposes all the queries available in the contract. +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { + base_query(deps, env, msg) +} diff --git a/contracts/vesting-lp-pcl/src/lib.rs b/contracts/vesting-lp-pcl/src/lib.rs new file mode 100644 index 00000000..4934c19d --- /dev/null +++ b/contracts/vesting-lp-pcl/src/lib.rs @@ -0,0 +1,3 @@ +pub mod contract; +pub mod msg; +pub mod state; diff --git a/contracts/vesting-lp-pcl/src/msg.rs b/contracts/vesting-lp-pcl/src/msg.rs new file mode 100644 index 00000000..2af63d0d --- /dev/null +++ b/contracts/vesting-lp-pcl/src/msg.rs @@ -0,0 +1,110 @@ +use astroport::asset::AssetInfo; +use cosmwasm_schema::cw_serde; +use cosmwasm_std::{Addr, Uint128}; +use cw20::Cw20ReceiveMsg; +use vesting_base::msg::{ + ExecuteMsg as BaseExecute, ExecuteMsgHistorical, ExecuteMsgManaged, ExecuteMsgWithManagers, +}; +use vesting_base::types::{VestingAccount, VestingInfo}; + +/// This structure describes the parameters used for creating a contract. +#[cw_serde] +pub struct InstantiateMsg { + /// Address allowed to change contract parameters + pub owner: String, + /// Initial list of whitelisted vesting managers + pub vesting_managers: Vec, + /// Token info manager address + pub token_info_manager: String, + pub xyk_vesting_lp_contract: String, + pub vesting_token: AssetInfo, +} + +#[cw_serde] +pub enum ExecuteMsg { + // Claim claims vested tokens and sends them to a recipient + Claim { + /// The address that receives the vested tokens + recipient: Option, + /// The amount of tokens to claim + amount: Option, + }, + /// RegisterVestingAccounts registers vesting targets/accounts + RegisterVestingAccounts { + vesting_accounts: Vec, + }, + /// Creates a request to change contract ownership + /// ## Executor + /// Only the current owner can execute this + ProposeNewOwner { + /// The newly proposed owner + owner: String, + /// The validity period of the offer to change the owner + expires_in: u64, + }, + /// Removes a request to change contract ownership + /// ## Executor + /// Only the current owner can execute this + DropOwnershipProposal {}, + /// Claims contract ownership + /// ## Executor + /// Only the newly proposed owner can execute this + ClaimOwnership {}, + /// Sets vesting token + /// ## Executor + /// Only the current owner or token info manager can execute this + SetVestingToken { + vesting_token: AssetInfo, + }, + /// Contains messages associated with the managed extension for vesting contracts. + ManagedExtension { + msg: ExecuteMsgManaged, + }, + /// Contains messages associated with the with_managers extension for vesting contracts. + WithManagersExtension { + msg: ExecuteMsgWithManagers, + }, + /// Contains messages associated with the historical extension for vesting contracts. + HistoricalExtension { + msg: ExecuteMsgHistorical, + }, + Receive(Cw20ReceiveMsg), +} + +/// This structure describes a CW20 hook message. +#[cw_serde] +pub enum Cw20HookMsg { + /// RegisterVestingAccounts registers vesting targets/accounts + RegisterVestingAccounts { + vesting_accounts: Vec, + }, + #[serde(rename = "migrate_xyk_liquidity")] + MigrateXYKLiquidity { + /// The address of the user which owns the vested tokens. + user_address_raw: Addr, + user_vesting_info: VestingInfo, + }, +} + +impl From for BaseExecute { + fn from(item: ExecuteMsg) -> Self { + match item { + ExecuteMsg::Claim { recipient, amount } => BaseExecute::Claim { recipient, amount }, + ExecuteMsg::RegisterVestingAccounts { vesting_accounts } => { + BaseExecute::RegisterVestingAccounts { vesting_accounts } + } + ExecuteMsg::ProposeNewOwner { owner, expires_in } => { + BaseExecute::ProposeNewOwner { owner, expires_in } + } + ExecuteMsg::DropOwnershipProposal {} => BaseExecute::DropOwnershipProposal {}, + ExecuteMsg::ClaimOwnership {} => BaseExecute::ClaimOwnership {}, + ExecuteMsg::SetVestingToken { vesting_token } => { + BaseExecute::SetVestingToken { vesting_token } + } + ExecuteMsg::ManagedExtension { msg } => BaseExecute::ManagedExtension { msg }, + ExecuteMsg::WithManagersExtension { msg } => BaseExecute::WithManagersExtension { msg }, + ExecuteMsg::HistoricalExtension { msg } => BaseExecute::HistoricalExtension { msg }, + _ => panic!("Unhandled ExecuteMsg variant"), + } + } +} diff --git a/contracts/vesting-lp-pcl/src/state.rs b/contracts/vesting-lp-pcl/src/state.rs new file mode 100644 index 00000000..e3fb2078 --- /dev/null +++ b/contracts/vesting-lp-pcl/src/state.rs @@ -0,0 +1,3 @@ +use cosmwasm_std::Addr; +use cw_storage_plus::Item; +pub(crate) const XYK_VESTING_LP_CONTRACT: Item = Item::new("xyk_vesting_lp_contract"); diff --git a/contracts/vesting-lp/.cargo/config b/contracts/vesting-lp/.cargo/config index f2fbc6a9..a79b8fdb 100644 --- a/contracts/vesting-lp/.cargo/config +++ b/contracts/vesting-lp/.cargo/config @@ -3,4 +3,4 @@ wasm = "build --release --target wasm32-unknown-unknown" wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" -schema = "run --example vesting-lp_schema" +schema = "run --example vesting_schema" diff --git a/contracts/vesting-lp/Cargo.toml b/contracts/vesting-lp/Cargo.toml index 31f70c7c..0dadfa86 100644 --- a/contracts/vesting-lp/Cargo.toml +++ b/contracts/vesting-lp/Cargo.toml @@ -9,20 +9,21 @@ description = "Vesting contract with a voting capabilities. Provides queries to crate-type = ["cdylib", "rlib"] [features] -# for more explicit tests, cargo test --features=backtraces -backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all init/handle/query exports library = [] [dependencies] -cw2 = { workspace = true } -cw20 = { workspace = true } -astroport = { workspace = true } -vesting-base = { workspace = true } -cosmwasm-schema = { workspace = true } -cosmwasm-std = { workspace = true } +cw2 = { version = "0.15" } +vesting-base = {path = "../../packages/vesting-base"} +vesting-lp-pcl = {path = "../vesting-lp-pcl"} +astroport = { path = "../../packages/astroport" } +cosmwasm-schema = { version = "1.1", default-features = false } +cosmwasm-std = { version = "1.1" } +cw-storage-plus = "0.15" +cw20 = { version = "0.15" } [dev-dependencies] -cw-multi-test = { workspace = true } +cw-multi-test = "0.15" astroport-token = {git = "https://github.com/astroport-fi/astroport-core.git", rev = "65ce7d1879cc5d95b09fa14202f0423bba52ae0e" } +cw20 = { version = "0.15" } cw-utils = "0.15" diff --git a/contracts/vesting-lp/examples/vesting-lp_schema.rs b/contracts/vesting-lp/examples/vesting-lp_schema.rs index 90284134..821d12fc 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_base::msg::QueryMsg; +use vesting_lp::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg}; 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": { diff --git a/contracts/vesting-lp/src/contract.rs b/contracts/vesting-lp/src/contract.rs index 4b3a4659..2756b247 100644 --- a/contracts/vesting-lp/src/contract.rs +++ b/contracts/vesting-lp/src/contract.rs @@ -1,10 +1,24 @@ -use crate::msg::InstantiateMsg; -use cosmwasm_std::{entry_point, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult}; +use crate::msg::{CallbackMsg, ExecuteMsg, InstantiateMsg, MigrateMsg}; +use crate::state::{XykToClMigrationConfig, XYK_TO_CL_MIGRATION_CONFIG}; +use astroport::asset::{native_asset, PairInfo}; +use astroport::pair::{ + Cw20HookMsg as PairCw20HookMsg, ExecuteMsg as PairExecuteMsg, QueryMsg as PairQueryMsg, +}; +use cosmwasm_std::{ + entry_point, to_binary, Addr, Binary, Coin, CosmosMsg, Decimal, Deps, DepsMut, Env, + MessageInfo, Response, StdResult, Uint128, WasmMsg, +}; use cw2::set_contract_version; +use cw20::{BalanceResponse, Cw20ExecuteMsg, Cw20QueryMsg}; use vesting_base::builder::VestingBaseBuilder; use vesting_base::error::ContractError; -use vesting_base::handlers::{execute as base_execute, query as base_query}; -use vesting_base::msg::{ExecuteMsg, QueryMsg}; +use vesting_base::handlers::execute as base_execute; +use vesting_base::handlers::query as base_query; +use vesting_base::msg::{ExecuteMsg as BaseExecute, QueryMsg}; +use vesting_base::state::{vesting_info, vesting_state, CONFIG}; +use vesting_base::types::{ + VestingAccountFullInfo, VestingInfo, VestingSchedule, VestingSchedulePoint, +}; /// Contract name that is used for migration. const CONTRACT_NAME: &str = "neutron-vesting-lp"; @@ -36,7 +50,16 @@ pub fn execute( info: MessageInfo, msg: ExecuteMsg, ) -> Result { - base_execute(deps, env, info, msg) + match msg { + ExecuteMsg::MigrateLiquidityToPCLPool { user } => { + execute_migrate_liquidity(deps, info, env, None, user) + } + ExecuteMsg::Callback(msg) => _handle_callback(deps, env, info, msg), + _ => { + let base_msg: BaseExecute = msg.into(); + base_execute(deps, env, info, base_msg) + } + } } /// Exposes all the queries available in the contract. @@ -44,3 +67,369 @@ pub fn execute( pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { base_query(deps, env, msg) } + +/// Manages contract migration. +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result { + XYK_TO_CL_MIGRATION_CONFIG.save( + deps.storage, + &XykToClMigrationConfig { + max_slippage: msg.max_slippage, + ntrn_denom: msg.ntrn_denom, + xyk_pair: deps.api.addr_validate(msg.xyk_pair.as_str())?, + paired_denom: msg.paired_denom, + cl_pair: deps.api.addr_validate(msg.cl_pair.as_str())?, + new_lp_token: deps.api.addr_validate(msg.new_lp_token.as_str())?, + pcl_vesting: deps.api.addr_validate(msg.pcl_vesting.as_str())?, + dust_threshold: msg.dust_threshold, + }, + )?; + + Ok(Response::default()) +} + +fn execute_migrate_liquidity( + deps: DepsMut, + info: MessageInfo, + env: Env, + slippage_tolerance: Option, + user: Option, +) -> Result { + let config = CONFIG.load(deps.storage)?; + let migration_config: XykToClMigrationConfig = XYK_TO_CL_MIGRATION_CONFIG.load(deps.storage)?; + let address = match user { + Some(val) => deps.api.addr_validate(&val)?, + None => info.sender, + }; + let vesting_info = vesting_info(config.extensions.historical); + let info = vesting_info.load(deps.storage, address.clone())?; + let mut resp = Response::default(); + let user = VestingAccountFullInfo { address, info }; + + // get pairs LP token addresses + let pair_info: PairInfo = deps + .querier + .query_wasm_smart(migration_config.xyk_pair.clone(), &PairQueryMsg::Pair {})?; + + let user_share = compute_share(&user.info)?; + + // if there is nothing to migrate just update vi and quit. + // if there is only dust, than send it back to user, update vi and quit + if user_share < migration_config.dust_threshold { + if !user_share.is_zero() { + resp = resp.add_message(CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: pair_info.liquidity_token.to_string(), + msg: to_binary(&Cw20ExecuteMsg::Transfer { + recipient: user.address.to_string(), + amount: user_share, + })?, + funds: vec![], + })); + } + + vesting_info.save( + deps.storage, + user.address.clone(), + &VestingInfo { + schedules: vec![], + released_amount: Uint128::zero(), + }, + env.block.height, + )?; + return Ok(resp); + }; + + if let Some(slippage_tolerance) = slippage_tolerance { + if slippage_tolerance.gt(&migration_config.max_slippage) { + return Err(ContractError::MigrationError {}); + } + } + + let slippage_tolerance = slippage_tolerance.unwrap_or(migration_config.max_slippage); + + resp = resp.add_message( + CallbackMsg::MigrateLiquidityToClPair { + xyk_pair: migration_config.xyk_pair.clone(), + xyk_lp_token: pair_info.liquidity_token.clone(), + amount: user_share, + slippage_tolerance, + cl_pair: migration_config.cl_pair.clone(), + ntrn_denom: migration_config.ntrn_denom.clone(), + paired_asset_denom: migration_config.paired_denom.clone(), + user, + } + .to_cosmos_msg(&env)?, + ); + + Ok(resp) +} + +fn _handle_callback( + deps: DepsMut, + env: Env, + info: MessageInfo, + msg: CallbackMsg, +) -> Result { + // Only the contract itself can call callbacks + if info.sender != env.contract.address { + return Err(ContractError::Unauthorized {}); + } + match msg { + CallbackMsg::MigrateLiquidityToClPair { + xyk_pair, + xyk_lp_token, + amount, + slippage_tolerance, + cl_pair, + ntrn_denom, + paired_asset_denom, + user, + } => migrate_liquidity_to_cl_pair_callback( + deps, + env, + xyk_pair, + xyk_lp_token, + amount, + slippage_tolerance, + cl_pair, + ntrn_denom, + paired_asset_denom, + user, + ), + CallbackMsg::ProvideLiquidityToClPairAfterWithdrawal { + ntrn_denom, + ntrn_init_balance, + paired_asset_denom, + paired_asset_init_balance, + cl_pair, + slippage_tolerance, + user, + } => provide_liquidity_to_cl_pair_after_withdrawal_callback( + deps, + env, + ntrn_denom, + ntrn_init_balance, + paired_asset_denom, + paired_asset_init_balance, + cl_pair, + slippage_tolerance, + user, + ), + CallbackMsg::PostMigrationVestingReschedule { + user, + init_balance_pcl_lp, + } => post_migration_vesting_reschedule_callback(deps, env, &user, init_balance_pcl_lp), + } +} + +#[allow(clippy::too_many_arguments)] +fn migrate_liquidity_to_cl_pair_callback( + deps: DepsMut, + env: Env, + xyk_pair: Addr, + xyk_lp_token: Addr, + amount: Uint128, + slippage_tolerance: Decimal, + cl_pair: Addr, + ntrn_denom: String, + paired_asset_denom: String, + user: VestingAccountFullInfo, +) -> Result { + let ntrn_init_balance = deps + .querier + .query_balance(env.contract.address.to_string(), ntrn_denom.clone())? + .amount; + let paired_asset_init_balance = deps + .querier + .query_balance(env.contract.address.to_string(), paired_asset_denom.clone())? + .amount; + + let mut msgs: Vec = vec![]; + + // push message to withdraw liquidity from the xyk pair + msgs.push(CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: xyk_lp_token.to_string(), + msg: to_binary(&Cw20ExecuteMsg::Send { + contract: xyk_pair.to_string(), + amount, + msg: to_binary(&PairCw20HookMsg::WithdrawLiquidity { assets: vec![] })?, + })?, + funds: vec![], + })); + let config = CONFIG.load(deps.storage)?; + vesting_state(config.extensions.historical).update::<_, ContractError>( + deps.storage, + env.block.height, + |s| { + let mut state = s.unwrap_or_default(); + state.total_granted = state.total_granted.checked_sub(amount)?; + Ok(state) + }, + )?; + // push the next migration step as a callback message + msgs.push( + CallbackMsg::ProvideLiquidityToClPairAfterWithdrawal { + ntrn_denom, + ntrn_init_balance, + paired_asset_denom, + paired_asset_init_balance, + cl_pair, + slippage_tolerance, + user, + } + .to_cosmos_msg(&env)?, + ); + + Ok(Response::default().add_messages(msgs)) +} + +#[allow(clippy::too_many_arguments)] +fn provide_liquidity_to_cl_pair_after_withdrawal_callback( + deps: DepsMut, + env: Env, + ntrn_denom: String, + ntrn_init_balance: Uint128, + paired_asset_denom: String, + paired_asset_init_balance: Uint128, + cl_pair_address: Addr, + slippage_tolerance: Decimal, + user: VestingAccountFullInfo, +) -> Result { + let ntrn_balance_after_withdrawal = deps + .querier + .query_balance(env.contract.address.to_string(), ntrn_denom.clone())? + .amount; + let paired_asset_balance_after_withdrawal = deps + .querier + .query_balance(env.contract.address.to_string(), paired_asset_denom.clone())? + .amount; + + // calc amount of assets that's been withdrawn + let withdrawn_ntrn_amount = ntrn_balance_after_withdrawal.checked_sub(ntrn_init_balance)?; + let withdrawn_paired_asset_amount = + paired_asset_balance_after_withdrawal.checked_sub(paired_asset_init_balance)?; + + let mut msgs: Vec = vec![]; + + let migration_config: XykToClMigrationConfig = XYK_TO_CL_MIGRATION_CONFIG.load(deps.storage)?; + + let balance_response: BalanceResponse = deps.querier.query_wasm_smart( + migration_config.new_lp_token, + &Cw20QueryMsg::Balance { + address: env.contract.address.to_string(), + }, + )?; + let current_balance = balance_response.balance; + + msgs.push(CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: cl_pair_address.to_string(), + msg: to_binary(&PairExecuteMsg::ProvideLiquidity { + assets: vec![ + native_asset(ntrn_denom.clone(), withdrawn_ntrn_amount), + native_asset(paired_asset_denom.clone(), withdrawn_paired_asset_amount), + ], + slippage_tolerance: Some(slippage_tolerance), + auto_stake: None, + receiver: None, + })?, + funds: vec![ + Coin::new(withdrawn_ntrn_amount.into(), ntrn_denom), + Coin::new(withdrawn_paired_asset_amount.into(), paired_asset_denom), + ], + })); + + msgs.push( + CallbackMsg::PostMigrationVestingReschedule { + user, + init_balance_pcl_lp: current_balance, + } + .to_cosmos_msg(&env)?, + ); + + Ok(Response::default().add_messages(msgs)) +} + +fn post_migration_vesting_reschedule_callback( + deps: DepsMut, + env: Env, + user: &VestingAccountFullInfo, + init_balance_pcl_lp: Uint128, +) -> Result { + let config = CONFIG.load(deps.storage)?; + let migration_config: XykToClMigrationConfig = XYK_TO_CL_MIGRATION_CONFIG.load(deps.storage)?; + let balance_response: BalanceResponse = deps.querier.query_wasm_smart( + &migration_config.new_lp_token, + &Cw20QueryMsg::Balance { + address: env.contract.address.to_string(), + }, + )?; + let balance_diff = balance_response.balance.checked_sub(init_balance_pcl_lp)?; + + let schedule = user + .info + .schedules + .last() + .ok_or(ContractError::VestingScheduleExtractError( + user.address.to_string(), + ))?; + + let new_end_point = match &schedule.end_point { + Some(end_point) => Option::from(VestingSchedulePoint { + time: end_point.time, + amount: balance_diff, + }), + None => None, + }; + + let new_schedule = VestingSchedule { + start_point: VestingSchedulePoint { + time: schedule.start_point.time, + amount: Uint128::zero(), + }, + end_point: new_end_point, + }; + + let vesting_info = vesting_info(config.extensions.historical); + + vesting_info.save( + deps.storage, + user.address.clone(), + &VestingInfo { + schedules: vec![], + released_amount: Uint128::zero(), + }, + env.block.height, + )?; + if !balance_diff.is_zero() { + let msgs = vec![CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: migration_config.new_lp_token.to_string(), + funds: vec![], + msg: to_binary(&Cw20ExecuteMsg::Send { + contract: migration_config.pcl_vesting.to_string(), + amount: balance_diff, + msg: to_binary(&vesting_lp_pcl::msg::Cw20HookMsg::MigrateXYKLiquidity { + user_address_raw: user.address.clone(), + user_vesting_info: VestingInfo { + schedules: vec![new_schedule], + released_amount: Uint128::zero(), + }, + })?, + })?, + })]; + + Ok(Response::new().add_messages(msgs)) + } else { + Ok(Response::new()) + } +} + +fn compute_share(vesting_info: &VestingInfo) -> StdResult { + let mut available_amount: Uint128 = Uint128::zero(); + for sch in &vesting_info.schedules { + if let Some(end_point) = &sch.end_point { + available_amount = available_amount.checked_add(end_point.amount)? + } + } + + Ok(available_amount.checked_sub(vesting_info.released_amount)?) +} diff --git a/contracts/vesting-lp/src/lib.rs b/contracts/vesting-lp/src/lib.rs index 08d6d688..172c45a6 100644 --- a/contracts/vesting-lp/src/lib.rs +++ b/contracts/vesting-lp/src/lib.rs @@ -1,5 +1,5 @@ +extern crate core; + pub mod contract; pub mod msg; - -#[cfg(test)] -mod tests; +pub mod state; diff --git a/contracts/vesting-lp/src/msg.rs b/contracts/vesting-lp/src/msg.rs index b35ee7ff..aba536d7 100644 --- a/contracts/vesting-lp/src/msg.rs +++ b/contracts/vesting-lp/src/msg.rs @@ -1,4 +1,11 @@ +use astroport::asset::AssetInfo; use cosmwasm_schema::cw_serde; +use cosmwasm_std::{to_binary, Addr, CosmosMsg, Decimal, Env, StdResult, Uint128, WasmMsg}; +use cw20::Cw20ReceiveMsg; +use vesting_base::msg::{ + ExecuteMsg as BaseExecute, ExecuteMsgHistorical, ExecuteMsgManaged, ExecuteMsgWithManagers, +}; +use vesting_base::types::{VestingAccount, VestingAccountFullInfo}; /// This structure describes the parameters used for creating a contract. #[cw_serde] @@ -10,3 +17,129 @@ pub struct InstantiateMsg { /// Token info manager address pub token_info_manager: String, } + +#[cw_serde] +pub enum ExecuteMsg { + /// Claim claims vested tokens and sends them to a recipient + Claim { + /// The address that receives the vested tokens + recipient: Option, + /// The amount of tokens to claim + amount: Option, + }, + /// Receives a message of type [`Cw20ReceiveMsg`] and processes it depending on the received template + Receive(Cw20ReceiveMsg), + /// RegisterVestingAccounts registers vesting targets/accounts + RegisterVestingAccounts { + vesting_accounts: Vec, + }, + /// Creates a request to change contract ownership + /// ## Executor + /// Only the current owner can execute this + ProposeNewOwner { + /// The newly proposed owner + owner: String, + /// The validity period of the offer to change the owner + expires_in: u64, + }, + /// Removes a request to change contract ownership + /// ## Executor + /// Only the current owner can execute this + DropOwnershipProposal {}, + /// Claims contract ownership + /// ## Executor + /// Only the newly proposed owner can execute this + ClaimOwnership {}, + /// Sets vesting token + /// ## Executor + /// Only the current owner or token info manager can execute this + SetVestingToken { vesting_token: AssetInfo }, + /// Contains messages associated with the managed extension for vesting contracts. + ManagedExtension { msg: ExecuteMsgManaged }, + /// Contains messages associated with the with_managers extension for vesting contracts. + WithManagersExtension { msg: ExecuteMsgWithManagers }, + /// Contains messages associated with the historical extension for vesting contracts. + HistoricalExtension { msg: ExecuteMsgHistorical }, + #[serde(rename = "migrate_liquidity_to_pcl_pool")] + MigrateLiquidityToPCLPool { user: Option }, + /// Callbacks; only callable by the contract itself. + Callback(CallbackMsg), +} + +#[cw_serde] +pub enum CallbackMsg { + MigrateLiquidityToClPair { + xyk_pair: Addr, + xyk_lp_token: Addr, + amount: Uint128, + slippage_tolerance: Decimal, + cl_pair: Addr, + ntrn_denom: String, + paired_asset_denom: String, + user: VestingAccountFullInfo, + }, + ProvideLiquidityToClPairAfterWithdrawal { + ntrn_denom: String, + ntrn_init_balance: Uint128, + paired_asset_denom: String, + paired_asset_init_balance: Uint128, + cl_pair: Addr, + slippage_tolerance: Decimal, + user: VestingAccountFullInfo, + }, + PostMigrationVestingReschedule { + user: VestingAccountFullInfo, + init_balance_pcl_lp: Uint128, + }, +} + +// Modified from +// https://github.com/CosmWasm/cosmwasm-plus/blob/v0.2.3/packages/cw20/src/receiver.rs#L15 +impl CallbackMsg { + pub fn to_cosmos_msg(self, env: &Env) -> StdResult { + Ok(CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: env.contract.address.to_string(), + msg: to_binary(&ExecuteMsg::Callback(self))?, + funds: vec![], + })) + } +} + +/// This structure describes a migration message. +/// We currently take no arguments for migrations. +#[cw_serde] +#[serde(rename_all = "snake_case")] +pub struct MigrateMsg { + pub max_slippage: Decimal, + pub ntrn_denom: String, + pub paired_denom: String, + pub xyk_pair: String, + pub cl_pair: String, + pub new_lp_token: String, + pub pcl_vesting: String, + pub dust_threshold: Uint128, +} + +impl From for BaseExecute { + fn from(item: ExecuteMsg) -> Self { + match item { + ExecuteMsg::Claim { recipient, amount } => BaseExecute::Claim { recipient, amount }, + ExecuteMsg::Receive(msg) => BaseExecute::Receive(msg), + ExecuteMsg::RegisterVestingAccounts { vesting_accounts } => { + BaseExecute::RegisterVestingAccounts { vesting_accounts } + } + ExecuteMsg::ProposeNewOwner { owner, expires_in } => { + BaseExecute::ProposeNewOwner { owner, expires_in } + } + ExecuteMsg::DropOwnershipProposal {} => BaseExecute::DropOwnershipProposal {}, + ExecuteMsg::ClaimOwnership {} => BaseExecute::ClaimOwnership {}, + ExecuteMsg::SetVestingToken { vesting_token } => { + BaseExecute::SetVestingToken { vesting_token } + } + ExecuteMsg::ManagedExtension { msg } => BaseExecute::ManagedExtension { msg }, + ExecuteMsg::WithManagersExtension { msg } => BaseExecute::WithManagersExtension { msg }, + ExecuteMsg::HistoricalExtension { msg } => BaseExecute::HistoricalExtension { msg }, + _ => panic!("Unhandled ExecuteMsg variant"), + } + } +} diff --git a/contracts/vesting-lp/src/state.rs b/contracts/vesting-lp/src/state.rs new file mode 100644 index 00000000..4036cd9c --- /dev/null +++ b/contracts/vesting-lp/src/state.rs @@ -0,0 +1,20 @@ +use cosmwasm_schema::cw_serde; +use cosmwasm_std::{Addr, Decimal, Uint128}; +use cw_storage_plus::Item; + +/// Config for xyk->CL liquidity migration. +#[cw_serde] +pub struct XykToClMigrationConfig { + /// The maximum allowed slippage tolerance for xyk to CL liquidity migration calls. + pub max_slippage: Decimal, + pub ntrn_denom: String, + pub xyk_pair: Addr, + pub paired_denom: String, + pub cl_pair: Addr, + pub new_lp_token: Addr, + pub pcl_vesting: Addr, + pub dust_threshold: Uint128, +} + +pub const XYK_TO_CL_MIGRATION_CONFIG: Item = + Item::new("xyk_to_cl_migration_config"); diff --git a/packages/astroport_periphery/src/lib.rs b/packages/astroport_periphery/src/lib.rs index 37ab064d..9cd6ad7f 100644 --- a/packages/astroport_periphery/src/lib.rs +++ b/packages/astroport_periphery/src/lib.rs @@ -2,6 +2,7 @@ pub mod airdrop; pub mod auction; pub mod helpers; pub mod lockdrop; +pub mod lockdrop_pcl; pub mod pricefeed; pub mod simple_airdrop; pub mod utils; diff --git a/packages/astroport_periphery/src/lockdrop_pcl.rs b/packages/astroport_periphery/src/lockdrop_pcl.rs new file mode 100644 index 00000000..6dcbd342 --- /dev/null +++ b/packages/astroport_periphery/src/lockdrop_pcl.rs @@ -0,0 +1,426 @@ +use astroport::asset::{Asset, AssetInfo}; +use astroport::restricted_vector::RestrictedVector; +use cosmwasm_schema::{cw_serde, QueryResponses}; +use cosmwasm_std::{ + to_binary, Addr, CosmosMsg, Decimal, Decimal256, Env, StdError, StdResult, Uint128, Uint256, + WasmMsg, +}; +use cw20::Cw20ReceiveMsg; +use cw_storage_plus::{Key, KeyDeserialize, Prefixer, PrimaryKey}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +// TODO: implement display trait +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Copy)] +pub enum PoolType { + USDC, + ATOM, +} + +#[allow(clippy::from_over_into)] +impl Into for PoolType { + fn into(self) -> String { + match self { + PoolType::USDC => "usdc".to_string(), + PoolType::ATOM => "atom".to_string(), + } + } +} + +impl PoolType { + fn bytes(&self) -> &[u8] { + match self { + PoolType::USDC => "usdc".as_bytes(), + PoolType::ATOM => "atom".as_bytes(), + } + } +} + +impl KeyDeserialize for PoolType { + type Output = PoolType; + + fn from_vec(value: Vec) -> StdResult { + match value.as_slice() { + b"usdc" => Ok(PoolType::USDC), + b"atom" => Ok(PoolType::ATOM), + _ => Err(StdError::generic_err("Invalid PoolType")), + } + } +} + +impl<'a> PrimaryKey<'a> for PoolType { + type Prefix = (); + type SubPrefix = (); + type Suffix = Self; + type SuperSuffix = Self; + + fn key(&self) -> Vec { + vec![Key::Ref(self.bytes())] + } +} + +impl<'a> Prefixer<'a> for PoolType { + fn prefix(&self) -> Vec { + vec![Key::Ref(self.bytes())] + } +} + +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct InstantiateMsg { + /// Account which can update config + pub owner: Option, + /// Account which can update token addresses and generator + pub token_info_manager: String, + /// Credits contract address + pub credits_contract: String, + /// Auction contract address + pub auction_contract: String, + /// Timestamp when Contract will start accepting LP Token deposits + pub init_timestamp: u64, + /// Number of seconds during which lockup deposits will be accepted + pub lock_window: u64, + /// Withdrawal Window Length :: Post the deposit window + pub withdrawal_window: u64, + /// Min. no. of weeks allowed for lockup + pub min_lock_duration: u64, + /// Max. no. of weeks allowed for lockup + pub max_lock_duration: u64, + /// Max lockup positions a user can have + pub max_positions_per_user: u32, + /// Describes rewards coefficients for each lockup duration + pub lockup_rewards_info: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct UpdateConfigMsg { + /// Bootstrap Auction contract address + pub auction_contract_address: Option, + /// Generator (Staking for dual rewards) contract address + pub generator_address: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum ExecuteMsg { + IncreaseLockupFor { + user_address: String, + pool_type: PoolType, + amount: Uint128, + duration: u64, + }, + // Receive hook used to accept LP Token deposits + Receive(Cw20ReceiveMsg), + #[serde(rename = "increase_ntrn_incentives")] + IncreaseNTRNIncentives {}, + // ADMIN Function ::: To update configuration + UpdateConfig { + new_config: UpdateConfigMsg, + }, + SetTokenInfo { + atom_token: String, + usdc_token: String, + generator: String, + }, + // Function to facilitate LP Token withdrawals from lockups + WithdrawFromLockup { + user_address: String, + pool_type: PoolType, + duration: u64, + amount: Uint128, + }, + + // ADMIN Function ::: To Migrate liquidity from terraswap to astroport + // MigrateLiquidity { + // terraswap_lp_token: String, + // astroport_pool_addr: String, + // slippage_tolerance: Option, + // }, + // ADMIN Function ::: To stake LP Tokens with the generator contract + // StakeLpTokens { + // pool_type: PoolType, + // }, + // Facilitates ASTRO reward withdrawal which have not been delegated to bootstrap auction along with optional Unlock (can be forceful) + // If withdraw_lp_stake is true and force_unlock is false, it Unlocks the lockup position if its lockup duration has concluded + // If both withdraw_lp_stake and force_unlock are true, it forcefully unlocks the positon. user needs to approve ASTRO Token to + // be transferred by the lockdrop contract to itself for forceful unlock + ClaimRewardsAndOptionallyUnlock { + pool_type: PoolType, + duration: u64, + withdraw_lp_stake: bool, + }, + /// Callbacks; only callable by the contract itself. + Callback(CallbackMsg), + /// ProposeNewOwner creates a proposal to change contract ownership. + /// The validity period for the proposal is set in the `expires_in` variable. + ProposeNewOwner { + /// Newly proposed contract owner + owner: String, + /// The date after which this proposal expires + expires_in: u64, + }, + /// DropOwnershipProposal removes the existing offer to change contract ownership. + DropOwnershipProposal {}, + /// Used to claim contract ownership. + ClaimOwnership {}, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum Cw20HookMsg { + // Called by the bootstrap auction contract when liquidity is added to the + // Pool to enable ASTRO withdrawals by users + // EnableClaims {}, + // ADMIN Function ::: Add new Pool (Only Terraswap Pools) + InitializePool { + pool_type: PoolType, + incentives_share: Uint128, + }, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum CallbackMsg { + UpdatePoolOnDualRewardsClaim { + pool_type: PoolType, + prev_ntrn_balance: Uint128, + prev_proxy_reward_balances: Vec, + }, + WithdrawUserLockupRewardsCallback { + pool_type: PoolType, + user_address: Addr, + duration: u64, + withdraw_lp_stake: bool, + }, + // WithdrawLiquidityFromTerraswapCallback { + // terraswap_lp_token: Addr, + // astroport_pool: Addr, + // prev_assets: [terraswap::asset::Asset; 2], + // slippage_tolerance: Option, + // }, +} + +// Modified from +// https://github.com/CosmWasm/cosmwasm-plus/blob/v0.2.3/packages/cw20/src/receiver.rs#L15 +impl CallbackMsg { + pub fn to_cosmos_msg(self, env: &Env) -> StdResult { + Ok(CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: env.contract.address.to_string(), + msg: to_binary(&ExecuteMsg::Callback(self))?, + funds: vec![], + })) + } +} + +#[cw_serde] +#[derive(QueryResponses)] +pub enum QueryMsg { + #[returns(Config)] + Config {}, + #[returns(StateResponse)] + State {}, + #[returns(PoolInfo)] + Pool { pool_type: PoolType }, + #[returns(UserInfoResponse)] + UserInfo { address: String }, + #[returns(UserInfoWithListResponse)] + UserInfoWithLockupsList { address: String }, + #[returns(LockUpInfoResponse)] + LockUpInfo { + user_address: String, + pool_type: PoolType, + duration: u64, + }, + #[returns(Option)] + QueryUserLockupTotalAtHeight { + pool_type: PoolType, + user_address: String, + height: u64, + }, + #[returns(Option)] + QueryLockupTotalAtHeight { pool_type: PoolType, height: u64 }, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct MigrateMsg {} + +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)] +pub struct MigrationInfo { + pub terraswap_migrated_amount: Uint128, + pub astroport_lp_token: Addr, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct LockupRewardsInfo { + pub duration: u64, + pub coefficient: Decimal256, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct Config { + /// Account which can update the config + pub owner: Addr, + /// Account which can update the generator and token addresses + pub token_info_manager: Addr, + /// Credits contract address + pub credits_contract: Addr, + /// Bootstrap Auction contract address + pub auction_contract: Addr, + /// Generator (Staking for dual rewards) contract address + pub generator: Option, + /// Timestamp when Contract will start accepting LP Token deposits + pub init_timestamp: u64, + /// Number of seconds during which lockup positions be accepted + pub lock_window: u64, + /// Withdrawal Window Length :: Post the deposit window + pub withdrawal_window: u64, + /// Min. no. of weeks allowed for lockup + pub min_lock_duration: u64, + /// Max. no. of weeks allowed for lockup + pub max_lock_duration: u64, + /// Total NTRN lockdrop incentives to be distributed among the users + pub lockdrop_incentives: Uint128, + /// Max lockup positions a user can have + pub max_positions_per_user: u32, + /// Describes rewards coefficients for each lockup duration + pub lockup_rewards_info: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] +pub struct State { + /// Total NTRN incentives share + pub total_incentives_share: Uint128, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct PoolInfo { + pub lp_token: Addr, + pub amount_in_lockups: Uint128, + // pub migration_info: Option, + /// Share of total NTRN incentives allocated to this pool + pub incentives_share: Uint128, + /// Weighted LP Token balance used to calculate NTRN rewards a particular user can claim + pub weighted_amount: Uint256, + /// Ratio of Generator NTRN rewards accured to astroport pool share + pub generator_ntrn_per_share: Decimal, + /// Ratio of Generator Proxy rewards accured to astroport pool share + pub generator_proxy_per_share: RestrictedVector, + /// Boolean value indicating if the LP Tokens are staked with the Generator contract or not + pub is_staked: bool, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] +pub struct UserInfo { + /// Total NTRN tokens user received as rewards for participation in the lockdrop + pub total_ntrn_rewards: Uint128, + /// NTRN tokens transferred to user + pub ntrn_transferred: bool, + /// Number of lockup positions the user is having + pub lockup_positions_index: u32, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct LockupInfoV1 { + /// Terraswap LP units locked by the user + pub lp_units_locked: Uint128, + pub astroport_lp_transferred: Option, + /// Boolean value indicating if the user's has withdrawn funds post the only 1 withdrawal limit cutoff + pub withdrawal_flag: bool, + /// NTRN tokens received as rewards for participation in the lockdrop + pub ntrn_rewards: Uint128, + /// Generator NTRN tokens loockup received as generator rewards + pub generator_ntrn_debt: Uint128, + /// Generator Proxy tokens lockup received as generator rewards + pub generator_proxy_debt: Uint128, + /// Timestamp beyond which this position can be unlocked + pub unlock_timestamp: u64, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct LockupInfoV2 { + /// Terraswap LP units locked by the user + pub lp_units_locked: Uint128, + pub astroport_lp_transferred: Option, + /// Boolean value indicating if the user's has withdrawn funds post the only 1 withdrawal limit cutoff + pub withdrawal_flag: bool, + /// NTRN tokens received as rewards for participation in the lockdrop + pub ntrn_rewards: Uint128, + /// Generator NTRN tokens loockup received as generator rewards + pub generator_ntrn_debt: Uint128, + /// Generator Proxy tokens lockup received as generator rewards + pub generator_proxy_debt: RestrictedVector, + /// Timestamp beyond which this position can be unlocked + pub unlock_timestamp: u64, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct StateResponse { + /// Total NTRN incentives share + pub total_incentives_share: Uint128, + /// Vector containing LP addresses for all the supported LP Pools + pub supported_pairs_list: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct UserInfoResponse { + /// Total NTRN tokens user received as rewards for participation in the lockdrop + pub total_ntrn_rewards: Uint128, + /// NTRN tokens transferred to user + pub ntrn_transferred: bool, + /// Lockup positions + pub lockup_infos: Vec, + /// NTRN tokens receivable as generator rewards that user can claim + pub claimable_generator_ntrn_debt: Uint128, + /// Number of lockup positions the user is having + pub lockup_positions_index: u32, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct UserInfoWithListResponse { + /// Total NTRN tokens user received as rewards for participation in the lockdrop + pub total_ntrn_rewards: Uint128, + /// NTRN tokens transferred to user + pub ntrn_transferred: bool, + /// Lockup positions + pub lockup_infos: Vec, + /// Number of lockup positions the user is having + pub lockup_positions_index: u32, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct LockUpInfoSummary { + pub pool_type: PoolType, + pub duration: u64, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct LockUpInfoResponse { + /// Terraswap LP token + pub pool_type: PoolType, + /// Terraswap LP units locked by the user + pub lp_units_locked: Uint128, + /// Boolean value indicating if the user's has withdrawn funds post the only 1 withdrawal limit cutoff + pub withdrawal_flag: bool, + /// NTRN tokens received as rewards for participation in the lockdrop + pub ntrn_rewards: Uint128, + pub duration: u64, + /// Generator NTRN tokens lockup received as generator rewards + pub generator_ntrn_debt: Uint128, + /// ASTRO tokens receivable as generator rewards that user can claim + pub claimable_generator_astro_debt: Uint128, + /// Generator Proxy tokens lockup received as generator rewards + pub generator_proxy_debt: RestrictedVector, + /// Proxy tokens receivable as generator rewards that user can claim + pub claimable_generator_proxy_debt: RestrictedVector, + /// Timestamp beyond which this position can be unlocked + pub unlock_timestamp: u64, + /// User's Astroport LP units, calculated as lp_units_locked (terraswap) / total LP units locked (terraswap) * Astroport LP units minted post migration + pub astroport_lp_units: Option, + pub astroport_lp_token: Addr, + pub astroport_lp_transferred: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct PendingAssetRewardResponse { + pub amount: Uint128, +} diff --git a/packages/vesting-base/Cargo.toml b/packages/vesting-base/Cargo.toml index ffe8e644..f533e362 100644 --- a/packages/vesting-base/Cargo.toml +++ b/packages/vesting-base/Cargo.toml @@ -13,10 +13,10 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cw20 = { workspace = true } +cw20 = { version = "0.15" } cosmwasm-std = { workspace = true } cw-storage-plus = { workspace = true } -astroport = { workspace = true } +astroport = { path = "../../packages/astroport" } thiserror = { workspace = true } # we keep it at 0.15 instead of latest version just for vesting investors contract cw-utils = "0.15" diff --git a/packages/vesting-base/src/error.rs b/packages/vesting-base/src/error.rs index a1859ac0..efee45d3 100644 --- a/packages/vesting-base/src/error.rs +++ b/packages/vesting-base/src/error.rs @@ -20,6 +20,9 @@ pub enum ContractError { #[error("Vesting schedule error on addr: {0}. Should satisfy: (start < end and at_start < total) or (start = end and at_start = total)")] VestingScheduleError(String), + #[error("Vesting schedule error on addr: {0}. No schedule found")] + VestingScheduleExtractError(String), + #[error("Vesting schedule amount error. The total amount should be equal to the CW20 receive amount.")] VestingScheduleAmountError {}, diff --git a/packages/vesting-base/src/handlers.rs b/packages/vesting-base/src/handlers.rs index 7797db28..d41c3371 100644 --- a/packages/vesting-base/src/handlers.rs +++ b/packages/vesting-base/src/handlers.rs @@ -120,7 +120,7 @@ fn receive_cw20( /// * **vesting_accounts** list of accounts and associated vesting schedules to create. /// /// * **cw20_amount** sets the amount that confirms the total amount of all accounts to register. -fn register_vesting_accounts( +pub fn register_vesting_accounts( deps: DepsMut, vesting_accounts: Vec, amount: Uint128, @@ -275,7 +275,7 @@ pub(crate) fn set_vesting_token( ])) } -pub(crate) fn get_vesting_token(config: &Config) -> Result { +pub fn get_vesting_token(config: &Config) -> Result { config .vesting_token .clone() @@ -398,7 +398,7 @@ fn is_sender_whitelisted(store: &mut dyn Storage, config: &Config, sender: &Addr /// * **addr** receiver of the vested tokens. /// /// * **vesting_schedules** vesting schedules to validate. -fn assert_vesting_schedules( +pub fn assert_vesting_schedules( addr: &Addr, vesting_schedules: &[VestingSchedule], ) -> Result<(), ContractError> { diff --git a/packages/vesting-base/src/state.rs b/packages/vesting-base/src/state.rs index 978fd8c6..9178f7ca 100644 --- a/packages/vesting-base/src/state.rs +++ b/packages/vesting-base/src/state.rs @@ -3,9 +3,9 @@ use astroport::common::OwnershipProposal; use cosmwasm_std::{Addr, Deps, StdResult}; use cw_storage_plus::{Bound, Item, Map, SnapshotItem, SnapshotMap, Strategy}; -pub(crate) const CONFIG: Item = Item::new("config"); +pub const CONFIG: Item = Item::new("config"); pub(crate) const OWNERSHIP_PROPOSAL: Item = Item::new("ownership_proposal"); -pub(crate) const VESTING_MANAGERS: Map = Map::new("vesting_managers"); +pub const VESTING_MANAGERS: Map = Map::new("vesting_managers"); pub(crate) const VESTING_STATE: SnapshotItem = SnapshotItem::new( "vesting_state", "vesting_state__checkpoints", @@ -31,14 +31,14 @@ pub(crate) const VESTING_INFO_HISTORICAL: SnapshotMap = Snaps Strategy::EveryBlock, ); -pub(crate) fn vesting_state(historical: bool) -> SnapshotItem<'static, VestingState> { +pub fn vesting_state(historical: bool) -> SnapshotItem<'static, VestingState> { if historical { return VESTING_STATE_HISTORICAL; } VESTING_STATE } -pub(crate) fn vesting_info(historical: bool) -> SnapshotMap<'static, Addr, VestingInfo> { +pub fn vesting_info(historical: bool) -> SnapshotMap<'static, Addr, VestingInfo> { if historical { return VESTING_INFO_HISTORICAL; } diff --git a/packages/vesting-base/src/types.rs b/packages/vesting-base/src/types.rs index f6081025..6a1378b4 100644 --- a/packages/vesting-base/src/types.rs +++ b/packages/vesting-base/src/types.rs @@ -81,6 +81,15 @@ pub struct VestingAccountResponse { pub info: VestingInfo, } +/// This structure describes a custom struct used to pass the vesting data about a specific vesting target during migration. +#[cw_serde] +pub struct VestingAccountFullInfo { + /// The address that's vesting tokens + pub address: Addr, + /// Vesting information + pub info: VestingInfo, +} + /// This structure describes a custom struct used to return vesting data for multiple vesting targets. #[cw_serde] pub struct VestingAccountsResponse {