File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ use stargaze_vip_collection::state::Metadata;
19
19
const CONTRACT_NAME : & str = "crates.io:stargaze-vip-minter" ;
20
20
const CONTRACT_VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
21
21
22
+ const MIN_STAKED_AMOUNT : u128 = 5000000000 ; // Minimum staked amount to be eligible for minting
23
+
22
24
#[ cfg_attr( not( feature = "library" ) , entry_point) ]
23
25
pub fn instantiate (
24
26
deps : DepsMut ,
@@ -155,6 +157,13 @@ pub fn mint(
155
157
156
158
let owner_addr = deps. api . addr_validate ( sender. as_ref ( ) ) ?;
157
159
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
+ ) ;
158
167
let tiers = TIERS . load ( deps. storage ) ?;
159
168
let index = tiers
160
169
. iter ( )
Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ pub enum ContractError {
27
27
#[ error( "TokenNotFound" ) ]
28
28
TokenNotFound { } ,
29
29
30
+ #[ error( "InsufficientStakedAmount (required: {required}, actual: {actual})" ) ]
31
+ InsufficientStakedAmount { required : u128 , actual : u128 } ,
32
+
30
33
#[ error( "AlreadyMinted" ) ]
31
34
AlreadyMinted { } ,
32
35
// Add any other custom errors you like here.
You can’t perform that action at this time.
0 commit comments