Skip to content

Commit

Permalink
Update the error for discount price removal too soon
Browse files Browse the repository at this point in the history
  • Loading branch information
MightOfOaks committed Apr 3, 2024
1 parent d8e7897 commit 184d034
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 9 deletions.
4 changes: 2 additions & 2 deletions contracts/minters/vending-minter-featured/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions contracts/minters/vending-minter-featured/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 },

Expand Down
4 changes: 2 additions & 2 deletions contracts/minters/vending-minter-merkle-wl/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
3 changes: 3 additions & 0 deletions contracts/minters/vending-minter-merkle-wl/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 },

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },

Expand Down
4 changes: 2 additions & 2 deletions contracts/minters/vending-minter-wl-flex/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
3 changes: 3 additions & 0 deletions contracts/minters/vending-minter-wl-flex/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 },

Expand Down
4 changes: 2 additions & 2 deletions contracts/minters/vending-minter/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
3 changes: 3 additions & 0 deletions contracts/minters/vending-minter/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 },

Expand Down

0 comments on commit 184d034

Please sign in to comment.