@@ -381,6 +381,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
381
381
. validator ( is_parsable :: < u16 > )
382
382
. help ( "Do not deposit if the current pool APY is less than this amount of BPS" )
383
383
)
384
+ . arg (
385
+ Arg :: with_name ( "dry_run" )
386
+ . long ( "dry-run" )
387
+ . takes_value ( false )
388
+ )
384
389
)
385
390
. subcommand (
386
391
SubCommand :: with_name ( "withdraw" )
@@ -421,6 +426,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
421
426
. default_value ( "USDC" )
422
427
. help ( "Token to withdraw" ) ,
423
428
)
429
+ . arg (
430
+ Arg :: with_name ( "dry_run" )
431
+ . long ( "dry-run" )
432
+ . takes_value ( false )
433
+ )
424
434
)
425
435
. subcommand (
426
436
SubCommand :: with_name ( "rebalance" )
@@ -471,6 +481,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
471
481
. default_value ( "250" )
472
482
. help ( "Skip rebalance if the APY improvement would be less than this amount of BPS" )
473
483
)
484
+ . arg (
485
+ Arg :: with_name ( "dry_run" )
486
+ . long ( "dry-run" )
487
+ . takes_value ( false )
488
+ )
474
489
)
475
490
. subcommand (
476
491
SubCommand :: with_name ( "supply-balance" )
@@ -769,6 +784,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
769
784
770
785
let maybe_token = MaybeToken :: from ( value_t ! ( matches, "token" , Token ) . ok ( ) ) ;
771
786
let token = maybe_token. token ( ) . unwrap_or ( Token :: wSOL) ;
787
+ let dry_run = matches. is_present ( "dry_run" ) ;
772
788
773
789
let pools = values_t ! ( matches, "pool" , String )
774
790
. ok ( )
@@ -1117,26 +1133,20 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1117
1133
}
1118
1134
1119
1135
format ! (
1120
- "Deposit {} from {} into {} at {simulation_deposit_pool_apy:.2}%" ,
1121
- maybe_token. format_amount( amount) ,
1122
- address,
1123
- deposit_pool
1136
+ "Deposit {} from {address} into {deposit_pool} ({deposit_pool_apy:.2}% -> {simulation_deposit_pool_apy:.2}%)" ,
1137
+ maybe_token. format_amount( amount)
1124
1138
)
1125
1139
}
1126
1140
Command :: Withdraw => {
1127
1141
format ! (
1128
- "Withdrew {} from {} into {}" ,
1129
- maybe_token. format_amount( amount) ,
1130
- withdraw_pool,
1131
- address
1142
+ "Withdraw {} from {withdraw_pool} ({withdraw_pool_apy:.2}% -> {simulation_withdraw_pool_apy:.2}%) into {address}" ,
1143
+ maybe_token. format_amount( amount)
1132
1144
)
1133
1145
}
1134
1146
Command :: Rebalance => {
1135
1147
let msg_prefix = format ! ( "Rebalance of {} from {withdraw_pool} ({withdraw_pool_apy:.2}% -> {simulation_withdraw_pool_apy:.2}%) \
1136
1148
to {deposit_pool} ({deposit_pool_apy:.2}% -> {simulation_deposit_pool_apy:.2}%)",
1137
-
1138
- maybe_token. format_amount( amount) ,
1139
-
1149
+ maybe_token. format_amount( amount)
1140
1150
) ;
1141
1151
1142
1152
if simulation_apy_improvement_bps < minimum_apy_bps as isize {
@@ -1153,6 +1163,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1153
1163
1154
1164
println ! ( "{msg}" ) ;
1155
1165
1166
+ if dry_run {
1167
+ println ! ( "Aborting due to --dry-run flag" ) ;
1168
+ return Ok ( ( ) ) ;
1169
+ }
1170
+
1156
1171
if !send_transaction_until_expired ( & rpc_clients, & transaction, last_valid_block_height)
1157
1172
{
1158
1173
let msg = format ! ( "Transaction failed: {signature}" ) ;
0 commit comments