From 184d034423893863b6421b2442b36751a8ac8d7c Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Wed, 3 Apr 2024 19:33:17 +0300 Subject: [PATCH] Update the error for discount price removal too soon --- contracts/minters/vending-minter-featured/src/contract.rs | 4 ++-- contracts/minters/vending-minter-featured/src/error.rs | 3 +++ contracts/minters/vending-minter-merkle-wl/src/contract.rs | 4 ++-- contracts/minters/vending-minter-merkle-wl/src/error.rs | 3 +++ .../minters/vending-minter-wl-flex-featured/src/contract.rs | 2 +- .../minters/vending-minter-wl-flex-featured/src/error.rs | 3 +++ contracts/minters/vending-minter-wl-flex/src/contract.rs | 4 ++-- contracts/minters/vending-minter-wl-flex/src/error.rs | 3 +++ contracts/minters/vending-minter/src/contract.rs | 4 ++-- contracts/minters/vending-minter/src/error.rs | 3 +++ 10 files changed, 24 insertions(+), 9 deletions(-) diff --git a/contracts/minters/vending-minter-featured/src/contract.rs b/contracts/minters/vending-minter-featured/src/contract.rs index 2606d66e7..5ff529695 100644 --- a/contracts/minters/vending-minter-featured/src/contract.rs +++ b/contracts/minters/vending-minter-featured/src/contract.rs @@ -310,8 +310,8 @@ pub fn execute_remove_discount_price( } let last_discount_time = LAST_DISCOUNT_TIME.load(deps.storage)?; - if last_discount_time.plus_seconds(12 * 60 * 60) > env.block.time { - return Err(ContractError::DiscountUpdateTooSoon {}); + if last_discount_time.plus_seconds(60 * 60) > env.block.time { + return Err(ContractError::DiscountRemovalTooSoon {}); } config.extension.discount_price = None; diff --git a/contracts/minters/vending-minter-featured/src/error.rs b/contracts/minters/vending-minter-featured/src/error.rs index 528b9cd22..cfdd78c85 100644 --- a/contracts/minters/vending-minter-featured/src/error.rs +++ b/contracts/minters/vending-minter-featured/src/error.rs @@ -59,6 +59,9 @@ pub enum ContractError { #[error("Discount price can only be updated every 12 hours")] DiscountUpdateTooSoon {}, + #[error("Discount price can only be removed 1 hour after the last update")] + DiscountRemovalTooSoon {}, + #[error("Invalid address {addr}")] InvalidAddress { addr: String }, diff --git a/contracts/minters/vending-minter-merkle-wl/src/contract.rs b/contracts/minters/vending-minter-merkle-wl/src/contract.rs index 1c26f71d0..61b0a7049 100644 --- a/contracts/minters/vending-minter-merkle-wl/src/contract.rs +++ b/contracts/minters/vending-minter-merkle-wl/src/contract.rs @@ -310,8 +310,8 @@ pub fn execute_remove_discount_price( )); } let last_discount_time = LAST_DISCOUNT_TIME.load(deps.storage)?; - if last_discount_time.plus_seconds(12 * 60 * 60) > env.block.time { - return Err(ContractError::DiscountUpdateTooSoon {}); + if last_discount_time.plus_seconds(60 * 60) > env.block.time { + return Err(ContractError::DiscountRemovalTooSoon {}); } config.extension.discount_price = None; CONFIG.save(deps.storage, &config)?; diff --git a/contracts/minters/vending-minter-merkle-wl/src/error.rs b/contracts/minters/vending-minter-merkle-wl/src/error.rs index 528b9cd22..cfdd78c85 100644 --- a/contracts/minters/vending-minter-merkle-wl/src/error.rs +++ b/contracts/minters/vending-minter-merkle-wl/src/error.rs @@ -59,6 +59,9 @@ pub enum ContractError { #[error("Discount price can only be updated every 12 hours")] DiscountUpdateTooSoon {}, + #[error("Discount price can only be removed 1 hour after the last update")] + DiscountRemovalTooSoon {}, + #[error("Invalid address {addr}")] InvalidAddress { addr: String }, diff --git a/contracts/minters/vending-minter-wl-flex-featured/src/contract.rs b/contracts/minters/vending-minter-wl-flex-featured/src/contract.rs index 5895e1725..524b91bf7 100644 --- a/contracts/minters/vending-minter-wl-flex-featured/src/contract.rs +++ b/contracts/minters/vending-minter-wl-flex-featured/src/contract.rs @@ -296,7 +296,7 @@ pub fn execute_remove_discount_price( } let last_discount_time = LAST_DISCOUNT_TIME.load(deps.storage)?; if last_discount_time.plus_seconds(60 * 60) > env.block.time { - return Err(ContractError::DiscountUpdateTooSoon {}); + return Err(ContractError::DiscountRemovalTooSoon {}); } config.extension.discount_price = None; CONFIG.save(deps.storage, &config)?; diff --git a/contracts/minters/vending-minter-wl-flex-featured/src/error.rs b/contracts/minters/vending-minter-wl-flex-featured/src/error.rs index 528b9cd22..cfdd78c85 100644 --- a/contracts/minters/vending-minter-wl-flex-featured/src/error.rs +++ b/contracts/minters/vending-minter-wl-flex-featured/src/error.rs @@ -59,6 +59,9 @@ pub enum ContractError { #[error("Discount price can only be updated every 12 hours")] DiscountUpdateTooSoon {}, + #[error("Discount price can only be removed 1 hour after the last update")] + DiscountRemovalTooSoon {}, + #[error("Invalid address {addr}")] InvalidAddress { addr: String }, diff --git a/contracts/minters/vending-minter-wl-flex/src/contract.rs b/contracts/minters/vending-minter-wl-flex/src/contract.rs index c23e0e49c..73599a208 100644 --- a/contracts/minters/vending-minter-wl-flex/src/contract.rs +++ b/contracts/minters/vending-minter-wl-flex/src/contract.rs @@ -294,8 +294,8 @@ pub fn execute_remove_discount_price( )); } let last_discount_time = LAST_DISCOUNT_TIME.load(deps.storage)?; - if last_discount_time.plus_seconds(12 * 60 * 60) > env.block.time { - return Err(ContractError::DiscountUpdateTooSoon {}); + if last_discount_time.plus_seconds(60 * 60) > env.block.time { + return Err(ContractError::DiscountRemovalTooSoon {}); } config.extension.discount_price = None; CONFIG.save(deps.storage, &config)?; diff --git a/contracts/minters/vending-minter-wl-flex/src/error.rs b/contracts/minters/vending-minter-wl-flex/src/error.rs index 528b9cd22..cfdd78c85 100644 --- a/contracts/minters/vending-minter-wl-flex/src/error.rs +++ b/contracts/minters/vending-minter-wl-flex/src/error.rs @@ -59,6 +59,9 @@ pub enum ContractError { #[error("Discount price can only be updated every 12 hours")] DiscountUpdateTooSoon {}, + #[error("Discount price can only be removed 1 hour after the last update")] + DiscountRemovalTooSoon {}, + #[error("Invalid address {addr}")] InvalidAddress { addr: String }, diff --git a/contracts/minters/vending-minter/src/contract.rs b/contracts/minters/vending-minter/src/contract.rs index 10018ba2d..f923223a2 100644 --- a/contracts/minters/vending-minter/src/contract.rs +++ b/contracts/minters/vending-minter/src/contract.rs @@ -309,8 +309,8 @@ pub fn execute_remove_discount_price( )); } let last_discount_time = LAST_DISCOUNT_TIME.load(deps.storage)?; - if last_discount_time.plus_seconds(12 * 60 * 60) > env.block.time { - return Err(ContractError::DiscountUpdateTooSoon {}); + if last_discount_time.plus_seconds(60 * 60) > env.block.time { + return Err(ContractError::DiscountRemovalTooSoon {}); } config.extension.discount_price = None; CONFIG.save(deps.storage, &config)?; diff --git a/contracts/minters/vending-minter/src/error.rs b/contracts/minters/vending-minter/src/error.rs index 528b9cd22..cfdd78c85 100644 --- a/contracts/minters/vending-minter/src/error.rs +++ b/contracts/minters/vending-minter/src/error.rs @@ -59,6 +59,9 @@ pub enum ContractError { #[error("Discount price can only be updated every 12 hours")] DiscountUpdateTooSoon {}, + #[error("Discount price can only be removed 1 hour after the last update")] + DiscountRemovalTooSoon {}, + #[error("Invalid address {addr}")] InvalidAddress { addr: String },