@dhedge/v2-sdk 1.2.0 → 1.2.1
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/entities/pool.d.ts +5 -3
- package/dist/services/claim-balancer/claim.service.d.ts +1 -5
- package/dist/v2-sdk.cjs.development.js +119 -263
- package/dist/v2-sdk.cjs.development.js.map +1 -1
- package/dist/v2-sdk.cjs.production.min.js +1 -1
- package/dist/v2-sdk.cjs.production.min.js.map +1 -1
- package/dist/v2-sdk.esm.js +120 -264
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +6 -2
- package/src/entities/pool.ts +7 -3
- package/src/services/claim-balancer/claim.service.ts +14 -76
package/dist/entities/pool.d.ts
CHANGED
|
@@ -109,11 +109,12 @@ export declare class Pool {
|
|
|
109
109
|
* Lend asset to a lending pool
|
|
110
110
|
* @param {Dapp} dapp Platform like Aave
|
|
111
111
|
* @param {string} asset Asset
|
|
112
|
-
* @param
|
|
112
|
+
* @param {BigNumber | string} amount Amount of asset to lend
|
|
113
|
+
* @param {number} referrralCode Code from Aave referral program
|
|
113
114
|
* @param {any} options Transaction options
|
|
114
115
|
* @returns {Promise<any>} Transaction
|
|
115
116
|
*/
|
|
116
|
-
lend(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any): Promise<any>;
|
|
117
|
+
lend(dapp: Dapp, asset: string, amount: BigNumber | string, referrralCode?: number, options?: any): Promise<any>;
|
|
117
118
|
/**
|
|
118
119
|
* Witdraw asset from a lending pool
|
|
119
120
|
* @param {Dapp} dapp Platform like Aave
|
|
@@ -128,10 +129,11 @@ export declare class Pool {
|
|
|
128
129
|
* @param {Dapp} dapp Platform like Aave
|
|
129
130
|
* @param {string} asset Asset
|
|
130
131
|
* @param {BigNumber | string} amount Amount of asset to lend
|
|
132
|
+
* @param {number} referrralCode Code from Aave referral program
|
|
131
133
|
* @param {any} options Transaction options
|
|
132
134
|
* @returns {Promise<any>} Transaction
|
|
133
135
|
*/
|
|
134
|
-
borrow(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any): Promise<any>;
|
|
136
|
+
borrow(dapp: Dapp, asset: string, amount: BigNumber | string, referrralCode?: number, options?: any): Promise<any>;
|
|
135
137
|
/**
|
|
136
138
|
* Repays borrowed asset to a lending pool
|
|
137
139
|
* @param {Dapp} dapp Platform like Aave
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ethers, Wallet } from "ethers";
|
|
2
|
-
import {
|
|
2
|
+
import { MultiTokenPendingClaims, TokenClaimInfo } from "./types";
|
|
3
3
|
import { Network } from "../../types";
|
|
4
4
|
export declare class ClaimService {
|
|
5
5
|
network: Network;
|
|
@@ -7,10 +7,6 @@ export declare class ClaimService {
|
|
|
7
7
|
constructor(network: Network, signer: Wallet);
|
|
8
8
|
getMultiTokensPendingClaims(account: string): Promise<MultiTokenPendingClaims[]>;
|
|
9
9
|
getTokenPendingClaims(tokenClaimInfo: TokenClaimInfo, account: string): Promise<MultiTokenPendingClaims>;
|
|
10
|
-
getMultiTokensCurrentRewardsEstimate(account: string): Promise<{
|
|
11
|
-
data: MultiTokenCurrentRewardsEstimate[];
|
|
12
|
-
timestamp: string | null;
|
|
13
|
-
}>;
|
|
14
10
|
multiTokenClaimRewards(account: string, multiTokenPendingClaims: MultiTokenPendingClaims[]): Promise<any>;
|
|
15
11
|
private computeClaimProofs;
|
|
16
12
|
private computeClaimProof;
|
|
@@ -3848,7 +3848,10 @@ var ManagerLogic = {
|
|
|
3848
3848
|
})(exports.Transaction || (exports.Transaction = {}));
|
|
3849
3849
|
|
|
3850
3850
|
var _factoryAddress, _Network$POLYGON, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _networkChainIdMap, _balancerSubgraph, _multiCallAddress;
|
|
3851
|
-
|
|
3851
|
+
|
|
3852
|
+
require("dotenv").config();
|
|
3853
|
+
|
|
3854
|
+
var factoryAddress = (_factoryAddress = {}, _factoryAddress[exports.Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress);
|
|
3852
3855
|
var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x1111111254fb6c44bac0bed2854e76f90643097d", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON), _routerAddress);
|
|
3853
3856
|
var dappFactoryAddress = (_dappFactoryAddress = {}, _dappFactoryAddress[exports.Network.POLYGON] = (_Network$POLYGON2 = {}, _Network$POLYGON2[exports.Dapp.SUSHISWAP] = "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", _Network$POLYGON2[exports.Dapp.QUICKSWAP] = "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32", _Network$POLYGON2), _dappFactoryAddress);
|
|
3854
3857
|
var stakingAddress = (_stakingAddress = {}, _stakingAddress[exports.Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[exports.Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[exports.Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[exports.Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3), _stakingAddress);
|
|
@@ -6391,122 +6394,6 @@ var IpfsService = /*#__PURE__*/function () {
|
|
|
6391
6394
|
}();
|
|
6392
6395
|
var ipfsService = /*#__PURE__*/new IpfsService();
|
|
6393
6396
|
|
|
6394
|
-
var MultiTokenClaim = {
|
|
6395
|
-
"1": [
|
|
6396
|
-
{
|
|
6397
|
-
label: "BAL",
|
|
6398
|
-
distributor: "0xd2EB7Bd802A7CA68d9AcD209bEc4E664A9abDD7b",
|
|
6399
|
-
token: "0xba100000625a3754423978a60c9317c58a424e3d",
|
|
6400
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current.json",
|
|
6401
|
-
weekStart: 52
|
|
6402
|
-
},
|
|
6403
|
-
{
|
|
6404
|
-
label: "UNN",
|
|
6405
|
-
distributor: "0xBfbd6e720ffdF0497f69C95E5C03a4861C65A6E7",
|
|
6406
|
-
token: "0x226f7b842E0F0120b7E194D05432b3fd14773a9D",
|
|
6407
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-union.json",
|
|
6408
|
-
weekStart: 1
|
|
6409
|
-
},
|
|
6410
|
-
{
|
|
6411
|
-
label: "BANK",
|
|
6412
|
-
distributor: "0x9d20FE66eC5Dd15a3D3213556534C77cA20318bE",
|
|
6413
|
-
token: "0x2d94AA3e47d9D5024503Ca8491fcE9A2fB4DA198",
|
|
6414
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-bankless.json",
|
|
6415
|
-
weekStart: 1
|
|
6416
|
-
},
|
|
6417
|
-
{
|
|
6418
|
-
label: "NOTE",
|
|
6419
|
-
distributor: "0xF1C2dD9bD863f2444086B739383F1043E6b88F69",
|
|
6420
|
-
token: "0xcfeaead4947f0705a14ec42ac3d44129e1ef3ed5",
|
|
6421
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-note.json",
|
|
6422
|
-
weekStart: 1
|
|
6423
|
-
},
|
|
6424
|
-
{
|
|
6425
|
-
label: "NEXO",
|
|
6426
|
-
distributor: "0x0000000000000000000000000000000000000000",
|
|
6427
|
-
token: "0xB62132e35a6c13ee1EE0f84dC5d40bad8d815206",
|
|
6428
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-nexo.json",
|
|
6429
|
-
weekStart: 1
|
|
6430
|
-
}
|
|
6431
|
-
],
|
|
6432
|
-
"42": [
|
|
6433
|
-
{
|
|
6434
|
-
label: "BAL",
|
|
6435
|
-
distributor: "0x95FaE1C936B4Cd6c5099d7A705D792ee6aC9FEc3",
|
|
6436
|
-
token: "0x41286Bb1D3E870f3F750eB7E1C25d7E48c8A1Ac7",
|
|
6437
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/sample-tree/reports-kovan/_current.json",
|
|
6438
|
-
weekStart: 52
|
|
6439
|
-
},
|
|
6440
|
-
{
|
|
6441
|
-
label: "DAI",
|
|
6442
|
-
distributor: "0x95FaE1C936B4Cd6c5099d7A705D792ee6aC9FEc3",
|
|
6443
|
-
token: "0x04DF6e4121c27713ED22341E7c7Df330F56f289B",
|
|
6444
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/sample-tree/reports-kovan/_current-dai.json",
|
|
6445
|
-
weekStart: 1
|
|
6446
|
-
}
|
|
6447
|
-
],
|
|
6448
|
-
"137": [
|
|
6449
|
-
{
|
|
6450
|
-
label: "BAL",
|
|
6451
|
-
distributor: "0xd2EB7Bd802A7CA68d9AcD209bEc4E664A9abDD7b",
|
|
6452
|
-
token: "0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3",
|
|
6453
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-polygon.json",
|
|
6454
|
-
weekStart: 1
|
|
6455
|
-
},
|
|
6456
|
-
{
|
|
6457
|
-
label: "WMATIC",
|
|
6458
|
-
distributor: "0x087A7AFB6975A2837453BE685EB6272576c0bC06",
|
|
6459
|
-
token: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
|
|
6460
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-wmatic-polygon.json",
|
|
6461
|
-
weekStart: 1
|
|
6462
|
-
},
|
|
6463
|
-
{
|
|
6464
|
-
label: "WMATIC",
|
|
6465
|
-
distributor: "0xBd44C01EC7d623372B4572247afB6231eDD8486F",
|
|
6466
|
-
token: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
|
|
6467
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-wmatic-polygon.json",
|
|
6468
|
-
weekStart: 4
|
|
6469
|
-
},
|
|
6470
|
-
{
|
|
6471
|
-
label: "WMATIC",
|
|
6472
|
-
distributor: "0x632208491602Dd205da8Cb9C0BA98620fc19854A",
|
|
6473
|
-
token: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
|
|
6474
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-wmatic-polygon.json",
|
|
6475
|
-
weekStart: 5
|
|
6476
|
-
},
|
|
6477
|
-
{
|
|
6478
|
-
label: "TUSD",
|
|
6479
|
-
distributor: "0x09f3010ec0f6d72ef8ff2008f8e756d60482c9a8",
|
|
6480
|
-
token: "0x2e1ad108ff1d8c782fcbbb89aad783ac49586756",
|
|
6481
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-tusd-polygon.json",
|
|
6482
|
-
weekStart: 1
|
|
6483
|
-
}
|
|
6484
|
-
],
|
|
6485
|
-
"42161": [
|
|
6486
|
-
{
|
|
6487
|
-
label: "BAL",
|
|
6488
|
-
distributor: "0xd2EB7Bd802A7CA68d9AcD209bEc4E664A9abDD7b",
|
|
6489
|
-
token: "0x040d1EdC9569d4Bab2D15287Dc5A4F10F56a56B8",
|
|
6490
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-arbitrum.json",
|
|
6491
|
-
weekStart: 6
|
|
6492
|
-
},
|
|
6493
|
-
{
|
|
6494
|
-
label: "MCB",
|
|
6495
|
-
distributor: "0x25c646adf184051b35a405b9aaeba321e8d5342a",
|
|
6496
|
-
token: "0x4e352cf164e64adcbad318c3a1e222e9eba4ce42",
|
|
6497
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-mcdex-arbitrum.json",
|
|
6498
|
-
weekStart: 4
|
|
6499
|
-
},
|
|
6500
|
-
{
|
|
6501
|
-
label: "PICKLE",
|
|
6502
|
-
distributor: "0xf02CeB58d549E4b403e8F85FBBaEe4c5dfA47c01",
|
|
6503
|
-
token: "0x965772e0e9c84b6f359c8597c891108dcf1c5b1a",
|
|
6504
|
-
manifest: "https://raw.githubusercontent.com/balancer-labs/bal-mining-scripts/master/reports/_current-pickle-arbitrum.json",
|
|
6505
|
-
weekStart: 4
|
|
6506
|
-
}
|
|
6507
|
-
]
|
|
6508
|
-
};
|
|
6509
|
-
|
|
6510
6397
|
var ClaimService = /*#__PURE__*/function () {
|
|
6511
6398
|
function ClaimService(network, signer) {
|
|
6512
6399
|
this.network = network;
|
|
@@ -6524,29 +6411,33 @@ var ClaimService = /*#__PURE__*/function () {
|
|
|
6524
6411
|
while (1) {
|
|
6525
6412
|
switch (_context.prev = _context.next) {
|
|
6526
6413
|
case 0:
|
|
6527
|
-
|
|
6414
|
+
_context.next = 2;
|
|
6415
|
+
return this.getTokenClaimsInfo();
|
|
6416
|
+
|
|
6417
|
+
case 2:
|
|
6418
|
+
tokenClaimsInfo = _context.sent;
|
|
6528
6419
|
|
|
6529
6420
|
if (!(tokenClaimsInfo != null)) {
|
|
6530
|
-
_context.next =
|
|
6421
|
+
_context.next = 9;
|
|
6531
6422
|
break;
|
|
6532
6423
|
}
|
|
6533
6424
|
|
|
6534
|
-
_context.next =
|
|
6425
|
+
_context.next = 6;
|
|
6535
6426
|
return Promise.all(tokenClaimsInfo.map(function (tokenClaimInfo) {
|
|
6536
6427
|
return _this.getTokenPendingClaims(tokenClaimInfo, address.getAddress(account));
|
|
6537
6428
|
}));
|
|
6538
6429
|
|
|
6539
|
-
case
|
|
6430
|
+
case 6:
|
|
6540
6431
|
multiTokenPendingClaims = _context.sent;
|
|
6541
6432
|
multiTokenPendingClaimsWithRewards = multiTokenPendingClaims.filter(function (pendingClaim) {
|
|
6542
6433
|
return Number(pendingClaim.availableToClaim) > 0;
|
|
6543
6434
|
});
|
|
6544
6435
|
return _context.abrupt("return", multiTokenPendingClaimsWithRewards);
|
|
6545
6436
|
|
|
6546
|
-
case
|
|
6437
|
+
case 9:
|
|
6547
6438
|
return _context.abrupt("return", []);
|
|
6548
6439
|
|
|
6549
|
-
case
|
|
6440
|
+
case 10:
|
|
6550
6441
|
case "end":
|
|
6551
6442
|
return _context.stop();
|
|
6552
6443
|
}
|
|
@@ -6629,124 +6520,40 @@ var ClaimService = /*#__PURE__*/function () {
|
|
|
6629
6520
|
return getTokenPendingClaims;
|
|
6630
6521
|
}();
|
|
6631
6522
|
|
|
6632
|
-
_proto.
|
|
6633
|
-
var
|
|
6634
|
-
var
|
|
6523
|
+
_proto.multiTokenClaimRewards = /*#__PURE__*/function () {
|
|
6524
|
+
var _multiTokenClaimRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(account, multiTokenPendingClaims) {
|
|
6525
|
+
var _this2 = this;
|
|
6635
6526
|
|
|
6527
|
+
var multiTokenClaims;
|
|
6636
6528
|
return runtime_1.wrap(function _callee3$(_context3) {
|
|
6637
6529
|
while (1) {
|
|
6638
6530
|
switch (_context3.prev = _context3.next) {
|
|
6639
6531
|
case 0:
|
|
6640
6532
|
_context3.prev = 0;
|
|
6641
6533
|
_context3.next = 3;
|
|
6642
|
-
return axios.get("https://api.balancer.finance/liquidity-mining/v1/liquidity-provider-multitoken/" + account);
|
|
6643
|
-
|
|
6644
|
-
case 3:
|
|
6645
|
-
response = _context3.sent;
|
|
6646
|
-
|
|
6647
|
-
if (!response.data.success) {
|
|
6648
|
-
_context3.next = 10;
|
|
6649
|
-
break;
|
|
6650
|
-
}
|
|
6651
|
-
|
|
6652
|
-
multiTokenLiquidityProviders = response.data.result["liquidity-providers"].filter(function (incentive) {
|
|
6653
|
-
return incentive.chain_id === 137;
|
|
6654
|
-
}).map(function (incentive) {
|
|
6655
|
-
return _extends({}, incentive, {
|
|
6656
|
-
token_address: address.getAddress(incentive.token_address)
|
|
6657
|
-
});
|
|
6658
|
-
});
|
|
6659
|
-
multiTokenCurrentRewardsEstimate = [];
|
|
6660
|
-
multiTokenLiquidityProvidersByToken = Object.entries(lodash.groupBy(multiTokenLiquidityProviders, "token_address"));
|
|
6661
|
-
|
|
6662
|
-
for (_i = 0, _multiTokenLiquidityP = multiTokenLiquidityProvidersByToken; _i < _multiTokenLiquidityP.length; _i++) {
|
|
6663
|
-
_multiTokenLiquidityP2 = _multiTokenLiquidityP[_i], token = _multiTokenLiquidityP2[0], liquidityProvider = _multiTokenLiquidityP2[1];
|
|
6664
|
-
rewards = liquidityProvider.reduce(function (total, _ref3) {
|
|
6665
|
-
var current_estimate = _ref3.current_estimate;
|
|
6666
|
-
return total.plus(current_estimate);
|
|
6667
|
-
}, bnum(0)).toString();
|
|
6668
|
-
velocity = (_liquidityProvider$fi = (_liquidityProvider$fi2 = liquidityProvider.find(function (liquidityProvider) {
|
|
6669
|
-
return Number(liquidityProvider.velocity) > 0;
|
|
6670
|
-
})) == null ? void 0 : _liquidityProvider$fi2.velocity.toString()) != null ? _liquidityProvider$fi : "0";
|
|
6671
|
-
|
|
6672
|
-
if (Number(rewards) > 0) {
|
|
6673
|
-
multiTokenCurrentRewardsEstimate.push({
|
|
6674
|
-
rewards: rewards,
|
|
6675
|
-
velocity: velocity,
|
|
6676
|
-
token: address.getAddress(token)
|
|
6677
|
-
});
|
|
6678
|
-
}
|
|
6679
|
-
}
|
|
6680
|
-
|
|
6681
|
-
return _context3.abrupt("return", {
|
|
6682
|
-
data: multiTokenCurrentRewardsEstimate,
|
|
6683
|
-
timestamp: response.data.result.current_timestamp
|
|
6684
|
-
});
|
|
6685
|
-
|
|
6686
|
-
case 10:
|
|
6687
|
-
_context3.next = 15;
|
|
6688
|
-
break;
|
|
6689
|
-
|
|
6690
|
-
case 12:
|
|
6691
|
-
_context3.prev = 12;
|
|
6692
|
-
_context3.t0 = _context3["catch"](0);
|
|
6693
|
-
console.log("[Claim] Current Rewards Estimate Error", _context3.t0);
|
|
6694
|
-
|
|
6695
|
-
case 15:
|
|
6696
|
-
return _context3.abrupt("return", {
|
|
6697
|
-
data: [],
|
|
6698
|
-
timestamp: null
|
|
6699
|
-
});
|
|
6700
|
-
|
|
6701
|
-
case 16:
|
|
6702
|
-
case "end":
|
|
6703
|
-
return _context3.stop();
|
|
6704
|
-
}
|
|
6705
|
-
}
|
|
6706
|
-
}, _callee3, null, [[0, 12]]);
|
|
6707
|
-
}));
|
|
6708
|
-
|
|
6709
|
-
function getMultiTokensCurrentRewardsEstimate(_x4) {
|
|
6710
|
-
return _getMultiTokensCurrentRewardsEstimate.apply(this, arguments);
|
|
6711
|
-
}
|
|
6712
|
-
|
|
6713
|
-
return getMultiTokensCurrentRewardsEstimate;
|
|
6714
|
-
}();
|
|
6715
|
-
|
|
6716
|
-
_proto.multiTokenClaimRewards = /*#__PURE__*/function () {
|
|
6717
|
-
var _multiTokenClaimRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(account, multiTokenPendingClaims) {
|
|
6718
|
-
var _this2 = this;
|
|
6719
|
-
|
|
6720
|
-
var multiTokenClaims;
|
|
6721
|
-
return runtime_1.wrap(function _callee4$(_context4) {
|
|
6722
|
-
while (1) {
|
|
6723
|
-
switch (_context4.prev = _context4.next) {
|
|
6724
|
-
case 0:
|
|
6725
|
-
_context4.prev = 0;
|
|
6726
|
-
_context4.next = 3;
|
|
6727
6534
|
return Promise.all(multiTokenPendingClaims.map(function (tokenPendingClaims, tokenIndex) {
|
|
6728
6535
|
return _this2.computeClaimProofs(tokenPendingClaims, address.getAddress(account), tokenIndex);
|
|
6729
6536
|
}));
|
|
6730
6537
|
|
|
6731
6538
|
case 3:
|
|
6732
|
-
multiTokenClaims =
|
|
6733
|
-
return
|
|
6539
|
+
multiTokenClaims = _context3.sent;
|
|
6540
|
+
return _context3.abrupt("return", lodash.flatten(multiTokenClaims));
|
|
6734
6541
|
|
|
6735
6542
|
case 7:
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
console.log("[Claim] Claim Rewards Error:",
|
|
6739
|
-
return
|
|
6543
|
+
_context3.prev = 7;
|
|
6544
|
+
_context3.t0 = _context3["catch"](0);
|
|
6545
|
+
console.log("[Claim] Claim Rewards Error:", _context3.t0);
|
|
6546
|
+
return _context3.abrupt("return", Promise.reject(_context3.t0));
|
|
6740
6547
|
|
|
6741
6548
|
case 11:
|
|
6742
6549
|
case "end":
|
|
6743
|
-
return
|
|
6550
|
+
return _context3.stop();
|
|
6744
6551
|
}
|
|
6745
6552
|
}
|
|
6746
|
-
},
|
|
6553
|
+
}, _callee3, null, [[0, 7]]);
|
|
6747
6554
|
}));
|
|
6748
6555
|
|
|
6749
|
-
function multiTokenClaimRewards(
|
|
6556
|
+
function multiTokenClaimRewards(_x4, _x5) {
|
|
6750
6557
|
return _multiTokenClaimRewards.apply(this, arguments);
|
|
6751
6558
|
}
|
|
6752
6559
|
|
|
@@ -6754,14 +6561,14 @@ var ClaimService = /*#__PURE__*/function () {
|
|
|
6754
6561
|
}();
|
|
6755
6562
|
|
|
6756
6563
|
_proto.computeClaimProofs = /*#__PURE__*/function () {
|
|
6757
|
-
var _computeClaimProofs = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
6564
|
+
var _computeClaimProofs = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(tokenPendingClaims, account, tokenIndex) {
|
|
6758
6565
|
var _this3 = this;
|
|
6759
6566
|
|
|
6760
|
-
return runtime_1.wrap(function
|
|
6567
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
6761
6568
|
while (1) {
|
|
6762
|
-
switch (
|
|
6569
|
+
switch (_context4.prev = _context4.next) {
|
|
6763
6570
|
case 0:
|
|
6764
|
-
return
|
|
6571
|
+
return _context4.abrupt("return", Promise.all(tokenPendingClaims.claims.map(function (claim) {
|
|
6765
6572
|
var payload = {
|
|
6766
6573
|
account: account,
|
|
6767
6574
|
distributor: tokenPendingClaims.tokenClaimInfo.distributor,
|
|
@@ -6776,13 +6583,13 @@ var ClaimService = /*#__PURE__*/function () {
|
|
|
6776
6583
|
|
|
6777
6584
|
case 1:
|
|
6778
6585
|
case "end":
|
|
6779
|
-
return
|
|
6586
|
+
return _context4.stop();
|
|
6780
6587
|
}
|
|
6781
6588
|
}
|
|
6782
|
-
},
|
|
6589
|
+
}, _callee4);
|
|
6783
6590
|
}));
|
|
6784
6591
|
|
|
6785
|
-
function computeClaimProofs(_x7, _x8
|
|
6592
|
+
function computeClaimProofs(_x6, _x7, _x8) {
|
|
6786
6593
|
return _computeClaimProofs.apply(this, arguments);
|
|
6787
6594
|
}
|
|
6788
6595
|
|
|
@@ -6809,20 +6616,59 @@ var ClaimService = /*#__PURE__*/function () {
|
|
|
6809
6616
|
return [parseInt(claim.id), scaledBalance, distributor, tokenIndex, proof];
|
|
6810
6617
|
};
|
|
6811
6618
|
|
|
6812
|
-
_proto.getTokenClaimsInfo = function
|
|
6813
|
-
var
|
|
6619
|
+
_proto.getTokenClaimsInfo = /*#__PURE__*/function () {
|
|
6620
|
+
var _getTokenClaimsInfo = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
|
|
6621
|
+
var tokenClaims, multiTokenClaim, chainId;
|
|
6622
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
6623
|
+
while (1) {
|
|
6624
|
+
switch (_context5.prev = _context5.next) {
|
|
6625
|
+
case 0:
|
|
6626
|
+
_context5.prev = 0;
|
|
6627
|
+
_context5.next = 3;
|
|
6628
|
+
return axios.get("https://raw.githubusercontent.com/balancer-labs/frontend-v2/develop/src/services/claim/MultiTokenClaim.json");
|
|
6814
6629
|
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6630
|
+
case 3:
|
|
6631
|
+
multiTokenClaim = _context5.sent;
|
|
6632
|
+
chainId = networkChainIdMap[this.network];
|
|
6633
|
+
tokenClaims = multiTokenClaim.data[chainId];
|
|
6634
|
+
_context5.next = 11;
|
|
6635
|
+
break;
|
|
6636
|
+
|
|
6637
|
+
case 8:
|
|
6638
|
+
_context5.prev = 8;
|
|
6639
|
+
_context5.t0 = _context5["catch"](0);
|
|
6640
|
+
console.log("balancer multi token info error", _context5.t0);
|
|
6641
|
+
|
|
6642
|
+
case 11:
|
|
6643
|
+
if (!(tokenClaims != null)) {
|
|
6644
|
+
_context5.next = 13;
|
|
6645
|
+
break;
|
|
6646
|
+
}
|
|
6647
|
+
|
|
6648
|
+
return _context5.abrupt("return", tokenClaims.map(function (tokenClaim) {
|
|
6649
|
+
return _extends({}, tokenClaim, {
|
|
6650
|
+
token: address.getAddress(tokenClaim.token),
|
|
6651
|
+
decimals: 18
|
|
6652
|
+
});
|
|
6653
|
+
}));
|
|
6654
|
+
|
|
6655
|
+
case 13:
|
|
6656
|
+
return _context5.abrupt("return", null);
|
|
6657
|
+
|
|
6658
|
+
case 14:
|
|
6659
|
+
case "end":
|
|
6660
|
+
return _context5.stop();
|
|
6661
|
+
}
|
|
6662
|
+
}
|
|
6663
|
+
}, _callee5, this, [[0, 8]]);
|
|
6664
|
+
}));
|
|
6665
|
+
|
|
6666
|
+
function getTokenClaimsInfo() {
|
|
6667
|
+
return _getTokenClaimsInfo.apply(this, arguments);
|
|
6822
6668
|
}
|
|
6823
6669
|
|
|
6824
|
-
return
|
|
6825
|
-
};
|
|
6670
|
+
return getTokenClaimsInfo;
|
|
6671
|
+
}();
|
|
6826
6672
|
|
|
6827
6673
|
_proto.getSnapshot = /*#__PURE__*/function () {
|
|
6828
6674
|
var _getSnapshot = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(manifest) {
|
|
@@ -6852,7 +6698,7 @@ var ClaimService = /*#__PURE__*/function () {
|
|
|
6852
6698
|
}, _callee6, null, [[0, 7]]);
|
|
6853
6699
|
}));
|
|
6854
6700
|
|
|
6855
|
-
function getSnapshot(
|
|
6701
|
+
function getSnapshot(_x9) {
|
|
6856
6702
|
return _getSnapshot.apply(this, arguments);
|
|
6857
6703
|
}
|
|
6858
6704
|
|
|
@@ -6918,7 +6764,7 @@ var ClaimService = /*#__PURE__*/function () {
|
|
|
6918
6764
|
}, _callee7, this, [[3, 14]]);
|
|
6919
6765
|
}));
|
|
6920
6766
|
|
|
6921
|
-
function getClaimStatus(_x11, _x12
|
|
6767
|
+
function getClaimStatus(_x10, _x11, _x12) {
|
|
6922
6768
|
return _getClaimStatus.apply(this, arguments);
|
|
6923
6769
|
}
|
|
6924
6770
|
|
|
@@ -6953,7 +6799,7 @@ var ClaimService = /*#__PURE__*/function () {
|
|
|
6953
6799
|
}, _callee8);
|
|
6954
6800
|
}));
|
|
6955
6801
|
|
|
6956
|
-
function getReports(
|
|
6802
|
+
function getReports(_x13, _x14) {
|
|
6957
6803
|
return _getReports.apply(this, arguments);
|
|
6958
6804
|
}
|
|
6959
6805
|
|
|
@@ -7536,7 +7382,8 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7536
7382
|
* Lend asset to a lending pool
|
|
7537
7383
|
* @param {Dapp} dapp Platform like Aave
|
|
7538
7384
|
* @param {string} asset Asset
|
|
7539
|
-
* @param
|
|
7385
|
+
* @param {BigNumber | string} amount Amount of asset to lend
|
|
7386
|
+
* @param {number} referrralCode Code from Aave referral program
|
|
7540
7387
|
* @param {any} options Transaction options
|
|
7541
7388
|
* @returns {Promise<any>} Transaction
|
|
7542
7389
|
*/
|
|
@@ -7545,26 +7392,30 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7545
7392
|
_proto.lend =
|
|
7546
7393
|
/*#__PURE__*/
|
|
7547
7394
|
function () {
|
|
7548
|
-
var _lend = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(dapp, asset, amount, options) {
|
|
7395
|
+
var _lend = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(dapp, asset, amount, referrralCode, options) {
|
|
7549
7396
|
var iLendingPool, depositTxData, tx;
|
|
7550
7397
|
return runtime_1.wrap(function _callee12$(_context12) {
|
|
7551
7398
|
while (1) {
|
|
7552
7399
|
switch (_context12.prev = _context12.next) {
|
|
7553
7400
|
case 0:
|
|
7401
|
+
if (referrralCode === void 0) {
|
|
7402
|
+
referrralCode = 0;
|
|
7403
|
+
}
|
|
7404
|
+
|
|
7554
7405
|
if (options === void 0) {
|
|
7555
7406
|
options = null;
|
|
7556
7407
|
}
|
|
7557
7408
|
|
|
7558
7409
|
iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
|
|
7559
|
-
depositTxData = iLendingPool.encodeFunctionData(exports.Transaction.DEPOSIT, [asset, amount, this.address,
|
|
7560
|
-
_context12.next =
|
|
7410
|
+
depositTxData = iLendingPool.encodeFunctionData(exports.Transaction.DEPOSIT, [asset, amount, this.address, referrralCode]);
|
|
7411
|
+
_context12.next = 6;
|
|
7561
7412
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], depositTxData, options);
|
|
7562
7413
|
|
|
7563
|
-
case
|
|
7414
|
+
case 6:
|
|
7564
7415
|
tx = _context12.sent;
|
|
7565
7416
|
return _context12.abrupt("return", tx);
|
|
7566
7417
|
|
|
7567
|
-
case
|
|
7418
|
+
case 8:
|
|
7568
7419
|
case "end":
|
|
7569
7420
|
return _context12.stop();
|
|
7570
7421
|
}
|
|
@@ -7572,7 +7423,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7572
7423
|
}, _callee12, this);
|
|
7573
7424
|
}));
|
|
7574
7425
|
|
|
7575
|
-
function lend(_x42, _x43, _x44, _x45) {
|
|
7426
|
+
function lend(_x42, _x43, _x44, _x45, _x46) {
|
|
7576
7427
|
return _lend.apply(this, arguments);
|
|
7577
7428
|
}
|
|
7578
7429
|
|
|
@@ -7618,7 +7469,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7618
7469
|
}, _callee13, this);
|
|
7619
7470
|
}));
|
|
7620
7471
|
|
|
7621
|
-
function withdrawDeposit(
|
|
7472
|
+
function withdrawDeposit(_x47, _x48, _x49, _x50) {
|
|
7622
7473
|
return _withdrawDeposit.apply(this, arguments);
|
|
7623
7474
|
}
|
|
7624
7475
|
|
|
@@ -7629,6 +7480,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7629
7480
|
* @param {Dapp} dapp Platform like Aave
|
|
7630
7481
|
* @param {string} asset Asset
|
|
7631
7482
|
* @param {BigNumber | string} amount Amount of asset to lend
|
|
7483
|
+
* @param {number} referrralCode Code from Aave referral program
|
|
7632
7484
|
* @param {any} options Transaction options
|
|
7633
7485
|
* @returns {Promise<any>} Transaction
|
|
7634
7486
|
*/
|
|
@@ -7637,26 +7489,30 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7637
7489
|
_proto.borrow =
|
|
7638
7490
|
/*#__PURE__*/
|
|
7639
7491
|
function () {
|
|
7640
|
-
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(dapp, asset, amount, options) {
|
|
7492
|
+
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(dapp, asset, amount, referrralCode, options) {
|
|
7641
7493
|
var iLendingPool, borrowTxData, tx;
|
|
7642
7494
|
return runtime_1.wrap(function _callee14$(_context14) {
|
|
7643
7495
|
while (1) {
|
|
7644
7496
|
switch (_context14.prev = _context14.next) {
|
|
7645
7497
|
case 0:
|
|
7498
|
+
if (referrralCode === void 0) {
|
|
7499
|
+
referrralCode = 0;
|
|
7500
|
+
}
|
|
7501
|
+
|
|
7646
7502
|
if (options === void 0) {
|
|
7647
7503
|
options = null;
|
|
7648
7504
|
}
|
|
7649
7505
|
|
|
7650
7506
|
iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
|
|
7651
|
-
borrowTxData = iLendingPool.encodeFunctionData(exports.Transaction.BORROW, [asset, amount, 2,
|
|
7652
|
-
_context14.next =
|
|
7507
|
+
borrowTxData = iLendingPool.encodeFunctionData(exports.Transaction.BORROW, [asset, amount, 2, referrralCode, this.address]);
|
|
7508
|
+
_context14.next = 6;
|
|
7653
7509
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], borrowTxData, options);
|
|
7654
7510
|
|
|
7655
|
-
case
|
|
7511
|
+
case 6:
|
|
7656
7512
|
tx = _context14.sent;
|
|
7657
7513
|
return _context14.abrupt("return", tx);
|
|
7658
7514
|
|
|
7659
|
-
case
|
|
7515
|
+
case 8:
|
|
7660
7516
|
case "end":
|
|
7661
7517
|
return _context14.stop();
|
|
7662
7518
|
}
|
|
@@ -7664,7 +7520,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7664
7520
|
}, _callee14, this);
|
|
7665
7521
|
}));
|
|
7666
7522
|
|
|
7667
|
-
function borrow(
|
|
7523
|
+
function borrow(_x51, _x52, _x53, _x54, _x55) {
|
|
7668
7524
|
return _borrow.apply(this, arguments);
|
|
7669
7525
|
}
|
|
7670
7526
|
|
|
@@ -7710,7 +7566,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7710
7566
|
}, _callee15, this);
|
|
7711
7567
|
}));
|
|
7712
7568
|
|
|
7713
|
-
function repay(
|
|
7569
|
+
function repay(_x56, _x57, _x58, _x59) {
|
|
7714
7570
|
return _repay.apply(this, arguments);
|
|
7715
7571
|
}
|
|
7716
7572
|
|
|
@@ -7760,7 +7616,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7760
7616
|
}, _callee16, this);
|
|
7761
7617
|
}));
|
|
7762
7618
|
|
|
7763
|
-
function harvestRewards(
|
|
7619
|
+
function harvestRewards(_x60, _x61, _x62) {
|
|
7764
7620
|
return _harvestRewards.apply(this, arguments);
|
|
7765
7621
|
}
|
|
7766
7622
|
|
|
@@ -7819,7 +7675,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7819
7675
|
}, _callee17, this);
|
|
7820
7676
|
}));
|
|
7821
7677
|
|
|
7822
|
-
function changeAssets(
|
|
7678
|
+
function changeAssets(_x63, _x64) {
|
|
7823
7679
|
return _changeAssets.apply(this, arguments);
|
|
7824
7680
|
}
|
|
7825
7681
|
|
|
@@ -7861,7 +7717,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7861
7717
|
}, _callee18, this);
|
|
7862
7718
|
}));
|
|
7863
7719
|
|
|
7864
|
-
function setTrader(
|
|
7720
|
+
function setTrader(_x65, _x66) {
|
|
7865
7721
|
return _setTrader.apply(this, arguments);
|
|
7866
7722
|
}
|
|
7867
7723
|
|
|
@@ -7906,7 +7762,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7906
7762
|
}, _callee19, this);
|
|
7907
7763
|
}));
|
|
7908
7764
|
|
|
7909
|
-
function joinBalancerPool(
|
|
7765
|
+
function joinBalancerPool(_x67, _x68, _x69, _x70) {
|
|
7910
7766
|
return _joinBalancerPool.apply(this, arguments);
|
|
7911
7767
|
}
|
|
7912
7768
|
|
|
@@ -7951,7 +7807,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
7951
7807
|
}, _callee20, this);
|
|
7952
7808
|
}));
|
|
7953
7809
|
|
|
7954
|
-
function exitBalancerPool(
|
|
7810
|
+
function exitBalancerPool(_x71, _x72, _x73, _x74) {
|
|
7955
7811
|
return _exitBalancerPool.apply(this, arguments);
|
|
7956
7812
|
}
|
|
7957
7813
|
|
|
@@ -8009,7 +7865,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
8009
7865
|
}, _callee21, this);
|
|
8010
7866
|
}));
|
|
8011
7867
|
|
|
8012
|
-
function harvestBalancerRewards(
|
|
7868
|
+
function harvestBalancerRewards(_x75) {
|
|
8013
7869
|
return _harvestBalancerRewards.apply(this, arguments);
|
|
8014
7870
|
}
|
|
8015
7871
|
|
|
@@ -8060,7 +7916,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
8060
7916
|
}, _callee22, this);
|
|
8061
7917
|
}));
|
|
8062
7918
|
|
|
8063
|
-
function harvestAaveRewards(
|
|
7919
|
+
function harvestAaveRewards(_x76, _x77) {
|
|
8064
7920
|
return _harvestAaveRewards.apply(this, arguments);
|
|
8065
7921
|
}
|
|
8066
7922
|
|