Skip to content

Commit

Permalink
Introduce compounder cap (#220)
Browse files Browse the repository at this point in the history
* introduce participant's cap

* Introduce snapshot map for total voting power tracking and handle its population

* Added round<->height tracking and implemented validation for users locking in extra_cap based on their voting power in previous round.

* Introduced USER_LOCKS to be able to calculate users voting power at a given height

* - Added test for compunders cap and fixed couple of minor bugs within the new code
- validate_denom() modified to be able to execute for past rounds as well

* fixing errors after merge from main

* added tests for user lock snapshoting and heght<->round tracking

* added transaction to remove the constants at a specified timestamps

* implementation of migration

* CR required changes

* added SNAPSHOTS_ACTIVATION_HEIGHT

* added migration tests

* added changelogs, recompiled contracts and schemas

* added util function for ICQ results mock
  • Loading branch information
dusan-maksimovic authored Jan 29, 2025
1 parent 69f00a5 commit 82c43c3
Show file tree
Hide file tree
Showing 37 changed files with 3,439 additions and 954 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Introduced SnapshotMaps for tracking the historical voting power for each user as well as the round total voting power.
([\#220](https://github.com/informalsystems/hydro/pull/220))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Introduced the compounder cap- a reserved portion of the maximum token lock limit that is allocated exclusively for known users from the previous round.
([\#220](https://github.com/informalsystems/hydro/pull/220))
4 changes: 2 additions & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
5f19172adc451140c7d14966faf217b82ed64bd70dfa518a4093d74bf8d60617 hydro.wasm
5acd797d95c0addc2b457deab521c171acad2a514b0a1624f3f07f7775aacc59 tribute.wasm
e2c17ff7bac4ff4ec80e63b8dfa6c0d65f53bad633f9fb80b26121431b97f07e hydro.wasm
83f12ed4aa3b4900588096c639a9abec78080a4c91720442b47cba1b8059e63a tribute.wasm
Binary file modified artifacts/hydro.wasm
Binary file not shown.
Binary file modified artifacts/tribute.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion contracts/hydro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hydro"
version = "3.0.0"
version = "4.0.0"
authors = ["Jehan Tremback", "Philip Offtermatt", "Dusan Maksimovic"]
edition = "2018"

Expand Down
6 changes: 6 additions & 0 deletions contracts/hydro/schema/constants_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"hub_connection_id",
"hub_transfer_channel_id",
"icq_update_period",
"known_users_cap",
"lock_epoch_length",
"max_deployment_duration",
"max_locked_tokens",
Expand All @@ -42,6 +43,11 @@
"format": "uint64",
"minimum": 0.0
},
"known_users_cap": {
"type": "integer",
"format": "uint128",
"minimum": 0.0
},
"lock_epoch_length": {
"type": "integer",
"format": "uint64",
Expand Down
50 changes: 50 additions & 0 deletions contracts/hydro/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,21 @@
"properties": {
"update_config": {
"type": "object",
"required": [
"activate_at"
],
"properties": {
"activate_at": {
"$ref": "#/definitions/Timestamp"
},
"known_users_cap": {
"type": [
"integer",
"null"
],
"format": "uint128",
"minimum": 0.0
},
"max_deployment_duration": {
"type": [
"integer",
Expand All @@ -235,6 +249,30 @@
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"delete_configs"
],
"properties": {
"delete_configs": {
"type": "object",
"required": [
"timestamps"
],
"properties": {
"timestamps": {
"type": "array",
"items": {
"$ref": "#/definitions/Timestamp"
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
Expand Down Expand Up @@ -535,6 +573,14 @@
},
"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"
}
]
},
"TrancheInfo": {
"type": "object",
"required": [
Expand All @@ -554,6 +600,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"
}
}
}
Loading

0 comments on commit 82c43c3

Please sign in to comment.