network-defaults: make defaults a bit more dynamic
By attaching network defaults to the selector enum, we can get them either from DEFAULT_NETWORK or a selector passed as a dependency. Hopefully this opens up some venues for being able to toggle between networks at runtime.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::config::template::config_template;
|
||||
use config::defaults::{default_api_endpoints, DEFAULT_MIXNET_CONTRACT_ADDRESS};
|
||||
use config::defaults::{default_api_endpoints, DEFAULT_NETWORK};
|
||||
use config::NymConfig;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::PathBuf;
|
||||
@@ -97,7 +97,8 @@ impl Default for Base {
|
||||
local_validator: DEFAULT_LOCAL_VALIDATOR
|
||||
.parse()
|
||||
.expect("default local validator is malformed!"),
|
||||
mixnet_contract_address: DEFAULT_MIXNET_CONTRACT_ADDRESS.to_string(),
|
||||
// mixnet_contract_address: DEFAULT_MIXNET_CONTRACT_ADDRESS.to_string(),
|
||||
mixnet_contract_address: DEFAULT_NETWORK.mixnet_contract_address().to_string(),
|
||||
#[cfg(feature = "coconut")]
|
||||
keypair_bs58: String::default(),
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::rewarding::{error::RewardingError, IntervalRewardParams, MixnodeToReward};
|
||||
use config::defaults::{default_network, DEFAULT_VALIDATOR_API_PORT};
|
||||
use config::defaults::{DEFAULT_NETWORK, DEFAULT_VALIDATOR_API_PORT};
|
||||
use mixnet_contract_common::{
|
||||
ContractStateParams, Delegation, ExecuteMsg, GatewayBond, IdentityKey, Interval, MixNodeBond,
|
||||
MixnodeRewardingStatusResponse, RewardedSetNodeStatus, RewardedSetUpdateDetails,
|
||||
@@ -37,7 +37,7 @@ impl Client<QueryNymdClient> {
|
||||
.parse()
|
||||
.unwrap();
|
||||
let nymd_url = config.get_nymd_validator_url();
|
||||
let network = default_network();
|
||||
let network = DEFAULT_NETWORK;
|
||||
|
||||
let mixnet_contract = config
|
||||
.get_mixnet_contract_address()
|
||||
@@ -67,7 +67,7 @@ impl Client<SigningNymdClient> {
|
||||
.parse()
|
||||
.unwrap();
|
||||
let nymd_url = config.get_nymd_validator_url();
|
||||
let network = default_network();
|
||||
let network = DEFAULT_NETWORK;
|
||||
|
||||
let mixnet_contract = config
|
||||
.get_mixnet_contract_address()
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::storage::models::{
|
||||
FailedMixnodeRewardChunk, PossiblyUnrewardedMixnode, RewardingReport,
|
||||
};
|
||||
use crate::storage::ValidatorApiStorage;
|
||||
use config::defaults::DENOM;
|
||||
use config::defaults::DEFAULT_NETWORK;
|
||||
use log::{error, info};
|
||||
use mixnet_contract_common::mixnode::NodeRewardParams;
|
||||
use mixnet_contract_common::{
|
||||
@@ -201,15 +201,18 @@ impl Rewarder {
|
||||
info!("Rewarding pool stats");
|
||||
info!(
|
||||
"-- Reward pool: {} {}",
|
||||
interval_reward_params.reward_pool, DENOM
|
||||
interval_reward_params.reward_pool,
|
||||
DEFAULT_NETWORK.denom()
|
||||
);
|
||||
info!(
|
||||
"---- Interval reward pool: {} {}",
|
||||
interval_reward_params.period_reward_pool, DENOM
|
||||
interval_reward_params.period_reward_pool,
|
||||
DEFAULT_NETWORK.denom()
|
||||
);
|
||||
info!(
|
||||
"-- Circulating supply: {} {}",
|
||||
interval_reward_params.circulating_supply, DENOM
|
||||
interval_reward_params.circulating_supply,
|
||||
DEFAULT_NETWORK.denom()
|
||||
);
|
||||
|
||||
// 1. get list of all currently bonded nodes
|
||||
|
||||
Reference in New Issue
Block a user