From 62e9c8236a2ac410885bd375b2f73ab746c03d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Wed, 9 Nov 2022 11:04:32 +0100 Subject: [PATCH] Remove log from vesting-contract (#1745) * Remove log from vesting-contract * rustfmt --- Cargo.lock | 1 - .../vesting-contract/Cargo.toml | 1 - .../vesting-contract/src/lib.rs | 23 ++++--------------- contracts/Cargo.lock | 1 - contracts/vesting/src/contract.rs | 4 ++-- 5 files changed, 7 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 207872c863..c0ad7c504d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6514,7 +6514,6 @@ version = "0.1.0" dependencies = [ "contracts-common", "cosmwasm-std", - "log", "mixnet-contract-common", "schemars", "serde", diff --git a/common/cosmwasm-smart-contracts/vesting-contract/Cargo.toml b/common/cosmwasm-smart-contracts/vesting-contract/Cargo.toml index c2fa50a159..c4a51aff9d 100644 --- a/common/cosmwasm-smart-contracts/vesting-contract/Cargo.toml +++ b/common/cosmwasm-smart-contracts/vesting-contract/Cargo.toml @@ -9,7 +9,6 @@ mixnet-contract-common = { path = "../mixnet-contract" } contracts-common = { path = "../contracts-common" } serde = { version = "1.0", features = ["derive"] } schemars = "0.8" -log = "0.4" ts-rs = {version = "6.1.2", optional = true} [features] diff --git a/common/cosmwasm-smart-contracts/vesting-contract/src/lib.rs b/common/cosmwasm-smart-contracts/vesting-contract/src/lib.rs index 7e0e90d852..0b89f1aa52 100644 --- a/common/cosmwasm-smart-contracts/vesting-contract/src/lib.rs +++ b/common/cosmwasm-smart-contracts/vesting-contract/src/lib.rs @@ -4,7 +4,6 @@ use std::str::FromStr; // SPDX-License-Identifier: Apache-2.0 use contracts_common::Percent; use cosmwasm_std::{Addr, Coin, Timestamp, Uint128}; -use log::warn; use mixnet_contract_common::MixId; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -59,23 +58,11 @@ impl FromStr for PledgeCap { fn from_str(cap: &str) -> Result { let cap = cap.replace('_', "").replace(',', "."); match Percent::from_str(&cap) { - Ok(p) => { - if p.is_zero() { - warn!("Pledge cap set to 0%, are you sure this is right?") - } - Ok(PledgeCap::Percent(p)) - } - Err(_) => { - match cap.parse::() { - Ok(i) => { - if i < 100_000_000_000 { - warn!("PledgeCap set to less then 100_000 NYM, are you sure this is right?"); - } - Ok(PledgeCap::Absolute(Uint128::from(i))) - } - Err(_e) => Err(format!("Could not parse {} as Percent or Uint128", cap)), - } - } + Ok(p) => Ok(PledgeCap::Percent(p)), + Err(_) => match cap.parse::() { + Ok(i) => Ok(PledgeCap::Absolute(Uint128::from(i))), + Err(_e) => Err(format!("Could not parse {} as Percent or Uint128", cap)), + }, } } } diff --git a/contracts/Cargo.lock b/contracts/Cargo.lock index 706a7c5e36..09bc8adff2 100644 --- a/contracts/Cargo.lock +++ b/contracts/Cargo.lock @@ -1625,7 +1625,6 @@ version = "0.1.0" dependencies = [ "contracts-common", "cosmwasm-std", - "log", "mixnet-contract-common", "schemars", "serde", diff --git a/contracts/vesting/src/contract.rs b/contracts/vesting/src/contract.rs index ff6970d7a1..6c67db1b27 100644 --- a/contracts/vesting/src/contract.rs +++ b/contracts/vesting/src/contract.rs @@ -1,8 +1,8 @@ use crate::errors::ContractError; use crate::queued_migrations::migrate_to_v2_mixnet_contract; use crate::storage::{ - account_from_address, BlockTimestampSecs, ADMIN, DELEGATIONS, MIXNET_CONTRACT_ADDRESS, - MIX_DENOM, save_account, + account_from_address, save_account, BlockTimestampSecs, ADMIN, DELEGATIONS, + MIXNET_CONTRACT_ADDRESS, MIX_DENOM, }; use crate::traits::{ DelegatingAccount, GatewayBondingAccount, MixnodeBondingAccount, VestingAccount,