diff --git a/.changelog/unreleased/bug-fixes/206-fix-historical-tribute-claims.md b/.changelog/v3.0.0/bug-fixes/206-fix-historical-tribute-claims.md similarity index 100% rename from .changelog/unreleased/bug-fixes/206-fix-historical-tribute-claims.md rename to .changelog/v3.0.0/bug-fixes/206-fix-historical-tribute-claims.md diff --git a/.changelog/unreleased/features/208-add-per-tranche-info.md b/.changelog/v3.0.0/features/208-add-per-tranche-info.md similarity index 100% rename from .changelog/unreleased/features/208-add-per-tranche-info.md rename to .changelog/v3.0.0/features/208-add-per-tranche-info.md diff --git a/.changelog/unreleased/features/213-allow-unlocking-specific-lock_ids.md b/.changelog/v3.0.0/features/213-allow-unlocking-specific-lock_ids.md similarity index 100% rename from .changelog/unreleased/features/213-allow-unlocking-specific-lock_ids.md rename to .changelog/v3.0.0/features/213-allow-unlocking-specific-lock_ids.md diff --git a/.changelog/unreleased/features/216-add-specific-user-lockups-query.md b/.changelog/v3.0.0/features/216-add-specific-user-lockups-query.md similarity index 100% rename from .changelog/unreleased/features/216-add-specific-user-lockups-query.md rename to .changelog/v3.0.0/features/216-add-specific-user-lockups-query.md diff --git a/.changelog/v3.0.0/summary.md b/.changelog/v3.0.0/summary.md new file mode 100644 index 00000000..6fb2ccaa --- /dev/null +++ b/.changelog/v3.0.0/summary.md @@ -0,0 +1,7 @@ +Date: January 20th, 2025 + + diff --git a/CHANGELOG b/CHANGELOG index c54a1e8d..020495ae 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,29 @@ # CHANGELOG +## v3.0.0 + +Date: January 20th, 2025 + + + +### BUG FIXES + +- Fix the return type of the `HistoricalTributeClaims` query to be `HistoricalTributeClaimsResponse` instead of `Vec` + ([\#206](https://github.com/informalsystems/hydro/pull/206)) + +### FEATURES + +- Add an extra query for lockups that includes information about when lockups can vote again. + ([\#208](https://github.com/informalsystems/hydro/pull/208)) +- Allow users / aggregators to unlock only some specific locks instead of all their locks. + ([\#213](https://github.com/informalsystems/hydro/pull/213)) +- Add SpecificUserLockups and SpecificUserLockupsWithTrancheInfos queries for aggregators to be able to query only a subset of their lockups. + ([\#216](https://github.com/informalsystems/hydro/pull/216)) + ## v2.1.0 Date: December 12th, 2024 @@ -71,10 +95,10 @@ Date: November 18th, 2024 - Adjusts tributes to only be claimable if their proposal received a non-zero fund deployment. ([\#164](https://github.com/informalsystems/hydro/pull/164)) -- Add a minimum liquidity request value to proposals. - ([\#164](https://github.com/informalsystems/hydro/pull/164)) - Allow whitelist admins to register performed liquidity deployments in the Hydro contract. ([\#164](https://github.com/informalsystems/hydro/pull/164)) +- Add a minimum liquidity request value to proposals. + ([\#164](https://github.com/informalsystems/hydro/pull/164)) - Allow bids to set a custom duration they would like to receive liquidity for. ([\#165](https://github.com/informalsystems/hydro/pull/165)) diff --git a/Cargo.lock b/Cargo.lock index 5dd44ac9..a4fb32dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "abstract-cw-multi-test" @@ -3728,7 +3728,7 @@ dependencies = [ [[package]] name = "tribute" -version = "2.0.2" +version = "3.0.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", diff --git a/artifacts/checksums.txt b/artifacts/checksums.txt index 6c0339d9..4ea104a9 100644 --- a/artifacts/checksums.txt +++ b/artifacts/checksums.txt @@ -1,2 +1,2 @@ -30ce648f9fead26e96aafdb5e199a7fe2ab4a8c8beba0f27367ce3bcab8d7a23 hydro.wasm -b8ab9f80560a293a879472d839e0d20a651cd0b51ad9471523e1c8c5ee0756c7 tribute.wasm +5f19172adc451140c7d14966faf217b82ed64bd70dfa518a4093d74bf8d60617 hydro.wasm +5acd797d95c0addc2b457deab521c171acad2a514b0a1624f3f07f7775aacc59 tribute.wasm diff --git a/artifacts/hydro.wasm b/artifacts/hydro.wasm index a0539f66..3c2348dd 100644 Binary files a/artifacts/hydro.wasm and b/artifacts/hydro.wasm differ diff --git a/artifacts/tribute.wasm b/artifacts/tribute.wasm index dd83ee9e..8618e5be 100644 Binary files a/artifacts/tribute.wasm and b/artifacts/tribute.wasm differ diff --git a/contracts/hydro/schema/hydro_full_schema.json b/contracts/hydro/schema/hydro_full_schema.json index 29c35c47..61821e58 100644 --- a/contracts/hydro/schema/hydro_full_schema.json +++ b/contracts/hydro/schema/hydro_full_schema.json @@ -1285,19 +1285,16 @@ "migrate": {}, "sudo": {}, "responses": { - "round_tranche_liquidity_deployments": { + "liquidity_deployment": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "RoundTrancheLiquidityDeploymentsResponse", + "title": "LiquidityDeploymentResponse", "type": "object", "required": [ - "liquidity_deployments" + "liquidity_deployment" ], "properties": { - "liquidity_deployments": { - "type": "array", - "items": { - "$ref": "#/definitions/LiquidityDeployment" - } + "liquidity_deployment": { + "$ref": "#/definitions/LiquidityDeployment" } }, "additionalProperties": false, @@ -1383,120 +1380,108 @@ } } }, - "all_user_lockups_with_tranche_infos": { + "tranches": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "AllUserLockupsWithTrancheInfosResponse", + "title": "TranchesResponse", "type": "object", "required": [ - "lockups_with_per_tranche_infos" + "tranches" ], "properties": { - "lockups_with_per_tranche_infos": { + "tranches": { "type": "array", "items": { - "$ref": "#/definitions/LockupWithPerTrancheInfo" + "$ref": "#/definitions/Tranche" } } }, "additionalProperties": false, "definitions": { - "Coin": { + "Tranche": { "type": "object", "required": [ - "amount", - "denom" + "id", + "metadata", + "name" ], "properties": { - "amount": { - "$ref": "#/definitions/Uint128" + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 }, - "denom": { + "metadata": { + "type": "string" + }, + "name": { "type": "string" } }, "additionalProperties": false - }, - "LockEntry": { + } + } + }, + "top_n_proposals": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TopNProposalsResponse", + "type": "object", + "required": [ + "proposals" + ], + "properties": { + "proposals": { + "type": "array", + "items": { + "$ref": "#/definitions/Proposal" + } + } + }, + "additionalProperties": false, + "definitions": { + "Proposal": { "type": "object", "required": [ - "funds", - "lock_end", - "lock_id", - "lock_start" + "deployment_duration", + "description", + "minimum_atom_liquidity_request", + "percentage", + "power", + "proposal_id", + "round_id", + "title", + "tranche_id" ], "properties": { - "funds": { - "$ref": "#/definitions/Coin" - }, - "lock_end": { - "$ref": "#/definitions/Timestamp" - }, - "lock_id": { + "deployment_duration": { "type": "integer", "format": "uint64", "minimum": 0.0 }, - "lock_start": { - "$ref": "#/definitions/Timestamp" - } - }, - "additionalProperties": false - }, - "LockEntryWithPower": { - "type": "object", - "required": [ - "current_voting_power", - "lock_entry" - ], - "properties": { - "current_voting_power": { + "description": { + "type": "string" + }, + "minimum_atom_liquidity_request": { "$ref": "#/definitions/Uint128" }, - "lock_entry": { - "$ref": "#/definitions/LockEntry" - } - }, - "additionalProperties": false - }, - "LockupWithPerTrancheInfo": { - "type": "object", - "required": [ - "lock_with_power", - "per_tranche_info" - ], - "properties": { - "lock_with_power": { - "$ref": "#/definitions/LockEntryWithPower" + "percentage": { + "$ref": "#/definitions/Uint128" }, - "per_tranche_info": { - "type": "array", - "items": { - "$ref": "#/definitions/PerTrancheLockupInfo" - } - } - }, - "additionalProperties": false - }, - "PerTrancheLockupInfo": { - "type": "object", - "required": [ - "next_round_lockup_can_vote", - "tranche_id" - ], - "properties": { - "current_voted_on_proposal": { - "type": [ - "integer", - "null" - ], + "power": { + "$ref": "#/definitions/Uint128" + }, + "proposal_id": { + "type": "integer", "format": "uint64", "minimum": 0.0 }, - "next_round_lockup_can_vote": { + "round_id": { "type": "integer", "format": "uint64", "minimum": 0.0 }, + "title": { + "type": "string" + }, "tranche_id": { "type": "integer", "format": "uint64", @@ -1505,21 +1490,9 @@ }, "additionalProperties": false }, - "Timestamp": { - "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", - "allOf": [ - { - "$ref": "#/definitions/Uint64" - } - ] - }, "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" - }, - "Uint64": { - "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 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 `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", - "type": "string" } } }, @@ -1598,50 +1571,107 @@ } } }, - "tranches": { + "round_tranche_liquidity_deployments": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "TranchesResponse", + "title": "RoundTrancheLiquidityDeploymentsResponse", "type": "object", "required": [ - "tranches" + "liquidity_deployments" ], "properties": { - "tranches": { + "liquidity_deployments": { "type": "array", "items": { - "$ref": "#/definitions/Tranche" + "$ref": "#/definitions/LiquidityDeployment" } } }, "additionalProperties": false, "definitions": { - "Tranche": { + "Coin": { "type": "object", "required": [ - "id", - "metadata", - "name" + "amount", + "denom" ], "properties": { - "id": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "additionalProperties": false + }, + "LiquidityDeployment": { + "type": "object", + "required": [ + "deployed_funds", + "destinations", + "funds_before_deployment", + "proposal_id", + "remaining_rounds", + "round_id", + "total_rounds", + "tranche_id" + ], + "properties": { + "deployed_funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "destinations": { + "type": "array", + "items": { + "type": "string" + } + }, + "funds_before_deployment": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "proposal_id": { "type": "integer", "format": "uint64", "minimum": 0.0 }, - "metadata": { - "type": "string" + "remaining_rounds": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 }, - "name": { - "type": "string" + "round_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_rounds": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "tranche_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 } }, "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" } } }, - "expired_user_lockups": { + "all_user_lockups": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ExpiredUserLockupsResponse", + "title": "AllUserLockupsResponse", "type": "object", "required": [ "lockups" @@ -1650,7 +1680,7 @@ "lockups": { "type": "array", "items": { - "$ref": "#/definitions/LockEntry" + "$ref": "#/definitions/LockEntryWithPower" } } }, @@ -1698,8 +1728,24 @@ }, "additionalProperties": false }, - "Timestamp": { - "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "LockEntryWithPower": { + "type": "object", + "required": [ + "current_voting_power", + "lock_entry" + ], + "properties": { + "current_voting_power": { + "$ref": "#/definitions/Uint128" + }, + "lock_entry": { + "$ref": "#/definitions/LockEntry" + } + }, + "additionalProperties": false + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", "allOf": [ { "$ref": "#/definitions/Uint64" @@ -1716,64 +1762,223 @@ } } }, - "validator_power_ratio": { + "i_c_q_managers": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ValidatorPowerRatioResponse", + "title": "ICQManagersResponse", "type": "object", "required": [ - "ratio" + "managers" ], "properties": { - "ratio": { - "$ref": "#/definitions/Decimal" + "managers": { + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } } }, "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)", + "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" } } }, - "user_votes": { + "user_voting_power": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "UserVotesResponse", + "title": "UserVotingPowerResponse", "type": "object", "required": [ - "votes" + "voting_power" ], "properties": { - "votes": { + "voting_power": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "registered_validator_queries": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "RegisteredValidatorQueriesResponse", + "type": "object", + "required": [ + "query_ids" + ], + "properties": { + "query_ids": { "type": "array", "items": { - "$ref": "#/definitions/VoteWithPower" + "type": "array", + "items": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + ], + "maxItems": 2, + "minItems": 2 + } + } + }, + "additionalProperties": false + }, + "specific_user_lockups": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SpecificUserLockupsResponse", + "type": "object", + "required": [ + "lockups" + ], + "properties": { + "lockups": { + "type": "array", + "items": { + "$ref": "#/definitions/LockEntryWithPower" } } }, "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" + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "additionalProperties": false }, - "VoteWithPower": { + "LockEntry": { "type": "object", "required": [ - "power", - "prop_id" + "funds", + "lock_end", + "lock_id", + "lock_start" ], "properties": { - "power": { - "$ref": "#/definitions/Decimal" + "funds": { + "$ref": "#/definitions/Coin" }, - "prop_id": { + "lock_end": { + "$ref": "#/definitions/Timestamp" + }, + "lock_id": { "type": "integer", "format": "uint64", "minimum": 0.0 + }, + "lock_start": { + "$ref": "#/definitions/Timestamp" } }, "additionalProperties": false + }, + "LockEntryWithPower": { + "type": "object", + "required": [ + "current_voting_power", + "lock_entry" + ], + "properties": { + "current_voting_power": { + "$ref": "#/definitions/Uint128" + }, + "lock_entry": { + "$ref": "#/definitions/LockEntry" + } + }, + "additionalProperties": false + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "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" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 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 `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "total_locked_tokens": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TotalLockedTokensResponse", + "type": "object", + "required": [ + "total_locked_tokens" + ], + "properties": { + "total_locked_tokens": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "validator_power_ratio": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ValidatorPowerRatioResponse", + "type": "object", + "required": [ + "ratio" + ], + "properties": { + "ratio": { + "$ref": "#/definitions/Decimal" + } + }, + "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" + } + } + }, + "whitelist": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "WhitelistResponse", + "type": "object", + "required": [ + "whitelist" + ], + "properties": { + "whitelist": { + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + } + }, + "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" } } }, @@ -1906,32 +2111,9 @@ } } }, - "whitelist": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "WhitelistResponse", - "type": "object", - "required": [ - "whitelist" - ], - "properties": { - "whitelist": { - "type": "array", - "items": { - "$ref": "#/definitions/Addr" - } - } - }, - "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" - } - } - }, - "all_user_lockups": { + "expired_user_lockups": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "AllUserLockupsResponse", + "title": "ExpiredUserLockupsResponse", "type": "object", "required": [ "lockups" @@ -1940,7 +2122,7 @@ "lockups": { "type": "array", "items": { - "$ref": "#/definitions/LockEntryWithPower" + "$ref": "#/definitions/LockEntry" } } }, @@ -1988,22 +2170,6 @@ }, "additionalProperties": false }, - "LockEntryWithPower": { - "type": "object", - "required": [ - "current_voting_power", - "lock_entry" - ], - "properties": { - "current_voting_power": { - "$ref": "#/definitions/Uint128" - }, - "lock_entry": { - "$ref": "#/definitions/LockEntry" - } - }, - "additionalProperties": false - }, "Timestamp": { "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", "allOf": [ @@ -2022,119 +2188,38 @@ } } }, - "proposal": { + "round_total_voting_power": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ProposalResponse", + "title": "RoundTotalVotingPowerResponse", "type": "object", "required": [ - "proposal" + "total_voting_power" ], "properties": { - "proposal": { - "$ref": "#/definitions/Proposal" + "total_voting_power": { + "$ref": "#/definitions/Uint128" } }, "additionalProperties": false, "definitions": { - "Proposal": { - "type": "object", - "required": [ - "deployment_duration", - "description", - "minimum_atom_liquidity_request", - "percentage", - "power", - "proposal_id", - "round_id", - "title", - "tranche_id" - ], - "properties": { - "deployment_duration": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "description": { - "type": "string" - }, - "minimum_atom_liquidity_request": { - "$ref": "#/definitions/Uint128" - }, - "percentage": { - "$ref": "#/definitions/Uint128" - }, - "power": { - "$ref": "#/definitions/Uint128" - }, - "proposal_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "round_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "title": { - "type": "string" - }, - "tranche_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "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" } } }, - "registered_validator_queries": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "RegisteredValidatorQueriesResponse", - "type": "object", - "required": [ - "query_ids" - ], - "properties": { - "query_ids": { - "type": "array", - "items": { - "type": "array", - "items": [ - { - "type": "string" - }, - { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - ], - "maxItems": 2, - "minItems": 2 - } - } - }, - "additionalProperties": false - }, - "specific_user_lockups": { + "all_user_lockups_with_tranche_infos": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "SpecificUserLockupsResponse", + "title": "AllUserLockupsWithTrancheInfosResponse", "type": "object", "required": [ - "lockups" + "lockups_with_per_tranche_infos" ], "properties": { - "lockups": { + "lockups_with_per_tranche_infos": { "type": "array", "items": { - "$ref": "#/definitions/LockEntryWithPower" + "$ref": "#/definitions/LockupWithPerTrancheInfo" } } }, @@ -2198,6 +2283,53 @@ }, "additionalProperties": false }, + "LockupWithPerTrancheInfo": { + "type": "object", + "required": [ + "lock_with_power", + "per_tranche_info" + ], + "properties": { + "lock_with_power": { + "$ref": "#/definitions/LockEntryWithPower" + }, + "per_tranche_info": { + "type": "array", + "items": { + "$ref": "#/definitions/PerTrancheLockupInfo" + } + } + }, + "additionalProperties": false + }, + "PerTrancheLockupInfo": { + "type": "object", + "required": [ + "next_round_lockup_can_vote", + "tranche_id" + ], + "properties": { + "current_voted_on_proposal": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "next_round_lockup_can_vote": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "tranche_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, "Timestamp": { "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", "allOf": [ @@ -2216,22 +2348,76 @@ } } }, - "top_n_proposals": { + "whitelist_admins": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "TopNProposalsResponse", + "title": "WhitelistAdminsResponse", "type": "object", "required": [ - "proposals" + "admins" ], "properties": { - "proposals": { + "admins": { "type": "array", "items": { - "$ref": "#/definitions/Proposal" + "$ref": "#/definitions/Addr" } } }, "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" + } + } + }, + "current_round": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CurrentRoundResponse", + "type": "object", + "required": [ + "round_end", + "round_id" + ], + "properties": { + "round_end": { + "$ref": "#/definitions/Timestamp" + }, + "round_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 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 `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "proposal": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ProposalResponse", + "type": "object", + "required": [ + "proposal" + ], + "properties": { + "proposal": { + "$ref": "#/definitions/Proposal" + } + }, + "additionalProperties": false, "definitions": { "Proposal": { "type": "object", @@ -2291,103 +2477,44 @@ } } }, - "whitelist_admins": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "WhitelistAdminsResponse", - "type": "object", - "required": [ - "admins" - ], - "properties": { - "admins": { - "type": "array", - "items": { - "$ref": "#/definitions/Addr" - } - } - }, - "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" - } - } - }, - "i_c_q_managers": { + "user_votes": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ICQManagersResponse", + "title": "UserVotesResponse", "type": "object", "required": [ - "managers" + "votes" ], "properties": { - "managers": { + "votes": { "type": "array", "items": { - "$ref": "#/definitions/Addr" + "$ref": "#/definitions/VoteWithPower" } } }, "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.", + "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" - } - } - }, - "current_round": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "CurrentRoundResponse", - "type": "object", - "required": [ - "round_end", - "round_id" - ], - "properties": { - "round_end": { - "$ref": "#/definitions/Timestamp" }, - "round_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false, - "definitions": { - "Timestamp": { - "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", - "allOf": [ - { - "$ref": "#/definitions/Uint64" + "VoteWithPower": { + "type": "object", + "required": [ + "power", + "prop_id" + ], + "properties": { + "power": { + "$ref": "#/definitions/Decimal" + }, + "prop_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 } - ] - }, - "Uint64": { - "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 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 `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", - "type": "string" - } - } - }, - "round_total_voting_power": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "RoundTotalVotingPowerResponse", - "type": "object", - "required": [ - "total_voting_power" - ], - "properties": { - "total_voting_power": { - "$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" + }, + "additionalProperties": false } } }, @@ -2531,133 +2658,6 @@ } } }, - "liquidity_deployment": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "LiquidityDeploymentResponse", - "type": "object", - "required": [ - "liquidity_deployment" - ], - "properties": { - "liquidity_deployment": { - "$ref": "#/definitions/LiquidityDeployment" - } - }, - "additionalProperties": false, - "definitions": { - "Coin": { - "type": "object", - "required": [ - "amount", - "denom" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "denom": { - "type": "string" - } - }, - "additionalProperties": false - }, - "LiquidityDeployment": { - "type": "object", - "required": [ - "deployed_funds", - "destinations", - "funds_before_deployment", - "proposal_id", - "remaining_rounds", - "round_id", - "total_rounds", - "tranche_id" - ], - "properties": { - "deployed_funds": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "destinations": { - "type": "array", - "items": { - "type": "string" - } - }, - "funds_before_deployment": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "proposal_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "remaining_rounds": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "round_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "total_rounds": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "tranche_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "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" - } - } - }, - "total_locked_tokens": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "TotalLockedTokensResponse", - "type": "object", - "required": [ - "total_locked_tokens" - ], - "properties": { - "total_locked_tokens": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 - } - }, - "additionalProperties": false - }, - "user_voting_power": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "UserVotingPowerResponse", - "type": "object", - "required": [ - "voting_power" - ], - "properties": { - "voting_power": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 - } - }, - "additionalProperties": false - }, "round_end": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "RoundEndResponse", diff --git a/contracts/hydro/src/migration/migrate.rs b/contracts/hydro/src/migration/migrate.rs index c54e0619..47fd4009 100644 --- a/contracts/hydro/src/migration/migrate.rs +++ b/contracts/hydro/src/migration/migrate.rs @@ -7,18 +7,20 @@ use cw2::{get_contract_version, set_contract_version}; use neutron_sdk::bindings::msg::NeutronMsg; use neutron_sdk::bindings::query::NeutronQuery; -use super::unreleased::{migrate_v2_0_2_to_unreleased, MigrateMsgUNRELEASED}; +use super::v3_0_0::MigrateMsgV3_0_0; pub const CONTRACT_VERSION_V1_1_0: &str = "1.1.0"; pub const CONTRACT_VERSION_V2_0_1: &str = "2.0.1"; pub const CONTRACT_VERSION_V2_0_2: &str = "2.0.2"; -pub const CONTRACT_VERSION_UNRELEASED: &str = "3.0.0"; +pub const CONTRACT_VERSION_V2_1_0: &str = "2.0.2"; +pub const CONTRACT_VERSION_V3_0_0: &str = "3.0.0"; +pub const CONTRACT_VERSION_UNRELEASED: &str = "4.0.0"; #[cfg_attr(not(feature = "library"), entry_point)] pub fn migrate( - mut deps: DepsMut, - env: Env, - msg: MigrateMsgUNRELEASED, + deps: DepsMut, + _env: Env, + _msg: MigrateMsgV3_0_0, ) -> Result, ContractError> { let contract_version = get_contract_version(deps.storage)?; @@ -28,9 +30,7 @@ pub fn migrate( ))); } - if contract_version.version == CONTRACT_VERSION_V2_0_2 { - migrate_v2_0_2_to_unreleased(&mut deps, env.clone(), msg)?; - } + // no migration necessary from 2.1.0 to 3.0.0 set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; diff --git a/contracts/hydro/src/migration/mod.rs b/contracts/hydro/src/migration/mod.rs index 26d71445..3c29627c 100644 --- a/contracts/hydro/src/migration/mod.rs +++ b/contracts/hydro/src/migration/mod.rs @@ -1,7 +1,2 @@ pub mod migrate; -pub mod unreleased; -pub mod v1_1_0; -pub mod v2_0_1; - -#[cfg(test)] -mod testing_v2_0_2_to_unreleased; +pub mod v3_0_0; diff --git a/contracts/hydro/src/migration/testing_v2_0_2_to_unreleased.rs b/contracts/hydro/src/migration/testing_v2_0_2_to_unreleased.rs deleted file mode 100644 index 279c8277..00000000 --- a/contracts/hydro/src/migration/testing_v2_0_2_to_unreleased.rs +++ /dev/null @@ -1,389 +0,0 @@ -use std::str::FromStr; - -use cosmwasm_std::{testing::mock_env, Addr, Decimal, Timestamp, Uint128}; -use cw2::{get_contract_version, set_contract_version}; -use cw_storage_plus::Item; - -use crate::{ - contract::{instantiate, CONTRACT_NAME}, - migration::{ - migrate::{migrate, CONTRACT_VERSION_UNRELEASED, CONTRACT_VERSION_V2_0_2}, - unreleased::{ConstantsUNRELEASED, ConstantsV2_0_2, MigrateMsgUNRELEASED}, - }, - state::{Proposal, RoundLockPowerSchedule, Vote, PROPOSAL_MAP, VOTE_MAP, VOTING_ALLOWED_ROUND}, - testing::{ - get_default_instantiate_msg, get_message_info, ONE_MONTH_IN_NANO_SECONDS, VALIDATOR_1, - }, - testing_mocks::{mock_dependencies, no_op_grpc_query_mock}, -}; - -use super::unreleased::VoteMigrationInfo; - -#[test] -fn test_constants_migration() { - let (mut deps, mut env) = (mock_dependencies(no_op_grpc_query_mock()), mock_env()); - - let first_round_start = Timestamp::from_nanos(1730851140000000000); - env.block.time = first_round_start; - - let user_addr = "addr0000"; - let info = get_message_info(&deps.api, user_addr, &[]); - - // Instantiate the contract - let mut instantiate_msg = get_default_instantiate_msg(&deps.api); - instantiate_msg.first_round_start = first_round_start; - - instantiate( - deps.as_mut(), - env.clone(), - info.clone(), - instantiate_msg.clone(), - ) - .unwrap(); - - // Override contract version so that we can run the migration - let res = set_contract_version(&mut deps.storage, CONTRACT_NAME, CONTRACT_VERSION_V2_0_2); - assert!( - res.is_ok(), - "failed to set contract version before running the migration" - ); - - const OLD_CONSTANTS: Item = Item::new("constants"); - const NEW_CONSTANTS: Item = Item::new("constants"); - - // Override the constants so that they have old data structure stored before running the migration - let old_constants = ConstantsV2_0_2 { - round_length: 2628000000000000, - lock_epoch_length: 2628000000000000, - first_round_start, - max_locked_tokens: 20000000000, - max_validator_shares_participating: 500, - hub_connection_id: "connection-0".to_string(), - hub_transfer_channel_id: "channel-1".to_string(), - icq_update_period: 109000, - paused: false, - is_in_pilot_mode: true, - max_deployment_duration: 12, - }; - - let res = OLD_CONSTANTS.save(&mut deps.storage, &old_constants); - assert!( - res.is_ok(), - "failed to save old constants before running the migration" - ); - - // advance the chain to move to the round 1 - env.block.time = env.block.time.plus_nanos(instantiate_msg.round_length + 1); - - // Run the migration - let migrate_msg = MigrateMsgUNRELEASED {}; - let res = migrate(deps.as_mut(), env.clone(), migrate_msg.clone()); - assert!(res.is_ok(), "migration failed: {}", res.unwrap_err()); - - // Verify that the Constants got migrated properly - let expected_new_constants = ConstantsUNRELEASED { - round_length: old_constants.round_length, - lock_epoch_length: old_constants.lock_epoch_length, - first_round_start: old_constants.first_round_start, - max_locked_tokens: old_constants.max_locked_tokens, - max_validator_shares_participating: old_constants.max_validator_shares_participating, - hub_connection_id: old_constants.hub_connection_id, - hub_transfer_channel_id: old_constants.hub_transfer_channel_id, - icq_update_period: old_constants.icq_update_period, - paused: old_constants.paused, - max_deployment_duration: old_constants.max_deployment_duration, - round_lock_power_schedule: RoundLockPowerSchedule::new(vec![ - (1, Decimal::from_str("1").unwrap()), - (2, Decimal::from_str("1.25").unwrap()), - (3, Decimal::from_str("1.5").unwrap()), - (6, Decimal::from_str("2").unwrap()), - (12, Decimal::from_str("4").unwrap()), - ]), - }; - let res = NEW_CONSTANTS.load(&deps.storage); - assert!( - res.is_ok(), - "failed to load new constants after running the migration" - ); - let new_constants = res.unwrap(); - assert_eq!( - new_constants, expected_new_constants, - "migrated constants not equal to expected ones" - ); - - // Verify the contract version after running the migration - let res = get_contract_version(&deps.storage); - assert_eq!( - res.unwrap().version, - CONTRACT_VERSION_UNRELEASED.to_string() - ); -} - -#[test] -fn test_voting_allowed_info_migration() { - let (mut deps, mut env) = (mock_dependencies(no_op_grpc_query_mock()), mock_env()); - - let first_round_start = Timestamp::from_nanos(1730851140000000000); - env.block.time = first_round_start; - - let user_addr = "addr0000"; - let info = get_message_info(&deps.api, user_addr, &[]); - - // Instantiate the contract - let mut instantiate_msg = get_default_instantiate_msg(&deps.api); - instantiate_msg.first_round_start = first_round_start; - instantiate_msg.round_length = ONE_MONTH_IN_NANO_SECONDS; - - instantiate( - deps.as_mut(), - env.clone(), - info.clone(), - instantiate_msg.clone(), - ) - .unwrap(); - - // Override contract version so that we can run the migration - let res = set_contract_version(&mut deps.storage, CONTRACT_NAME, CONTRACT_VERSION_V2_0_2); - assert!( - res.is_ok(), - "failed to set contract version before running the migration" - ); - - const OLD_CONSTANTS: Item = Item::new("constants"); - - // Override the constants so that they have old data structure stored before running the migration - let old_constants = ConstantsV2_0_2 { - round_length: 2628000000000000, - lock_epoch_length: 2628000000000000, - first_round_start, - max_locked_tokens: 20000000000, - max_validator_shares_participating: 500, - hub_connection_id: "connection-0".to_string(), - hub_transfer_channel_id: "channel-1".to_string(), - icq_update_period: 109000, - paused: false, - is_in_pilot_mode: true, - max_deployment_duration: 12, - }; - - let res = OLD_CONSTANTS.save(&mut deps.storage, &old_constants); - assert!( - res.is_ok(), - "failed to save old constants before running the migration" - ); - - // advance the chain to move to the round 1 - env.block.time = env.block.time.plus_nanos(instantiate_msg.round_length + 1); - - let round_id = 1; - let tranche_id = 1; - - let first_proposal_id = 9; - let second_proposal_id = 10; - - let first_lock_id = 103; - let second_lock_id = 104; - let third_lock_id = 105; - let fourt_lock_id = 106; - let fifth_lock_id = 107; - - // save some proposals into the storage - let proposals = vec![ - Proposal { - round_id, - tranche_id, - proposal_id: first_proposal_id, - power: Uint128::zero(), - percentage: Uint128::zero(), - title: "Proposal 9".to_string(), - description: "Proposal 9 Description".to_string(), - deployment_duration: 3, - minimum_atom_liquidity_request: Uint128::zero(), - }, - Proposal { - round_id, - tranche_id, - proposal_id: second_proposal_id, - power: Uint128::zero(), - percentage: Uint128::zero(), - title: "Proposal 10".to_string(), - description: "Proposal 10 Description".to_string(), - deployment_duration: 4, - minimum_atom_liquidity_request: Uint128::zero(), - }, - ]; - - for proposal in &proposals { - let res = PROPOSAL_MAP.save( - &mut deps.storage, - (round_id, tranche_id, proposal.proposal_id), - proposal, - ); - assert!( - res.is_ok(), - "failed to save proposal before running the migration: {}", - res.unwrap_err() - ); - } - - let voting_allowed_prop_1 = round_id + proposals[0].deployment_duration; - let voting_allowed_prop_2 = round_id + proposals[1].deployment_duration; - - let user_addr_1 = deps.api.addr_make("addr0001"); - let user_addr_2 = deps.api.addr_make("addr0002"); - - let test_infos = vec![ - // user 1, lock 1, voting info already in the store - VotingInfoMigrationTest { - vote: ( - user_addr_1.clone(), - VoteMigrationInfo { - lock_id: first_lock_id, - proposal_id: first_proposal_id, - }, - ), - voting_info_before: Some(VotingAllowedInfoTest { - lock_id: first_lock_id, - round_id: voting_allowed_prop_1, - }), - voting_info_after: VotingAllowedInfoTest { - lock_id: first_lock_id, - round_id: voting_allowed_prop_1, - }, - }, - // user 1, lock 2, voting info not in the store - VotingInfoMigrationTest { - vote: ( - user_addr_1.clone(), - VoteMigrationInfo { - lock_id: second_lock_id, - proposal_id: first_proposal_id, - }, - ), - voting_info_before: None, - voting_info_after: VotingAllowedInfoTest { - lock_id: second_lock_id, - round_id: voting_allowed_prop_1, - }, - }, - // user 2, lock 3, voting info already in the store - VotingInfoMigrationTest { - vote: ( - user_addr_2.clone(), - VoteMigrationInfo { - lock_id: third_lock_id, - proposal_id: second_proposal_id, - }, - ), - voting_info_before: Some(VotingAllowedInfoTest { - lock_id: third_lock_id, - round_id: voting_allowed_prop_2, - }), - voting_info_after: VotingAllowedInfoTest { - lock_id: third_lock_id, - round_id: voting_allowed_prop_2, - }, - }, - // user 2, lock 4, voting info not in the store - VotingInfoMigrationTest { - vote: ( - user_addr_2.clone(), - VoteMigrationInfo { - lock_id: fourt_lock_id, - proposal_id: second_proposal_id, - }, - ), - voting_info_before: None, - voting_info_after: VotingAllowedInfoTest { - lock_id: fourt_lock_id, - round_id: voting_allowed_prop_2, - }, - }, - // user 2, lock 5, voting info not in the store - VotingInfoMigrationTest { - vote: ( - user_addr_2.clone(), - VoteMigrationInfo { - lock_id: fifth_lock_id, - proposal_id: second_proposal_id, - }, - ), - voting_info_before: None, - voting_info_after: VotingAllowedInfoTest { - lock_id: fifth_lock_id, - round_id: voting_allowed_prop_2, - }, - }, - ]; - - for test_case in &test_infos { - let time_weighted_shares = (VALIDATOR_1.to_string(), Decimal::one()); - let res = VOTE_MAP.save( - &mut deps.storage, - ( - (round_id, tranche_id), - test_case.vote.0.clone(), - test_case.vote.1.lock_id, - ), - &Vote { - prop_id: test_case.vote.1.proposal_id, - time_weighted_shares, - }, - ); - assert!( - res.is_ok(), - "failed to save vote before running the migration: {}", - res.unwrap_err() - ); - - if let Some(vote_info_before) = &test_case.voting_info_before { - let res = VOTING_ALLOWED_ROUND.save( - &mut deps.storage, - (tranche_id, vote_info_before.lock_id), - &vote_info_before.round_id, - ); - assert!( - res.is_ok(), - "failed to save voting allowed info before running the migration: {}", - res.unwrap_err() - ); - } - } - - // Run the migration - let migrate_msg = MigrateMsgUNRELEASED {}; - let res = migrate(deps.as_mut(), env.clone(), migrate_msg.clone()); - assert!(res.is_ok(), "migration failed: {}", res.unwrap_err()); - - for test_case in &test_infos { - let res = VOTING_ALLOWED_ROUND.load( - &deps.storage, - (tranche_id, test_case.voting_info_after.lock_id), - ); - assert!( - res.is_ok(), - "voting allowed round not populated after migration: {}", - res.unwrap_err() - ); - - let voting_allowed_round = res.unwrap(); - assert_eq!( - voting_allowed_round, test_case.voting_info_after.round_id, - "voting allowed round doesn't match expected value; got: {}, expected: {}", - voting_allowed_round, test_case.voting_info_after.round_id - ); - } -} - -struct VotingInfoMigrationTest { - pub vote: (Addr, VoteMigrationInfo), - // (lock_id, round_id) - pub voting_info_before: Option, - // (lock_id, round_id) - pub voting_info_after: VotingAllowedInfoTest, -} - -struct VotingAllowedInfoTest { - pub lock_id: u64, - pub round_id: u64, -} diff --git a/contracts/hydro/src/migration/unreleased.rs b/contracts/hydro/src/migration/unreleased.rs deleted file mode 100644 index a12a1433..00000000 --- a/contracts/hydro/src/migration/unreleased.rs +++ /dev/null @@ -1,174 +0,0 @@ -use std::{collections::HashMap, str::FromStr}; - -use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Decimal, DepsMut, Env, Order, Storage, Timestamp}; -use cw_storage_plus::Item; -use neutron_sdk::bindings::query::NeutronQuery; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::{ - contract::compute_current_round_id, - error::ContractError, - state::{ - RoundLockPowerSchedule, CONSTANTS, PROPOSAL_MAP, TRANCHE_MAP, VOTE_MAP, - VOTING_ALLOWED_ROUND, - }, -}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct MigrateMsgUNRELEASED {} - -#[cw_serde] -pub struct ConstantsV2_0_2 { - pub round_length: u64, - pub lock_epoch_length: u64, - pub first_round_start: Timestamp, - pub max_locked_tokens: u128, - pub max_validator_shares_participating: u64, - pub hub_connection_id: String, - pub hub_transfer_channel_id: String, - pub icq_update_period: u64, - pub paused: bool, - pub is_in_pilot_mode: bool, - pub max_deployment_duration: u64, -} - -#[cw_serde] -pub struct ConstantsUNRELEASED { - pub round_length: u64, - pub lock_epoch_length: u64, - pub first_round_start: Timestamp, - pub max_locked_tokens: u128, - pub max_validator_shares_participating: u64, - pub hub_connection_id: String, - pub hub_transfer_channel_id: String, - pub icq_update_period: u64, - pub paused: bool, - pub max_deployment_duration: u64, - pub round_lock_power_schedule: RoundLockPowerSchedule, -} - -impl ConstantsUNRELEASED { - pub fn from(old_constants: ConstantsV2_0_2) -> Self { - Self { - round_length: old_constants.round_length, - lock_epoch_length: old_constants.lock_epoch_length, - first_round_start: old_constants.first_round_start, - max_locked_tokens: old_constants.max_locked_tokens, - max_validator_shares_participating: old_constants.max_validator_shares_participating, - hub_connection_id: old_constants.hub_connection_id, - hub_transfer_channel_id: old_constants.hub_transfer_channel_id, - icq_update_period: old_constants.icq_update_period, - paused: old_constants.paused, - max_deployment_duration: old_constants.max_deployment_duration, - round_lock_power_schedule: RoundLockPowerSchedule::new(get_default_power_schedule()), - } - } -} - -pub fn get_default_power_schedule() -> Vec<(u64, Decimal)> { - vec![ - (1, Decimal::from_str("1").unwrap()), - (2, Decimal::from_str("1.25").unwrap()), - (3, Decimal::from_str("1.5").unwrap()), - (6, Decimal::from_str("2").unwrap()), - (12, Decimal::from_str("4").unwrap()), - ] -} - -pub fn migrate_v2_0_2_to_unreleased( - deps: &mut DepsMut, - env: Env, - _msg: MigrateMsgUNRELEASED, -) -> Result<(), ContractError> { - migrate_constants(deps.storage)?; - migrate_voting_allowed_info(deps, &env)?; - - Ok(()) -} - -fn migrate_constants(storage: &mut dyn Storage) -> Result<(), ContractError> { - const OLD_CONSTANTS: Item = Item::new("constants"); - const NEW_CONSTANTS: Item = Item::new("constants"); - - let old_constants = OLD_CONSTANTS.load(storage)?; - let new_constants = ConstantsUNRELEASED::from(old_constants); - NEW_CONSTANTS.save(storage, &new_constants)?; - - Ok(()) -} - -fn migrate_voting_allowed_info( - deps: &mut DepsMut, - env: &Env, -) -> Result<(), ContractError> { - // migrate_constants() must be executed first - let constants = CONSTANTS.load(deps.storage)?; - - let tranche_ids: Vec = TRANCHE_MAP - .keys(deps.storage, None, None, Order::Ascending) - .filter_map(|tranche_id| match tranche_id { - Ok(tranche_id) => Some(tranche_id), - Err(_) => None, - }) - .collect(); - - // don't rely on migration being run in round 1, even though it probably will - let current_round_id = compute_current_round_id(env, &constants)?; - - // to cache proposal deployment durations once we load them; saves some gas - let mut deployment_durations: HashMap = HashMap::new(); - - // no need to populate this info for round 0 since we only had 1-round-long deployment proposals - for round_id in 1..=current_round_id { - for &tranche_id in tranche_ids.iter() { - let votes: Vec = VOTE_MAP - .sub_prefix((round_id, tranche_id)) - .range(deps.storage, None, None, Order::Ascending) - .filter_map(|vote| match vote { - Err(_) => None, - Ok(vote) => Some(VoteMigrationInfo { - lock_id: vote.0 .1, - proposal_id: vote.1.prop_id, - }), - }) - .collect(); - - for vote in votes { - if VOTING_ALLOWED_ROUND - .may_load(deps.storage, (tranche_id, vote.lock_id))? - .is_some() - { - continue; - } - - let deployment_duration = match deployment_durations.get(&vote.proposal_id) { - Some(deployment_duration) => *deployment_duration, - None => { - let proposal = PROPOSAL_MAP - .load(deps.storage, (round_id, tranche_id, vote.proposal_id))?; - deployment_durations - .insert(proposal.proposal_id, proposal.deployment_duration); - - proposal.deployment_duration - } - }; - - let voting_allowed_round = round_id + deployment_duration; - VOTING_ALLOWED_ROUND.save( - deps.storage, - (tranche_id, vote.lock_id), - &voting_allowed_round, - )?; - } - } - } - - Ok(()) -} - -pub struct VoteMigrationInfo { - pub lock_id: u64, - pub proposal_id: u64, -} diff --git a/contracts/hydro/src/migration/v1_1_0.rs b/contracts/hydro/src/migration/v1_1_0.rs deleted file mode 100644 index feb54560..00000000 --- a/contracts/hydro/src/migration/v1_1_0.rs +++ /dev/null @@ -1,42 +0,0 @@ -use std::collections::HashMap; - -use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Decimal, Timestamp, Uint128}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct MigrateMsgV1_1_0 { - pub new_first_round_start: Timestamp, -} - -#[cw_serde] -pub struct ConstantsV1_1_0 { - pub round_length: u64, - pub lock_epoch_length: u64, - pub first_round_start: Timestamp, - pub max_locked_tokens: u128, - pub max_validator_shares_participating: u64, - pub hub_connection_id: String, - pub hub_transfer_channel_id: String, - pub icq_update_period: u64, - pub paused: bool, - pub is_in_pilot_mode: bool, -} - -#[cw_serde] -pub struct ProposalV1_1_0 { - pub round_id: u64, - pub tranche_id: u64, - pub proposal_id: u64, - pub title: String, - pub description: String, - pub power: Uint128, - pub percentage: Uint128, -} - -#[cw_serde] -pub struct VoteV1_1_0 { - pub prop_id: u64, - pub time_weighted_shares: HashMap, -} diff --git a/contracts/hydro/src/migration/v2_0_1.rs b/contracts/hydro/src/migration/v2_0_1.rs deleted file mode 100644 index 663dae9a..00000000 --- a/contracts/hydro/src/migration/v2_0_1.rs +++ /dev/null @@ -1,261 +0,0 @@ -use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Addr, Decimal, DepsMut, Order, Storage, Timestamp, Uint128}; -use cw_storage_plus::{Item, Map}; -use neutron_sdk::bindings::query::NeutronQuery; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::contract::{compute_round_end, get_lock_time_weighted_shares}; -use crate::error::ContractError; - -use crate::lsm_integration::resolve_validator_from_denom; -use crate::migration::v1_1_0::{ConstantsV1_1_0, ProposalV1_1_0, VoteV1_1_0}; -use crate::state::{CONSTANTS, LOCKS_MAP}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct MigrateMsgV2_0_1 { - pub max_deployment_duration: u64, -} - -#[cw_serde] -pub struct ConstantsV2_0_1 { - pub round_length: u64, - pub lock_epoch_length: u64, - pub first_round_start: Timestamp, - pub max_locked_tokens: u128, - pub max_validator_shares_participating: u64, - pub hub_connection_id: String, - pub hub_transfer_channel_id: String, - pub icq_update_period: u64, - pub paused: bool, - pub is_in_pilot_mode: bool, - pub max_deployment_duration: u64, -} - -impl ConstantsV2_0_1 { - pub fn from(old_constants: ConstantsV1_1_0, max_deployment_duration: u64) -> Self { - Self { - round_length: old_constants.round_length, - lock_epoch_length: old_constants.lock_epoch_length, - first_round_start: old_constants.first_round_start, - max_locked_tokens: old_constants.max_locked_tokens, - max_validator_shares_participating: old_constants.max_validator_shares_participating, - hub_connection_id: old_constants.hub_connection_id, - hub_transfer_channel_id: old_constants.hub_transfer_channel_id, - icq_update_period: old_constants.icq_update_period, - paused: old_constants.paused, - is_in_pilot_mode: old_constants.is_in_pilot_mode, - // Set max_deployment_duration to the value specified in the migrate message - max_deployment_duration, - } - } -} - -#[cw_serde] -pub struct ProposalV2_0_1 { - pub round_id: u64, - pub tranche_id: u64, - pub proposal_id: u64, - pub title: String, - pub description: String, - pub power: Uint128, - pub percentage: Uint128, - pub deployment_duration: u64, - pub minimum_atom_liquidity_request: Uint128, -} - -impl ProposalV2_0_1 { - pub fn from(old_proposal: ProposalV1_1_0) -> Self { - Self { - round_id: old_proposal.round_id, - tranche_id: old_proposal.tranche_id, - proposal_id: old_proposal.proposal_id, - power: old_proposal.power, - percentage: old_proposal.percentage, - title: old_proposal.title, - description: old_proposal.description, - // Existing proposals are getting the liquidity deployed for only one round - deployment_duration: 1, - minimum_atom_liquidity_request: Uint128::zero(), - } - } -} - -#[cw_serde] -pub struct VoteV2_0_1 { - pub prop_id: u64, - pub time_weighted_shares: (String, Decimal), -} - -struct OldVoteInfo { - pub round_id: u64, - pub tranche_id: u64, - pub voter: Addr, -} - -struct NewVoteInfo { - pub round_id: u64, - pub tranche_id: u64, - pub voter: Addr, - pub lock_id: u64, - pub vote: VoteV2_0_1, -} - -// Migrating from 1.1.0 to 2.0.1 will: -// - Migrate the existing Constants to add "max_deployment_duration" field -// - Migrate the existing Proposals to add "deployment_duration" and "minimum_atom_liquidity_request" fields -// - Migrate each Vote from first round to a new format where the key will also include lock_id, and the value -// will no longer contain HashMap but only (String, Decimal), since each vote refers to -// a single lock entry, and therefore has only one LSM token denom associated with it. To construct new votes, -// we iterate over all lock entries that belong to a user and create a vote for each lock entry. -// All votes saved under the old keys are removed from the store, and the replacing votes are added -// under the new keys. -pub fn migrate_v1_1_0_to_v2_0_1( - deps: &mut DepsMut, - msg: MigrateMsgV2_0_1, -) -> Result<(), ContractError> { - migrate_constants(deps.storage, msg)?; - migrate_proposals(deps.storage)?; - migrate_votes(deps)?; - - Ok(()) -} - -fn migrate_constants( - storage: &mut dyn Storage, - migrate_msg: MigrateMsgV2_0_1, -) -> Result<(), ContractError> { - const OLD_CONSTANTS: Item = Item::new("constants"); - const NEW_CONSTANTS: Item = Item::new("constants"); - - let old_constants = OLD_CONSTANTS.load(storage)?; - let new_constants = ConstantsV2_0_1::from(old_constants, migrate_msg.max_deployment_duration); - NEW_CONSTANTS.save(storage, &new_constants)?; - - Ok(()) -} - -fn migrate_proposals(storage: &mut dyn Storage) -> Result<(), ContractError> { - const OLD_PROPOSAL_MAP: Map<(u64, u64, u64), ProposalV1_1_0> = Map::new("prop_map"); - const NEW_PROPOSAL_MAP: Map<(u64, u64, u64), ProposalV2_0_1> = Map::new("prop_map"); - - let old_proposals = OLD_PROPOSAL_MAP.range(storage, None, None, Order::Descending); - let mut new_proposals = vec![]; - - for old_proposal in old_proposals { - let ((_, _, _), old_proposal) = old_proposal?; - new_proposals.push(ProposalV2_0_1::from(old_proposal)); - } - - for new_proposal in new_proposals { - NEW_PROPOSAL_MAP.save( - storage, - ( - new_proposal.round_id, - new_proposal.tranche_id, - new_proposal.proposal_id, - ), - &new_proposal, - )?; - } - - Ok(()) -} - -fn migrate_votes(deps: &mut DepsMut) -> Result<(), ContractError> { - const OLD_VOTE_MAP: Map<(u64, u64, Addr), VoteV1_1_0> = Map::new("vote_map"); - const NEW_VOTE_MAP: Map<((u64, u64), Addr, u64), VoteV2_0_1> = Map::new("vote_map"); - - let mut old_votes = vec![]; - let mut new_votes = vec![]; - - // Here we rely on CONSTANTS being already migrated, and therefore we can use - // the new struct and helper functions from the latest code. - let constants = CONSTANTS.load(deps.storage)?; - let lock_epoch_length = constants.lock_epoch_length; - - for old_vote in OLD_VOTE_MAP.range(deps.storage, None, None, Order::Descending) { - let ((round_id, tranche_id, voter), old_vote) = old_vote?; - let round_end = compute_round_end(&constants, round_id)?; - - old_votes.push(OldVoteInfo { - round_id, - tranche_id, - voter: voter.clone(), - }); - - // We use LOCKS_MAP from the latest code since this storage hasn't changed. - // This is needed in order to use get_lock_time_weighted_shares() helper function. - for lock_entry in - LOCKS_MAP - .prefix(voter.clone()) - .range(deps.storage, None, None, Order::Ascending) - { - let (_, lock_entry) = lock_entry?; - let validator = match resolve_validator_from_denom( - &deps.as_ref(), - &constants, - lock_entry.clone().funds.denom, - ) { - Ok(validator) => validator, - Err(_) => { - continue; - } - }; - - // We do not check if the validator is active at the moment we run the migration, since this can change - // afterwards. Instead, we will create a vote for each lock that user has. The reasoning is as follows: - // if user voted, most likely they voted with all their locks. If they first voted and then locked more - // tokens, this would add the new lock to their vote. If user voted with tokens from validator that later - // dropped out from the top N, this lock's power would remain in user's vote, which is the same we do in - // this migration. Votes with tokens from dropped-out validators will be filtered out in query_votes(). - let scaled_shares = Decimal::from_ratio( - get_lock_time_weighted_shares( - &constants.round_lock_power_schedule, - round_end, - lock_entry.clone(), - lock_epoch_length, - ), - Uint128::one(), - ); - - if scaled_shares.is_zero() { - continue; - } - - let new_vote = NewVoteInfo { - round_id, - tranche_id, - voter: voter.clone(), - lock_id: lock_entry.lock_id, - vote: VoteV2_0_1 { - prop_id: old_vote.prop_id, - time_weighted_shares: (validator, scaled_shares), - }, - }; - - new_votes.push(new_vote); - } - } - - for old_vote in old_votes { - OLD_VOTE_MAP.remove( - deps.storage, - (old_vote.round_id, old_vote.tranche_id, old_vote.voter), - ); - } - - for new_vote in new_votes { - NEW_VOTE_MAP.save( - deps.storage, - ( - (new_vote.round_id, new_vote.tranche_id), - new_vote.voter, - new_vote.lock_id, - ), - &new_vote.vote, - )?; - } - - Ok(()) -} diff --git a/contracts/tribute/src/migration/v1_1_0.rs b/contracts/hydro/src/migration/v3_0_0.rs similarity index 53% rename from contracts/tribute/src/migration/v1_1_0.rs rename to contracts/hydro/src/migration/v3_0_0.rs index 00d0172e..aa12869a 100644 --- a/contracts/tribute/src/migration/v1_1_0.rs +++ b/contracts/hydro/src/migration/v3_0_0.rs @@ -1,8 +1,5 @@ -use cosmwasm_std::Uint128; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct MigrateMsgV1_1_0 { - pub min_prop_percent_for_claimable_tributes: Uint128, -} +pub struct MigrateMsgV3_0_0 {} diff --git a/contracts/tribute/Cargo.toml b/contracts/tribute/Cargo.toml index 6fb79e80..f943ec56 100644 --- a/contracts/tribute/Cargo.toml +++ b/contracts/tribute/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tribute" -version = "2.0.2" +version = "3.0.0" edition = "2018" authors = ["Jehan Tremback", "Philip Offtermatt", "Dusan Maksimovic"] diff --git a/contracts/tribute/schema/tribute_full_schema.json b/contracts/tribute/schema/tribute_full_schema.json index ca12f5e5..0dcd425d 100644 --- a/contracts/tribute/schema/tribute_full_schema.json +++ b/contracts/tribute/schema/tribute_full_schema.json @@ -310,59 +310,23 @@ "migrate": {}, "sudo": {}, "responses": { - "config": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ConfigResponse", - "type": "object", - "required": [ - "config" - ], - "properties": { - "config": { - "$ref": "#/definitions/Config" - } - }, - "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" - }, - "Config": { - "type": "object", - "required": [ - "hydro_contract" - ], - "properties": { - "hydro_contract": { - "$ref": "#/definitions/Addr" - } - }, - "additionalProperties": false - } - } - }, - "proposal_tributes": { + "historical_tribute_claims": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ProposalTributesResponse", + "title": "HistoricalTributeClaimsResponse", "type": "object", "required": [ - "tributes" + "claims" ], "properties": { - "tributes": { + "claims": { "type": "array", "items": { - "$ref": "#/definitions/Tribute" + "$ref": "#/definitions/TributeClaim" } } }, "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" - }, "Coin": { "type": "object", "required": [ @@ -379,40 +343,17 @@ }, "additionalProperties": false }, - "Timestamp": { - "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", - "allOf": [ - { - "$ref": "#/definitions/Uint64" - } - ] - }, - "Tribute": { + "TributeClaim": { "type": "object", "required": [ - "creation_round", - "creation_time", - "depositor", - "funds", + "amount", "proposal_id", - "refunded", "round_id", "tranche_id", "tribute_id" ], "properties": { - "creation_round": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "creation_time": { - "$ref": "#/definitions/Timestamp" - }, - "depositor": { - "$ref": "#/definitions/Addr" - }, - "funds": { + "amount": { "$ref": "#/definitions/Coin" }, "proposal_id": { @@ -420,9 +361,6 @@ "format": "uint64", "minimum": 0.0 }, - "refunded": { - "type": "boolean" - }, "round_id": { "type": "integer", "format": "uint64", @@ -444,16 +382,44 @@ "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" - }, - "Uint64": { - "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 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 `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + } + } + }, + "config": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "$ref": "#/definitions/Config" + } + }, + "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" + }, + "Config": { + "type": "object", + "required": [ + "hydro_contract" + ], + "properties": { + "hydro_contract": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false } } }, - "historical_tribute_claims": { + "outstanding_tribute_claims": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "HistoricalTributeClaimsResponse", + "title": "OutstandingTributeClaimsResponse", "type": "object", "required": [ "claims" @@ -526,23 +492,27 @@ } } }, - "outstanding_tribute_claims": { + "proposal_tributes": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "OutstandingTributeClaimsResponse", + "title": "ProposalTributesResponse", "type": "object", "required": [ - "claims" + "tributes" ], "properties": { - "claims": { + "tributes": { "type": "array", "items": { - "$ref": "#/definitions/TributeClaim" + "$ref": "#/definitions/Tribute" } } }, "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" + }, "Coin": { "type": "object", "required": [ @@ -559,17 +529,40 @@ }, "additionalProperties": false }, - "TributeClaim": { + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Tribute": { "type": "object", "required": [ - "amount", + "creation_round", + "creation_time", + "depositor", + "funds", "proposal_id", + "refunded", "round_id", "tranche_id", "tribute_id" ], "properties": { - "amount": { + "creation_round": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "creation_time": { + "$ref": "#/definitions/Timestamp" + }, + "depositor": { + "$ref": "#/definitions/Addr" + }, + "funds": { "$ref": "#/definitions/Coin" }, "proposal_id": { @@ -577,6 +570,9 @@ "format": "uint64", "minimum": 0.0 }, + "refunded": { + "type": "boolean" + }, "round_id": { "type": "integer", "format": "uint64", @@ -598,6 +594,10 @@ "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" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 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 `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" } } }, diff --git a/contracts/tribute/src/migration/migrate.rs b/contracts/tribute/src/migration/migrate.rs index b4a1ac50..366243ac 100644 --- a/contracts/tribute/src/migration/migrate.rs +++ b/contracts/tribute/src/migration/migrate.rs @@ -4,18 +4,19 @@ use cw2::{get_contract_version, set_contract_version}; use crate::{ contract::{CONTRACT_NAME, CONTRACT_VERSION}, error::ContractError, - migration::v2_0_1::{migrate_v1_1_1_to_v2_0_1, MigrateMsgV2_0_1}, + migration::v3_0_0::MigrateMsgV3_0_0, }; pub const CONTRACT_VERSION_V1_1_1: &str = "1.1.1"; pub const CONTRACT_VERSION_V2_0_1: &str = "2.0.1"; pub const CONTRACT_VERSION_V2_0_2: &str = "2.0.2"; +pub const CONTRACT_VERSION_V3_0_0: &str = "3.0.0"; #[cfg_attr(not(feature = "library"), entry_point)] pub fn migrate( - mut deps: DepsMut, + deps: DepsMut, _env: Env, - _msg: MigrateMsgV2_0_1, + _msg: MigrateMsgV3_0_0, ) -> Result { let contract_version = get_contract_version(deps.storage)?; @@ -25,9 +26,7 @@ pub fn migrate( ))); } - if contract_version.version == CONTRACT_VERSION_V1_1_1 { - migrate_v1_1_1_to_v2_0_1(&mut deps)?; - } + // no migration necessary from 2.0.2 to 3.0.0 set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; diff --git a/contracts/tribute/src/migration/mod.rs b/contracts/tribute/src/migration/mod.rs index 813092b3..3c29627c 100644 --- a/contracts/tribute/src/migration/mod.rs +++ b/contracts/tribute/src/migration/mod.rs @@ -1,4 +1,2 @@ pub mod migrate; -pub mod v1_1_0; -pub mod v1_1_1; -pub mod v2_0_1; +pub mod v3_0_0; diff --git a/contracts/tribute/src/migration/v1_1_1.rs b/contracts/tribute/src/migration/v1_1_1.rs deleted file mode 100644 index 91d1bf09..00000000 --- a/contracts/tribute/src/migration/v1_1_1.rs +++ /dev/null @@ -1,20 +0,0 @@ -use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Addr, Coin, Uint128}; - -#[cw_serde] -pub struct ConfigV1_1_1 { - pub hydro_contract: Addr, - pub top_n_props_count: u64, - pub min_prop_percent_for_claimable_tributes: Uint128, -} - -#[cw_serde] -pub struct TributeV1_1_1 { - pub round_id: u64, - pub tranche_id: u64, - pub proposal_id: u64, - pub tribute_id: u64, - pub depositor: Addr, - pub funds: Coin, - pub refunded: bool, -} diff --git a/contracts/tribute/src/migration/v2_0_1.rs b/contracts/tribute/src/migration/v2_0_1.rs deleted file mode 100644 index 1169896c..00000000 --- a/contracts/tribute/src/migration/v2_0_1.rs +++ /dev/null @@ -1,106 +0,0 @@ -use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Addr, Coin, DepsMut, Order, StdResult, Storage, Timestamp}; -use cw_storage_plus::{Item, Map}; -use hydro::{ - contract::compute_round_end, - query::{ConstantsResponse, QueryMsg as HydroQueryMsg}, - state::Constants, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::{ - error::ContractError, - migration::v1_1_1::{ConfigV1_1_1, TributeV1_1_1}, -}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct MigrateMsgV2_0_1 {} - -#[cw_serde] -pub struct ConfigV2_0_1 { - pub hydro_contract: Addr, -} - -#[cw_serde] -pub struct TributeV2_0_1 { - pub round_id: u64, - pub tranche_id: u64, - pub proposal_id: u64, - pub tribute_id: u64, - pub depositor: Addr, - pub funds: Coin, - pub refunded: bool, - pub creation_time: Timestamp, - pub creation_round: u64, -} - -impl TributeV2_0_1 { - fn from(old_tribute: TributeV1_1_1, constants: &Constants) -> StdResult { - let round_start = - compute_round_end(constants, old_tribute.round_id)?.nanos() - constants.round_length; - - Ok(Self { - round_id: old_tribute.round_id, - tranche_id: old_tribute.tranche_id, - proposal_id: old_tribute.proposal_id, - tribute_id: old_tribute.tribute_id, - depositor: old_tribute.depositor, - funds: old_tribute.funds, - refunded: old_tribute.refunded, - // Set the tribute creation time to the start of the round in which the tribute was created - creation_time: Timestamp::from_nanos(round_start), - // In V1 tributes could only be added in current round - creation_round: old_tribute.round_id, - }) - } -} - -// Migrating from 1.1.1 to 2.0.1 will: -// - Migrate the existing Config to remove "top_n_props_count" and "min_prop_percent_for_claimable_tributes" fields. -// - Migrate the existing Tributes to add "creation_round" and "creation_time" fields. This fields will be populated -// with the round in which the tribute was created and with timestamp when the given round started. -pub fn migrate_v1_1_1_to_v2_0_1(deps: &mut DepsMut) -> Result<(), ContractError> { - let new_config = migrate_config(deps.storage)?; - migrate_tributes(deps, new_config)?; - - Ok(()) -} - -fn migrate_config(storage: &mut dyn Storage) -> Result { - const OLD_CONFIG: Item = Item::new("config"); - const NEW_CONFIG: Item = Item::new("config"); - - let old_config = OLD_CONFIG.load(storage)?; - let new_config = ConfigV2_0_1 { - hydro_contract: old_config.hydro_contract, - }; - - NEW_CONFIG.save(storage, &new_config)?; - - Ok(new_config) -} - -fn migrate_tributes(deps: &mut DepsMut, config: ConfigV2_0_1) -> Result<(), ContractError> { - const OLD_ID_TO_TRIBUTE_MAP: Map = Map::new("id_to_tribute_map"); - const NEW_ID_TO_TRIBUTE_MAP: Map = Map::new("id_to_tribute_map"); - - let constants_resp: ConstantsResponse = deps - .querier - .query_wasm_smart(config.hydro_contract, &HydroQueryMsg::Constants {})?; - - let mut new_tributes = vec![]; - - for old_tribute in OLD_ID_TO_TRIBUTE_MAP.range(deps.storage, None, None, Order::Ascending) { - let (_, old_tribute) = old_tribute?; - - let new_tribute = TributeV2_0_1::from(old_tribute, &constants_resp.constants)?; - new_tributes.push(new_tribute); - } - - for new_tribute in new_tributes { - NEW_ID_TO_TRIBUTE_MAP.save(deps.storage, new_tribute.tribute_id, &new_tribute)?; - } - - Ok(()) -} diff --git a/contracts/tribute/src/migration/v3_0_0.rs b/contracts/tribute/src/migration/v3_0_0.rs new file mode 100644 index 00000000..aa12869a --- /dev/null +++ b/contracts/tribute/src/migration/v3_0_0.rs @@ -0,0 +1,5 @@ +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct MigrateMsgV3_0_0 {} diff --git a/packages/interface/src/hydro.rs b/packages/interface/src/hydro.rs index cdd8c768..8dd85ce7 100644 --- a/packages/interface/src/hydro.rs +++ b/packages/interface/src/hydro.rs @@ -1,12 +1,12 @@ use cw_orch::interface; -use hydro::migration::v2_0_1::MigrateMsgV2_0_1; +use hydro::migration::v3_0_0::MigrateMsgV3_0_0; pub use hydro::msg::{ExecuteMsg, InstantiateMsg}; pub use hydro::query::QueryMsg; pub const CONTRACT_ID: &str = "hydro_contract"; -#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, MigrateMsgV2_0_1, id = CONTRACT_ID)] +#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, MigrateMsgV3_0_0, id = CONTRACT_ID)] pub struct Hydro; #[cfg(not(target_arch = "wasm32"))] diff --git a/packages/interface/src/tribute.rs b/packages/interface/src/tribute.rs index c425e17b..0f03050f 100644 --- a/packages/interface/src/tribute.rs +++ b/packages/interface/src/tribute.rs @@ -1,12 +1,12 @@ use cw_orch::interface; -use tribute::migration::v2_0_1::MigrateMsgV2_0_1; +use tribute::migration::v3_0_0::MigrateMsgV3_0_0; pub use tribute::msg::{ExecuteMsg, InstantiateMsg}; pub use tribute::query::QueryMsg; pub const CONTRACT_ID: &str = "tribute_contract"; -#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, MigrateMsgV2_0_1, id = CONTRACT_ID)] +#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, MigrateMsgV3_0_0, id = CONTRACT_ID)] pub struct Tribute; #[cfg(not(target_arch = "wasm32"))] diff --git a/ts_types/HydroBase.client.ts b/ts_types/HydroBase.client.ts index 1f18f42a..8fb874d6 100644 --- a/ts_types/HydroBase.client.ts +++ b/ts_types/HydroBase.client.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@1.12.0. +* This file was automatically generated by @cosmwasm/ts-codegen@1.11.1. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ @@ -451,19 +451,19 @@ export interface HydroBaseInterface extends HydroBaseReadOnlyInterface { lockDuration }: { lockDuration: number; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; refreshLockDuration: ({ lockDuration, lockIds }: { lockDuration: number; lockIds: number[]; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; unlockTokens: ({ lockIds }: { lockIds?: number[]; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; createProposal: ({ deploymentDuration, description, @@ -478,37 +478,37 @@ export interface HydroBaseInterface extends HydroBaseReadOnlyInterface { roundId?: number; title: string; trancheId: number; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; vote: ({ proposalsVotes, trancheId }: { proposalsVotes: ProposalToLockups[]; trancheId: number; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; addAccountToWhitelist: ({ address }: { address: string; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; removeAccountFromWhitelist: ({ address }: { address: string; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; updateConfig: ({ maxDeploymentDuration, maxLockedTokens }: { maxDeploymentDuration?: number; maxLockedTokens?: number; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; - pause: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + pause: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; addTranche: ({ tranche }: { tranche: TrancheInfo; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; editTranche: ({ trancheId, trancheMetadata, @@ -517,27 +517,27 @@ export interface HydroBaseInterface extends HydroBaseReadOnlyInterface { trancheId: number; trancheMetadata?: string; trancheName?: string; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; createIcqsForValidators: ({ validators }: { validators: string[]; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; addICQManager: ({ address }: { address: string; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; removeICQManager: ({ address }: { address: string; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; withdrawICQFunds: ({ amount }: { amount: Uint128; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; addLiquidityDeployment: ({ deployedFunds, destinations, @@ -556,7 +556,7 @@ export interface HydroBaseInterface extends HydroBaseReadOnlyInterface { roundId: number; totalRounds: number; trancheId: number; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; removeLiquidityDeployment: ({ proposalId, roundId, @@ -565,7 +565,7 @@ export interface HydroBaseInterface extends HydroBaseReadOnlyInterface { proposalId: number; roundId: number; trancheId: number; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; } export class HydroBaseClient extends HydroBaseQueryClient implements HydroBaseInterface { client: SigningCosmWasmClient; @@ -598,12 +598,12 @@ export class HydroBaseClient extends HydroBaseQueryClient implements HydroBaseIn lockDuration }: { lockDuration: number; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { lock_tokens: { lock_duration: lockDuration } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; refreshLockDuration = async ({ lockDuration, @@ -611,24 +611,24 @@ export class HydroBaseClient extends HydroBaseQueryClient implements HydroBaseIn }: { lockDuration: number; lockIds: number[]; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { refresh_lock_duration: { lock_duration: lockDuration, lock_ids: lockIds } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; unlockTokens = async ({ lockIds }: { lockIds?: number[]; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { unlock_tokens: { lock_ids: lockIds } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; createProposal = async ({ deploymentDuration, @@ -644,7 +644,7 @@ export class HydroBaseClient extends HydroBaseQueryClient implements HydroBaseIn roundId?: number; title: string; trancheId: number; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { create_proposal: { deployment_duration: deploymentDuration, @@ -654,7 +654,7 @@ export class HydroBaseClient extends HydroBaseQueryClient implements HydroBaseIn title, tranche_id: trancheId } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; vote = async ({ proposalsVotes, @@ -662,35 +662,35 @@ export class HydroBaseClient extends HydroBaseQueryClient implements HydroBaseIn }: { proposalsVotes: ProposalToLockups[]; trancheId: number; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { vote: { proposals_votes: proposalsVotes, tranche_id: trancheId } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; addAccountToWhitelist = async ({ address }: { address: string; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { add_account_to_whitelist: { address } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; removeAccountFromWhitelist = async ({ address }: { address: string; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { remove_account_from_whitelist: { address } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; updateConfig = async ({ maxDeploymentDuration, @@ -698,29 +698,29 @@ export class HydroBaseClient extends HydroBaseQueryClient implements HydroBaseIn }: { maxDeploymentDuration?: number; maxLockedTokens?: number; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_config: { max_deployment_duration: maxDeploymentDuration, max_locked_tokens: maxLockedTokens } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; - pause = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + pause = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { pause: {} - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; addTranche = async ({ tranche }: { tranche: TrancheInfo; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { add_tranche: { tranche } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; editTranche = async ({ trancheId, @@ -730,58 +730,58 @@ export class HydroBaseClient extends HydroBaseQueryClient implements HydroBaseIn trancheId: number; trancheMetadata?: string; trancheName?: string; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { edit_tranche: { tranche_id: trancheId, tranche_metadata: trancheMetadata, tranche_name: trancheName } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; createIcqsForValidators = async ({ validators }: { validators: string[]; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { create_icqs_for_validators: { validators } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; addICQManager = async ({ address }: { address: string; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { add_i_c_q_manager: { address } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; removeICQManager = async ({ address }: { address: string; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { remove_i_c_q_manager: { address } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; withdrawICQFunds = async ({ amount }: { amount: Uint128; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { withdraw_i_c_q_funds: { amount } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; addLiquidityDeployment = async ({ deployedFunds, @@ -801,7 +801,7 @@ export class HydroBaseClient extends HydroBaseQueryClient implements HydroBaseIn roundId: number; totalRounds: number; trancheId: number; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { add_liquidity_deployment: { deployed_funds: deployedFunds, @@ -813,7 +813,7 @@ export class HydroBaseClient extends HydroBaseQueryClient implements HydroBaseIn total_rounds: totalRounds, tranche_id: trancheId } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; removeLiquidityDeployment = async ({ proposalId, @@ -823,13 +823,13 @@ export class HydroBaseClient extends HydroBaseQueryClient implements HydroBaseIn proposalId: number; roundId: number; trancheId: number; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { remove_liquidity_deployment: { proposal_id: proposalId, round_id: roundId, tranche_id: trancheId } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; } \ No newline at end of file diff --git a/ts_types/HydroBase.types.ts b/ts_types/HydroBase.types.ts index ca00370c..386447ed 100644 --- a/ts_types/HydroBase.types.ts +++ b/ts_types/HydroBase.types.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@1.12.0. +* This file was automatically generated by @cosmwasm/ts-codegen@1.11.1. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/ts_types/TributeBase.client.ts b/ts_types/TributeBase.client.ts index 572a1273..2f816dbc 100644 --- a/ts_types/TributeBase.client.ts +++ b/ts_types/TributeBase.client.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@1.12.0. +* This file was automatically generated by @cosmwasm/ts-codegen@1.11.1. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ @@ -159,7 +159,7 @@ export interface TributeBaseInterface extends TributeBaseReadOnlyInterface { proposalId: number; roundId: number; trancheId: number; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; claimTribute: ({ roundId, trancheId, @@ -170,7 +170,7 @@ export interface TributeBaseInterface extends TributeBaseReadOnlyInterface { trancheId: number; tributeId: number; voterAddress: string; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; refundTribute: ({ proposalId, roundId, @@ -181,7 +181,7 @@ export interface TributeBaseInterface extends TributeBaseReadOnlyInterface { roundId: number; trancheId: number; tributeId: number; - }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; } export class TributeBaseClient extends TributeBaseQueryClient implements TributeBaseInterface { client: SigningCosmWasmClient; @@ -204,14 +204,14 @@ export class TributeBaseClient extends TributeBaseQueryClient implements Tribute proposalId: number; roundId: number; trancheId: number; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { add_tribute: { proposal_id: proposalId, round_id: roundId, tranche_id: trancheId } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; claimTribute = async ({ roundId, @@ -223,7 +223,7 @@ export class TributeBaseClient extends TributeBaseQueryClient implements Tribute trancheId: number; tributeId: number; voterAddress: string; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { claim_tribute: { round_id: roundId, @@ -231,7 +231,7 @@ export class TributeBaseClient extends TributeBaseQueryClient implements Tribute tribute_id: tributeId, voter_address: voterAddress } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; refundTribute = async ({ proposalId, @@ -243,7 +243,7 @@ export class TributeBaseClient extends TributeBaseQueryClient implements Tribute roundId: number; trancheId: number; tributeId: number; - }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { refund_tribute: { proposal_id: proposalId, @@ -251,6 +251,6 @@ export class TributeBaseClient extends TributeBaseQueryClient implements Tribute tranche_id: trancheId, tribute_id: tributeId } - }, fee_, memo_, funds_); + }, fee, memo, _funds); }; } \ No newline at end of file diff --git a/ts_types/TributeBase.types.ts b/ts_types/TributeBase.types.ts index 47886583..18ab9fa3 100644 --- a/ts_types/TributeBase.types.ts +++ b/ts_types/TributeBase.types.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@1.12.0. +* This file was automatically generated by @cosmwasm/ts-codegen@1.11.1. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */