@@ -110,6 +110,19 @@ mod dp {
110
110
. field ( "apy_bps" , apy_bps as f64 )
111
111
}
112
112
113
+ pub fn total_supply_balance_and_apy (
114
+ address : & Pubkey ,
115
+ maybe_token : MaybeToken ,
116
+ ui_amount : f64 ,
117
+ apy_bps : u64 ,
118
+ ) -> metrics:: Point {
119
+ metrics:: Point :: new ( "sys_lend::total_supply_balance_and_apy" )
120
+ . tag ( "address" , metrics:: dp:: pubkey_to_value ( address) )
121
+ . tag ( "token" , maybe_token. name ( ) )
122
+ . field ( "amount" , ui_amount)
123
+ . field ( "apy_bps" , apy_bps as f64 )
124
+ }
125
+
113
126
pub fn principal_balance_change (
114
127
pool : & str ,
115
128
address : & Pubkey ,
@@ -1057,6 +1070,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1057
1070
}
1058
1071
1059
1072
let ( total_apr, total_balance) = pools_supply_balance_apr ( & supply_balance) ;
1073
+ let total_apy = apr_to_apy ( total_apr) * 100. ;
1074
+
1075
+ metrics:: push ( dp:: total_supply_balance_and_apy (
1076
+ & address,
1077
+ maybe_token,
1078
+ token. ui_amount ( total_balance) ,
1079
+ ( total_apy * 100. ) as u64 ,
1080
+ ) )
1081
+ . await ;
1060
1082
1061
1083
if raw && total_only {
1062
1084
println ! ( "{}" , token. ui_amount( total_balance) ) ;
@@ -1066,7 +1088,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1066
1088
println ! (
1067
1089
"Total supply: {} at {:.2}%" ,
1068
1090
token. format_amount( total_balance) ,
1069
- apr_to_apy ( total_apr ) * 100.
1091
+ total_apy ,
1070
1092
) ;
1071
1093
1072
1094
let wallet_balance = maybe_token. balance ( rpc_client, & address) ?;
@@ -1496,8 +1518,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1496
1518
notifier
1497
1519
. send ( & format ! ( "{} via via {signature}" , operation_info. op_msg) )
1498
1520
. await ;
1499
-
1500
- return Ok ( ( ) ) ;
1501
1521
}
1502
1522
_ => unreachable ! ( ) ,
1503
1523
}
0 commit comments