-
Notifications
You must be signed in to change notification settings - Fork 2
/
schemas.ts
64 lines (46 loc) · 1.47 KB
/
schemas.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
import { Type, Transform } from "class-transformer";
import { toChecksumAddress } from "web3-utils";
import BigNumber from "bignumber.js"
export class Reserve {
@Type(() => String)
symbol: string;
@Type(() => BigNumber)
decimals: BigNumber
@Type(() => String)
id: string;
@Transform(value => toChecksumAddress(value), { toClassOnly: true })
underlyingAsset: string;
}
export class ReservesData {
@Transform(value => new BigNumber(value), { toClassOnly: true })
principalATokenBalance: BigNumber
@Type(() => Reserve)
reserve: Reserve;
@Transform(value => new BigNumber(value), { toClassOnly: true })
currentUnderlyingBalanceUSD: BigNumber
}
export class User {
@Transform(value => new BigNumber(value), { toClassOnly: true })
totalBorrowsUSD: BigNumber;
@Type(() => Number)
healthFactor: number;
@Transform(value => toChecksumAddress(value), { toClassOnly: true })
id: string;
@Type(() => ReservesData)
reservesData: ReservesData[];
}
export class CDP {
@Transform(value => new BigNumber(value), { toClassOnly: true })
principalBorrows: BigNumber;
@Type(() => User)
user: User;
@Type(() => Reserve)
reserve: Reserve;
}
export class OneSplitReturn {
@Transform(value => new BigNumber(value), { toClassOnly: true })
returnAmount: BigNumber;
// @Transform((values: BigNumber[]) => values.map(value => new BigNumber(value)), { toClassOnly: true })
@Type(() => String)
distribution: string[];
}