Initial commit: add .gitignore and README
This commit is contained in:
94
src/types/index.ts
Normal file
94
src/types/index.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
export type Network = 'ethereum' | 'arbitrum' | 'polygon' | 'optimism' | 'base';
|
||||
|
||||
export type WalletProviderType = 'private_key' | 'keystore' | 'eip1193';
|
||||
|
||||
export type DexProvider = 'uniswap_v3' | 'curve' | '1inch';
|
||||
|
||||
export type ExecutionMode = 'direct' | 'flash_loan';
|
||||
|
||||
export type TokenSymbol = 'USDC' | 'USDT' | 'DAI';
|
||||
|
||||
export interface NetworkConfig {
|
||||
name: string;
|
||||
chainId: number;
|
||||
rpcUrl: string;
|
||||
aavePoolAddress: string;
|
||||
aavePoolDataProviderAddress: string;
|
||||
tokens: {
|
||||
[key in TokenSymbol]?: string;
|
||||
};
|
||||
dex: {
|
||||
uniswapV3Router?: string;
|
||||
uniswapV3Quoter?: string;
|
||||
curvePool?: string;
|
||||
curveRouter?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface WalletConfig {
|
||||
providerType: WalletProviderType;
|
||||
privateKey?: string;
|
||||
keystorePath?: string;
|
||||
keystorePassword?: string;
|
||||
eip1193ProviderUrl?: string;
|
||||
}
|
||||
|
||||
export interface LoopConfig {
|
||||
initialCollateralAmount: number;
|
||||
collateralAsset: TokenSymbol;
|
||||
borrowAsset: TokenSymbol;
|
||||
ltvPercentage: number;
|
||||
numLoops: number;
|
||||
minHealthFactor: number;
|
||||
maxLoops: number;
|
||||
}
|
||||
|
||||
export interface DexConfig {
|
||||
provider: DexProvider;
|
||||
slippageTolerance: number;
|
||||
oneInchApiKey?: string;
|
||||
}
|
||||
|
||||
export interface SafetyConfig {
|
||||
priceDeviationThreshold: number;
|
||||
enablePriceChecks: boolean;
|
||||
}
|
||||
|
||||
export interface GasConfig {
|
||||
maxGasPriceGwei: number;
|
||||
gasLimitMultiplier: number;
|
||||
}
|
||||
|
||||
export interface AppConfig {
|
||||
network: Network;
|
||||
networkConfig: NetworkConfig;
|
||||
wallet: WalletConfig;
|
||||
loop: LoopConfig;
|
||||
dex: DexConfig;
|
||||
safety: SafetyConfig;
|
||||
gas: GasConfig;
|
||||
executionMode: ExecutionMode;
|
||||
}
|
||||
|
||||
export interface LoopState {
|
||||
currentLoop: number;
|
||||
totalSupplied: bigint;
|
||||
totalBorrowed: bigint;
|
||||
healthFactor: number;
|
||||
collateralBalance: bigint;
|
||||
borrowBalance: bigint;
|
||||
}
|
||||
|
||||
export interface SwapQuote {
|
||||
amountOut: bigint;
|
||||
priceImpact: number;
|
||||
route?: string[];
|
||||
}
|
||||
|
||||
export interface TransactionResult {
|
||||
success: boolean;
|
||||
txHash?: string;
|
||||
error?: string;
|
||||
gasUsed?: bigint;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user