@@ -4,7 +4,7 @@ use near_contract_standards::fungible_token::core::ext_ft_core;
44use near_sdk:: {
55 env,
66 json_types:: U128 ,
7- near, serde_json,
7+ near, require , serde_json,
88 store:: { IterableMap , LookupMap , Vector } ,
99 AccountId , BorshStorageKey , IntoStorageKey , PanicOnDefault , Promise , PromiseOrValue ,
1010} ;
@@ -21,11 +21,11 @@ use near_sdk_contract_tools::{owner::OwnerExternal, rbac::Rbac};
2121use templar_common:: {
2222 asset:: { BorrowAsset , BorrowAssetAmount , FungibleAsset } ,
2323 vault:: {
24- ext_self, AllocationMode , AllocationPlan , AllocationWeights , Error , Event ,
25- MarketConfiguration , OpState , PendingValue , PendingWithdrawal , TimestampNs ,
24+ ext_self, require_at_least , AllocationMode , AllocationPlan , AllocationWeights , Error ,
25+ Event , MarketConfiguration , OpState , PendingValue , PendingWithdrawal , TimestampNs ,
2626 VaultConfiguration , AFTER_CREATE_WITHDRAW_REQ_GAS , AFTER_SEND_TO_USER_GAS ,
27- AFTER_SUPPLY_ENSURE_GAS , CREATE_WITHDRAW_REQ_GAS , MAX_QUEUE_LEN , MAX_TIMELOCK_NS ,
28- MIN_TIMELOCK_NS ,
27+ AFTER_SUPPLY_ENSURE_GAS , ALLOCATE_GAS , CREATE_WITHDRAW_REQ_GAS , EXECUTE_WITHDRAW_GAS ,
28+ MAX_QUEUE_LEN , MAX_TIMELOCK_NS , MIN_TIMELOCK_NS , WITHDRAW_GAS ,
2929 } ,
3030} ;
3131pub use wad:: * ;
@@ -731,6 +731,7 @@ impl Contract {
731731 /// Internally calls `redeem` after computing the share amount.
732732 #[ payable]
733733 pub fn withdraw ( & mut self , amount : U128 , receiver : AccountId ) -> PromiseOrValue < ( ) > {
734+ require_at_least ( WITHDRAW_GAS ) ;
734735 let shares_needed = self . preview_withdraw ( amount) . 0 ;
735736 self . redeem ( U128 ( shares_needed) , receiver)
736737 }
@@ -768,6 +769,7 @@ impl Contract {
768769 /// Executes the next pending withdrawal request, if any, using the existing withdraw pipeline.
769770 /// This defers creating market-side withdrawal requests until explicitly invoked.
770771 pub fn execute_next_withdrawal_request ( & mut self ) -> PromiseOrValue < ( ) > {
772+ require_at_least ( EXECUTE_WITHDRAW_GAS ) ;
771773 self . ensure_idle ( ) ;
772774 Self :: assert_allocator ( ) ;
773775
@@ -810,6 +812,7 @@ impl Contract {
810812 weights : AllocationWeights ,
811813 amount : Option < U128 > ,
812814 ) -> PromiseOrValue < ( ) > {
815+ require_at_least ( ALLOCATE_GAS ) ;
813816 Self :: assert_allocator ( ) ;
814817 self . ensure_idle ( ) ;
815818
0 commit comments