-
Notifications
You must be signed in to change notification settings - Fork 0
/
interfaces.ts
70 lines (61 loc) · 1.74 KB
/
interfaces.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
import { Address } from './types';
import { BigNumber } from 'ethers/utils/bignumber';
export interface ContractAddresses {
adapterRegistry: Address;
}
//TODO:
// getProtocolBalanceAtBlock(protocol, block)
// getBalancesForPools?
export interface DeFiSDKInterface {
getProtocolNames(): Promise<string[]>;
getProtocolMetaData(protocol: string): Promise<ProtocolMetadataInterface>;
getTokenAdapterNames(): Promise<string[]>;
getProtocolBalance(
account: Address,
protocol: string
): Promise<ProtocolBalanceInterface>;
getProtocolBalances(
account: Address,
protocols: [string]
): Promise<[ProtocolBalanceInterface]>;
getAccountBalances(account: Address): Promise<[ProtocolBalanceInterface]>;
getTokenComponents(
type: string,
token: Address
): Promise<[TokenBalanceInterface]>;
}
export interface ProtocolMetadataInterface {
name: string;
description: string;
website: URL;
logo: URL;
version: BigInt;
}
export interface TokenMetadataInterface {
address: Address;
name: string;
symbol: string;
decimals: number;
}
export interface TokenBalanceInterface {
metadata: TokenMetadataInterface;
balance: BigInt;
//TODO: I wouldn't say I like this dependency on the concrete implementation, but BigNumberish seems to be a wrong interface as well
getAmount(): BigNumber;
}
export interface AssetBalanceInterface {
base: TokenBalanceInterface;
underlying: [TokenBalanceInterface];
}
export interface AdapterMetadataInterface {
address: Address;
type: string;
}
export interface AdapterBalanceInterface {
metadata: AdapterMetadataInterface;
balances: [AssetBalanceInterface];
}
export interface ProtocolBalanceInterface {
metadata: ProtocolMetadataInterface;
balances: [AdapterBalanceInterface];
}