@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/consts/dummy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Token, TokenAmount } from '../entities';
|
|
2
|
-
import { UserMarketDetails } from '../types';
|
|
2
|
+
import { ReferralReward, UserMarketDetails } from '../types';
|
|
3
3
|
export declare const dummyToken: Token;
|
|
4
4
|
export declare const dummyPly: Token;
|
|
5
5
|
export declare const dummyPlyAurora: Token;
|
|
@@ -9,3 +9,5 @@ export declare const dummyTokenAmount2: TokenAmount;
|
|
|
9
9
|
export declare const dummyTokenAmount3: TokenAmount;
|
|
10
10
|
export declare const dummyMarketAddress = "0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f";
|
|
11
11
|
export declare const dummyUserMarketDetails: UserMarketDetails;
|
|
12
|
+
export declare const referralRewardDummy1: ReferralReward;
|
|
13
|
+
export declare const referralRewardDummy2: ReferralReward;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { AuriAirdrop } from '@aurigami/contracts/typechain';
|
|
2
1
|
import { TransactionResponse } from '@ethersproject/abstract-provider';
|
|
3
|
-
import { BlockchainEntity, BlockchainEntityRead, TokenAmount } from '../entities';
|
|
2
|
+
import { AuriEnv, BlockchainEntity, BlockchainEntityRead, TokenAmount } from '../entities';
|
|
4
3
|
import { Address, NetworkConnection } from '../types';
|
|
5
4
|
export declare class AirdropRead extends BlockchainEntityRead {
|
|
6
|
-
readonly
|
|
5
|
+
readonly env: AuriEnv;
|
|
7
6
|
constructor(networkConnection: NetworkConnection);
|
|
8
7
|
/**
|
|
9
8
|
* Get redeemable rewards amount of user
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ReferralDirectory } from '@aurigami/contracts/typechain';
|
|
2
1
|
import { TransactionResponse } from '@ethersproject/abstract-provider';
|
|
3
|
-
import { BlockchainEntity, BlockchainEntityRead } from '../entities';
|
|
4
|
-
import { Address, NetworkConnection } from '../types';
|
|
2
|
+
import { AuriEnv, BlockchainEntity, BlockchainEntityRead } from '../entities';
|
|
3
|
+
import { Address, NetworkConnection, ReferralReward } from '../types';
|
|
5
4
|
export declare class ReferralRead extends BlockchainEntityRead {
|
|
6
|
-
readonly
|
|
5
|
+
readonly env: AuriEnv;
|
|
7
6
|
constructor(networkConnection: NetworkConnection);
|
|
8
7
|
/**
|
|
9
8
|
* Generate a 10-character referral code
|
|
@@ -31,6 +30,14 @@ export declare class ReferralRead extends BlockchainEntityRead {
|
|
|
31
30
|
user: string;
|
|
32
31
|
timestamp: number;
|
|
33
32
|
}[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Array of rewards, sorted by time of the referral period (from latest to oldest)
|
|
35
|
+
*/
|
|
36
|
+
referralRewards(userAddr: Address): Promise<ReferralReward[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Top 50 reward earners from the last round, sorted by token amount
|
|
39
|
+
*/
|
|
40
|
+
leaderboard(): Promise<ReferralReward[]>;
|
|
34
41
|
}
|
|
35
42
|
export declare class ReferralReadWrite extends ReferralRead {
|
|
36
43
|
/**
|
|
@@ -43,6 +50,10 @@ export declare class ReferralReadWrite extends ReferralRead {
|
|
|
43
50
|
* Called when an user confirms he is referred by a specified code
|
|
44
51
|
*/
|
|
45
52
|
useReferralCode(code: string): Promise<TransactionResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Claim all unclaimed rewards for a given user
|
|
55
|
+
*/
|
|
56
|
+
claimReferralRewards(): Promise<TransactionResponse>;
|
|
46
57
|
}
|
|
47
58
|
export declare class Referral extends BlockchainEntity {
|
|
48
59
|
constructor();
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import { AuriFairLaunch, AuriInternalLens, AuriLens, Comptroller, IERC20, PULP } from '@aurigami/contracts/typechain';
|
|
1
|
+
import { AuriAirdrop, AuriFairLaunch, AuriInternalLens, AuriLens, Comptroller, IERC20, PULP, ReferralDirectory } from '@aurigami/contracts/typechain';
|
|
2
2
|
import { Contract } from 'ethers';
|
|
3
|
-
import { AuTokenWithUnderlying
|
|
3
|
+
import { AuTokenWithUnderlying } from '../types';
|
|
4
4
|
import { BlockchainEntityRead } from './BlockchainEntity';
|
|
5
5
|
export declare class AuriEnv extends BlockchainEntityRead {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
private _comptroller;
|
|
7
|
+
private _auriFairLaunch;
|
|
8
|
+
private _auriLens;
|
|
9
|
+
private _ply;
|
|
10
|
+
private _pulp;
|
|
11
|
+
private _auriInternalLens;
|
|
12
|
+
private _auriAirdrop;
|
|
13
|
+
private _referralDirectory;
|
|
12
14
|
getContract<CType extends Contract>(address: string, abi: any): CType;
|
|
13
15
|
getAuTokenContracts(): AuTokenWithUnderlying[];
|
|
14
|
-
|
|
16
|
+
get comptroller(): Comptroller;
|
|
17
|
+
get auriFairLaunch(): AuriFairLaunch;
|
|
18
|
+
get auriLens(): AuriLens;
|
|
19
|
+
get ply(): IERC20;
|
|
20
|
+
get pulp(): PULP;
|
|
21
|
+
get auriInternalLens(): AuriInternalLens;
|
|
22
|
+
get auriAirdrop(): AuriAirdrop;
|
|
23
|
+
get referralDirectory(): ReferralDirectory;
|
|
15
24
|
}
|
|
@@ -9,19 +9,19 @@ var ethers = require('ethers');
|
|
|
9
9
|
var utils = require('ethers/lib/utils');
|
|
10
10
|
var abis = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json'));
|
|
11
11
|
var abis$1 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json'));
|
|
12
|
-
var
|
|
13
|
-
var abis$
|
|
14
|
-
var abis$
|
|
12
|
+
var abis$2 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuriAirdrop.sol/AuriAirdrop.json'));
|
|
13
|
+
var abis$3 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json'));
|
|
14
|
+
var abis$4 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json'));
|
|
15
15
|
var AuriOracleABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuriOracle.sol/AuriOracle.json'));
|
|
16
|
-
var abis$
|
|
17
|
-
var abis$
|
|
18
|
-
var abis$
|
|
19
|
-
var abis$
|
|
20
|
-
var abis$
|
|
16
|
+
var abis$5 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json'));
|
|
17
|
+
var abis$6 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json'));
|
|
18
|
+
var abis$7 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json'));
|
|
19
|
+
var abis$8 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json'));
|
|
20
|
+
var abis$9 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/mock/AuriInternalLens.sol/AuriInternalLens.json'));
|
|
21
21
|
var IUniswapV2PairABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json'));
|
|
22
|
-
var abis$
|
|
23
|
-
var abis$
|
|
24
|
-
var abis$
|
|
22
|
+
var abis$a = _interopDefault(require('@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json'));
|
|
23
|
+
var abis$b = _interopDefault(require('@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json'));
|
|
24
|
+
var abis$c = _interopDefault(require('@aurigami/contracts/artifacts/contracts/ReferralDirectory.sol/ReferralDirectory.json'));
|
|
25
25
|
var MAINNET_ADDRESSES = _interopDefault(require('@aurigami/contracts/deployments/aurora_mainnet.json'));
|
|
26
26
|
var aurora_testnet_json = _interopDefault(require('@aurigami/contracts/deployments/aurora_testnet.json'));
|
|
27
27
|
var abstractSigner = require('@ethersproject/abstract-signer');
|
|
@@ -32,20 +32,20 @@ var axios = _interopDefault(require('axios'));
|
|
|
32
32
|
var index = {
|
|
33
33
|
__proto__: null,
|
|
34
34
|
AuriOracleABI: AuriOracleABI,
|
|
35
|
-
AuTokenABI: abis$
|
|
35
|
+
AuTokenABI: abis$5,
|
|
36
36
|
IUniswapV2PairABI: IUniswapV2PairABI,
|
|
37
|
-
AuriAirdropABI:
|
|
38
|
-
AuriFairLaunchABI: abis$
|
|
39
|
-
AuriLensABI: abis$
|
|
40
|
-
ComptrollerABI: abis$
|
|
41
|
-
EIP20InterfaceABI: abis$
|
|
42
|
-
ReferralDirectoryABI: abis$
|
|
37
|
+
AuriAirdropABI: abis$2,
|
|
38
|
+
AuriFairLaunchABI: abis$3,
|
|
39
|
+
AuriLensABI: abis$4,
|
|
40
|
+
ComptrollerABI: abis$6,
|
|
41
|
+
EIP20InterfaceABI: abis$8,
|
|
42
|
+
ReferralDirectoryABI: abis$c,
|
|
43
43
|
AuErc20ABI: abis,
|
|
44
44
|
AuETHABI: abis$1,
|
|
45
|
-
EthRepayHelperABI: abis$
|
|
46
|
-
Multicall2ABI: abis$
|
|
47
|
-
PulpABI: abis$
|
|
48
|
-
AuriInternalLensABI: abis$
|
|
45
|
+
EthRepayHelperABI: abis$7,
|
|
46
|
+
Multicall2ABI: abis$a,
|
|
47
|
+
PulpABI: abis$b,
|
|
48
|
+
AuriInternalLensABI: abis$9
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
var dummyAddress = '0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
|
|
@@ -223,6 +223,25 @@ function _asyncToGenerator(fn) {
|
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
function _defineProperties(target, props) {
|
|
227
|
+
for (var i = 0; i < props.length; i++) {
|
|
228
|
+
var descriptor = props[i];
|
|
229
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
230
|
+
descriptor.configurable = true;
|
|
231
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
232
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
237
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
238
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
239
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
240
|
+
writable: false
|
|
241
|
+
});
|
|
242
|
+
return Constructor;
|
|
243
|
+
}
|
|
244
|
+
|
|
226
245
|
function _extends() {
|
|
227
246
|
_extends = Object.assign || function (target) {
|
|
228
247
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -330,20 +349,20 @@ var BlockchainEntity = /*#__PURE__*/function () {
|
|
|
330
349
|
var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
331
350
|
_inheritsLoose(AuriEnv, _BlockchainEntityRead);
|
|
332
351
|
|
|
333
|
-
function AuriEnv(
|
|
352
|
+
function AuriEnv() {
|
|
334
353
|
var _this;
|
|
335
354
|
|
|
336
|
-
_this = _BlockchainEntityRead.
|
|
337
|
-
_this.
|
|
338
|
-
_this.
|
|
339
|
-
_this.
|
|
340
|
-
_this.
|
|
341
|
-
_this.
|
|
342
|
-
|
|
343
|
-
_this.
|
|
355
|
+
_this = _BlockchainEntityRead.apply(this, arguments) || this;
|
|
356
|
+
_this._comptroller = null;
|
|
357
|
+
_this._auriFairLaunch = null;
|
|
358
|
+
_this._auriLens = null;
|
|
359
|
+
_this._ply = null;
|
|
360
|
+
_this._pulp = null;
|
|
361
|
+
_this._auriInternalLens = null;
|
|
362
|
+
_this._auriAirdrop = null;
|
|
363
|
+
_this._referralDirectory = null;
|
|
344
364
|
return _this;
|
|
345
|
-
}
|
|
346
|
-
|
|
365
|
+
}
|
|
347
366
|
|
|
348
367
|
var _proto = AuriEnv.prototype;
|
|
349
368
|
|
|
@@ -355,13 +374,87 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
355
374
|
var _this2 = this;
|
|
356
375
|
|
|
357
376
|
return networkAddresses.auTokens.map(function (auToken) {
|
|
358
|
-
var contract = _this2.getContract(auToken.address, abis$
|
|
377
|
+
var contract = _this2.getContract(auToken.address, abis$5.abi);
|
|
359
378
|
|
|
360
379
|
contract.underlying = auToken.underlying;
|
|
361
380
|
return contract;
|
|
362
381
|
});
|
|
363
382
|
};
|
|
364
383
|
|
|
384
|
+
_createClass(AuriEnv, [{
|
|
385
|
+
key: "comptroller",
|
|
386
|
+
get: function get() {
|
|
387
|
+
if (!this._comptroller) {
|
|
388
|
+
this._comptroller = this.getContract(networkAddresses.misc.COMPTROLLER, abis$6.abi);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
return this._comptroller;
|
|
392
|
+
}
|
|
393
|
+
}, {
|
|
394
|
+
key: "auriFairLaunch",
|
|
395
|
+
get: function get() {
|
|
396
|
+
if (!this._auriFairLaunch) {
|
|
397
|
+
this._auriFairLaunch = this.getContract(networkAddresses.misc.AURIFAIRLAUNCH, abis$3.abi);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return this._auriFairLaunch;
|
|
401
|
+
}
|
|
402
|
+
}, {
|
|
403
|
+
key: "auriLens",
|
|
404
|
+
get: function get() {
|
|
405
|
+
if (!this._auriLens) {
|
|
406
|
+
this._auriLens = this.getContract(networkAddresses.misc.AURILENS, abis$4.abi);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return this._auriLens;
|
|
410
|
+
}
|
|
411
|
+
}, {
|
|
412
|
+
key: "ply",
|
|
413
|
+
get: function get() {
|
|
414
|
+
if (!this._ply) {
|
|
415
|
+
this._ply = this.getContract(networkAddresses.tokens.PLY, abis$8.abi);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
return this._ply;
|
|
419
|
+
}
|
|
420
|
+
}, {
|
|
421
|
+
key: "pulp",
|
|
422
|
+
get: function get() {
|
|
423
|
+
if (!this._pulp) {
|
|
424
|
+
this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$b.abi);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
return this._pulp;
|
|
428
|
+
}
|
|
429
|
+
}, {
|
|
430
|
+
key: "auriInternalLens",
|
|
431
|
+
get: function get() {
|
|
432
|
+
if (!this._auriInternalLens) {
|
|
433
|
+
this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$9.abi);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
return this._auriInternalLens;
|
|
437
|
+
}
|
|
438
|
+
}, {
|
|
439
|
+
key: "auriAirdrop",
|
|
440
|
+
get: function get() {
|
|
441
|
+
if (!this._auriAirdrop) {
|
|
442
|
+
this._auriAirdrop = this.getContract(networkAddresses.misc.AURI_AIRDROP, abis$2.abi);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
return this._auriAirdrop;
|
|
446
|
+
}
|
|
447
|
+
}, {
|
|
448
|
+
key: "referralDirectory",
|
|
449
|
+
get: function get() {
|
|
450
|
+
if (!this._referralDirectory) {
|
|
451
|
+
this._referralDirectory = this.getContract(networkAddresses.misc.REFERRAL, abis$c.abi);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
return this._referralDirectory;
|
|
455
|
+
}
|
|
456
|
+
}]);
|
|
457
|
+
|
|
365
458
|
return AuriEnv;
|
|
366
459
|
}(BlockchainEntityRead);
|
|
367
460
|
|
|
@@ -1551,7 +1644,7 @@ var TokenAmount = /*#__PURE__*/function () {
|
|
|
1551
1644
|
return TokenAmount;
|
|
1552
1645
|
}();
|
|
1553
1646
|
|
|
1554
|
-
var dummyToken = /*#__PURE__*/new Token(
|
|
1647
|
+
var dummyToken = /*#__PURE__*/new Token(networkAddresses.tokens.WNEAR, 24);
|
|
1555
1648
|
var dummyPly = /*#__PURE__*/new Token('0x8729438eb15e2c8b576fcc6aecda6a148776c0f5', 18);
|
|
1556
1649
|
var dummyPlyAurora = /*#__PURE__*/new Token('0xE530dC2095Ef5653205CF5ea79F8979a7028065c', 18);
|
|
1557
1650
|
var dummyTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '123.456', false);
|
|
@@ -1569,6 +1662,22 @@ var dummyUserMarketDetails = {
|
|
|
1569
1662
|
collateralRatio: 0.5,
|
|
1570
1663
|
underlyingPrice: '1'
|
|
1571
1664
|
};
|
|
1665
|
+
var referralRewardDummy1 = {
|
|
1666
|
+
campaign: 'testa',
|
|
1667
|
+
startTime: 1652882400,
|
|
1668
|
+
endTime: 1653573599,
|
|
1669
|
+
isReferrer: false,
|
|
1670
|
+
rewardTokenAmount: dummyTokenAmount,
|
|
1671
|
+
transactionHash: null
|
|
1672
|
+
};
|
|
1673
|
+
var referralRewardDummy2 = {
|
|
1674
|
+
campaign: 'testb',
|
|
1675
|
+
startTime: 1652882400,
|
|
1676
|
+
endTime: 1653573599,
|
|
1677
|
+
isReferrer: true,
|
|
1678
|
+
rewardTokenAmount: dummyTokenAmount2,
|
|
1679
|
+
transactionHash: '0x4da9657663b46ef18d150b897b28c7b717f16421978b52e3a06d91b54ca3548b'
|
|
1680
|
+
};
|
|
1572
1681
|
|
|
1573
1682
|
var AURIGAMI_API_END_POINT = 'https://api.aurigami.finance/app/';
|
|
1574
1683
|
function getApi(_x, _x2) {
|
|
@@ -1902,7 +2011,7 @@ function _fetchUnderlyingTokensPrices() {
|
|
|
1902
2011
|
while (1) {
|
|
1903
2012
|
switch (_context7.prev = _context7.next) {
|
|
1904
2013
|
case 0:
|
|
1905
|
-
auriLens = new ethers.Contract(networkAddresses.misc.AURILENS, abis$
|
|
2014
|
+
auriLens = new ethers.Contract(networkAddresses.misc.AURILENS, abis$4.abi, provider);
|
|
1906
2015
|
auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
|
|
1907
2016
|
return auToken.address;
|
|
1908
2017
|
});
|
|
@@ -2208,7 +2317,7 @@ var TransferEventQuery = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2208
2317
|
var _this;
|
|
2209
2318
|
|
|
2210
2319
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
2211
|
-
_this.auToken = new ethers.Contract(tokenAddr, abis$
|
|
2320
|
+
_this.auToken = new ethers.Contract(tokenAddr, abis$5.abi, _this._networkConnection.provider);
|
|
2212
2321
|
return _this;
|
|
2213
2322
|
}
|
|
2214
2323
|
/**
|
|
@@ -2348,7 +2457,7 @@ var AirdropRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2348
2457
|
var _this;
|
|
2349
2458
|
|
|
2350
2459
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
2351
|
-
_this.
|
|
2460
|
+
_this.env = new AuriEnv(networkConnection);
|
|
2352
2461
|
return _this;
|
|
2353
2462
|
}
|
|
2354
2463
|
/**
|
|
@@ -2369,7 +2478,7 @@ var AirdropRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2369
2478
|
case 0:
|
|
2370
2479
|
tokenInstance = new Token(token, getDecimal(token));
|
|
2371
2480
|
_context.next = 3;
|
|
2372
|
-
return this.
|
|
2481
|
+
return this.env.auriAirdrop.getRedeemableReward(ethers.utils.formatBytes32String(campaign), token, user);
|
|
2373
2482
|
|
|
2374
2483
|
case 3:
|
|
2375
2484
|
rewards = _context.sent;
|
|
@@ -2413,7 +2522,7 @@ var AirdropReadWrite = /*#__PURE__*/function (_AirdropRead) {
|
|
|
2413
2522
|
switch (_context2.prev = _context2.next) {
|
|
2414
2523
|
case 0:
|
|
2415
2524
|
assert(campaigns.length == tokens.length, 'campaigns and tokens must have the same length');
|
|
2416
|
-
_context2.t0 = this.
|
|
2525
|
+
_context2.t0 = this.env.auriAirdrop.connect(this._networkConnection.signer);
|
|
2417
2526
|
_context2.t1 = campaigns.map(function (e) {
|
|
2418
2527
|
return ethers.utils.formatBytes32String(e);
|
|
2419
2528
|
});
|
|
@@ -2842,12 +2951,26 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2842
2951
|
_context9.t5 = underlyingPrice.multipliedBy(totalBorrowed.formattedAmount());
|
|
2843
2952
|
borrowNEARApy = _context9.t3.calcLMRewardApr.call(_context9.t3, _context9.t4, _context9.t5, 52);
|
|
2844
2953
|
|
|
2845
|
-
if (isSameAddress(this.underlying.address, networkAddresses.tokens.stNEAR)) {
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
depositMETAApy = new BigNumber(0);
|
|
2954
|
+
if (!isSameAddress(this.underlying.address, networkAddresses.tokens.stNEAR)) {
|
|
2955
|
+
_context9.next = 34;
|
|
2956
|
+
break;
|
|
2849
2957
|
}
|
|
2850
2958
|
|
|
2959
|
+
_context9.t6 = helpers;
|
|
2960
|
+
_context9.next = 29;
|
|
2961
|
+
return fetchValuation(TokenAmount.fromAddressAndAmount(networkAddresses.tokens.META, '1250000', false), this._networkConnection.provider);
|
|
2962
|
+
|
|
2963
|
+
case 29:
|
|
2964
|
+
_context9.t7 = _context9.sent;
|
|
2965
|
+
_context9.t8 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
|
|
2966
|
+
depositMETAApy = _context9.t6.calcLMRewardApr.call(_context9.t6, _context9.t7, _context9.t8, 12);
|
|
2967
|
+
_context9.next = 35;
|
|
2968
|
+
break;
|
|
2969
|
+
|
|
2970
|
+
case 34:
|
|
2971
|
+
depositMETAApy = new BigNumber(0);
|
|
2972
|
+
|
|
2973
|
+
case 35:
|
|
2851
2974
|
return _context9.abrupt("return", {
|
|
2852
2975
|
auTokenAddress: this.auToken.address,
|
|
2853
2976
|
totalTokenDeposited: totalDeposited,
|
|
@@ -2864,7 +2987,7 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2864
2987
|
depositMETAApy: depositMETAApy.toNumber()
|
|
2865
2988
|
});
|
|
2866
2989
|
|
|
2867
|
-
case
|
|
2990
|
+
case 36:
|
|
2868
2991
|
case "end":
|
|
2869
2992
|
return _context9.stop();
|
|
2870
2993
|
}
|
|
@@ -2980,7 +3103,7 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
2980
3103
|
var _this3;
|
|
2981
3104
|
|
|
2982
3105
|
_this3 = _MoneyMarketRead.call(this, networkConnection, auToken, underlyingAsset) || this;
|
|
2983
|
-
_this3._EthRepayHelper = new ethers.Contract(networkAddresses.misc.ETHREPAYHELPER, abis$
|
|
3106
|
+
_this3._EthRepayHelper = new ethers.Contract(networkAddresses.misc.ETHREPAYHELPER, abis$7.abi, networkConnection.provider);
|
|
2984
3107
|
return _this3;
|
|
2985
3108
|
}
|
|
2986
3109
|
|
|
@@ -3194,7 +3317,7 @@ var MulticallRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3194
3317
|
var _this;
|
|
3195
3318
|
|
|
3196
3319
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
3197
|
-
_this.multicall = new ethers.Contract(networkAddresses.misc.MULTICALL, abis$
|
|
3320
|
+
_this.multicall = new ethers.Contract(networkAddresses.misc.MULTICALL, abis$a.abi, networkConnection.provider);
|
|
3198
3321
|
return _this;
|
|
3199
3322
|
}
|
|
3200
3323
|
/**
|
|
@@ -3766,7 +3889,7 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3766
3889
|
while (1) {
|
|
3767
3890
|
switch (_context3.prev = _context3.next) {
|
|
3768
3891
|
case 0:
|
|
3769
|
-
lpContract = new ethers.Contract(networkAddresses.tokens.PLYWNEAR, abis$
|
|
3892
|
+
lpContract = new ethers.Contract(networkAddresses.tokens.PLYWNEAR, abis$8.abi, this._networkConnection.provider);
|
|
3770
3893
|
_context3.next = 3;
|
|
3771
3894
|
return lpContract.balanceOf(user);
|
|
3772
3895
|
|
|
@@ -4259,7 +4382,7 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4259
4382
|
dust = new BigNumber(0.1);
|
|
4260
4383
|
oracle = this.env.getContract(networkAddresses.misc.oracle, AuriOracleABI.abi);
|
|
4261
4384
|
tokens = tokenAddresses.map(function (addr) {
|
|
4262
|
-
return _this3.env.getContract(addr, abis$
|
|
4385
|
+
return _this3.env.getContract(addr, abis$5.abi);
|
|
4263
4386
|
});
|
|
4264
4387
|
_context5.next = 6;
|
|
4265
4388
|
return oracle.getUnderlyingPrices(tokenAddresses);
|
|
@@ -4357,7 +4480,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4357
4480
|
var _this;
|
|
4358
4481
|
|
|
4359
4482
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
4360
|
-
_this.
|
|
4483
|
+
_this.env = new AuriEnv(networkConnection);
|
|
4361
4484
|
return _this;
|
|
4362
4485
|
}
|
|
4363
4486
|
/**
|
|
@@ -4397,7 +4520,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4397
4520
|
switch (_context.prev = _context.next) {
|
|
4398
4521
|
case 0:
|
|
4399
4522
|
_context.next = 2;
|
|
4400
|
-
return this.
|
|
4523
|
+
return this.env.referralDirectory.userReferralCode(userAddr);
|
|
4401
4524
|
|
|
4402
4525
|
case 2:
|
|
4403
4526
|
result = _context.sent;
|
|
@@ -4432,7 +4555,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4432
4555
|
switch (_context2.prev = _context2.next) {
|
|
4433
4556
|
case 0:
|
|
4434
4557
|
_context2.next = 2;
|
|
4435
|
-
return this.
|
|
4558
|
+
return this.env.referralDirectory.referralCodeUsed(userAddr);
|
|
4436
4559
|
|
|
4437
4560
|
case 2:
|
|
4438
4561
|
result = _context2.sent;
|
|
@@ -4467,7 +4590,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4467
4590
|
switch (_context3.prev = _context3.next) {
|
|
4468
4591
|
case 0:
|
|
4469
4592
|
referralCode = ethers.ethers.utils.formatBytes32String(code);
|
|
4470
|
-
return _context3.abrupt("return", this.
|
|
4593
|
+
return _context3.abrupt("return", this.env.referralDirectory.referralCodeOwner(referralCode));
|
|
4471
4594
|
|
|
4472
4595
|
case 2:
|
|
4473
4596
|
case "end":
|
|
@@ -4533,6 +4656,64 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4533
4656
|
}
|
|
4534
4657
|
|
|
4535
4658
|
return getReferralsList;
|
|
4659
|
+
}()
|
|
4660
|
+
/**
|
|
4661
|
+
* Array of rewards, sorted by time of the referral period (from latest to oldest)
|
|
4662
|
+
*/
|
|
4663
|
+
;
|
|
4664
|
+
|
|
4665
|
+
_proto.referralRewards =
|
|
4666
|
+
/*#__PURE__*/
|
|
4667
|
+
function () {
|
|
4668
|
+
var _referralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(userAddr) {
|
|
4669
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
4670
|
+
while (1) {
|
|
4671
|
+
switch (_context5.prev = _context5.next) {
|
|
4672
|
+
case 0:
|
|
4673
|
+
return _context5.abrupt("return", [referralRewardDummy1, referralRewardDummy2]);
|
|
4674
|
+
|
|
4675
|
+
case 1:
|
|
4676
|
+
case "end":
|
|
4677
|
+
return _context5.stop();
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4680
|
+
}, _callee5);
|
|
4681
|
+
}));
|
|
4682
|
+
|
|
4683
|
+
function referralRewards(_x5) {
|
|
4684
|
+
return _referralRewards.apply(this, arguments);
|
|
4685
|
+
}
|
|
4686
|
+
|
|
4687
|
+
return referralRewards;
|
|
4688
|
+
}()
|
|
4689
|
+
/**
|
|
4690
|
+
* Top 50 reward earners from the last round, sorted by token amount
|
|
4691
|
+
*/
|
|
4692
|
+
;
|
|
4693
|
+
|
|
4694
|
+
_proto.leaderboard =
|
|
4695
|
+
/*#__PURE__*/
|
|
4696
|
+
function () {
|
|
4697
|
+
var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
|
|
4698
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
4699
|
+
while (1) {
|
|
4700
|
+
switch (_context6.prev = _context6.next) {
|
|
4701
|
+
case 0:
|
|
4702
|
+
return _context6.abrupt("return", [referralRewardDummy2, referralRewardDummy1]);
|
|
4703
|
+
|
|
4704
|
+
case 1:
|
|
4705
|
+
case "end":
|
|
4706
|
+
return _context6.stop();
|
|
4707
|
+
}
|
|
4708
|
+
}
|
|
4709
|
+
}, _callee6);
|
|
4710
|
+
}));
|
|
4711
|
+
|
|
4712
|
+
function leaderboard() {
|
|
4713
|
+
return _leaderboard.apply(this, arguments);
|
|
4714
|
+
}
|
|
4715
|
+
|
|
4716
|
+
return leaderboard;
|
|
4536
4717
|
}();
|
|
4537
4718
|
|
|
4538
4719
|
return ReferralRead;
|
|
@@ -4554,21 +4735,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
4554
4735
|
_proto2.registerNewReferralCode =
|
|
4555
4736
|
/*#__PURE__*/
|
|
4556
4737
|
function () {
|
|
4557
|
-
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4738
|
+
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
|
|
4558
4739
|
var referralCode;
|
|
4559
|
-
return runtime_1.wrap(function
|
|
4740
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
4560
4741
|
while (1) {
|
|
4561
|
-
switch (
|
|
4742
|
+
switch (_context7.prev = _context7.next) {
|
|
4562
4743
|
case 0:
|
|
4563
4744
|
referralCode = ethers.ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
4564
|
-
return
|
|
4745
|
+
return _context7.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
|
|
4565
4746
|
|
|
4566
4747
|
case 2:
|
|
4567
4748
|
case "end":
|
|
4568
|
-
return
|
|
4749
|
+
return _context7.stop();
|
|
4569
4750
|
}
|
|
4570
4751
|
}
|
|
4571
|
-
},
|
|
4752
|
+
}, _callee7, this);
|
|
4572
4753
|
}));
|
|
4573
4754
|
|
|
4574
4755
|
function registerNewReferralCode() {
|
|
@@ -4585,28 +4766,77 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
4585
4766
|
_proto2.useReferralCode =
|
|
4586
4767
|
/*#__PURE__*/
|
|
4587
4768
|
function () {
|
|
4588
|
-
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4769
|
+
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(code) {
|
|
4589
4770
|
var referralCode;
|
|
4590
|
-
return runtime_1.wrap(function
|
|
4771
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
4591
4772
|
while (1) {
|
|
4592
|
-
switch (
|
|
4773
|
+
switch (_context8.prev = _context8.next) {
|
|
4593
4774
|
case 0:
|
|
4594
4775
|
referralCode = ethers.ethers.utils.formatBytes32String(code);
|
|
4595
|
-
return
|
|
4776
|
+
return _context8.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
|
|
4596
4777
|
|
|
4597
4778
|
case 2:
|
|
4598
4779
|
case "end":
|
|
4599
|
-
return
|
|
4780
|
+
return _context8.stop();
|
|
4600
4781
|
}
|
|
4601
4782
|
}
|
|
4602
|
-
},
|
|
4783
|
+
}, _callee8, this);
|
|
4603
4784
|
}));
|
|
4604
4785
|
|
|
4605
|
-
function useReferralCode(
|
|
4786
|
+
function useReferralCode(_x6) {
|
|
4606
4787
|
return _useReferralCode.apply(this, arguments);
|
|
4607
4788
|
}
|
|
4608
4789
|
|
|
4609
4790
|
return useReferralCode;
|
|
4791
|
+
}()
|
|
4792
|
+
/**
|
|
4793
|
+
* Claim all unclaimed rewards for a given user
|
|
4794
|
+
*/
|
|
4795
|
+
;
|
|
4796
|
+
|
|
4797
|
+
_proto2.claimReferralRewards =
|
|
4798
|
+
/*#__PURE__*/
|
|
4799
|
+
function () {
|
|
4800
|
+
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
|
|
4801
|
+
var unclaimedRewards, campaigns, tokens;
|
|
4802
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
4803
|
+
while (1) {
|
|
4804
|
+
switch (_context9.prev = _context9.next) {
|
|
4805
|
+
case 0:
|
|
4806
|
+
_context9.t0 = this;
|
|
4807
|
+
_context9.next = 3;
|
|
4808
|
+
return this._networkConnection.signer.getAddress();
|
|
4809
|
+
|
|
4810
|
+
case 3:
|
|
4811
|
+
_context9.t1 = _context9.sent;
|
|
4812
|
+
_context9.next = 6;
|
|
4813
|
+
return _context9.t0.referralRewards.call(_context9.t0, _context9.t1);
|
|
4814
|
+
|
|
4815
|
+
case 6:
|
|
4816
|
+
unclaimedRewards = _context9.sent.filter(function (reward) {
|
|
4817
|
+
return reward.transactionHash == null;
|
|
4818
|
+
});
|
|
4819
|
+
campaigns = unclaimedRewards.map(function (reward) {
|
|
4820
|
+
return reward.campaign;
|
|
4821
|
+
});
|
|
4822
|
+
tokens = unclaimedRewards.map(function (reward) {
|
|
4823
|
+
return reward.rewardTokenAmount.token.address;
|
|
4824
|
+
});
|
|
4825
|
+
return _context9.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
|
|
4826
|
+
|
|
4827
|
+
case 10:
|
|
4828
|
+
case "end":
|
|
4829
|
+
return _context9.stop();
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
}, _callee9, this);
|
|
4833
|
+
}));
|
|
4834
|
+
|
|
4835
|
+
function claimReferralRewards() {
|
|
4836
|
+
return _claimReferralRewards.apply(this, arguments);
|
|
4837
|
+
}
|
|
4838
|
+
|
|
4839
|
+
return claimReferralRewards;
|
|
4610
4840
|
}();
|
|
4611
4841
|
|
|
4612
4842
|
return ReferralReadWrite;
|
|
@@ -5132,6 +5362,8 @@ exports.getUnderlying = getUnderlying;
|
|
|
5132
5362
|
exports.isSameAddress = isSameAddress;
|
|
5133
5363
|
exports.networkAddresses = networkAddresses;
|
|
5134
5364
|
exports.queryGraphQL = queryGraphQL;
|
|
5365
|
+
exports.referralRewardDummy1 = referralRewardDummy1;
|
|
5366
|
+
exports.referralRewardDummy2 = referralRewardDummy2;
|
|
5135
5367
|
exports.symbolRecords = symbolRecords;
|
|
5136
5368
|
exports.validateAndParseAddress = validateAndParseAddress;
|
|
5137
5369
|
exports.valuateToken = valuateToken;
|