@@ -134,19 +134,24 @@ async fn check_wallet_balance(
134
134
}
135
135
}
136
136
137
- fn token_client_from_config (
137
+ fn base_token_client (
138
138
config : & Config < ' _ > ,
139
139
token_pubkey : & Pubkey ,
140
140
decimals : Option < u8 > ,
141
141
) -> Result < Token < ProgramRpcClientSendTransaction > , Error > {
142
- let token = Token :: new (
142
+ Ok ( Token :: new (
143
143
config. program_client . clone ( ) ,
144
144
& config. program_id ,
145
145
token_pubkey,
146
146
decimals,
147
147
config. fee_payer ( ) ?. clone ( ) ,
148
- ) ;
148
+ ) )
149
+ }
149
150
151
+ fn config_token_client (
152
+ token : Token < ProgramRpcClientSendTransaction > ,
153
+ config : & Config < ' _ > ,
154
+ ) -> Result < Token < ProgramRpcClientSendTransaction > , Error > {
150
155
let token = if let Some ( compute_unit_limit) = config. compute_unit_limit {
151
156
token. with_compute_unit_limit ( compute_unit_limit)
152
157
} else {
@@ -174,6 +179,15 @@ fn token_client_from_config(
174
179
}
175
180
}
176
181
182
+ fn token_client_from_config (
183
+ config : & Config < ' _ > ,
184
+ token_pubkey : & Pubkey ,
185
+ decimals : Option < u8 > ,
186
+ ) -> Result < Token < ProgramRpcClientSendTransaction > , Error > {
187
+ let token = base_token_client ( config, token_pubkey, decimals) ?;
188
+ config_token_client ( token, config)
189
+ }
190
+
177
191
fn native_token_client_from_config (
178
192
config : & Config < ' _ > ,
179
193
) -> Result < Token < ProgramRpcClientSendTransaction > , Error > {
@@ -418,7 +432,10 @@ async fn command_set_interest_rate(
418
432
rate_bps : i16 ,
419
433
bulk_signers : Vec < Arc < dyn Signer > > ,
420
434
) -> CommandResult {
421
- let token = token_client_from_config ( config, & token_pubkey, None ) ?;
435
+ // Because set_interest_rate depends on the time, it can cost more between
436
+ // simulation and execution. To help that, just set a static compute limit
437
+ let token = base_token_client ( config, & token_pubkey, None ) ?. with_compute_unit_limit ( 2_500 ) ;
438
+ let token = config_token_client ( token, config) ?;
422
439
423
440
if !config. sign_only {
424
441
let mint_account = config. get_account_checked ( & token_pubkey) . await ?;
0 commit comments