-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
88 lines (77 loc) · 1.76 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { ethers } from 'ethers';
export type Log = {
index: number;
address: `0x${string}`;
topics: `0x${string}`[];
data: `0x${string}`;
callPath: string;
};
export type Call = {
from: `0x${string}`;
gas: `0x${string}`;
gasUsed: `0x${string}`;
to: `0x${string}`;
input: `0x${string}`;
output?: `0x${string}`;
logs?: Log[];
calls?: Call[];
value: `0x${string}`;
type: 'CALL' | 'STATICCALL' | 'DELEGATECALL' | 'CREATE' | 'CREATE2';
};
export type FlatCall = Omit<Call, 'calls'> & {
parentCall: string | null;
calls?: string[];
};
export type MappedCall = Record<string, FlatCall>;
export type CallersAndReceivers = {
caller: `0x${string}`;
receiver: `0x${string}`;
key: string;
type: FlatCall['type'];
};
export type BlockTransactionTrace = {
txHash: `0x${string}`;
result: Call;
};
export type FlashLoanInfos = {
receiver: `0x${string}`;
token: `0x${string}`;
tokenName: string;
lender: `0x${string}`;
amount: ethers.BigNumber;
callKey: string;
event: Log;
};
export type BorrowAndMaybeDerivative = {
borrow: {
borrower: `0x${string}`;
protocol: `0x${string}`;
value: ethers.BigNumber;
event: Log;
};
value: ethers.BigNumber;
lender: `0x${string}`;
maybeDerivative: `0x${string}`;
event: Log;
};
export type Liquidation = {
derivatives: `0x${string}`[];
borrow: BorrowAndMaybeDerivative['borrow'];
borrower: `0x${string}`;
liquidator: `0x${string}`;
logs: Log[];
};
export type DrainedTokens = Record<
string,
{
account: `0x${string}`;
diff: string;
}[]
>;
export type FlashLoanAnaylisis = {
flashLoan?: FlashLoanInfos;
maybeBorrows?: BorrowAndMaybeDerivative[];
borrow?: Liquidation['borrow'];
liquidation?: Omit<Liquidation, 'borrow'>;
drainedTokens?: DrainedTokens;
};