-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into benny/nym-api-test…
…s-via-mixfetch
- Loading branch information
Showing
32 changed files
with
680 additions
and
185 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
common/commands/src/validator/mixnet/operators/mixnode/settings/update_cost_params.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2021 - Nym Technologies SA <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::context::SigningClient; | ||
use clap::Parser; | ||
use cosmwasm_std::Uint128; | ||
use log::info; | ||
use nym_mixnet_contract_common::{MixNodeCostParams, Percent}; | ||
use nym_validator_client::nyxd::contract_traits::MixnetSigningClient; | ||
use nym_validator_client::nyxd::CosmWasmCoin; | ||
|
||
#[derive(Debug, Parser)] | ||
pub struct Args { | ||
#[clap( | ||
long, | ||
help = "input your profit margin as follows; (so it would be 10, rather than 0.1)" | ||
)] | ||
pub profit_margin_percent: Option<u8>, | ||
|
||
#[clap( | ||
long, | ||
help = "operating cost in current DENOMINATION (so it would be 'unym', rather than 'nym')" | ||
)] | ||
pub interval_operating_cost: Option<u128>, | ||
} | ||
|
||
pub async fn update_cost_params(args: Args, client: SigningClient) { | ||
let denom = client.current_chain_details().mix_denom.base.as_str(); | ||
|
||
let cost_params = MixNodeCostParams { | ||
profit_margin_percent: Percent::from_percentage_value( | ||
args.profit_margin_percent.unwrap_or(10) as u64, | ||
) | ||
.unwrap(), | ||
interval_operating_cost: CosmWasmCoin { | ||
denom: denom.into(), | ||
amount: Uint128::new(args.interval_operating_cost.unwrap_or(40_000_000)), | ||
}, | ||
}; | ||
|
||
info!("Starting mixnode params updating!"); | ||
let res = client | ||
.update_mixnode_cost_params(cost_params, None) | ||
.await | ||
.expect("failed to update cost params"); | ||
|
||
info!("Cost params result: {:?}", res) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.