@@ -28,8 +28,8 @@ const decodeLog = async (log: any, abi: any) => {
28
28
} ;
29
29
30
30
export const decodeLogs = async ( logs : any [ ] ) => {
31
- const decodedLogs = [ ] ;
32
- let abi ;
31
+ const decodedLogs : any [ ] = [ ] ;
32
+ let abi : any ;
33
33
34
34
for ( const log of logs ) {
35
35
abi = abis . get ( log . address ) ;
@@ -69,21 +69,30 @@ export const printLogs = async (logs: any[]) => {
69
69
} ) ;
70
70
} ;
71
71
72
+ const printInternalBalanceChanged = ( log : any ) => {
73
+ const { user, token, delta } = log . args
74
+ console . log ( '\x1b[32m%s\x1b[0m' , 'User: ' , user )
75
+ console . log ( '\x1b[32m%s\x1b[0m' , 'Token:' , token )
76
+ console . log ( '\x1b[32m%s\x1b[0m' , 'Delta:' , formatEther ( delta ) )
77
+ }
78
+
72
79
const printTransfer = ( log : any ) => {
73
80
console . log ( log . address ) ;
74
- const { from, to, value, src, dst, wad } = log . args ;
75
- console . log ( '\x1b[32m%s\x1b[0m' , 'From: ' , from || src ) ;
76
- console . log ( '\x1b[32m%s\x1b[0m' , 'To: ' , to || dst ) ;
77
- console . log ( '\x1b[32m%s\x1b[0m' , 'Value:' , formatEther ( value || wad ) ) ;
78
- } ;
81
+ const { from, to, value, src, dst, wad, _to , _from , _value } = log . args
82
+ console . log ( '\x1b[32m%s\x1b[0m' , 'From: ' , from || _from || src )
83
+ console . log ( '\x1b[32m%s\x1b[0m' , 'To: ' , to || _to || dst )
84
+ console . log ( '\x1b[32m%s\x1b[0m' , 'Value:' , formatEther ( value || _value || wad ) )
85
+ }
79
86
80
- decodedLogs . map ( ( log ) => {
87
+ decodedLogs . map ( ( log : any ) => {
81
88
console . log ( '-' . repeat ( 80 ) ) ;
82
89
console . log ( log . name ) ;
83
90
if ( log . name === 'Swap' ) {
84
91
printSwap ( log ) ;
85
92
} else if ( log . name === 'PoolBalanceChanged' ) {
86
93
printPoolBalanceChanged ( log ) ;
94
+ } else if ( log . name === 'InternalBalanceChanged' ) {
95
+ printInternalBalanceChanged ( log ) ;
87
96
} else if ( log . name === 'Transfer' ) {
88
97
printTransfer ( log ) ;
89
98
}
0 commit comments