Skip to content

Commit 03eed56

Browse files
committed
Check for min_staked_amount before mint
1 parent b309a44 commit 03eed56

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

contracts/vip/minter/src/contract.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ use stargaze_vip_collection::state::Metadata;
1919
const CONTRACT_NAME: &str = "crates.io:stargaze-vip-minter";
2020
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
2121

22+
const MIN_STAKED_AMOUNT: u128 = 5000000000; // Minimum staked amount to be eligible for minting
23+
2224
#[cfg_attr(not(feature = "library"), entry_point)]
2325
pub fn instantiate(
2426
deps: DepsMut,
@@ -155,6 +157,13 @@ pub fn mint(
155157

156158
let owner_addr = deps.api.addr_validate(sender.as_ref())?;
157159
let staked_amount = total_staked(deps.branch(), owner_addr)?;
160+
ensure!(
161+
staked_amount >= Uint128::from(MIN_STAKED_AMOUNT),
162+
ContractError::InsufficientStakedAmount {
163+
required: MIN_STAKED_AMOUNT,
164+
actual: u128::from(staked_amount)
165+
}
166+
);
158167
let tiers = TIERS.load(deps.storage)?;
159168
let index = tiers
160169
.iter()

contracts/vip/minter/src/error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ pub enum ContractError {
2727
#[error("TokenNotFound")]
2828
TokenNotFound {},
2929

30+
#[error("InsufficientStakedAmount (required: {required}, actual: {actual})")]
31+
InsufficientStakedAmount { required: u128, actual: u128 },
32+
3033
#[error("AlreadyMinted")]
3134
AlreadyMinted {},
3235
// Add any other custom errors you like here.

0 commit comments

Comments
 (0)