flashloan-profit-calculator
Version:
A library for analyzing flashloan transactions and calculating profits
63 lines (62 loc) • 1.41 kB
TypeScript
export interface TokenFlowApiResponse {
transactionHash: string;
blockNumber: number;
timestamp: number;
senderAddress: string;
contractAddress: string;
addresses: AddressFlow[];
tokens: TokenInfo[];
transfers: TransferFlow[];
profits: ProfitSummary[];
totalProfitUsd: number;
}
export interface AddressFlow {
address: string;
isContract: boolean;
isSender: boolean;
isBuilder: boolean;
tokenBalances: {
[token: string]: TokenBalance;
};
label?: string;
}
export interface TokenBalance {
token: string;
symbol: string;
decimals: number;
amount: string;
amountFormatted: number;
type: "Revenue" | "Cost" | "TokenTransfer";
usdValue?: number;
}
export interface TokenInfo {
address: string;
symbol: string;
decimals: number;
name?: string;
usdPrice?: number;
}
export interface TransferFlow {
from: string;
to: string;
token: string;
amount: string;
amountFormatted: number;
symbol: string;
usdValue?: number;
type: "ERC20" | "ETH" | "WETH_DEPOSIT" | "WETH_WITHDRAWAL";
}
export interface ProfitSummary {
token: string;
symbol: string;
decimals: number;
profit: string;
profitFormatted: number;
usdValue: number;
percentage?: number;
}
export interface ApiError {
error: string;
message: string;
details?: any;
}