@aurigami/sdk 1.23.1 → 1.24.0
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/dist/SDK.d.ts +48 -65
- package/dist/SDK.js +165 -0
- package/dist/abis/index.d.ts +18 -18
- package/dist/abis/index.js +39 -0
- package/dist/consts/constants.d.ts +139 -139
- package/dist/consts/constants.js +185 -0
- package/dist/consts/decimals.d.ts +1 -1
- package/dist/consts/decimals.js +35 -0
- package/dist/consts/deployments.d.ts +3 -3
- package/dist/consts/deployments.js +9 -0
- package/dist/consts/dummy.d.ts +13 -13
- package/dist/consts/dummy.js +43 -0
- package/dist/consts/index.d.ts +5 -5
- package/dist/consts/index.js +9 -0
- package/dist/consts/symbols.d.ts +1 -1
- package/dist/consts/symbols.js +10 -0
- package/dist/entities/BlockchainEntity.d.ts +13 -13
- package/dist/entities/BlockchainEntity.js +36 -0
- package/dist/entities/auriEnv.d.ts +34 -40
- package/dist/entities/auriEnv.js +166 -0
- package/dist/entities/index.d.ts +4 -4
- package/dist/entities/index.js +8 -0
- package/dist/entities/token.d.ts +7 -7
- package/dist/entities/token.js +27 -0
- package/dist/entities/tokenAmount.d.ts +13 -13
- package/dist/entities/tokenAmount.js +52 -0
- package/dist/helpers/aurigami-api.d.ts +13 -13
- package/dist/helpers/aurigami-api.js +26 -0
- package/dist/helpers/aurora-api-helpers.d.ts +1 -1
- package/dist/helpers/aurora-api-helpers.js +15 -0
- package/dist/helpers/graphql-helpers.d.ts +1 -1
- package/dist/helpers/graphql-helpers.js +13 -0
- package/dist/helpers/helpers.d.ts +23 -40
- package/dist/helpers/helpers.js +148 -0
- package/dist/helpers/historicalPriceFetcher.d.ts +15 -15
- package/dist/helpers/historicalPriceFetcher.js +142 -0
- package/dist/helpers/index.d.ts +7 -7
- package/dist/helpers/index.js +11 -0
- package/dist/helpers/kyber-aggregator-api.d.ts +5 -5
- package/dist/helpers/kyber-aggregator-api.js +27 -0
- package/dist/helpers/multicall.d.ts +40 -0
- package/dist/helpers/multicall.js +203 -0
- package/dist/helpers/notification-api.d.ts +2 -2
- package/dist/helpers/notification-api.js +21 -0
- package/dist/helpers/one-inch-aggregator-api.d.ts +21 -21
- package/dist/helpers/one-inch-aggregator-api.js +19 -0
- package/dist/helpers/priceFetcher.d.ts +36 -36
- package/dist/helpers/priceFetcher.js +296 -0
- package/dist/helpers/subgraphQuery.d.ts +1 -1
- package/dist/helpers/subgraphQuery.js +22 -0
- package/dist/helpers/transfer-event-query.d.ts +17 -26
- package/dist/helpers/transfer-event-query.js +41 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +17 -8
- package/dist/interactors/Airdrop.d.ts +17 -26
- package/dist/interactors/Airdrop.js +48 -0
- package/dist/interactors/MoneyMarket.d.ts +63 -63
- package/dist/interactors/MoneyMarket.js +392 -0
- package/dist/interactors/Multicall.d.ts +15 -18
- package/dist/interactors/Multicall.js +36 -0
- package/dist/interactors/Papermill.d.ts +27 -57
- package/dist/interactors/Papermill.js +125 -0
- package/dist/interactors/PlyGame.d.ts +30 -42
- package/dist/interactors/PlyGame.js +146 -0
- package/dist/interactors/PlyTokenLock.d.ts +16 -16
- package/dist/interactors/PlyTokenLock.js +44 -0
- package/dist/interactors/Pulp.d.ts +17 -17
- package/dist/interactors/Pulp.js +43 -0
- package/dist/interactors/Referral.d.ts +35 -78
- package/dist/interactors/Referral.js +158 -0
- package/dist/interactors/Staking.d.ts +20 -26
- package/dist/interactors/Staking.js +106 -0
- package/dist/interactors/index.d.ts +9 -9
- package/dist/interactors/index.js +13 -0
- package/dist/interactors/misc.d.ts +31 -39
- package/dist/interactors/misc.js +318 -0
- package/dist/types/index.d.ts +175 -197
- package/dist/types/index.js +18 -0
- package/package.json +3 -3
- package/src/SDK.ts +1 -1
- package/src/entities/auriEnv.ts +29 -27
- package/src/helpers/historicalPriceFetcher.ts +9 -12
- package/src/helpers/multicall.ts +251 -0
- package/src/helpers/priceFetcher.ts +19 -20
- package/src/interactors/Airdrop.ts +2 -2
- package/src/interactors/MoneyMarket.ts +31 -27
- package/src/interactors/Multicall.ts +3 -3
- package/src/interactors/Papermill.ts +9 -9
- package/src/interactors/PlyGame.ts +10 -10
- package/src/interactors/PlyTokenLock.ts +2 -3
- package/src/interactors/Pulp.ts +4 -2
- package/src/interactors/Referral.ts +6 -6
- package/src/interactors/Staking.ts +13 -9
- package/src/interactors/misc.ts +7 -5
- package/src/types/index.ts +32 -2
- package/dist/sdk.cjs.development.js +0 -6325
- package/dist/sdk.cjs.development.js.map +0 -1
- package/dist/sdk.cjs.production.min.js +0 -2
- package/dist/sdk.cjs.production.min.js.map +0 -1
- package/dist/sdk.esm.js +0 -6193
- package/dist/sdk.esm.js.map +0 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -1,197 +1,175 @@
|
|
|
1
|
-
import { AuToken } from '@aurigami/contracts/typechain';
|
|
2
|
-
import { TypedEvent } from '@aurigami/contracts/typechain/common';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
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
|
-
currentUnlockPortion: number;
|
|
49
|
-
accruedPly: TokenAmount;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
};
|
|
69
|
-
export
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
outcome:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
utilisation: number;
|
|
177
|
-
liquidation: boolean;
|
|
178
|
-
}[];
|
|
179
|
-
};
|
|
180
|
-
export declare type LiquidationEventEntity = {
|
|
181
|
-
liquidator: string;
|
|
182
|
-
borrower: string;
|
|
183
|
-
/** bigint string */
|
|
184
|
-
repayAmount: string;
|
|
185
|
-
marketRepayToken: string;
|
|
186
|
-
/** bigint string */
|
|
187
|
-
seizeTokens: string;
|
|
188
|
-
auTokenCollateral: string;
|
|
189
|
-
txnHash: string;
|
|
190
|
-
blockNumber: number;
|
|
191
|
-
};
|
|
192
|
-
export declare type LiquidationDetail = {
|
|
193
|
-
liquidationTime: Timestamp;
|
|
194
|
-
tokenAmount: TokenAmount;
|
|
195
|
-
transactionId: string;
|
|
196
|
-
};
|
|
197
|
-
export declare type Timestamp = number;
|
|
1
|
+
import { AuToken } from '@aurigami/contracts/typechain';
|
|
2
|
+
import { TypedEvent } from '@aurigami/contracts/typechain/common';
|
|
3
|
+
import type { BlockTag } from '@ethersproject/abstract-provider';
|
|
4
|
+
import BigNumber from 'bignumber.js';
|
|
5
|
+
import type { Contract, providers, Signer } from 'ethers';
|
|
6
|
+
import { BigNumber as BN } from 'ethers';
|
|
7
|
+
import { TokenAmount } from '../entities/tokenAmount';
|
|
8
|
+
export declare enum ComptrollerRewardType {
|
|
9
|
+
PLY = 0,
|
|
10
|
+
AURORA = 1
|
|
11
|
+
}
|
|
12
|
+
export type NetworkConnection = {
|
|
13
|
+
provider: providers.Provider;
|
|
14
|
+
signer?: Signer;
|
|
15
|
+
};
|
|
16
|
+
export type Address = string;
|
|
17
|
+
export type CurrencyAmount = {
|
|
18
|
+
currency: string;
|
|
19
|
+
amount: string;
|
|
20
|
+
};
|
|
21
|
+
export type TokenValuation = {
|
|
22
|
+
tokenAmount: TokenAmount;
|
|
23
|
+
currencyAmount: CurrencyAmount;
|
|
24
|
+
};
|
|
25
|
+
export type MoneyMarketDetails = {
|
|
26
|
+
auTokenAddress: string;
|
|
27
|
+
totalTokenDeposited: TokenAmount;
|
|
28
|
+
totalTokenBorrowed: TokenAmount;
|
|
29
|
+
depositApy: number;
|
|
30
|
+
depositPlyApy: number;
|
|
31
|
+
borrowApy: number;
|
|
32
|
+
borrowPlyApy: number;
|
|
33
|
+
collateralRatio: number;
|
|
34
|
+
depositPlyPerWeek: TokenAmount;
|
|
35
|
+
borrowPlyPerWeek: TokenAmount;
|
|
36
|
+
depositMETAApy: number;
|
|
37
|
+
depositNEARApy: number;
|
|
38
|
+
borrowNEARApy: number;
|
|
39
|
+
staderDepositApy: number;
|
|
40
|
+
};
|
|
41
|
+
export type UserDetails = {
|
|
42
|
+
markets: UserMarketDetails[];
|
|
43
|
+
borrowLimit: CurrencyAmount;
|
|
44
|
+
borrowableAmount: CurrencyAmount;
|
|
45
|
+
};
|
|
46
|
+
export type UserLockingDetails = {
|
|
47
|
+
vestingStart: number;
|
|
48
|
+
currentUnlockPortion: number;
|
|
49
|
+
accruedPly: TokenAmount;
|
|
50
|
+
currentPly: TokenAmount;
|
|
51
|
+
currentPulp: TokenAmount;
|
|
52
|
+
nextUnlockPortion: number;
|
|
53
|
+
nextPly: TokenAmount;
|
|
54
|
+
nextPulp: TokenAmount;
|
|
55
|
+
};
|
|
56
|
+
export type UserMarketDetails = {
|
|
57
|
+
market: string;
|
|
58
|
+
depositBalance: TokenAmount;
|
|
59
|
+
borrowBalance: TokenAmount;
|
|
60
|
+
isCollateral: boolean;
|
|
61
|
+
maxWithdrawableAmount: TokenAmount;
|
|
62
|
+
collateralRatio: number;
|
|
63
|
+
underlyingPrice: string;
|
|
64
|
+
};
|
|
65
|
+
export type TokenAPY = {
|
|
66
|
+
address: string;
|
|
67
|
+
apy: string;
|
|
68
|
+
};
|
|
69
|
+
export type PLYWNEARPoolDetails = {
|
|
70
|
+
totalStakedLiquidity: TokenAmount;
|
|
71
|
+
APYs: TokenAPY[];
|
|
72
|
+
};
|
|
73
|
+
export type MulticallOverrides = {
|
|
74
|
+
blockTag?: BlockTag | Promise<BlockTag>;
|
|
75
|
+
};
|
|
76
|
+
type ConcatTuple<A extends any[], B extends any[]> = [...A, ...B];
|
|
77
|
+
type RemoveLastOptionalParam<Fn extends (...params: any[]) => any> = Fn extends (...params: [...infer Head, any?]) => infer R ? (...params: Head) => R : Fn;
|
|
78
|
+
type AddParams<Fn extends (...params: any[]) => any, P extends any[]> = Fn extends (...params: infer Params) => infer R ? (...params: ConcatTuple<Params, P>) => R : Fn;
|
|
79
|
+
export type MulticallStatic<T extends Contract> = {
|
|
80
|
+
callStatic: {
|
|
81
|
+
[P in keyof T['callStatic']]: AddParams<RemoveLastOptionalParam<T['callStatic'][P]>, [
|
|
82
|
+
multicallOverrides?: MulticallOverrides
|
|
83
|
+
]>;
|
|
84
|
+
};
|
|
85
|
+
address: string;
|
|
86
|
+
raw: T;
|
|
87
|
+
};
|
|
88
|
+
export declare enum MarketAction {
|
|
89
|
+
Deposit = 0,
|
|
90
|
+
Borrow = 1,
|
|
91
|
+
Withdraw = 2,
|
|
92
|
+
Repay = 3,
|
|
93
|
+
EnableCollateral = 4,
|
|
94
|
+
DisableCollateral = 5
|
|
95
|
+
}
|
|
96
|
+
export type HypotheticalStats = {
|
|
97
|
+
newBorrowLimit: CurrencyAmount;
|
|
98
|
+
newBorrowUtilization: number;
|
|
99
|
+
};
|
|
100
|
+
export type AccountAuTokenInfo = {
|
|
101
|
+
token: string;
|
|
102
|
+
deposit: BigNumber;
|
|
103
|
+
borrow: BigNumber;
|
|
104
|
+
};
|
|
105
|
+
export type AccountAuTokensInfo = {
|
|
106
|
+
address: string;
|
|
107
|
+
tokens: AccountAuTokenInfo[];
|
|
108
|
+
};
|
|
109
|
+
export type AuTokenWithUnderlying = MulticallStatic<AuToken> & {
|
|
110
|
+
underlying: string;
|
|
111
|
+
};
|
|
112
|
+
export type ReferralReward = {
|
|
113
|
+
campaign: string;
|
|
114
|
+
userAddr: string;
|
|
115
|
+
startTime: number;
|
|
116
|
+
endTime: number;
|
|
117
|
+
isReferrer: boolean;
|
|
118
|
+
rewardTokenAmount: TokenAmount;
|
|
119
|
+
transactionHash: string | null;
|
|
120
|
+
refereeAddress: string | null;
|
|
121
|
+
};
|
|
122
|
+
export type PlyGameBetResult = {
|
|
123
|
+
player: string;
|
|
124
|
+
outcome: string;
|
|
125
|
+
lostAmount: TokenAmount;
|
|
126
|
+
unlockedPulpAmount: TokenAmount;
|
|
127
|
+
block: number;
|
|
128
|
+
timestamp: number;
|
|
129
|
+
transactionHash: string;
|
|
130
|
+
};
|
|
131
|
+
export type PlyGameLeaderboardItem = {
|
|
132
|
+
player: string;
|
|
133
|
+
gamesPlayed: number;
|
|
134
|
+
unlockedPulpAmount: TokenAmount;
|
|
135
|
+
};
|
|
136
|
+
export type PlyBetMadeEvent = TypedEvent<[
|
|
137
|
+
string,
|
|
138
|
+
BN,
|
|
139
|
+
number
|
|
140
|
+
] & {
|
|
141
|
+
player: string;
|
|
142
|
+
amount: BN;
|
|
143
|
+
outcome: number;
|
|
144
|
+
}>;
|
|
145
|
+
export type Apy = {
|
|
146
|
+
sum: BigNumber;
|
|
147
|
+
suppliedValue: BigNumber;
|
|
148
|
+
borrowedValue: BigNumber;
|
|
149
|
+
};
|
|
150
|
+
export type UserNotification = {
|
|
151
|
+
message: string;
|
|
152
|
+
userSetting: {
|
|
153
|
+
address: Address;
|
|
154
|
+
mail: string;
|
|
155
|
+
utilisation: number;
|
|
156
|
+
liquidation: boolean;
|
|
157
|
+
}[];
|
|
158
|
+
};
|
|
159
|
+
export type LiquidationEventEntity = {
|
|
160
|
+
liquidator: string;
|
|
161
|
+
borrower: string;
|
|
162
|
+
repayAmount: string;
|
|
163
|
+
marketRepayToken: string;
|
|
164
|
+
seizeTokens: string;
|
|
165
|
+
auTokenCollateral: string;
|
|
166
|
+
txnHash: string;
|
|
167
|
+
blockNumber: number;
|
|
168
|
+
};
|
|
169
|
+
export type LiquidationDetail = {
|
|
170
|
+
liquidationTime: Timestamp;
|
|
171
|
+
tokenAmount: TokenAmount;
|
|
172
|
+
transactionId: string;
|
|
173
|
+
};
|
|
174
|
+
export type Timestamp = number;
|
|
175
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MarketAction = exports.ComptrollerRewardType = void 0;
|
|
4
|
+
var ComptrollerRewardType;
|
|
5
|
+
(function (ComptrollerRewardType) {
|
|
6
|
+
ComptrollerRewardType[ComptrollerRewardType["PLY"] = 0] = "PLY";
|
|
7
|
+
ComptrollerRewardType[ComptrollerRewardType["AURORA"] = 1] = "AURORA";
|
|
8
|
+
})(ComptrollerRewardType || (exports.ComptrollerRewardType = ComptrollerRewardType = {}));
|
|
9
|
+
var MarketAction;
|
|
10
|
+
(function (MarketAction) {
|
|
11
|
+
MarketAction[MarketAction["Deposit"] = 0] = "Deposit";
|
|
12
|
+
MarketAction[MarketAction["Borrow"] = 1] = "Borrow";
|
|
13
|
+
MarketAction[MarketAction["Withdraw"] = 2] = "Withdraw";
|
|
14
|
+
MarketAction[MarketAction["Repay"] = 3] = "Repay";
|
|
15
|
+
MarketAction[MarketAction["EnableCollateral"] = 4] = "EnableCollateral";
|
|
16
|
+
MarketAction[MarketAction["DisableCollateral"] = 5] = "DisableCollateral";
|
|
17
|
+
})(MarketAction || (exports.MarketAction = MarketAction = {}));
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBUUEsSUFBWSxxQkFHWDtBQUhELFdBQVkscUJBQXFCO0lBQy9CLCtEQUFPLENBQUE7SUFDUCxxRUFBTSxDQUFBO0FBQ1IsQ0FBQyxFQUhXLHFCQUFxQixxQ0FBckIscUJBQXFCLFFBR2hDO0FBb0hELElBQVksWUFPWDtBQVBELFdBQVksWUFBWTtJQUN0QixxREFBVyxDQUFBO0lBQ1gsbURBQU0sQ0FBQTtJQUNOLHVEQUFRLENBQUE7SUFDUixpREFBSyxDQUFBO0lBQ0wsdUVBQWdCLENBQUE7SUFDaEIseUVBQWlCLENBQUE7QUFDbkIsQ0FBQyxFQVBXLFlBQVksNEJBQVosWUFBWSxRQU92QiJ9
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.24.0",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"start": "tsdx watch",
|
|
15
|
-
"build": "
|
|
15
|
+
"build": "tsc -p ./tsconfig.build.json ",
|
|
16
16
|
"test": "tsdx test --no-cache",
|
|
17
17
|
"w-hardhat": "env TS_NODE_PROJECT=\"test-hardhat/tsconfig.json\" yarn hardhat",
|
|
18
18
|
"lint": "prettier --check \"{src,test,test-hardhat}/**/*.{js,ts}\"",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"ts-node": "^10.7.0",
|
|
59
59
|
"tsdx": "^0.14.1",
|
|
60
60
|
"tslib": "^2.3.1",
|
|
61
|
-
"typescript": "^
|
|
61
|
+
"typescript": "^5.0.2"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@aurigami/contracts": "3.21.0",
|
package/src/SDK.ts
CHANGED
|
@@ -187,7 +187,7 @@ export class SdkReadWrite extends SdkRead {
|
|
|
187
187
|
* Claim rewards in all markets + staking pools
|
|
188
188
|
*/
|
|
189
189
|
public async claim(): Promise<TransactionResponse> {
|
|
190
|
-
return this.env.auriLens
|
|
190
|
+
return this.env.auriLens.raw
|
|
191
191
|
.connect(this._networkConnection.signer!)
|
|
192
192
|
.claimRewards(
|
|
193
193
|
this.env.comptroller.address,
|
package/src/entities/auriEnv.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AuErc20,
|
|
3
|
+
AuToken,
|
|
3
4
|
AuriAirdrop,
|
|
4
5
|
AuriFairLaunch,
|
|
5
6
|
AuriInternalLens,
|
|
@@ -16,32 +17,33 @@ import { Contract } from 'ethers';
|
|
|
16
17
|
import * as abis from '../abis';
|
|
17
18
|
import { networkAddresses } from '../consts/constants';
|
|
18
19
|
import { assert } from '../helpers/helpers';
|
|
19
|
-
import {
|
|
20
|
+
import { createContract } from '../helpers/multicall';
|
|
21
|
+
import { AuTokenWithUnderlying, MulticallStatic } from '../types';
|
|
20
22
|
import { BlockchainEntityRead } from './BlockchainEntity';
|
|
21
23
|
|
|
22
24
|
export class AuriEnv extends BlockchainEntityRead {
|
|
23
|
-
private _comptroller: Comptroller | null = null;
|
|
24
|
-
private _auriFairLaunch: AuriFairLaunch | null = null;
|
|
25
|
-
private _auriLens: AuriLens | null = null;
|
|
26
|
-
private _ply: IERC20 | null = null;
|
|
27
|
-
private _pulp: PULP | null = null;
|
|
28
|
-
private _auriInternalLens: AuriInternalLens | null = null;
|
|
29
|
-
private _auriAirdrop: AuriAirdrop | null = null;
|
|
30
|
-
private _referralDirectoryV2: ReferralDirectoryV2 | null = null;
|
|
31
|
-
private _oracle: AuriOracle | null = null;
|
|
32
|
-
private _plygame: PlyGame | null = null;
|
|
33
|
-
private _plyTokenLock: PlyTokenLock | null = null;
|
|
25
|
+
private _comptroller: MulticallStatic<Comptroller> | null = null;
|
|
26
|
+
private _auriFairLaunch: MulticallStatic<AuriFairLaunch> | null = null;
|
|
27
|
+
private _auriLens: MulticallStatic<AuriLens> | null = null;
|
|
28
|
+
private _ply: MulticallStatic<IERC20> | null = null;
|
|
29
|
+
private _pulp: MulticallStatic<PULP> | null = null;
|
|
30
|
+
private _auriInternalLens: MulticallStatic<AuriInternalLens> | null = null;
|
|
31
|
+
private _auriAirdrop: MulticallStatic<AuriAirdrop> | null = null;
|
|
32
|
+
private _referralDirectoryV2: MulticallStatic<ReferralDirectoryV2> | null = null;
|
|
33
|
+
private _oracle: MulticallStatic<AuriOracle> | null = null;
|
|
34
|
+
private _plygame: MulticallStatic<PlyGame> | null = null;
|
|
35
|
+
private _plyTokenLock: MulticallStatic<PlyTokenLock> | null = null;
|
|
34
36
|
|
|
35
37
|
public getContract<CType extends Contract>(address: string, abi: any) {
|
|
36
|
-
return
|
|
38
|
+
return createContract<CType>(address, abi, this._networkConnection.provider);
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
public getAuTokenContracts(): AuTokenWithUnderlying[] {
|
|
40
42
|
return networkAddresses.auTokens.map((auToken) => {
|
|
41
|
-
const contract = this.getContract<
|
|
43
|
+
const contract = this.getContract<AuToken>(
|
|
42
44
|
auToken.address,
|
|
43
45
|
abis.AuTokenABI.abi
|
|
44
|
-
);
|
|
46
|
+
) as AuTokenWithUnderlying;
|
|
45
47
|
contract.underlying = auToken.underlying;
|
|
46
48
|
return contract;
|
|
47
49
|
});
|
|
@@ -59,7 +61,7 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
59
61
|
}: {
|
|
60
62
|
address?: string;
|
|
61
63
|
underlyingName?: string;
|
|
62
|
-
})
|
|
64
|
+
}) {
|
|
63
65
|
assert(
|
|
64
66
|
address !== undefined || underlyingName !== undefined,
|
|
65
67
|
'Either address or underlyingName must be provided'
|
|
@@ -75,7 +77,7 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
75
77
|
return this.getContract<AuErc20>(address!, abis.AuErc20ABI.abi);
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
get comptroller()
|
|
80
|
+
get comptroller() {
|
|
79
81
|
if (!this._comptroller) {
|
|
80
82
|
this._comptroller = this.getContract<Comptroller>(
|
|
81
83
|
networkAddresses.misc.COMPTROLLER,
|
|
@@ -85,7 +87,7 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
85
87
|
return this._comptroller;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
get auriFairLaunch()
|
|
90
|
+
get auriFairLaunch() {
|
|
89
91
|
if (!this._auriFairLaunch) {
|
|
90
92
|
this._auriFairLaunch = this.getContract<AuriFairLaunch>(
|
|
91
93
|
networkAddresses.misc.AURIFAIRLAUNCH,
|
|
@@ -95,7 +97,7 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
95
97
|
return this._auriFairLaunch;
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
get auriLens()
|
|
100
|
+
get auriLens() {
|
|
99
101
|
if (!this._auriLens) {
|
|
100
102
|
this._auriLens = this.getContract<AuriLens>(
|
|
101
103
|
networkAddresses.misc.AURILENS,
|
|
@@ -105,21 +107,21 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
105
107
|
return this._auriLens;
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
get ply()
|
|
110
|
+
get ply() {
|
|
109
111
|
if (!this._ply) {
|
|
110
112
|
this._ply = this.getContract<IERC20>(networkAddresses.tokens.PLY, abis.EIP20InterfaceABI.abi);
|
|
111
113
|
}
|
|
112
114
|
return this._ply;
|
|
113
115
|
}
|
|
114
116
|
|
|
115
|
-
get pulp()
|
|
117
|
+
get pulp() {
|
|
116
118
|
if (!this._pulp) {
|
|
117
119
|
this._pulp = this.getContract<PULP>(networkAddresses.tokens.PULP, abis.PulpABI.abi);
|
|
118
120
|
}
|
|
119
121
|
return this._pulp;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
get auriInternalLens()
|
|
124
|
+
get auriInternalLens() {
|
|
123
125
|
if (!this._auriInternalLens) {
|
|
124
126
|
this._auriInternalLens = this.getContract<AuriInternalLens>(
|
|
125
127
|
networkAddresses.misc.AURI_INTERNAL_LENS,
|
|
@@ -129,7 +131,7 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
129
131
|
return this._auriInternalLens;
|
|
130
132
|
}
|
|
131
133
|
|
|
132
|
-
get auriAirdrop()
|
|
134
|
+
get auriAirdrop() {
|
|
133
135
|
if (!this._auriAirdrop) {
|
|
134
136
|
this._auriAirdrop = this.getContract<AuriAirdrop>(
|
|
135
137
|
networkAddresses.misc.AURI_AIRDROP,
|
|
@@ -139,7 +141,7 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
139
141
|
return this._auriAirdrop;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
|
-
get referralDirectoryV2()
|
|
144
|
+
get referralDirectoryV2() {
|
|
143
145
|
if (!this._referralDirectoryV2) {
|
|
144
146
|
this._referralDirectoryV2 = this.getContract<ReferralDirectoryV2>(
|
|
145
147
|
networkAddresses.misc.REFERRAL_V2,
|
|
@@ -149,7 +151,7 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
149
151
|
return this._referralDirectoryV2;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
|
-
get oracle()
|
|
154
|
+
get oracle() {
|
|
153
155
|
if (!this._oracle) {
|
|
154
156
|
this._oracle = this.getContract<AuriOracle>(
|
|
155
157
|
networkAddresses.misc.PYTH_ORACLE,
|
|
@@ -159,14 +161,14 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
159
161
|
return this._oracle;
|
|
160
162
|
}
|
|
161
163
|
|
|
162
|
-
get plygame()
|
|
164
|
+
get plygame() {
|
|
163
165
|
if (!this._plygame) {
|
|
164
166
|
this._plygame = this.getContract<PlyGame>(networkAddresses.misc.PLYGAME, abis.PlyGameABI.abi);
|
|
165
167
|
}
|
|
166
168
|
return this._plygame;
|
|
167
169
|
}
|
|
168
170
|
|
|
169
|
-
get plyTokenLock()
|
|
171
|
+
get plyTokenLock() {
|
|
170
172
|
if (!this._plyTokenLock) {
|
|
171
173
|
this._plyTokenLock = this.getContract<PlyTokenLock>(
|
|
172
174
|
networkAddresses.misc.PLY_TOKEN_LOCK,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { IUniswapV2Pair, PriceOracle } from '@aurigami/contracts/typechain';
|
|
2
2
|
import BigNumber from 'bignumber.js';
|
|
3
|
-
import { BigNumber as BN,
|
|
3
|
+
import { BigNumber as BN, providers } from 'ethers';
|
|
4
4
|
import { AuriOracleABI, IUniswapV2PairABI } from '../abis';
|
|
5
5
|
import { HARDCODE_PRICE_TOKENS, networkAddresses } from '../consts/constants';
|
|
6
6
|
import { Address } from '../types';
|
|
7
7
|
import { decimalFactor, devLog, getDecimal, isSameAddress } from './helpers';
|
|
8
|
+
import { createContract } from './multicall';
|
|
8
9
|
|
|
9
10
|
export async function fetchHistoricalLPPositions(
|
|
10
11
|
LPAddress: Address,
|
|
@@ -17,12 +18,12 @@ export async function fetchHistoricalLPPositions(
|
|
|
17
18
|
reserve1: BN;
|
|
18
19
|
totalSupply: BN;
|
|
19
20
|
}> {
|
|
20
|
-
const LPContract =
|
|
21
|
+
const LPContract = createContract<IUniswapV2Pair>(LPAddress, IUniswapV2PairABI.abi, provider);
|
|
21
22
|
var promises: any[] = [];
|
|
22
|
-
promises.push(LPContract.token0());
|
|
23
|
-
promises.push(LPContract.token1());
|
|
24
|
-
promises.push(LPContract.getReserves({ blockTag: block }));
|
|
25
|
-
promises.push(LPContract.totalSupply({ blockTag: block }));
|
|
23
|
+
promises.push(LPContract.callStatic.token0());
|
|
24
|
+
promises.push(LPContract.callStatic.token1());
|
|
25
|
+
promises.push(LPContract.callStatic.getReserves({ blockTag: block }));
|
|
26
|
+
promises.push(LPContract.callStatic.totalSupply({ blockTag: block }));
|
|
26
27
|
const values: any[] = await Promise.all(promises);
|
|
27
28
|
|
|
28
29
|
return {
|
|
@@ -111,12 +112,8 @@ export async function fetchHistoricalPriceFromOracle(
|
|
|
111
112
|
? networkAddresses.misc.DEPRECATED_OLD_ORACLE
|
|
112
113
|
: networkAddresses.misc.PYTH_ORACLE;
|
|
113
114
|
|
|
114
|
-
const oracleContract
|
|
115
|
-
|
|
116
|
-
AuriOracleABI.abi,
|
|
117
|
-
provider
|
|
118
|
-
) as PriceOracle;
|
|
119
|
-
const rawPrice = await oracleContract
|
|
115
|
+
const oracleContract = createContract<PriceOracle>(oracleAddress, AuriOracleABI.abi, provider);
|
|
116
|
+
const rawPrice = await oracleContract.callStatic
|
|
120
117
|
.getUnderlyingPrice(auTokenAddress, { blockTag: block })
|
|
121
118
|
.catch((e: any) => {
|
|
122
119
|
console.log(`Unable to fetch price from oracle for ${auTokenAddress}`);
|