Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into feat/DRP-367_granular_…
Browse files Browse the repository at this point in the history
…core_pause
  • Loading branch information
foxpy committed Oct 24, 2024
2 parents 7554e65 + f4be656 commit dc8f98f
Show file tree
Hide file tree
Showing 43 changed files with 2,319 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
toolchain: nightly-2023-12-21
profile: minimal
override: true
- name: Install cargo-tarpaulin
Expand Down
16 changes: 16 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ members = [
"contracts/staker",
"contracts/strategy",
"contracts/token",
"contracts/val-ref",
"contracts/splitter",
"contracts/price-provider",
"contracts/validators-stats",
Expand Down
11 changes: 11 additions & 0 deletions contracts/core/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ fn test_tick_idle_unbonding_close() {
drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: "valoper_address".to_string(),
weight: 1,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down Expand Up @@ -755,6 +756,7 @@ fn test_tick_idle_claim_wo_unbond() {
drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: "valoper_address".to_string(),
weight: 1,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down Expand Up @@ -916,6 +918,7 @@ fn test_tick_idle_claim_with_unbond_transfer() {
drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: "valoper_address".to_string(),
weight: 1,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down Expand Up @@ -1074,6 +1077,7 @@ fn test_tick_idle_staking_bond() {
drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: "valoper_address".to_string(),
weight: 1,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down Expand Up @@ -1224,6 +1228,7 @@ fn test_tick_idle_unbonding() {
drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: "valoper_address".to_string(),
weight: 1,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down Expand Up @@ -1427,6 +1432,7 @@ fn test_tick_idle_unbonding_failed() {
drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: "valoper_address".to_string(),
weight: 1,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down Expand Up @@ -3088,6 +3094,7 @@ fn test_bond_lsm_share_increase_exchange_rate() {
validator: Some(drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: "valoper1".to_string(),
weight: 1u64,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down Expand Up @@ -3289,6 +3296,7 @@ fn test_bond_lsm_share_ok() {
validator: Some(drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: "valoper1".to_string(),
weight: 1u64,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down Expand Up @@ -3400,6 +3408,7 @@ fn test_bond_lsm_share_ok_with_low_ratio() {
validator: Some(drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: "valoper1".to_string(),
weight: 1u64,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down Expand Up @@ -3522,6 +3531,7 @@ fn test_bond_lsm_share_ok_with_low_ratio_pending_already_there() {
validator: Some(drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: "valoper1".to_string(),
weight: 1u64,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down Expand Up @@ -4149,6 +4159,7 @@ mod check_denom {
validator: Some(drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: "valoper12345".to_string(),
weight: 1u64,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down
8 changes: 8 additions & 0 deletions contracts/factory/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ fn test_update_config_validators_set_unauthorized() {
let new_validator_set_config = drop_staking_base::state::validatorset::ConfigOptional {
stats_contract: Some("validator_stats_contract".to_string()),
provider_proposals_contract: Some("provider_proposals_contract1".to_string()),
val_ref_contract: Some("val_ref_contract1".to_string()),
};
let res = execute(
deps.as_mut().into_empty(),
Expand Down Expand Up @@ -640,6 +641,7 @@ fn test_update_config_validators_set() {
let new_validator_set_config = drop_staking_base::state::validatorset::ConfigOptional {
stats_contract: Some("validator_stats_contract".to_string()),
provider_proposals_contract: Some("provider_proposals_contract1".to_string()),
val_ref_contract: Some("val_ref_contract1".to_string()),
};
let res = execute(
deps.as_mut().into_empty(),
Expand Down Expand Up @@ -690,10 +692,12 @@ fn test_proxy_validators_set_update_validators_unauthorized() {
drop_staking_base::msg::validatorset::ValidatorData {
valoper_address: "valoper_address1".to_string(),
weight: 10u64,
on_top: Uint128::zero(),
},
drop_staking_base::msg::validatorset::ValidatorData {
valoper_address: "valoper_address2".to_string(),
weight: 10u64,
on_top: Uint128::zero(),
},
],
},
Expand Down Expand Up @@ -725,10 +729,12 @@ fn test_proxy_validators_set_update_validators() {
drop_staking_base::msg::validatorset::ValidatorData {
valoper_address: "valoper_address1".to_string(),
weight: 10u64,
on_top: Uint128::zero(),
},
drop_staking_base::msg::validatorset::ValidatorData {
valoper_address: "valoper_address2".to_string(),
weight: 10u64,
on_top: Uint128::zero(),
},
],
},
Expand All @@ -747,10 +753,12 @@ fn test_proxy_validators_set_update_validators() {
drop_staking_base::msg::validatorset::ValidatorData {
valoper_address: "valoper_address1".to_string(),
weight: 10u64,
on_top: Uint128::zero(),
},
drop_staking_base::msg::validatorset::ValidatorData {
valoper_address: "valoper_address2".to_string(),
weight: 10u64,
on_top: Uint128::zero(),
},
],
})
Expand Down
6 changes: 4 additions & 2 deletions contracts/strategy/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ fn prepare_delegation_data(
let mut delegations: Vec<drop_staking_base::msg::distribution::Delegation> = Vec::new();
let mut total_delegations: Uint128 = Uint128::zero();
let mut total_weight: u64 = 0;
let mut total_on_top = Uint128::zero();
let delegation_validator_map: HashMap<_, _> = account_delegations
.delegations
.delegations
Expand All @@ -161,19 +162,20 @@ fn prepare_delegation_data(
let delegation = drop_staking_base::msg::distribution::Delegation {
valoper_address: validator.valoper_address.clone(),
stake: validator_denom_delegation,
on_top: Uint128::zero(),
weight: validator.weight,
on_top: validator.on_top,
};

total_delegations += validator_denom_delegation;
total_weight += validator.weight;
total_on_top += validator.on_top;
delegations.push(delegation);
}

Ok(drop_staking_base::msg::distribution::Delegations {
total_stake: total_delegations,
total_on_top: Uint128::zero(),
total_weight,
total_on_top,
delegations,
})
}
Expand Down
1 change: 1 addition & 0 deletions contracts/strategy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ fn validator_set_query(_deps: Deps, _env: Env, msg: ValidatorSetQueryMsg) -> Std
let validator = drop_staking_base::state::validatorset::ValidatorInfo {
valoper_address: format!("valoper{}", i),
weight: 100,
on_top: Uint128::zero(),
last_processed_remote_height: None,
last_processed_local_height: None,
last_validated_height: None,
Expand Down
2 changes: 2 additions & 0 deletions contracts/val-ref/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
schema = "run --bin drop-val-ref-schema"
25 changes: 25 additions & 0 deletions contracts/val-ref/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
authors = ["Murad Karammaev <[email protected]>"]
description = "Contract module which stores validator's referral codes and their on_top stake"
edition = "2021"
name = "drop-val-ref"
version = "1.0.0"

[lib]
crate-type = ["cdylib", "rlib"]

[features]
backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
cosmwasm-std = { workspace = true }
neutron-sdk = { workspace = true }
drop-staking-base = { workspace = true }
cw2 = { workspace = true }
cw-ownable = { workspace = true }
drop-helpers = { workspace = true }
thiserror = { workspace = true }
semver = { workspace = true }
cw-storage-plus = { workspace = true }
cosmwasm-schema = { workspace = true }
1 change: 1 addition & 0 deletions contracts/val-ref/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Val ref contract
12 changes: 12 additions & 0 deletions contracts/val-ref/src/bin/drop-val-ref-schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use cosmwasm_schema::write_api;

use drop_staking_base::msg::val_ref::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};

fn main() {
write_api! {
instantiate: InstantiateMsg,
query: QueryMsg,
execute: ExecuteMsg,
migrate: MigrateMsg
}
}
Loading

0 comments on commit dc8f98f

Please sign in to comment.