@aurigami/sdk 1.7.6 → 1.7.7-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 +279 -61
- 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 +279 -63
- 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/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
|
});
|
|
@@ -2980,7 +3089,7 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
2980
3089
|
var _this3;
|
|
2981
3090
|
|
|
2982
3091
|
_this3 = _MoneyMarketRead.call(this, networkConnection, auToken, underlyingAsset) || this;
|
|
2983
|
-
_this3._EthRepayHelper = new ethers.Contract(networkAddresses.misc.ETHREPAYHELPER, abis$
|
|
3092
|
+
_this3._EthRepayHelper = new ethers.Contract(networkAddresses.misc.ETHREPAYHELPER, abis$7.abi, networkConnection.provider);
|
|
2984
3093
|
return _this3;
|
|
2985
3094
|
}
|
|
2986
3095
|
|
|
@@ -3194,7 +3303,7 @@ var MulticallRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3194
3303
|
var _this;
|
|
3195
3304
|
|
|
3196
3305
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
3197
|
-
_this.multicall = new ethers.Contract(networkAddresses.misc.MULTICALL, abis$
|
|
3306
|
+
_this.multicall = new ethers.Contract(networkAddresses.misc.MULTICALL, abis$a.abi, networkConnection.provider);
|
|
3198
3307
|
return _this;
|
|
3199
3308
|
}
|
|
3200
3309
|
/**
|
|
@@ -3766,7 +3875,7 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3766
3875
|
while (1) {
|
|
3767
3876
|
switch (_context3.prev = _context3.next) {
|
|
3768
3877
|
case 0:
|
|
3769
|
-
lpContract = new ethers.Contract(networkAddresses.tokens.PLYWNEAR, abis$
|
|
3878
|
+
lpContract = new ethers.Contract(networkAddresses.tokens.PLYWNEAR, abis$8.abi, this._networkConnection.provider);
|
|
3770
3879
|
_context3.next = 3;
|
|
3771
3880
|
return lpContract.balanceOf(user);
|
|
3772
3881
|
|
|
@@ -4259,7 +4368,7 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4259
4368
|
dust = new BigNumber(0.1);
|
|
4260
4369
|
oracle = this.env.getContract(networkAddresses.misc.oracle, AuriOracleABI.abi);
|
|
4261
4370
|
tokens = tokenAddresses.map(function (addr) {
|
|
4262
|
-
return _this3.env.getContract(addr, abis$
|
|
4371
|
+
return _this3.env.getContract(addr, abis$5.abi);
|
|
4263
4372
|
});
|
|
4264
4373
|
_context5.next = 6;
|
|
4265
4374
|
return oracle.getUnderlyingPrices(tokenAddresses);
|
|
@@ -4357,7 +4466,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4357
4466
|
var _this;
|
|
4358
4467
|
|
|
4359
4468
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
4360
|
-
_this.
|
|
4469
|
+
_this.env = new AuriEnv(networkConnection);
|
|
4361
4470
|
return _this;
|
|
4362
4471
|
}
|
|
4363
4472
|
/**
|
|
@@ -4397,7 +4506,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4397
4506
|
switch (_context.prev = _context.next) {
|
|
4398
4507
|
case 0:
|
|
4399
4508
|
_context.next = 2;
|
|
4400
|
-
return this.
|
|
4509
|
+
return this.env.referralDirectory.userReferralCode(userAddr);
|
|
4401
4510
|
|
|
4402
4511
|
case 2:
|
|
4403
4512
|
result = _context.sent;
|
|
@@ -4432,7 +4541,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4432
4541
|
switch (_context2.prev = _context2.next) {
|
|
4433
4542
|
case 0:
|
|
4434
4543
|
_context2.next = 2;
|
|
4435
|
-
return this.
|
|
4544
|
+
return this.env.referralDirectory.referralCodeUsed(userAddr);
|
|
4436
4545
|
|
|
4437
4546
|
case 2:
|
|
4438
4547
|
result = _context2.sent;
|
|
@@ -4467,7 +4576,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4467
4576
|
switch (_context3.prev = _context3.next) {
|
|
4468
4577
|
case 0:
|
|
4469
4578
|
referralCode = ethers.ethers.utils.formatBytes32String(code);
|
|
4470
|
-
return _context3.abrupt("return", this.
|
|
4579
|
+
return _context3.abrupt("return", this.env.referralDirectory.referralCodeOwner(referralCode));
|
|
4471
4580
|
|
|
4472
4581
|
case 2:
|
|
4473
4582
|
case "end":
|
|
@@ -4533,6 +4642,64 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4533
4642
|
}
|
|
4534
4643
|
|
|
4535
4644
|
return getReferralsList;
|
|
4645
|
+
}()
|
|
4646
|
+
/**
|
|
4647
|
+
* Array of rewards, sorted by time of the referral period (from latest to oldest)
|
|
4648
|
+
*/
|
|
4649
|
+
;
|
|
4650
|
+
|
|
4651
|
+
_proto.referralRewards =
|
|
4652
|
+
/*#__PURE__*/
|
|
4653
|
+
function () {
|
|
4654
|
+
var _referralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(userAddr) {
|
|
4655
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
4656
|
+
while (1) {
|
|
4657
|
+
switch (_context5.prev = _context5.next) {
|
|
4658
|
+
case 0:
|
|
4659
|
+
return _context5.abrupt("return", [referralRewardDummy1, referralRewardDummy2]);
|
|
4660
|
+
|
|
4661
|
+
case 1:
|
|
4662
|
+
case "end":
|
|
4663
|
+
return _context5.stop();
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
}, _callee5);
|
|
4667
|
+
}));
|
|
4668
|
+
|
|
4669
|
+
function referralRewards(_x5) {
|
|
4670
|
+
return _referralRewards.apply(this, arguments);
|
|
4671
|
+
}
|
|
4672
|
+
|
|
4673
|
+
return referralRewards;
|
|
4674
|
+
}()
|
|
4675
|
+
/**
|
|
4676
|
+
* Top 50 reward earners from the last round, sorted by token amount
|
|
4677
|
+
*/
|
|
4678
|
+
;
|
|
4679
|
+
|
|
4680
|
+
_proto.leaderboard =
|
|
4681
|
+
/*#__PURE__*/
|
|
4682
|
+
function () {
|
|
4683
|
+
var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
|
|
4684
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
4685
|
+
while (1) {
|
|
4686
|
+
switch (_context6.prev = _context6.next) {
|
|
4687
|
+
case 0:
|
|
4688
|
+
return _context6.abrupt("return", [referralRewardDummy2, referralRewardDummy1]);
|
|
4689
|
+
|
|
4690
|
+
case 1:
|
|
4691
|
+
case "end":
|
|
4692
|
+
return _context6.stop();
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4695
|
+
}, _callee6);
|
|
4696
|
+
}));
|
|
4697
|
+
|
|
4698
|
+
function leaderboard() {
|
|
4699
|
+
return _leaderboard.apply(this, arguments);
|
|
4700
|
+
}
|
|
4701
|
+
|
|
4702
|
+
return leaderboard;
|
|
4536
4703
|
}();
|
|
4537
4704
|
|
|
4538
4705
|
return ReferralRead;
|
|
@@ -4554,21 +4721,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
4554
4721
|
_proto2.registerNewReferralCode =
|
|
4555
4722
|
/*#__PURE__*/
|
|
4556
4723
|
function () {
|
|
4557
|
-
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4724
|
+
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
|
|
4558
4725
|
var referralCode;
|
|
4559
|
-
return runtime_1.wrap(function
|
|
4726
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
4560
4727
|
while (1) {
|
|
4561
|
-
switch (
|
|
4728
|
+
switch (_context7.prev = _context7.next) {
|
|
4562
4729
|
case 0:
|
|
4563
4730
|
referralCode = ethers.ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
4564
|
-
return
|
|
4731
|
+
return _context7.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
|
|
4565
4732
|
|
|
4566
4733
|
case 2:
|
|
4567
4734
|
case "end":
|
|
4568
|
-
return
|
|
4735
|
+
return _context7.stop();
|
|
4569
4736
|
}
|
|
4570
4737
|
}
|
|
4571
|
-
},
|
|
4738
|
+
}, _callee7, this);
|
|
4572
4739
|
}));
|
|
4573
4740
|
|
|
4574
4741
|
function registerNewReferralCode() {
|
|
@@ -4585,28 +4752,77 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
4585
4752
|
_proto2.useReferralCode =
|
|
4586
4753
|
/*#__PURE__*/
|
|
4587
4754
|
function () {
|
|
4588
|
-
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4755
|
+
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(code) {
|
|
4589
4756
|
var referralCode;
|
|
4590
|
-
return runtime_1.wrap(function
|
|
4757
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
4591
4758
|
while (1) {
|
|
4592
|
-
switch (
|
|
4759
|
+
switch (_context8.prev = _context8.next) {
|
|
4593
4760
|
case 0:
|
|
4594
4761
|
referralCode = ethers.ethers.utils.formatBytes32String(code);
|
|
4595
|
-
return
|
|
4762
|
+
return _context8.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
|
|
4596
4763
|
|
|
4597
4764
|
case 2:
|
|
4598
4765
|
case "end":
|
|
4599
|
-
return
|
|
4766
|
+
return _context8.stop();
|
|
4600
4767
|
}
|
|
4601
4768
|
}
|
|
4602
|
-
},
|
|
4769
|
+
}, _callee8, this);
|
|
4603
4770
|
}));
|
|
4604
4771
|
|
|
4605
|
-
function useReferralCode(
|
|
4772
|
+
function useReferralCode(_x6) {
|
|
4606
4773
|
return _useReferralCode.apply(this, arguments);
|
|
4607
4774
|
}
|
|
4608
4775
|
|
|
4609
4776
|
return useReferralCode;
|
|
4777
|
+
}()
|
|
4778
|
+
/**
|
|
4779
|
+
* Claim all unclaimed rewards for a given user
|
|
4780
|
+
*/
|
|
4781
|
+
;
|
|
4782
|
+
|
|
4783
|
+
_proto2.claimReferralRewards =
|
|
4784
|
+
/*#__PURE__*/
|
|
4785
|
+
function () {
|
|
4786
|
+
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
|
|
4787
|
+
var unclaimedRewards, campaigns, tokens;
|
|
4788
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
4789
|
+
while (1) {
|
|
4790
|
+
switch (_context9.prev = _context9.next) {
|
|
4791
|
+
case 0:
|
|
4792
|
+
_context9.t0 = this;
|
|
4793
|
+
_context9.next = 3;
|
|
4794
|
+
return this._networkConnection.signer.getAddress();
|
|
4795
|
+
|
|
4796
|
+
case 3:
|
|
4797
|
+
_context9.t1 = _context9.sent;
|
|
4798
|
+
_context9.next = 6;
|
|
4799
|
+
return _context9.t0.referralRewards.call(_context9.t0, _context9.t1);
|
|
4800
|
+
|
|
4801
|
+
case 6:
|
|
4802
|
+
unclaimedRewards = _context9.sent.filter(function (reward) {
|
|
4803
|
+
return reward.transactionHash == null;
|
|
4804
|
+
});
|
|
4805
|
+
campaigns = unclaimedRewards.map(function (reward) {
|
|
4806
|
+
return reward.campaign;
|
|
4807
|
+
});
|
|
4808
|
+
tokens = unclaimedRewards.map(function (reward) {
|
|
4809
|
+
return reward.rewardTokenAmount.token.address;
|
|
4810
|
+
});
|
|
4811
|
+
return _context9.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
|
|
4812
|
+
|
|
4813
|
+
case 10:
|
|
4814
|
+
case "end":
|
|
4815
|
+
return _context9.stop();
|
|
4816
|
+
}
|
|
4817
|
+
}
|
|
4818
|
+
}, _callee9, this);
|
|
4819
|
+
}));
|
|
4820
|
+
|
|
4821
|
+
function claimReferralRewards() {
|
|
4822
|
+
return _claimReferralRewards.apply(this, arguments);
|
|
4823
|
+
}
|
|
4824
|
+
|
|
4825
|
+
return claimReferralRewards;
|
|
4610
4826
|
}();
|
|
4611
4827
|
|
|
4612
4828
|
return ReferralReadWrite;
|
|
@@ -5132,6 +5348,8 @@ exports.getUnderlying = getUnderlying;
|
|
|
5132
5348
|
exports.isSameAddress = isSameAddress;
|
|
5133
5349
|
exports.networkAddresses = networkAddresses;
|
|
5134
5350
|
exports.queryGraphQL = queryGraphQL;
|
|
5351
|
+
exports.referralRewardDummy1 = referralRewardDummy1;
|
|
5352
|
+
exports.referralRewardDummy2 = referralRewardDummy2;
|
|
5135
5353
|
exports.symbolRecords = symbolRecords;
|
|
5136
5354
|
exports.validateAndParseAddress = validateAndParseAddress;
|
|
5137
5355
|
exports.valuateToken = valuateToken;
|