@defisaver/positions-sdk 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/aaveV2/index.d.ts +2 -2
- package/cjs/aaveV2/index.js +5 -3
- package/cjs/aaveV3/index.js +1 -1
- package/cjs/chickenBonds/index.js +2 -1
- package/cjs/compoundV3/index.d.ts +2 -2
- package/cjs/compoundV3/index.js +8 -5
- package/cjs/config/contracts.d.ts +144 -0
- package/cjs/config/contracts.js +18 -0
- package/cjs/contracts.d.ts +3 -0
- package/cjs/contracts.js +4 -1
- package/cjs/helpers/aaveHelpers/index.js +14 -2
- package/cjs/helpers/chickenBondsHelpers/index.d.ts +1 -0
- package/cjs/helpers/chickenBondsHelpers/index.js +14 -1
- package/cjs/helpers/compoundHelpers/index.d.ts +2 -2
- package/cjs/helpers/compoundHelpers/index.js +5 -4
- package/cjs/morphoAaveV2/index.d.ts +2 -2
- package/cjs/morphoAaveV2/index.js +5 -3
- package/cjs/services/priceService.d.ts +4 -0
- package/cjs/services/priceService.js +36 -0
- package/cjs/types/chickenBonds.d.ts +1 -0
- package/cjs/types/contracts/generated/COMPPriceFeed.d.ts +135 -0
- package/cjs/types/contracts/generated/COMPPriceFeed.js +5 -0
- package/cjs/types/contracts/generated/ETHPriceFeed.d.ts +135 -0
- package/cjs/types/contracts/generated/ETHPriceFeed.js +5 -0
- package/cjs/types/contracts/generated/USDCPriceFeed.d.ts +135 -0
- package/cjs/types/contracts/generated/USDCPriceFeed.js +5 -0
- package/cjs/types/contracts/generated/index.d.ts +3 -0
- package/esm/aaveV2/index.d.ts +2 -2
- package/esm/aaveV2/index.js +5 -3
- package/esm/aaveV3/index.js +1 -1
- package/esm/chickenBonds/index.js +3 -2
- package/esm/compoundV3/index.d.ts +2 -2
- package/esm/compoundV3/index.js +8 -5
- package/esm/config/contracts.d.ts +144 -0
- package/esm/config/contracts.js +18 -0
- package/esm/contracts.d.ts +3 -0
- package/esm/contracts.js +3 -0
- package/esm/helpers/aaveHelpers/index.js +14 -2
- package/esm/helpers/chickenBondsHelpers/index.d.ts +1 -0
- package/esm/helpers/chickenBondsHelpers/index.js +12 -0
- package/esm/helpers/compoundHelpers/index.d.ts +2 -2
- package/esm/helpers/compoundHelpers/index.js +5 -4
- package/esm/morphoAaveV2/index.d.ts +2 -2
- package/esm/morphoAaveV2/index.js +5 -3
- package/esm/services/priceService.d.ts +4 -0
- package/esm/services/priceService.js +27 -0
- package/esm/types/chickenBonds.d.ts +1 -0
- package/esm/types/contracts/generated/COMPPriceFeed.d.ts +135 -0
- package/esm/types/contracts/generated/COMPPriceFeed.js +4 -0
- package/esm/types/contracts/generated/ETHPriceFeed.d.ts +135 -0
- package/esm/types/contracts/generated/ETHPriceFeed.js +4 -0
- package/esm/types/contracts/generated/USDCPriceFeed.d.ts +135 -0
- package/esm/types/contracts/generated/USDCPriceFeed.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +3 -0
- package/package.json +1 -1
- package/src/aaveV2/index.ts +5 -3
- package/src/aaveV3/index.ts +1 -0
- package/src/chickenBonds/index.ts +3 -2
- package/src/compoundV3/index.ts +8 -5
- package/src/config/contracts.js +18 -0
- package/src/contracts.ts +5 -1
- package/src/helpers/aaveHelpers/index.ts +16 -2
- package/src/helpers/chickenBondsHelpers/index.ts +11 -0
- package/src/helpers/compoundHelpers/index.ts +7 -4
- package/src/morphoAaveV2/index.ts +5 -3
- package/src/services/priceService.ts +22 -0
- package/src/types/chickenBonds.ts +1 -0
- package/src/types/contracts/generated/COMPPriceFeed.ts +202 -0
- package/src/types/contracts/generated/ETHPriceFeed.ts +202 -0
- package/src/types/contracts/generated/USDCPriceFeed.ts +202 -0
- package/src/types/contracts/generated/index.ts +3 -0
- package/yarn-error.log +64 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type BN from "bn.js";
|
|
3
|
+
import type { ContractOptions } from "web3-eth-contract";
|
|
4
|
+
import type { EventLog } from "web3-core";
|
|
5
|
+
import type { EventEmitter } from "events";
|
|
6
|
+
import type { Callback, NonPayableTransactionObject, BlockType, ContractEventLog, BaseContract } from "./types";
|
|
7
|
+
export interface EventOptions {
|
|
8
|
+
filter?: object;
|
|
9
|
+
fromBlock?: BlockType;
|
|
10
|
+
topics?: string[];
|
|
11
|
+
}
|
|
12
|
+
export type AnswerUpdated = ContractEventLog<{
|
|
13
|
+
current: string;
|
|
14
|
+
roundId: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
0: string;
|
|
17
|
+
1: string;
|
|
18
|
+
2: string;
|
|
19
|
+
}>;
|
|
20
|
+
export type NewRound = ContractEventLog<{
|
|
21
|
+
roundId: string;
|
|
22
|
+
startedBy: string;
|
|
23
|
+
startedAt: string;
|
|
24
|
+
0: string;
|
|
25
|
+
1: string;
|
|
26
|
+
2: string;
|
|
27
|
+
}>;
|
|
28
|
+
export type OwnershipTransferRequested = ContractEventLog<{
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
0: string;
|
|
32
|
+
1: string;
|
|
33
|
+
}>;
|
|
34
|
+
export type OwnershipTransferred = ContractEventLog<{
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
0: string;
|
|
38
|
+
1: string;
|
|
39
|
+
}>;
|
|
40
|
+
export interface COMPPriceFeed extends BaseContract {
|
|
41
|
+
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): COMPPriceFeed;
|
|
42
|
+
clone(): COMPPriceFeed;
|
|
43
|
+
methods: {
|
|
44
|
+
acceptOwnership(): NonPayableTransactionObject<void>;
|
|
45
|
+
accessController(): NonPayableTransactionObject<string>;
|
|
46
|
+
aggregator(): NonPayableTransactionObject<string>;
|
|
47
|
+
confirmAggregator(_aggregator: string): NonPayableTransactionObject<void>;
|
|
48
|
+
decimals(): NonPayableTransactionObject<string>;
|
|
49
|
+
description(): NonPayableTransactionObject<string>;
|
|
50
|
+
getAnswer(_roundId: number | string | BN): NonPayableTransactionObject<string>;
|
|
51
|
+
getRoundData(_roundId: number | string | BN): NonPayableTransactionObject<[
|
|
52
|
+
string,
|
|
53
|
+
string,
|
|
54
|
+
string,
|
|
55
|
+
string,
|
|
56
|
+
string
|
|
57
|
+
] & {
|
|
58
|
+
roundId: string;
|
|
59
|
+
answer: string;
|
|
60
|
+
startedAt: string;
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
answeredInRound: string;
|
|
63
|
+
}>;
|
|
64
|
+
getTimestamp(_roundId: number | string | BN): NonPayableTransactionObject<string>;
|
|
65
|
+
latestAnswer(): NonPayableTransactionObject<string>;
|
|
66
|
+
latestRound(): NonPayableTransactionObject<string>;
|
|
67
|
+
latestRoundData(): NonPayableTransactionObject<[
|
|
68
|
+
string,
|
|
69
|
+
string,
|
|
70
|
+
string,
|
|
71
|
+
string,
|
|
72
|
+
string
|
|
73
|
+
] & {
|
|
74
|
+
roundId: string;
|
|
75
|
+
answer: string;
|
|
76
|
+
startedAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
answeredInRound: string;
|
|
79
|
+
}>;
|
|
80
|
+
latestTimestamp(): NonPayableTransactionObject<string>;
|
|
81
|
+
owner(): NonPayableTransactionObject<string>;
|
|
82
|
+
phaseAggregators(arg0: number | string | BN): NonPayableTransactionObject<string>;
|
|
83
|
+
phaseId(): NonPayableTransactionObject<string>;
|
|
84
|
+
proposeAggregator(_aggregator: string): NonPayableTransactionObject<void>;
|
|
85
|
+
proposedAggregator(): NonPayableTransactionObject<string>;
|
|
86
|
+
proposedGetRoundData(_roundId: number | string | BN): NonPayableTransactionObject<[
|
|
87
|
+
string,
|
|
88
|
+
string,
|
|
89
|
+
string,
|
|
90
|
+
string,
|
|
91
|
+
string
|
|
92
|
+
] & {
|
|
93
|
+
roundId: string;
|
|
94
|
+
answer: string;
|
|
95
|
+
startedAt: string;
|
|
96
|
+
updatedAt: string;
|
|
97
|
+
answeredInRound: string;
|
|
98
|
+
}>;
|
|
99
|
+
proposedLatestRoundData(): NonPayableTransactionObject<[
|
|
100
|
+
string,
|
|
101
|
+
string,
|
|
102
|
+
string,
|
|
103
|
+
string,
|
|
104
|
+
string
|
|
105
|
+
] & {
|
|
106
|
+
roundId: string;
|
|
107
|
+
answer: string;
|
|
108
|
+
startedAt: string;
|
|
109
|
+
updatedAt: string;
|
|
110
|
+
answeredInRound: string;
|
|
111
|
+
}>;
|
|
112
|
+
setController(_accessController: string): NonPayableTransactionObject<void>;
|
|
113
|
+
transferOwnership(_to: string): NonPayableTransactionObject<void>;
|
|
114
|
+
version(): NonPayableTransactionObject<string>;
|
|
115
|
+
};
|
|
116
|
+
events: {
|
|
117
|
+
AnswerUpdated(cb?: Callback<AnswerUpdated>): EventEmitter;
|
|
118
|
+
AnswerUpdated(options?: EventOptions, cb?: Callback<AnswerUpdated>): EventEmitter;
|
|
119
|
+
NewRound(cb?: Callback<NewRound>): EventEmitter;
|
|
120
|
+
NewRound(options?: EventOptions, cb?: Callback<NewRound>): EventEmitter;
|
|
121
|
+
OwnershipTransferRequested(cb?: Callback<OwnershipTransferRequested>): EventEmitter;
|
|
122
|
+
OwnershipTransferRequested(options?: EventOptions, cb?: Callback<OwnershipTransferRequested>): EventEmitter;
|
|
123
|
+
OwnershipTransferred(cb?: Callback<OwnershipTransferred>): EventEmitter;
|
|
124
|
+
OwnershipTransferred(options?: EventOptions, cb?: Callback<OwnershipTransferred>): EventEmitter;
|
|
125
|
+
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
126
|
+
};
|
|
127
|
+
once(event: "AnswerUpdated", cb: Callback<AnswerUpdated>): void;
|
|
128
|
+
once(event: "AnswerUpdated", options: EventOptions, cb: Callback<AnswerUpdated>): void;
|
|
129
|
+
once(event: "NewRound", cb: Callback<NewRound>): void;
|
|
130
|
+
once(event: "NewRound", options: EventOptions, cb: Callback<NewRound>): void;
|
|
131
|
+
once(event: "OwnershipTransferRequested", cb: Callback<OwnershipTransferRequested>): void;
|
|
132
|
+
once(event: "OwnershipTransferRequested", options: EventOptions, cb: Callback<OwnershipTransferRequested>): void;
|
|
133
|
+
once(event: "OwnershipTransferred", cb: Callback<OwnershipTransferred>): void;
|
|
134
|
+
once(event: "OwnershipTransferred", options: EventOptions, cb: Callback<OwnershipTransferred>): void;
|
|
135
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type BN from "bn.js";
|
|
3
|
+
import type { ContractOptions } from "web3-eth-contract";
|
|
4
|
+
import type { EventLog } from "web3-core";
|
|
5
|
+
import type { EventEmitter } from "events";
|
|
6
|
+
import type { Callback, NonPayableTransactionObject, BlockType, ContractEventLog, BaseContract } from "./types";
|
|
7
|
+
export interface EventOptions {
|
|
8
|
+
filter?: object;
|
|
9
|
+
fromBlock?: BlockType;
|
|
10
|
+
topics?: string[];
|
|
11
|
+
}
|
|
12
|
+
export type AnswerUpdated = ContractEventLog<{
|
|
13
|
+
current: string;
|
|
14
|
+
roundId: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
0: string;
|
|
17
|
+
1: string;
|
|
18
|
+
2: string;
|
|
19
|
+
}>;
|
|
20
|
+
export type NewRound = ContractEventLog<{
|
|
21
|
+
roundId: string;
|
|
22
|
+
startedBy: string;
|
|
23
|
+
startedAt: string;
|
|
24
|
+
0: string;
|
|
25
|
+
1: string;
|
|
26
|
+
2: string;
|
|
27
|
+
}>;
|
|
28
|
+
export type OwnershipTransferRequested = ContractEventLog<{
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
0: string;
|
|
32
|
+
1: string;
|
|
33
|
+
}>;
|
|
34
|
+
export type OwnershipTransferred = ContractEventLog<{
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
0: string;
|
|
38
|
+
1: string;
|
|
39
|
+
}>;
|
|
40
|
+
export interface ETHPriceFeed extends BaseContract {
|
|
41
|
+
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): ETHPriceFeed;
|
|
42
|
+
clone(): ETHPriceFeed;
|
|
43
|
+
methods: {
|
|
44
|
+
acceptOwnership(): NonPayableTransactionObject<void>;
|
|
45
|
+
accessController(): NonPayableTransactionObject<string>;
|
|
46
|
+
aggregator(): NonPayableTransactionObject<string>;
|
|
47
|
+
confirmAggregator(_aggregator: string): NonPayableTransactionObject<void>;
|
|
48
|
+
decimals(): NonPayableTransactionObject<string>;
|
|
49
|
+
description(): NonPayableTransactionObject<string>;
|
|
50
|
+
getAnswer(_roundId: number | string | BN): NonPayableTransactionObject<string>;
|
|
51
|
+
getRoundData(_roundId: number | string | BN): NonPayableTransactionObject<[
|
|
52
|
+
string,
|
|
53
|
+
string,
|
|
54
|
+
string,
|
|
55
|
+
string,
|
|
56
|
+
string
|
|
57
|
+
] & {
|
|
58
|
+
roundId: string;
|
|
59
|
+
answer: string;
|
|
60
|
+
startedAt: string;
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
answeredInRound: string;
|
|
63
|
+
}>;
|
|
64
|
+
getTimestamp(_roundId: number | string | BN): NonPayableTransactionObject<string>;
|
|
65
|
+
latestAnswer(): NonPayableTransactionObject<string>;
|
|
66
|
+
latestRound(): NonPayableTransactionObject<string>;
|
|
67
|
+
latestRoundData(): NonPayableTransactionObject<[
|
|
68
|
+
string,
|
|
69
|
+
string,
|
|
70
|
+
string,
|
|
71
|
+
string,
|
|
72
|
+
string
|
|
73
|
+
] & {
|
|
74
|
+
roundId: string;
|
|
75
|
+
answer: string;
|
|
76
|
+
startedAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
answeredInRound: string;
|
|
79
|
+
}>;
|
|
80
|
+
latestTimestamp(): NonPayableTransactionObject<string>;
|
|
81
|
+
owner(): NonPayableTransactionObject<string>;
|
|
82
|
+
phaseAggregators(arg0: number | string | BN): NonPayableTransactionObject<string>;
|
|
83
|
+
phaseId(): NonPayableTransactionObject<string>;
|
|
84
|
+
proposeAggregator(_aggregator: string): NonPayableTransactionObject<void>;
|
|
85
|
+
proposedAggregator(): NonPayableTransactionObject<string>;
|
|
86
|
+
proposedGetRoundData(_roundId: number | string | BN): NonPayableTransactionObject<[
|
|
87
|
+
string,
|
|
88
|
+
string,
|
|
89
|
+
string,
|
|
90
|
+
string,
|
|
91
|
+
string
|
|
92
|
+
] & {
|
|
93
|
+
roundId: string;
|
|
94
|
+
answer: string;
|
|
95
|
+
startedAt: string;
|
|
96
|
+
updatedAt: string;
|
|
97
|
+
answeredInRound: string;
|
|
98
|
+
}>;
|
|
99
|
+
proposedLatestRoundData(): NonPayableTransactionObject<[
|
|
100
|
+
string,
|
|
101
|
+
string,
|
|
102
|
+
string,
|
|
103
|
+
string,
|
|
104
|
+
string
|
|
105
|
+
] & {
|
|
106
|
+
roundId: string;
|
|
107
|
+
answer: string;
|
|
108
|
+
startedAt: string;
|
|
109
|
+
updatedAt: string;
|
|
110
|
+
answeredInRound: string;
|
|
111
|
+
}>;
|
|
112
|
+
setController(_accessController: string): NonPayableTransactionObject<void>;
|
|
113
|
+
transferOwnership(_to: string): NonPayableTransactionObject<void>;
|
|
114
|
+
version(): NonPayableTransactionObject<string>;
|
|
115
|
+
};
|
|
116
|
+
events: {
|
|
117
|
+
AnswerUpdated(cb?: Callback<AnswerUpdated>): EventEmitter;
|
|
118
|
+
AnswerUpdated(options?: EventOptions, cb?: Callback<AnswerUpdated>): EventEmitter;
|
|
119
|
+
NewRound(cb?: Callback<NewRound>): EventEmitter;
|
|
120
|
+
NewRound(options?: EventOptions, cb?: Callback<NewRound>): EventEmitter;
|
|
121
|
+
OwnershipTransferRequested(cb?: Callback<OwnershipTransferRequested>): EventEmitter;
|
|
122
|
+
OwnershipTransferRequested(options?: EventOptions, cb?: Callback<OwnershipTransferRequested>): EventEmitter;
|
|
123
|
+
OwnershipTransferred(cb?: Callback<OwnershipTransferred>): EventEmitter;
|
|
124
|
+
OwnershipTransferred(options?: EventOptions, cb?: Callback<OwnershipTransferred>): EventEmitter;
|
|
125
|
+
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
126
|
+
};
|
|
127
|
+
once(event: "AnswerUpdated", cb: Callback<AnswerUpdated>): void;
|
|
128
|
+
once(event: "AnswerUpdated", options: EventOptions, cb: Callback<AnswerUpdated>): void;
|
|
129
|
+
once(event: "NewRound", cb: Callback<NewRound>): void;
|
|
130
|
+
once(event: "NewRound", options: EventOptions, cb: Callback<NewRound>): void;
|
|
131
|
+
once(event: "OwnershipTransferRequested", cb: Callback<OwnershipTransferRequested>): void;
|
|
132
|
+
once(event: "OwnershipTransferRequested", options: EventOptions, cb: Callback<OwnershipTransferRequested>): void;
|
|
133
|
+
once(event: "OwnershipTransferred", cb: Callback<OwnershipTransferred>): void;
|
|
134
|
+
once(event: "OwnershipTransferred", options: EventOptions, cb: Callback<OwnershipTransferred>): void;
|
|
135
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type BN from "bn.js";
|
|
3
|
+
import type { ContractOptions } from "web3-eth-contract";
|
|
4
|
+
import type { EventLog } from "web3-core";
|
|
5
|
+
import type { EventEmitter } from "events";
|
|
6
|
+
import type { Callback, NonPayableTransactionObject, BlockType, ContractEventLog, BaseContract } from "./types";
|
|
7
|
+
export interface EventOptions {
|
|
8
|
+
filter?: object;
|
|
9
|
+
fromBlock?: BlockType;
|
|
10
|
+
topics?: string[];
|
|
11
|
+
}
|
|
12
|
+
export type AnswerUpdated = ContractEventLog<{
|
|
13
|
+
current: string;
|
|
14
|
+
roundId: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
0: string;
|
|
17
|
+
1: string;
|
|
18
|
+
2: string;
|
|
19
|
+
}>;
|
|
20
|
+
export type NewRound = ContractEventLog<{
|
|
21
|
+
roundId: string;
|
|
22
|
+
startedBy: string;
|
|
23
|
+
startedAt: string;
|
|
24
|
+
0: string;
|
|
25
|
+
1: string;
|
|
26
|
+
2: string;
|
|
27
|
+
}>;
|
|
28
|
+
export type OwnershipTransferRequested = ContractEventLog<{
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
0: string;
|
|
32
|
+
1: string;
|
|
33
|
+
}>;
|
|
34
|
+
export type OwnershipTransferred = ContractEventLog<{
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
0: string;
|
|
38
|
+
1: string;
|
|
39
|
+
}>;
|
|
40
|
+
export interface USDCPriceFeed extends BaseContract {
|
|
41
|
+
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): USDCPriceFeed;
|
|
42
|
+
clone(): USDCPriceFeed;
|
|
43
|
+
methods: {
|
|
44
|
+
acceptOwnership(): NonPayableTransactionObject<void>;
|
|
45
|
+
accessController(): NonPayableTransactionObject<string>;
|
|
46
|
+
aggregator(): NonPayableTransactionObject<string>;
|
|
47
|
+
confirmAggregator(_aggregator: string): NonPayableTransactionObject<void>;
|
|
48
|
+
decimals(): NonPayableTransactionObject<string>;
|
|
49
|
+
description(): NonPayableTransactionObject<string>;
|
|
50
|
+
getAnswer(_roundId: number | string | BN): NonPayableTransactionObject<string>;
|
|
51
|
+
getRoundData(_roundId: number | string | BN): NonPayableTransactionObject<[
|
|
52
|
+
string,
|
|
53
|
+
string,
|
|
54
|
+
string,
|
|
55
|
+
string,
|
|
56
|
+
string
|
|
57
|
+
] & {
|
|
58
|
+
roundId: string;
|
|
59
|
+
answer: string;
|
|
60
|
+
startedAt: string;
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
answeredInRound: string;
|
|
63
|
+
}>;
|
|
64
|
+
getTimestamp(_roundId: number | string | BN): NonPayableTransactionObject<string>;
|
|
65
|
+
latestAnswer(): NonPayableTransactionObject<string>;
|
|
66
|
+
latestRound(): NonPayableTransactionObject<string>;
|
|
67
|
+
latestRoundData(): NonPayableTransactionObject<[
|
|
68
|
+
string,
|
|
69
|
+
string,
|
|
70
|
+
string,
|
|
71
|
+
string,
|
|
72
|
+
string
|
|
73
|
+
] & {
|
|
74
|
+
roundId: string;
|
|
75
|
+
answer: string;
|
|
76
|
+
startedAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
answeredInRound: string;
|
|
79
|
+
}>;
|
|
80
|
+
latestTimestamp(): NonPayableTransactionObject<string>;
|
|
81
|
+
owner(): NonPayableTransactionObject<string>;
|
|
82
|
+
phaseAggregators(arg0: number | string | BN): NonPayableTransactionObject<string>;
|
|
83
|
+
phaseId(): NonPayableTransactionObject<string>;
|
|
84
|
+
proposeAggregator(_aggregator: string): NonPayableTransactionObject<void>;
|
|
85
|
+
proposedAggregator(): NonPayableTransactionObject<string>;
|
|
86
|
+
proposedGetRoundData(_roundId: number | string | BN): NonPayableTransactionObject<[
|
|
87
|
+
string,
|
|
88
|
+
string,
|
|
89
|
+
string,
|
|
90
|
+
string,
|
|
91
|
+
string
|
|
92
|
+
] & {
|
|
93
|
+
roundId: string;
|
|
94
|
+
answer: string;
|
|
95
|
+
startedAt: string;
|
|
96
|
+
updatedAt: string;
|
|
97
|
+
answeredInRound: string;
|
|
98
|
+
}>;
|
|
99
|
+
proposedLatestRoundData(): NonPayableTransactionObject<[
|
|
100
|
+
string,
|
|
101
|
+
string,
|
|
102
|
+
string,
|
|
103
|
+
string,
|
|
104
|
+
string
|
|
105
|
+
] & {
|
|
106
|
+
roundId: string;
|
|
107
|
+
answer: string;
|
|
108
|
+
startedAt: string;
|
|
109
|
+
updatedAt: string;
|
|
110
|
+
answeredInRound: string;
|
|
111
|
+
}>;
|
|
112
|
+
setController(_accessController: string): NonPayableTransactionObject<void>;
|
|
113
|
+
transferOwnership(_to: string): NonPayableTransactionObject<void>;
|
|
114
|
+
version(): NonPayableTransactionObject<string>;
|
|
115
|
+
};
|
|
116
|
+
events: {
|
|
117
|
+
AnswerUpdated(cb?: Callback<AnswerUpdated>): EventEmitter;
|
|
118
|
+
AnswerUpdated(options?: EventOptions, cb?: Callback<AnswerUpdated>): EventEmitter;
|
|
119
|
+
NewRound(cb?: Callback<NewRound>): EventEmitter;
|
|
120
|
+
NewRound(options?: EventOptions, cb?: Callback<NewRound>): EventEmitter;
|
|
121
|
+
OwnershipTransferRequested(cb?: Callback<OwnershipTransferRequested>): EventEmitter;
|
|
122
|
+
OwnershipTransferRequested(options?: EventOptions, cb?: Callback<OwnershipTransferRequested>): EventEmitter;
|
|
123
|
+
OwnershipTransferred(cb?: Callback<OwnershipTransferred>): EventEmitter;
|
|
124
|
+
OwnershipTransferred(options?: EventOptions, cb?: Callback<OwnershipTransferred>): EventEmitter;
|
|
125
|
+
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
126
|
+
};
|
|
127
|
+
once(event: "AnswerUpdated", cb: Callback<AnswerUpdated>): void;
|
|
128
|
+
once(event: "AnswerUpdated", options: EventOptions, cb: Callback<AnswerUpdated>): void;
|
|
129
|
+
once(event: "NewRound", cb: Callback<NewRound>): void;
|
|
130
|
+
once(event: "NewRound", options: EventOptions, cb: Callback<NewRound>): void;
|
|
131
|
+
once(event: "OwnershipTransferRequested", cb: Callback<OwnershipTransferRequested>): void;
|
|
132
|
+
once(event: "OwnershipTransferRequested", options: EventOptions, cb: Callback<OwnershipTransferRequested>): void;
|
|
133
|
+
once(event: "OwnershipTransferred", cb: Callback<OwnershipTransferred>): void;
|
|
134
|
+
once(event: "OwnershipTransferred", options: EventOptions, cb: Callback<OwnershipTransferred>): void;
|
|
135
|
+
}
|
|
@@ -7,6 +7,7 @@ export type { AaveV3PoolAddressesProvider } from "./AaveV3PoolAddressesProvider"
|
|
|
7
7
|
export type { AaveV3ProtocolDataProvider } from "./AaveV3ProtocolDataProvider";
|
|
8
8
|
export type { AaveV3View } from "./AaveV3View";
|
|
9
9
|
export type { BalanceScanner } from "./BalanceScanner";
|
|
10
|
+
export type { COMPPriceFeed } from "./COMPPriceFeed";
|
|
10
11
|
export type { CbEth } from "./CbEth";
|
|
11
12
|
export type { ChickenBondsManager } from "./ChickenBondsManager";
|
|
12
13
|
export type { ChickenBondsView } from "./ChickenBondsView";
|
|
@@ -17,6 +18,7 @@ export type { CompV3USDbCBulker } from "./CompV3USDbCBulker";
|
|
|
17
18
|
export type { CompV3View } from "./CompV3View";
|
|
18
19
|
export type { CompoundLoanInfo } from "./CompoundLoanInfo";
|
|
19
20
|
export type { Comptroller } from "./Comptroller";
|
|
21
|
+
export type { ETHPriceFeed } from "./ETHPriceFeed";
|
|
20
22
|
export type { Erc20 } from "./Erc20";
|
|
21
23
|
export type { GHO } from "./GHO";
|
|
22
24
|
export type { GhoDiscountRateStrategy } from "./GhoDiscountRateStrategy";
|
|
@@ -43,6 +45,7 @@ export type { SparkPoolAddressesProvider } from "./SparkPoolAddressesProvider";
|
|
|
43
45
|
export type { SparkProtocolDataProvider } from "./SparkProtocolDataProvider";
|
|
44
46
|
export type { SparkView } from "./SparkView";
|
|
45
47
|
export type { TroveManager } from "./TroveManager";
|
|
48
|
+
export type { USDCPriceFeed } from "./USDCPriceFeed";
|
|
46
49
|
export type { UniMulticall } from "./UniMulticall";
|
|
47
50
|
export type { CETHv3 } from "./CETHv3";
|
|
48
51
|
export type { CUSDCv3 } from "./CUSDCv3";
|
package/esm/aaveV2/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
2
|
import { Blockish, EthAddress, NetworkNumber, PositionBalances } from '../types/common';
|
|
3
3
|
import { AaveMarketInfo, AaveV2AssetsData, AaveV2PositionData } from '../types';
|
|
4
|
-
export declare const getAaveV2MarketsData: (web3: Web3, network: NetworkNumber, selectedMarket: AaveMarketInfo,
|
|
4
|
+
export declare const getAaveV2MarketsData: (web3: Web3, network: NetworkNumber, selectedMarket: AaveMarketInfo, mainnetWeb3: Web3) => Promise<{
|
|
5
5
|
assetsData: AaveV2AssetsData;
|
|
6
6
|
}>;
|
|
7
7
|
export declare const getAaveV2AccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress) => Promise<PositionBalances>;
|
|
8
8
|
export declare const getAaveV2AccountData: (web3: Web3, network: NetworkNumber, address: string, assetsData: AaveV2AssetsData, market: AaveMarketInfo) => Promise<AaveV2PositionData>;
|
|
9
|
-
export declare const getAaveV2FullPositionData: (web3: Web3, network: NetworkNumber, address: string, market: AaveMarketInfo,
|
|
9
|
+
export declare const getAaveV2FullPositionData: (web3: Web3, network: NetworkNumber, address: string, market: AaveMarketInfo, mainnetWeb3: Web3) => Promise<AaveV2PositionData>;
|
package/esm/aaveV2/index.js
CHANGED
|
@@ -16,7 +16,9 @@ import { calculateBorrowingAssetLimit } from '../moneymarket';
|
|
|
16
16
|
import { EMPTY_AAVE_DATA } from '../aaveV3';
|
|
17
17
|
import { AAVE_V2 } from '../markets/aave';
|
|
18
18
|
import { aaveAnyGetAggregatedPositionData } from '../helpers/aaveHelpers';
|
|
19
|
-
|
|
19
|
+
import { getEthPrice } from '../services/priceService';
|
|
20
|
+
export const getAaveV2MarketsData = (web3, network, selectedMarket, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
const ethPrice = yield getEthPrice(mainnetWeb3);
|
|
20
22
|
const _addresses = selectedMarket.assets.map(a => getAssetInfo(ethToWeth(a)).address);
|
|
21
23
|
const loanInfoContract = AaveLoanInfoV2Contract(web3, network);
|
|
22
24
|
const marketAddress = selectedMarket.providerAddress;
|
|
@@ -167,8 +169,8 @@ export const getAaveV2AccountData = (web3, network, address, assetsData, market)
|
|
|
167
169
|
payload.totalInterestUsd = totalInterestUsd;
|
|
168
170
|
return payload;
|
|
169
171
|
});
|
|
170
|
-
export const getAaveV2FullPositionData = (web3, network, address, market,
|
|
171
|
-
const marketData = yield getAaveV2MarketsData(web3, network, market,
|
|
172
|
+
export const getAaveV2FullPositionData = (web3, network, address, market, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
173
|
+
const marketData = yield getAaveV2MarketsData(web3, network, market, mainnetWeb3);
|
|
172
174
|
const positionData = yield getAaveV2AccountData(web3, network, address, marketData.assetsData, market);
|
|
173
175
|
return positionData;
|
|
174
176
|
});
|
package/esm/aaveV3/index.js
CHANGED
|
@@ -154,7 +154,7 @@ export function getAaveV3MarketData(web3, network, market, defaultWeb3) {
|
|
|
154
154
|
liquidationRatio: new Dec(tokenMarket.liquidationThreshold).div(10000).toString(),
|
|
155
155
|
collateralFactor: new Dec(tokenMarket.ltv).div(10000).toString(),
|
|
156
156
|
priceSource: tokenMarket.priceSource,
|
|
157
|
-
} }));
|
|
157
|
+
}, aTokenAddress: tokenMarket.aTokenAddress }));
|
|
158
158
|
})));
|
|
159
159
|
yield Promise.all(assetsData.map((_market) => __awaiter(this, void 0, void 0, function* () {
|
|
160
160
|
/* eslint-disable no-param-reassign */
|
|
@@ -11,7 +11,7 @@ import Dec from 'decimal.js';
|
|
|
11
11
|
import { assetAmountInEth, getAssetInfo } from '@defisaver/tokens';
|
|
12
12
|
import { ChickenBondsManagerContract, ChickenBondsViewContract } from '../contracts';
|
|
13
13
|
import { multicall } from '../multicall';
|
|
14
|
-
import { calcAverageBondAgeMs, calcCBondsBLUSDFloorPrice } from '../helpers/chickenBondsHelpers';
|
|
14
|
+
import { calcAverageBondAgeMs, calcCBondsBLUSDFloorPrice, decodeTokenURIToSvg } from '../helpers/chickenBondsHelpers';
|
|
15
15
|
export const getChickenBondsAccountBalances = (web3, network, block, addressMapping, bondId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
const viewContract = ChickenBondsViewContract(web3, network, block);
|
|
17
17
|
const fullBondInfo = yield viewContract.methods.getBondFullInfo(bondId).call({}, block);
|
|
@@ -82,7 +82,7 @@ export const fetchCBondsForUser = (web3, network, address) => __awaiter(void 0,
|
|
|
82
82
|
return bonds.map(({ bondID, accruedBLUSD, claimedBLUSD, endTime, lusdAmount, maxAmountBLUSD, startTime, status, tokenURI, }) => ({
|
|
83
83
|
bondId: bondID,
|
|
84
84
|
status,
|
|
85
|
-
|
|
85
|
+
tokenURI: decodeTokenURIToSvg(tokenURI),
|
|
86
86
|
startTime: new Date(+startTime * 1000),
|
|
87
87
|
endTime: new Date(+endTime * 1000),
|
|
88
88
|
accruedBLUSD: assetAmountInEth(accruedBLUSD, 'bLUSD'),
|
|
@@ -103,5 +103,6 @@ export const fetchCBondForId = (web3, network, bondId) => __awaiter(void 0, void
|
|
|
103
103
|
claimedBLUSD: assetAmountInEth(bond.claimedBLUSD, 'bLUSD'),
|
|
104
104
|
lusdAmount: assetAmountInEth(bond.lusdAmount, 'LUSD'),
|
|
105
105
|
maxAmountBLUSD: assetAmountInEth(bond.maxAmountBLUSD, 'bLUSD'),
|
|
106
|
+
tokenURI: decodeTokenURIToSvg(bond.tokenURI),
|
|
106
107
|
};
|
|
107
108
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
2
|
import { CompoundMarketData, CompoundV3AssetsData, CompoundV3MarketsData, CompoundV3PositionData } from '../types/compound';
|
|
3
3
|
import { Blockish, EthAddress, NetworkNumber, PositionBalances } from '../types/common';
|
|
4
|
-
export declare const getCompoundV3MarketsData: (web3: Web3, network: NetworkNumber, selectedMarket: CompoundMarketData,
|
|
4
|
+
export declare const getCompoundV3MarketsData: (web3: Web3, network: NetworkNumber, selectedMarket: CompoundMarketData, defaultWeb3: Web3) => Promise<CompoundV3MarketsData>;
|
|
5
5
|
export declare const EMPTY_COMPOUND_V3_DATA: {
|
|
6
6
|
usedAssets: {};
|
|
7
7
|
suppliedUsd: string;
|
|
@@ -34,4 +34,4 @@ export declare const getCompoundV3AccountData: (web3: Web3, network: NetworkNumb
|
|
|
34
34
|
selectedMarket: CompoundMarketData;
|
|
35
35
|
assetsData: CompoundV3AssetsData;
|
|
36
36
|
})) => Promise<CompoundV3PositionData>;
|
|
37
|
-
export declare const getCompoundV3FullPositionData: (web3: Web3, network: NetworkNumber, address: string, proxyAddress: string, selectedMarket: CompoundMarketData,
|
|
37
|
+
export declare const getCompoundV3FullPositionData: (web3: Web3, network: NetworkNumber, address: string, proxyAddress: string, selectedMarket: CompoundMarketData, mainnetWeb3: Web3) => Promise<CompoundV3PositionData>;
|
package/esm/compoundV3/index.js
CHANGED
|
@@ -18,7 +18,10 @@ import { ZERO_ADDRESS } from '../constants';
|
|
|
18
18
|
import { calculateBorrowingAssetLimit } from '../moneymarket';
|
|
19
19
|
import { formatBaseData, formatMarketData, getCompoundV3AggregatedData, getIncentiveApys, } from '../helpers/compoundHelpers';
|
|
20
20
|
import { COMPOUND_V3_ETH, COMPOUND_V3_USDBC, COMPOUND_V3_USDC } from '../markets/compound';
|
|
21
|
-
|
|
21
|
+
import { getEthPrice, getCompPrice, getUSDCPrice } from '../services/priceService';
|
|
22
|
+
export const getCompoundV3MarketsData = (web3, network, selectedMarket, defaultWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
const baseAssetPrice = selectedMarket.baseAsset === 'ETH' ? yield getEthPrice(defaultWeb3) : yield getUSDCPrice(defaultWeb3);
|
|
24
|
+
const compPrice = yield getCompPrice(defaultWeb3);
|
|
22
25
|
const contract = CompV3ViewContract(web3, network);
|
|
23
26
|
const CompV3ViewAddress = contract.options.address;
|
|
24
27
|
const calls = [
|
|
@@ -34,7 +37,7 @@ export const getCompoundV3MarketsData = (web3, network, selectedMarket, compPric
|
|
|
34
37
|
},
|
|
35
38
|
];
|
|
36
39
|
const data = yield multicall(calls, web3, network);
|
|
37
|
-
const colls = data[1].colls.map((coll) => formatMarketData(coll, network));
|
|
40
|
+
const colls = data[1].colls.map((coll) => formatMarketData(coll, network, baseAssetPrice));
|
|
38
41
|
if (selectedMarket.value === CompoundVersions.CompoundV3ETH) {
|
|
39
42
|
for (const coll of colls) {
|
|
40
43
|
if (coll.symbol === 'wstETH') {
|
|
@@ -61,7 +64,7 @@ export const getCompoundV3MarketsData = (web3, network, selectedMarket, compPric
|
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
|
-
const base = formatBaseData(data[0].baseToken, network);
|
|
67
|
+
const base = formatBaseData(data[0].baseToken, network, baseAssetPrice);
|
|
65
68
|
const payload = {};
|
|
66
69
|
const baseObj = Object.assign(Object.assign({}, base), getIncentiveApys(base, compPrice));
|
|
67
70
|
const allAssets = [baseObj, ...colls];
|
|
@@ -191,8 +194,8 @@ export const getCompoundV3AccountData = (web3, network, address, proxyAddress, e
|
|
|
191
194
|
});
|
|
192
195
|
return payload;
|
|
193
196
|
});
|
|
194
|
-
export const getCompoundV3FullPositionData = (web3, network, address, proxyAddress, selectedMarket,
|
|
195
|
-
const marketData = yield getCompoundV3MarketsData(web3, network, selectedMarket,
|
|
197
|
+
export const getCompoundV3FullPositionData = (web3, network, address, proxyAddress, selectedMarket, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
198
|
+
const marketData = yield getCompoundV3MarketsData(web3, network, selectedMarket, mainnetWeb3);
|
|
196
199
|
const positionData = yield getCompoundV3AccountData(web3, network, address, proxyAddress, { selectedMarket, assetsData: marketData.assetsData });
|
|
197
200
|
return positionData;
|
|
198
201
|
});
|