@@ -896,26 +896,16 @@ where
896
896
ctx. pre ( ) . read ( & balance_key) ?. unwrap_or_default ( ) ;
897
897
let post_balance: token:: Amount =
898
898
Self :: force_read ( ctx, & balance_key, ReadType :: Post ) ?;
899
+ let min_funds_parameter_key = gov_storage:: get_min_proposal_fund_key ( ) ;
900
+ let min_funds_parameter: token:: Amount =
901
+ Self :: force_read ( ctx, & min_funds_parameter_key, ReadType :: Pre ) ?;
899
902
900
903
let is_valid_balance = if is_proposal {
901
904
if !native_token_address. eq ( token) {
902
905
return Err ( Error :: new_const (
903
906
"Governance deposit must be paid in native token" ,
904
907
) ) ;
905
908
}
906
-
907
- let balance_key = TokenKeys :: balance_key ( token, & ADDRESS ) ;
908
- let min_funds_parameter_key =
909
- gov_storage:: get_min_proposal_fund_key ( ) ;
910
-
911
- let pre_balance: token:: Amount =
912
- ctx. pre ( ) . read ( & balance_key) ?. unwrap_or_default ( ) ;
913
-
914
- let min_funds_parameter: token:: Amount =
915
- Self :: force_read ( ctx, & min_funds_parameter_key, ReadType :: Pre ) ?;
916
- let post_balance: token:: Amount =
917
- Self :: force_read ( ctx, & balance_key, ReadType :: Post ) ?;
918
-
919
909
checked ! ( post_balance - pre_balance) ? >= min_funds_parameter
920
910
} else {
921
911
post_balance >= pre_balance
@@ -1159,7 +1149,7 @@ impl KeyType {
1159
1149
KeyType :: COUNTER
1160
1150
} else if gov_storage:: is_parameter_key ( key) {
1161
1151
KeyType :: PARAMETER
1162
- } else if let Some ( [ token, & ADDRESS ] ) =
1152
+ } else if let Some ( [ token, _ ] ) =
1163
1153
TokenKeys :: is_any_token_balance_key ( key)
1164
1154
{
1165
1155
KeyType :: BALANCE ( token. clone ( ) )
0 commit comments