@aurigami/sdk 1.7.6 → 1.7.8-dummy
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/consts/dummy.d.ts +3 -1
- package/dist/contracts/Airdrop.d.ts +2 -3
- package/dist/contracts/Referral.d.ts +15 -4
- package/dist/entities/auriEnv.d.ts +18 -9
- package/dist/sdk.cjs.development.js +298 -66
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +298 -68
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +23 -0
- package/package.json +2 -2
- package/src/consts/dummy.ts +21 -2
- package/src/contracts/Airdrop.ts +6 -14
- package/src/contracts/MoneyMarket.ts +4 -1
- package/src/contracts/Referral.ts +41 -18
- package/src/entities/auriEnv.ts +83 -31
- package/src/types/index.ts +24 -0
package/dist/sdk.esm.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { BigNumber as BigNumber$1, Contract, utils, ethers } from 'ethers';
|
|
3
3
|
import { Logger } from 'ethers/lib/utils';
|
|
4
|
-
import abis$
|
|
5
|
-
import abis$
|
|
6
|
-
import
|
|
7
|
-
import abis$
|
|
8
|
-
import abis$
|
|
4
|
+
import abis$7 from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
|
|
5
|
+
import abis$8 from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
|
|
6
|
+
import abis$1 from '@aurigami/contracts/artifacts/contracts/AuriAirdrop.sol/AuriAirdrop.json';
|
|
7
|
+
import abis$2 from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
|
|
8
|
+
import abis$3 from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
|
|
9
9
|
import AuriOracleABI from '@aurigami/contracts/artifacts/contracts/AuriOracle.sol/AuriOracle.json';
|
|
10
10
|
import abis from '@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json';
|
|
11
|
-
import abis$
|
|
12
|
-
import abis$
|
|
13
|
-
import abis$
|
|
14
|
-
import abis$
|
|
11
|
+
import abis$4 from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
|
|
12
|
+
import abis$9 from '@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json';
|
|
13
|
+
import abis$5 from '@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json';
|
|
14
|
+
import abis$c from '@aurigami/contracts/artifacts/contracts/mock/AuriInternalLens.sol/AuriInternalLens.json';
|
|
15
15
|
import IUniswapV2PairABI from '@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json';
|
|
16
|
-
import abis$
|
|
17
|
-
import abis$
|
|
18
|
-
import abis$
|
|
16
|
+
import abis$a from '@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json';
|
|
17
|
+
import abis$b from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
|
|
18
|
+
import abis$6 from '@aurigami/contracts/artifacts/contracts/ReferralDirectory.sol/ReferralDirectory.json';
|
|
19
19
|
import MAINNET_ADDRESSES from '@aurigami/contracts/deployments/aurora_mainnet.json';
|
|
20
20
|
export { default as MAINNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_mainnet.json';
|
|
21
21
|
export { default as TESTNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_testnet.json';
|
|
@@ -29,18 +29,18 @@ var index = {
|
|
|
29
29
|
AuriOracleABI: AuriOracleABI,
|
|
30
30
|
AuTokenABI: abis,
|
|
31
31
|
IUniswapV2PairABI: IUniswapV2PairABI,
|
|
32
|
-
AuriAirdropABI:
|
|
33
|
-
AuriFairLaunchABI: abis$
|
|
34
|
-
AuriLensABI: abis$
|
|
35
|
-
ComptrollerABI: abis$
|
|
36
|
-
EIP20InterfaceABI: abis$
|
|
37
|
-
ReferralDirectoryABI: abis$
|
|
38
|
-
AuErc20ABI: abis$
|
|
39
|
-
AuETHABI: abis$
|
|
40
|
-
EthRepayHelperABI: abis$
|
|
41
|
-
Multicall2ABI: abis$
|
|
42
|
-
PulpABI: abis$
|
|
43
|
-
AuriInternalLensABI: abis$
|
|
32
|
+
AuriAirdropABI: abis$1,
|
|
33
|
+
AuriFairLaunchABI: abis$2,
|
|
34
|
+
AuriLensABI: abis$3,
|
|
35
|
+
ComptrollerABI: abis$4,
|
|
36
|
+
EIP20InterfaceABI: abis$5,
|
|
37
|
+
ReferralDirectoryABI: abis$6,
|
|
38
|
+
AuErc20ABI: abis$7,
|
|
39
|
+
AuETHABI: abis$8,
|
|
40
|
+
EthRepayHelperABI: abis$9,
|
|
41
|
+
Multicall2ABI: abis$a,
|
|
42
|
+
PulpABI: abis$b,
|
|
43
|
+
AuriInternalLensABI: abis$c
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
var dummyAddress = '0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
|
|
@@ -218,6 +218,25 @@ function _asyncToGenerator(fn) {
|
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
+
function _defineProperties(target, props) {
|
|
222
|
+
for (var i = 0; i < props.length; i++) {
|
|
223
|
+
var descriptor = props[i];
|
|
224
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
225
|
+
descriptor.configurable = true;
|
|
226
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
227
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
232
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
233
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
234
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
235
|
+
writable: false
|
|
236
|
+
});
|
|
237
|
+
return Constructor;
|
|
238
|
+
}
|
|
239
|
+
|
|
221
240
|
function _extends() {
|
|
222
241
|
_extends = Object.assign || function (target) {
|
|
223
242
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -325,20 +344,20 @@ var BlockchainEntity = /*#__PURE__*/function () {
|
|
|
325
344
|
var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
326
345
|
_inheritsLoose(AuriEnv, _BlockchainEntityRead);
|
|
327
346
|
|
|
328
|
-
function AuriEnv(
|
|
347
|
+
function AuriEnv() {
|
|
329
348
|
var _this;
|
|
330
349
|
|
|
331
|
-
_this = _BlockchainEntityRead.
|
|
332
|
-
_this.
|
|
333
|
-
_this.
|
|
334
|
-
_this.
|
|
335
|
-
_this.
|
|
336
|
-
_this.
|
|
337
|
-
|
|
338
|
-
_this.
|
|
350
|
+
_this = _BlockchainEntityRead.apply(this, arguments) || this;
|
|
351
|
+
_this._comptroller = null;
|
|
352
|
+
_this._auriFairLaunch = null;
|
|
353
|
+
_this._auriLens = null;
|
|
354
|
+
_this._ply = null;
|
|
355
|
+
_this._pulp = null;
|
|
356
|
+
_this._auriInternalLens = null;
|
|
357
|
+
_this._auriAirdrop = null;
|
|
358
|
+
_this._referralDirectory = null;
|
|
339
359
|
return _this;
|
|
340
|
-
}
|
|
341
|
-
|
|
360
|
+
}
|
|
342
361
|
|
|
343
362
|
var _proto = AuriEnv.prototype;
|
|
344
363
|
|
|
@@ -357,6 +376,80 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
357
376
|
});
|
|
358
377
|
};
|
|
359
378
|
|
|
379
|
+
_createClass(AuriEnv, [{
|
|
380
|
+
key: "comptroller",
|
|
381
|
+
get: function get() {
|
|
382
|
+
if (!this._comptroller) {
|
|
383
|
+
this._comptroller = this.getContract(networkAddresses.misc.COMPTROLLER, abis$4.abi);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
return this._comptroller;
|
|
387
|
+
}
|
|
388
|
+
}, {
|
|
389
|
+
key: "auriFairLaunch",
|
|
390
|
+
get: function get() {
|
|
391
|
+
if (!this._auriFairLaunch) {
|
|
392
|
+
this._auriFairLaunch = this.getContract(networkAddresses.misc.AURIFAIRLAUNCH, abis$2.abi);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return this._auriFairLaunch;
|
|
396
|
+
}
|
|
397
|
+
}, {
|
|
398
|
+
key: "auriLens",
|
|
399
|
+
get: function get() {
|
|
400
|
+
if (!this._auriLens) {
|
|
401
|
+
this._auriLens = this.getContract(networkAddresses.misc.AURILENS, abis$3.abi);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return this._auriLens;
|
|
405
|
+
}
|
|
406
|
+
}, {
|
|
407
|
+
key: "ply",
|
|
408
|
+
get: function get() {
|
|
409
|
+
if (!this._ply) {
|
|
410
|
+
this._ply = this.getContract(networkAddresses.tokens.PLY, abis$5.abi);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
return this._ply;
|
|
414
|
+
}
|
|
415
|
+
}, {
|
|
416
|
+
key: "pulp",
|
|
417
|
+
get: function get() {
|
|
418
|
+
if (!this._pulp) {
|
|
419
|
+
this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$b.abi);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
return this._pulp;
|
|
423
|
+
}
|
|
424
|
+
}, {
|
|
425
|
+
key: "auriInternalLens",
|
|
426
|
+
get: function get() {
|
|
427
|
+
if (!this._auriInternalLens) {
|
|
428
|
+
this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$c.abi);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
return this._auriInternalLens;
|
|
432
|
+
}
|
|
433
|
+
}, {
|
|
434
|
+
key: "auriAirdrop",
|
|
435
|
+
get: function get() {
|
|
436
|
+
if (!this._auriAirdrop) {
|
|
437
|
+
this._auriAirdrop = this.getContract(networkAddresses.misc.AURI_AIRDROP, abis$1.abi);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return this._auriAirdrop;
|
|
441
|
+
}
|
|
442
|
+
}, {
|
|
443
|
+
key: "referralDirectory",
|
|
444
|
+
get: function get() {
|
|
445
|
+
if (!this._referralDirectory) {
|
|
446
|
+
this._referralDirectory = this.getContract(networkAddresses.misc.REFERRAL, abis$6.abi);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return this._referralDirectory;
|
|
450
|
+
}
|
|
451
|
+
}]);
|
|
452
|
+
|
|
360
453
|
return AuriEnv;
|
|
361
454
|
}(BlockchainEntityRead);
|
|
362
455
|
|
|
@@ -1546,7 +1639,7 @@ var TokenAmount = /*#__PURE__*/function () {
|
|
|
1546
1639
|
return TokenAmount;
|
|
1547
1640
|
}();
|
|
1548
1641
|
|
|
1549
|
-
var dummyToken = /*#__PURE__*/new Token(
|
|
1642
|
+
var dummyToken = /*#__PURE__*/new Token(networkAddresses.tokens.WNEAR, 24);
|
|
1550
1643
|
var dummyPly = /*#__PURE__*/new Token('0x8729438eb15e2c8b576fcc6aecda6a148776c0f5', 18);
|
|
1551
1644
|
var dummyPlyAurora = /*#__PURE__*/new Token('0xE530dC2095Ef5653205CF5ea79F8979a7028065c', 18);
|
|
1552
1645
|
var dummyTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '123.456', false);
|
|
@@ -1564,6 +1657,22 @@ var dummyUserMarketDetails = {
|
|
|
1564
1657
|
collateralRatio: 0.5,
|
|
1565
1658
|
underlyingPrice: '1'
|
|
1566
1659
|
};
|
|
1660
|
+
var referralRewardDummy1 = {
|
|
1661
|
+
campaign: 'testa',
|
|
1662
|
+
startTime: 1652882400,
|
|
1663
|
+
endTime: 1653573599,
|
|
1664
|
+
isReferrer: false,
|
|
1665
|
+
rewardTokenAmount: dummyTokenAmount,
|
|
1666
|
+
transactionHash: null
|
|
1667
|
+
};
|
|
1668
|
+
var referralRewardDummy2 = {
|
|
1669
|
+
campaign: 'testb',
|
|
1670
|
+
startTime: 1652882400,
|
|
1671
|
+
endTime: 1653573599,
|
|
1672
|
+
isReferrer: true,
|
|
1673
|
+
rewardTokenAmount: dummyTokenAmount2,
|
|
1674
|
+
transactionHash: '0x4da9657663b46ef18d150b897b28c7b717f16421978b52e3a06d91b54ca3548b'
|
|
1675
|
+
};
|
|
1567
1676
|
|
|
1568
1677
|
var AURIGAMI_API_END_POINT = 'https://api.aurigami.finance/app/';
|
|
1569
1678
|
function getApi(_x, _x2) {
|
|
@@ -1897,7 +2006,7 @@ function _fetchUnderlyingTokensPrices() {
|
|
|
1897
2006
|
while (1) {
|
|
1898
2007
|
switch (_context7.prev = _context7.next) {
|
|
1899
2008
|
case 0:
|
|
1900
|
-
auriLens = new Contract(networkAddresses.misc.AURILENS, abis$
|
|
2009
|
+
auriLens = new Contract(networkAddresses.misc.AURILENS, abis$3.abi, provider);
|
|
1901
2010
|
auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
|
|
1902
2011
|
return auToken.address;
|
|
1903
2012
|
});
|
|
@@ -2343,7 +2452,7 @@ var AirdropRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2343
2452
|
var _this;
|
|
2344
2453
|
|
|
2345
2454
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
2346
|
-
_this.
|
|
2455
|
+
_this.env = new AuriEnv(networkConnection);
|
|
2347
2456
|
return _this;
|
|
2348
2457
|
}
|
|
2349
2458
|
/**
|
|
@@ -2364,7 +2473,7 @@ var AirdropRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2364
2473
|
case 0:
|
|
2365
2474
|
tokenInstance = new Token(token, getDecimal(token));
|
|
2366
2475
|
_context.next = 3;
|
|
2367
|
-
return this.
|
|
2476
|
+
return this.env.auriAirdrop.getRedeemableReward(utils.formatBytes32String(campaign), token, user);
|
|
2368
2477
|
|
|
2369
2478
|
case 3:
|
|
2370
2479
|
rewards = _context.sent;
|
|
@@ -2408,7 +2517,7 @@ var AirdropReadWrite = /*#__PURE__*/function (_AirdropRead) {
|
|
|
2408
2517
|
switch (_context2.prev = _context2.next) {
|
|
2409
2518
|
case 0:
|
|
2410
2519
|
assert(campaigns.length == tokens.length, 'campaigns and tokens must have the same length');
|
|
2411
|
-
_context2.t0 = this.
|
|
2520
|
+
_context2.t0 = this.env.auriAirdrop.connect(this._networkConnection.signer);
|
|
2412
2521
|
_context2.t1 = campaigns.map(function (e) {
|
|
2413
2522
|
return utils.formatBytes32String(e);
|
|
2414
2523
|
});
|
|
@@ -2514,9 +2623,9 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2514
2623
|
_this.env = new AuriEnv(networkConnection);
|
|
2515
2624
|
|
|
2516
2625
|
if (isSameAddress(underlyingAsset, ETHAddress)) {
|
|
2517
|
-
_this.auToken = new Contract(auToken, abis$
|
|
2626
|
+
_this.auToken = new Contract(auToken, abis$8.abi, networkConnection.provider);
|
|
2518
2627
|
} else {
|
|
2519
|
-
_this.auToken = new Contract(auToken, abis$
|
|
2628
|
+
_this.auToken = new Contract(auToken, abis$7.abi, networkConnection.provider);
|
|
2520
2629
|
}
|
|
2521
2630
|
|
|
2522
2631
|
_this.underlying = new Token(underlyingAsset, getDecimal(underlyingAsset));
|
|
@@ -2841,12 +2950,26 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2841
2950
|
_context9.t5 = underlyingPrice.multipliedBy(totalBorrowed.formattedAmount());
|
|
2842
2951
|
borrowNEARApy = _context9.t3.calcLMRewardApr.call(_context9.t3, _context9.t4, _context9.t5, 52);
|
|
2843
2952
|
|
|
2844
|
-
if (isSameAddress(this.underlying.address, networkAddresses.tokens.stNEAR)) {
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
depositMETAApy = new BigNumber(0);
|
|
2953
|
+
if (!isSameAddress(this.underlying.address, networkAddresses.tokens.stNEAR)) {
|
|
2954
|
+
_context9.next = 34;
|
|
2955
|
+
break;
|
|
2848
2956
|
}
|
|
2849
2957
|
|
|
2958
|
+
_context9.t6 = helpers;
|
|
2959
|
+
_context9.next = 29;
|
|
2960
|
+
return fetchValuation(TokenAmount.fromAddressAndAmount(networkAddresses.tokens.META, '1250000', false), this._networkConnection.provider);
|
|
2961
|
+
|
|
2962
|
+
case 29:
|
|
2963
|
+
_context9.t7 = _context9.sent;
|
|
2964
|
+
_context9.t8 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
|
|
2965
|
+
depositMETAApy = _context9.t6.calcLMRewardApr.call(_context9.t6, _context9.t7, _context9.t8, 12);
|
|
2966
|
+
_context9.next = 35;
|
|
2967
|
+
break;
|
|
2968
|
+
|
|
2969
|
+
case 34:
|
|
2970
|
+
depositMETAApy = new BigNumber(0);
|
|
2971
|
+
|
|
2972
|
+
case 35:
|
|
2850
2973
|
return _context9.abrupt("return", {
|
|
2851
2974
|
auTokenAddress: this.auToken.address,
|
|
2852
2975
|
totalTokenDeposited: totalDeposited,
|
|
@@ -2863,7 +2986,7 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2863
2986
|
depositMETAApy: depositMETAApy.toNumber()
|
|
2864
2987
|
});
|
|
2865
2988
|
|
|
2866
|
-
case
|
|
2989
|
+
case 36:
|
|
2867
2990
|
case "end":
|
|
2868
2991
|
return _context9.stop();
|
|
2869
2992
|
}
|
|
@@ -2979,7 +3102,7 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
2979
3102
|
var _this3;
|
|
2980
3103
|
|
|
2981
3104
|
_this3 = _MoneyMarketRead.call(this, networkConnection, auToken, underlyingAsset) || this;
|
|
2982
|
-
_this3._EthRepayHelper = new Contract(networkAddresses.misc.ETHREPAYHELPER, abis$
|
|
3105
|
+
_this3._EthRepayHelper = new Contract(networkAddresses.misc.ETHREPAYHELPER, abis$9.abi, networkConnection.provider);
|
|
2983
3106
|
return _this3;
|
|
2984
3107
|
}
|
|
2985
3108
|
|
|
@@ -3193,7 +3316,7 @@ var MulticallRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3193
3316
|
var _this;
|
|
3194
3317
|
|
|
3195
3318
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
3196
|
-
_this.multicall = new Contract(networkAddresses.misc.MULTICALL, abis$
|
|
3319
|
+
_this.multicall = new Contract(networkAddresses.misc.MULTICALL, abis$a.abi, networkConnection.provider);
|
|
3197
3320
|
return _this;
|
|
3198
3321
|
}
|
|
3199
3322
|
/**
|
|
@@ -3765,7 +3888,7 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3765
3888
|
while (1) {
|
|
3766
3889
|
switch (_context3.prev = _context3.next) {
|
|
3767
3890
|
case 0:
|
|
3768
|
-
lpContract = new Contract(networkAddresses.tokens.PLYWNEAR, abis$
|
|
3891
|
+
lpContract = new Contract(networkAddresses.tokens.PLYWNEAR, abis$5.abi, this._networkConnection.provider);
|
|
3769
3892
|
_context3.next = 3;
|
|
3770
3893
|
return lpContract.balanceOf(user);
|
|
3771
3894
|
|
|
@@ -4356,7 +4479,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4356
4479
|
var _this;
|
|
4357
4480
|
|
|
4358
4481
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
4359
|
-
_this.
|
|
4482
|
+
_this.env = new AuriEnv(networkConnection);
|
|
4360
4483
|
return _this;
|
|
4361
4484
|
}
|
|
4362
4485
|
/**
|
|
@@ -4396,7 +4519,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4396
4519
|
switch (_context.prev = _context.next) {
|
|
4397
4520
|
case 0:
|
|
4398
4521
|
_context.next = 2;
|
|
4399
|
-
return this.
|
|
4522
|
+
return this.env.referralDirectory.userReferralCode(userAddr);
|
|
4400
4523
|
|
|
4401
4524
|
case 2:
|
|
4402
4525
|
result = _context.sent;
|
|
@@ -4431,7 +4554,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4431
4554
|
switch (_context2.prev = _context2.next) {
|
|
4432
4555
|
case 0:
|
|
4433
4556
|
_context2.next = 2;
|
|
4434
|
-
return this.
|
|
4557
|
+
return this.env.referralDirectory.referralCodeUsed(userAddr);
|
|
4435
4558
|
|
|
4436
4559
|
case 2:
|
|
4437
4560
|
result = _context2.sent;
|
|
@@ -4466,7 +4589,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4466
4589
|
switch (_context3.prev = _context3.next) {
|
|
4467
4590
|
case 0:
|
|
4468
4591
|
referralCode = ethers.utils.formatBytes32String(code);
|
|
4469
|
-
return _context3.abrupt("return", this.
|
|
4592
|
+
return _context3.abrupt("return", this.env.referralDirectory.referralCodeOwner(referralCode));
|
|
4470
4593
|
|
|
4471
4594
|
case 2:
|
|
4472
4595
|
case "end":
|
|
@@ -4532,6 +4655,64 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4532
4655
|
}
|
|
4533
4656
|
|
|
4534
4657
|
return getReferralsList;
|
|
4658
|
+
}()
|
|
4659
|
+
/**
|
|
4660
|
+
* Array of rewards, sorted by time of the referral period (from latest to oldest)
|
|
4661
|
+
*/
|
|
4662
|
+
;
|
|
4663
|
+
|
|
4664
|
+
_proto.referralRewards =
|
|
4665
|
+
/*#__PURE__*/
|
|
4666
|
+
function () {
|
|
4667
|
+
var _referralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(userAddr) {
|
|
4668
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
4669
|
+
while (1) {
|
|
4670
|
+
switch (_context5.prev = _context5.next) {
|
|
4671
|
+
case 0:
|
|
4672
|
+
return _context5.abrupt("return", [referralRewardDummy1, referralRewardDummy2]);
|
|
4673
|
+
|
|
4674
|
+
case 1:
|
|
4675
|
+
case "end":
|
|
4676
|
+
return _context5.stop();
|
|
4677
|
+
}
|
|
4678
|
+
}
|
|
4679
|
+
}, _callee5);
|
|
4680
|
+
}));
|
|
4681
|
+
|
|
4682
|
+
function referralRewards(_x5) {
|
|
4683
|
+
return _referralRewards.apply(this, arguments);
|
|
4684
|
+
}
|
|
4685
|
+
|
|
4686
|
+
return referralRewards;
|
|
4687
|
+
}()
|
|
4688
|
+
/**
|
|
4689
|
+
* Top 50 reward earners from the last round, sorted by token amount
|
|
4690
|
+
*/
|
|
4691
|
+
;
|
|
4692
|
+
|
|
4693
|
+
_proto.leaderboard =
|
|
4694
|
+
/*#__PURE__*/
|
|
4695
|
+
function () {
|
|
4696
|
+
var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
|
|
4697
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
4698
|
+
while (1) {
|
|
4699
|
+
switch (_context6.prev = _context6.next) {
|
|
4700
|
+
case 0:
|
|
4701
|
+
return _context6.abrupt("return", [referralRewardDummy2, referralRewardDummy1]);
|
|
4702
|
+
|
|
4703
|
+
case 1:
|
|
4704
|
+
case "end":
|
|
4705
|
+
return _context6.stop();
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
}, _callee6);
|
|
4709
|
+
}));
|
|
4710
|
+
|
|
4711
|
+
function leaderboard() {
|
|
4712
|
+
return _leaderboard.apply(this, arguments);
|
|
4713
|
+
}
|
|
4714
|
+
|
|
4715
|
+
return leaderboard;
|
|
4535
4716
|
}();
|
|
4536
4717
|
|
|
4537
4718
|
return ReferralRead;
|
|
@@ -4553,21 +4734,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
4553
4734
|
_proto2.registerNewReferralCode =
|
|
4554
4735
|
/*#__PURE__*/
|
|
4555
4736
|
function () {
|
|
4556
|
-
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4737
|
+
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
|
|
4557
4738
|
var referralCode;
|
|
4558
|
-
return runtime_1.wrap(function
|
|
4739
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
4559
4740
|
while (1) {
|
|
4560
|
-
switch (
|
|
4741
|
+
switch (_context7.prev = _context7.next) {
|
|
4561
4742
|
case 0:
|
|
4562
4743
|
referralCode = ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
4563
|
-
return
|
|
4744
|
+
return _context7.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
|
|
4564
4745
|
|
|
4565
4746
|
case 2:
|
|
4566
4747
|
case "end":
|
|
4567
|
-
return
|
|
4748
|
+
return _context7.stop();
|
|
4568
4749
|
}
|
|
4569
4750
|
}
|
|
4570
|
-
},
|
|
4751
|
+
}, _callee7, this);
|
|
4571
4752
|
}));
|
|
4572
4753
|
|
|
4573
4754
|
function registerNewReferralCode() {
|
|
@@ -4584,28 +4765,77 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
4584
4765
|
_proto2.useReferralCode =
|
|
4585
4766
|
/*#__PURE__*/
|
|
4586
4767
|
function () {
|
|
4587
|
-
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4768
|
+
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(code) {
|
|
4588
4769
|
var referralCode;
|
|
4589
|
-
return runtime_1.wrap(function
|
|
4770
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
4590
4771
|
while (1) {
|
|
4591
|
-
switch (
|
|
4772
|
+
switch (_context8.prev = _context8.next) {
|
|
4592
4773
|
case 0:
|
|
4593
4774
|
referralCode = ethers.utils.formatBytes32String(code);
|
|
4594
|
-
return
|
|
4775
|
+
return _context8.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
|
|
4595
4776
|
|
|
4596
4777
|
case 2:
|
|
4597
4778
|
case "end":
|
|
4598
|
-
return
|
|
4779
|
+
return _context8.stop();
|
|
4599
4780
|
}
|
|
4600
4781
|
}
|
|
4601
|
-
},
|
|
4782
|
+
}, _callee8, this);
|
|
4602
4783
|
}));
|
|
4603
4784
|
|
|
4604
|
-
function useReferralCode(
|
|
4785
|
+
function useReferralCode(_x6) {
|
|
4605
4786
|
return _useReferralCode.apply(this, arguments);
|
|
4606
4787
|
}
|
|
4607
4788
|
|
|
4608
4789
|
return useReferralCode;
|
|
4790
|
+
}()
|
|
4791
|
+
/**
|
|
4792
|
+
* Claim all unclaimed rewards for a given user
|
|
4793
|
+
*/
|
|
4794
|
+
;
|
|
4795
|
+
|
|
4796
|
+
_proto2.claimReferralRewards =
|
|
4797
|
+
/*#__PURE__*/
|
|
4798
|
+
function () {
|
|
4799
|
+
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
|
|
4800
|
+
var unclaimedRewards, campaigns, tokens;
|
|
4801
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
4802
|
+
while (1) {
|
|
4803
|
+
switch (_context9.prev = _context9.next) {
|
|
4804
|
+
case 0:
|
|
4805
|
+
_context9.t0 = this;
|
|
4806
|
+
_context9.next = 3;
|
|
4807
|
+
return this._networkConnection.signer.getAddress();
|
|
4808
|
+
|
|
4809
|
+
case 3:
|
|
4810
|
+
_context9.t1 = _context9.sent;
|
|
4811
|
+
_context9.next = 6;
|
|
4812
|
+
return _context9.t0.referralRewards.call(_context9.t0, _context9.t1);
|
|
4813
|
+
|
|
4814
|
+
case 6:
|
|
4815
|
+
unclaimedRewards = _context9.sent.filter(function (reward) {
|
|
4816
|
+
return reward.transactionHash == null;
|
|
4817
|
+
});
|
|
4818
|
+
campaigns = unclaimedRewards.map(function (reward) {
|
|
4819
|
+
return reward.campaign;
|
|
4820
|
+
});
|
|
4821
|
+
tokens = unclaimedRewards.map(function (reward) {
|
|
4822
|
+
return reward.rewardTokenAmount.token.address;
|
|
4823
|
+
});
|
|
4824
|
+
return _context9.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
|
|
4825
|
+
|
|
4826
|
+
case 10:
|
|
4827
|
+
case "end":
|
|
4828
|
+
return _context9.stop();
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4831
|
+
}, _callee9, this);
|
|
4832
|
+
}));
|
|
4833
|
+
|
|
4834
|
+
function claimReferralRewards() {
|
|
4835
|
+
return _claimReferralRewards.apply(this, arguments);
|
|
4836
|
+
}
|
|
4837
|
+
|
|
4838
|
+
return claimReferralRewards;
|
|
4609
4839
|
}();
|
|
4610
4840
|
|
|
4611
4841
|
return ReferralReadWrite;
|
|
@@ -5038,5 +5268,5 @@ BigNumber.config({
|
|
|
5038
5268
|
DECIMAL_PLACES: 50
|
|
5039
5269
|
});
|
|
5040
5270
|
|
|
5041
|
-
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, symbolRecords, validateAndParseAddress, valuateToken };
|
|
5271
|
+
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, symbolRecords, validateAndParseAddress, valuateToken };
|
|
5042
5272
|
//# sourceMappingURL=sdk.esm.js.map
|