@dhedge/v2-sdk 1.1.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/README.md +60 -3
- package/dist/config.d.ts +2 -0
- package/dist/entities/pool.d.ts +37 -3
- package/dist/entities/utils.d.ts +4 -0
- package/dist/services/claim-balancer/claim.service.d.ts +17 -0
- package/dist/services/claim-balancer/claim.worker.d.ts +4 -0
- package/dist/services/claim-balancer/ipfs.service.d.ts +4 -0
- package/dist/services/claim-balancer/types.d.ts +54 -0
- package/dist/test/constants.d.ts +12 -0
- package/dist/types.d.ts +5 -2
- package/dist/utils/contract.d.ts +14 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/merkle.d.ts +22 -0
- package/dist/v2-sdk.cjs.development.js +3497 -690
- 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 +3497 -690
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +9 -2
- package/src/abi/IAaveIncentivesController.json +50 -0
- package/src/abi/IBalancerMerkleOrchard.json +353 -0
- package/src/abi/IBalancertV2Vault.json +938 -0
- package/src/config.ts +21 -4
- package/src/entities/pool.ts +148 -5
- package/src/entities/utils.ts +135 -0
- package/src/services/claim-balancer/MultiTokenClaim.json +115 -0
- package/src/services/claim-balancer/claim.service.ts +262 -0
- package/src/services/claim-balancer/claim.worker.ts +32 -0
- package/src/services/claim-balancer/ipfs.service.ts +12 -0
- package/src/services/claim-balancer/types.ts +66 -0
- package/src/test/aave.test.ts +73 -0
- package/src/test/balancer.test.ts +109 -0
- package/src/test/constants.ts +13 -0
- package/src/test/oneInch.test.ts +56 -0
- package/src/test/pool.test.ts +5 -244
- package/src/test/sushi.test.ts +173 -0
- package/src/test/utils.test.ts +41 -26
- package/src/types.ts +6 -3
- package/src/utils/contract.ts +95 -0
- package/src/utils/index.ts +38 -0
- package/src/utils/merkle.ts +172 -0
|
@@ -7,6 +7,14 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
7
7
|
var ethers = require('ethers');
|
|
8
8
|
var sdk = require('@sushiswap/sdk');
|
|
9
9
|
var axios = _interopDefault(require('axios'));
|
|
10
|
+
var lodash = require('lodash');
|
|
11
|
+
var address = require('@ethersproject/address');
|
|
12
|
+
require('lodash/set');
|
|
13
|
+
var abi$c = require('@ethersproject/abi');
|
|
14
|
+
var BigNumber = _interopDefault(require('bignumber.js'));
|
|
15
|
+
var web3Utils = require('web3-utils');
|
|
16
|
+
var ethereumjsUtil = require('ethereumjs-util');
|
|
17
|
+
var sor = require('@balancer-labs/sor');
|
|
10
18
|
|
|
11
19
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
12
20
|
try {
|
|
@@ -44,6 +52,24 @@ function _asyncToGenerator(fn) {
|
|
|
44
52
|
};
|
|
45
53
|
}
|
|
46
54
|
|
|
55
|
+
function _extends() {
|
|
56
|
+
_extends = Object.assign || function (target) {
|
|
57
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
58
|
+
var source = arguments[i];
|
|
59
|
+
|
|
60
|
+
for (var key in source) {
|
|
61
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
62
|
+
target[key] = source[key];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return target;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return _extends.apply(this, arguments);
|
|
71
|
+
}
|
|
72
|
+
|
|
47
73
|
function createCommonjsModule(fn, module) {
|
|
48
74
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
49
75
|
}
|
|
@@ -3805,6 +3831,7 @@ var ManagerLogic = {
|
|
|
3805
3831
|
Dapp["AAVE"] = "aave";
|
|
3806
3832
|
Dapp["ONEINCH"] = "1inch";
|
|
3807
3833
|
Dapp["QUICKSWAP"] = "quickswap";
|
|
3834
|
+
Dapp["BALANCER"] = "balancer";
|
|
3808
3835
|
})(exports.Dapp || (exports.Dapp = {}));
|
|
3809
3836
|
|
|
3810
3837
|
(function (Transaction) {
|
|
@@ -3812,19 +3839,25 @@ var ManagerLogic = {
|
|
|
3812
3839
|
Transaction["ADD_LIQUIDITY"] = "addLiquidity";
|
|
3813
3840
|
Transaction["DEPOSIT"] = "deposit";
|
|
3814
3841
|
Transaction["HARVEST"] = "harvest";
|
|
3815
|
-
Transaction["
|
|
3842
|
+
Transaction["CLAIM_DISTRIBIUTIONS"] = "claimDistributions";
|
|
3843
|
+
Transaction["CLAIM_REWARDS"] = "claimRewards";
|
|
3816
3844
|
Transaction["REMOVE_LIQUIDITY"] = "removeLiquidity";
|
|
3817
3845
|
Transaction["BORROW"] = "borrow";
|
|
3818
3846
|
Transaction["REPAY"] = "repay";
|
|
3819
3847
|
Transaction["WITHDRAW"] = "withdraw";
|
|
3820
3848
|
})(exports.Transaction || (exports.Transaction = {}));
|
|
3821
3849
|
|
|
3822
|
-
var _factoryAddress, _Network$POLYGON, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _networkChainIdMap;
|
|
3823
|
-
|
|
3824
|
-
|
|
3850
|
+
var _factoryAddress, _Network$POLYGON, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _networkChainIdMap, _balancerSubgraph, _multiCallAddress;
|
|
3851
|
+
|
|
3852
|
+
require("dotenv").config();
|
|
3853
|
+
|
|
3854
|
+
var factoryAddress = (_factoryAddress = {}, _factoryAddress[exports.Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress);
|
|
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);
|
|
3825
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);
|
|
3826
|
-
var stakingAddress = (_stakingAddress = {}, _stakingAddress[exports.Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[exports.Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3), _stakingAddress);
|
|
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);
|
|
3827
3858
|
var networkChainIdMap = (_networkChainIdMap = {}, _networkChainIdMap[exports.Network.POLYGON] = sdk.ChainId.MATIC, _networkChainIdMap);
|
|
3859
|
+
var balancerSubgraph = (_balancerSubgraph = {}, _balancerSubgraph[exports.Network.POLYGON] = "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2", _balancerSubgraph);
|
|
3860
|
+
var multiCallAddress = (_multiCallAddress = {}, _multiCallAddress[exports.Network.POLYGON] = "0x275617327c958bD06b5D6b871E7f491D76113dd8", _multiCallAddress);
|
|
3828
3861
|
|
|
3829
3862
|
var abi$3 = [
|
|
3830
3863
|
{
|
|
@@ -5562,251 +5595,1465 @@ var IUniswapV2Router = {
|
|
|
5562
5595
|
abi: abi$6
|
|
5563
5596
|
};
|
|
5564
5597
|
|
|
5565
|
-
var
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5598
|
+
var abi$7 = [
|
|
5599
|
+
{
|
|
5600
|
+
inputs: [
|
|
5601
|
+
{
|
|
5602
|
+
internalType: "contract IVault",
|
|
5603
|
+
name: "vault",
|
|
5604
|
+
type: "address"
|
|
5605
|
+
}
|
|
5606
|
+
],
|
|
5607
|
+
stateMutability: "nonpayable",
|
|
5608
|
+
type: "constructor"
|
|
5609
|
+
},
|
|
5610
|
+
{
|
|
5611
|
+
anonymous: false,
|
|
5612
|
+
inputs: [
|
|
5613
|
+
{
|
|
5614
|
+
indexed: true,
|
|
5615
|
+
internalType: "address",
|
|
5616
|
+
name: "distributor",
|
|
5617
|
+
type: "address"
|
|
5618
|
+
},
|
|
5619
|
+
{
|
|
5620
|
+
indexed: true,
|
|
5621
|
+
internalType: "contract IERC20",
|
|
5622
|
+
name: "token",
|
|
5623
|
+
type: "address"
|
|
5624
|
+
},
|
|
5625
|
+
{
|
|
5626
|
+
indexed: false,
|
|
5627
|
+
internalType: "uint256",
|
|
5628
|
+
name: "distributionId",
|
|
5629
|
+
type: "uint256"
|
|
5630
|
+
},
|
|
5631
|
+
{
|
|
5632
|
+
indexed: false,
|
|
5633
|
+
internalType: "bytes32",
|
|
5634
|
+
name: "merkleRoot",
|
|
5635
|
+
type: "bytes32"
|
|
5636
|
+
},
|
|
5637
|
+
{
|
|
5638
|
+
indexed: false,
|
|
5639
|
+
internalType: "uint256",
|
|
5640
|
+
name: "amount",
|
|
5641
|
+
type: "uint256"
|
|
5642
|
+
}
|
|
5643
|
+
],
|
|
5644
|
+
name: "DistributionAdded",
|
|
5645
|
+
type: "event"
|
|
5646
|
+
},
|
|
5647
|
+
{
|
|
5648
|
+
anonymous: false,
|
|
5649
|
+
inputs: [
|
|
5650
|
+
{
|
|
5651
|
+
indexed: true,
|
|
5652
|
+
internalType: "address",
|
|
5653
|
+
name: "distributor",
|
|
5654
|
+
type: "address"
|
|
5655
|
+
},
|
|
5656
|
+
{
|
|
5657
|
+
indexed: true,
|
|
5658
|
+
internalType: "contract IERC20",
|
|
5659
|
+
name: "token",
|
|
5660
|
+
type: "address"
|
|
5661
|
+
},
|
|
5662
|
+
{
|
|
5663
|
+
indexed: false,
|
|
5664
|
+
internalType: "uint256",
|
|
5665
|
+
name: "distributionId",
|
|
5666
|
+
type: "uint256"
|
|
5667
|
+
},
|
|
5668
|
+
{
|
|
5669
|
+
indexed: true,
|
|
5670
|
+
internalType: "address",
|
|
5671
|
+
name: "claimer",
|
|
5672
|
+
type: "address"
|
|
5673
|
+
},
|
|
5674
|
+
{
|
|
5675
|
+
indexed: false,
|
|
5676
|
+
internalType: "address",
|
|
5677
|
+
name: "recipient",
|
|
5678
|
+
type: "address"
|
|
5679
|
+
},
|
|
5680
|
+
{
|
|
5681
|
+
indexed: false,
|
|
5682
|
+
internalType: "uint256",
|
|
5683
|
+
name: "amount",
|
|
5684
|
+
type: "uint256"
|
|
5685
|
+
}
|
|
5686
|
+
],
|
|
5687
|
+
name: "DistributionClaimed",
|
|
5688
|
+
type: "event"
|
|
5689
|
+
},
|
|
5690
|
+
{
|
|
5691
|
+
inputs: [
|
|
5692
|
+
{
|
|
5693
|
+
internalType: "address",
|
|
5694
|
+
name: "claimer",
|
|
5695
|
+
type: "address"
|
|
5696
|
+
},
|
|
5697
|
+
{
|
|
5698
|
+
components: [
|
|
5699
|
+
{
|
|
5700
|
+
internalType: "uint256",
|
|
5701
|
+
name: "distributionId",
|
|
5702
|
+
type: "uint256"
|
|
5703
|
+
},
|
|
5704
|
+
{
|
|
5705
|
+
internalType: "uint256",
|
|
5706
|
+
name: "balance",
|
|
5707
|
+
type: "uint256"
|
|
5708
|
+
},
|
|
5709
|
+
{
|
|
5710
|
+
internalType: "address",
|
|
5711
|
+
name: "distributor",
|
|
5712
|
+
type: "address"
|
|
5713
|
+
},
|
|
5714
|
+
{
|
|
5715
|
+
internalType: "uint256",
|
|
5716
|
+
name: "tokenIndex",
|
|
5717
|
+
type: "uint256"
|
|
5718
|
+
},
|
|
5719
|
+
{
|
|
5720
|
+
internalType: "bytes32[]",
|
|
5721
|
+
name: "merkleProof",
|
|
5722
|
+
type: "bytes32[]"
|
|
5723
|
+
}
|
|
5724
|
+
],
|
|
5725
|
+
internalType: "struct MerkleOrchard.Claim[]",
|
|
5726
|
+
name: "claims",
|
|
5727
|
+
type: "tuple[]"
|
|
5728
|
+
},
|
|
5729
|
+
{
|
|
5730
|
+
internalType: "contract IERC20[]",
|
|
5731
|
+
name: "tokens",
|
|
5732
|
+
type: "address[]"
|
|
5733
|
+
}
|
|
5734
|
+
],
|
|
5735
|
+
name: "claimDistributions",
|
|
5736
|
+
outputs: [
|
|
5737
|
+
],
|
|
5738
|
+
stateMutability: "nonpayable",
|
|
5739
|
+
type: "function"
|
|
5740
|
+
},
|
|
5741
|
+
{
|
|
5742
|
+
inputs: [
|
|
5743
|
+
{
|
|
5744
|
+
internalType: "address",
|
|
5745
|
+
name: "claimer",
|
|
5746
|
+
type: "address"
|
|
5747
|
+
},
|
|
5748
|
+
{
|
|
5749
|
+
components: [
|
|
5750
|
+
{
|
|
5751
|
+
internalType: "uint256",
|
|
5752
|
+
name: "distributionId",
|
|
5753
|
+
type: "uint256"
|
|
5754
|
+
},
|
|
5755
|
+
{
|
|
5756
|
+
internalType: "uint256",
|
|
5757
|
+
name: "balance",
|
|
5758
|
+
type: "uint256"
|
|
5759
|
+
},
|
|
5760
|
+
{
|
|
5761
|
+
internalType: "address",
|
|
5762
|
+
name: "distributor",
|
|
5763
|
+
type: "address"
|
|
5764
|
+
},
|
|
5765
|
+
{
|
|
5766
|
+
internalType: "uint256",
|
|
5767
|
+
name: "tokenIndex",
|
|
5768
|
+
type: "uint256"
|
|
5769
|
+
},
|
|
5770
|
+
{
|
|
5771
|
+
internalType: "bytes32[]",
|
|
5772
|
+
name: "merkleProof",
|
|
5773
|
+
type: "bytes32[]"
|
|
5774
|
+
}
|
|
5775
|
+
],
|
|
5776
|
+
internalType: "struct MerkleOrchard.Claim[]",
|
|
5777
|
+
name: "claims",
|
|
5778
|
+
type: "tuple[]"
|
|
5779
|
+
},
|
|
5780
|
+
{
|
|
5781
|
+
internalType: "contract IERC20[]",
|
|
5782
|
+
name: "tokens",
|
|
5783
|
+
type: "address[]"
|
|
5784
|
+
}
|
|
5785
|
+
],
|
|
5786
|
+
name: "claimDistributionsToInternalBalance",
|
|
5787
|
+
outputs: [
|
|
5788
|
+
],
|
|
5789
|
+
stateMutability: "nonpayable",
|
|
5790
|
+
type: "function"
|
|
5791
|
+
},
|
|
5792
|
+
{
|
|
5793
|
+
inputs: [
|
|
5794
|
+
{
|
|
5795
|
+
internalType: "address",
|
|
5796
|
+
name: "claimer",
|
|
5797
|
+
type: "address"
|
|
5798
|
+
},
|
|
5799
|
+
{
|
|
5800
|
+
components: [
|
|
5801
|
+
{
|
|
5802
|
+
internalType: "uint256",
|
|
5803
|
+
name: "distributionId",
|
|
5804
|
+
type: "uint256"
|
|
5805
|
+
},
|
|
5806
|
+
{
|
|
5807
|
+
internalType: "uint256",
|
|
5808
|
+
name: "balance",
|
|
5809
|
+
type: "uint256"
|
|
5810
|
+
},
|
|
5811
|
+
{
|
|
5812
|
+
internalType: "address",
|
|
5813
|
+
name: "distributor",
|
|
5814
|
+
type: "address"
|
|
5815
|
+
},
|
|
5816
|
+
{
|
|
5817
|
+
internalType: "uint256",
|
|
5818
|
+
name: "tokenIndex",
|
|
5819
|
+
type: "uint256"
|
|
5820
|
+
},
|
|
5821
|
+
{
|
|
5822
|
+
internalType: "bytes32[]",
|
|
5823
|
+
name: "merkleProof",
|
|
5824
|
+
type: "bytes32[]"
|
|
5825
|
+
}
|
|
5826
|
+
],
|
|
5827
|
+
internalType: "struct MerkleOrchard.Claim[]",
|
|
5828
|
+
name: "claims",
|
|
5829
|
+
type: "tuple[]"
|
|
5830
|
+
},
|
|
5831
|
+
{
|
|
5832
|
+
internalType: "contract IERC20[]",
|
|
5833
|
+
name: "tokens",
|
|
5834
|
+
type: "address[]"
|
|
5835
|
+
},
|
|
5836
|
+
{
|
|
5837
|
+
internalType: "contract IDistributorCallback",
|
|
5838
|
+
name: "callbackContract",
|
|
5839
|
+
type: "address"
|
|
5840
|
+
},
|
|
5841
|
+
{
|
|
5842
|
+
internalType: "bytes",
|
|
5843
|
+
name: "callbackData",
|
|
5844
|
+
type: "bytes"
|
|
5845
|
+
}
|
|
5846
|
+
],
|
|
5847
|
+
name: "claimDistributionsWithCallback",
|
|
5848
|
+
outputs: [
|
|
5849
|
+
],
|
|
5850
|
+
stateMutability: "nonpayable",
|
|
5851
|
+
type: "function"
|
|
5852
|
+
},
|
|
5853
|
+
{
|
|
5854
|
+
inputs: [
|
|
5855
|
+
{
|
|
5856
|
+
internalType: "contract IERC20",
|
|
5857
|
+
name: "token",
|
|
5858
|
+
type: "address"
|
|
5859
|
+
},
|
|
5860
|
+
{
|
|
5861
|
+
internalType: "bytes32",
|
|
5862
|
+
name: "merkleRoot",
|
|
5863
|
+
type: "bytes32"
|
|
5864
|
+
},
|
|
5865
|
+
{
|
|
5866
|
+
internalType: "uint256",
|
|
5867
|
+
name: "amount",
|
|
5868
|
+
type: "uint256"
|
|
5869
|
+
},
|
|
5870
|
+
{
|
|
5871
|
+
internalType: "uint256",
|
|
5872
|
+
name: "distributionId",
|
|
5873
|
+
type: "uint256"
|
|
5874
|
+
}
|
|
5875
|
+
],
|
|
5876
|
+
name: "createDistribution",
|
|
5877
|
+
outputs: [
|
|
5878
|
+
],
|
|
5879
|
+
stateMutability: "nonpayable",
|
|
5880
|
+
type: "function"
|
|
5881
|
+
},
|
|
5882
|
+
{
|
|
5883
|
+
inputs: [
|
|
5884
|
+
{
|
|
5885
|
+
internalType: "contract IERC20",
|
|
5886
|
+
name: "token",
|
|
5887
|
+
type: "address"
|
|
5888
|
+
},
|
|
5889
|
+
{
|
|
5890
|
+
internalType: "address",
|
|
5891
|
+
name: "distributor",
|
|
5892
|
+
type: "address"
|
|
5893
|
+
},
|
|
5894
|
+
{
|
|
5895
|
+
internalType: "uint256",
|
|
5896
|
+
name: "distributionId",
|
|
5897
|
+
type: "uint256"
|
|
5898
|
+
}
|
|
5899
|
+
],
|
|
5900
|
+
name: "getDistributionRoot",
|
|
5901
|
+
outputs: [
|
|
5902
|
+
{
|
|
5903
|
+
internalType: "bytes32",
|
|
5904
|
+
name: "",
|
|
5905
|
+
type: "bytes32"
|
|
5906
|
+
}
|
|
5907
|
+
],
|
|
5908
|
+
stateMutability: "view",
|
|
5909
|
+
type: "function"
|
|
5910
|
+
},
|
|
5911
|
+
{
|
|
5912
|
+
inputs: [
|
|
5913
|
+
{
|
|
5914
|
+
internalType: "contract IERC20",
|
|
5915
|
+
name: "token",
|
|
5916
|
+
type: "address"
|
|
5917
|
+
},
|
|
5918
|
+
{
|
|
5919
|
+
internalType: "address",
|
|
5920
|
+
name: "distributor",
|
|
5921
|
+
type: "address"
|
|
5922
|
+
}
|
|
5923
|
+
],
|
|
5924
|
+
name: "getNextDistributionId",
|
|
5925
|
+
outputs: [
|
|
5926
|
+
{
|
|
5927
|
+
internalType: "uint256",
|
|
5928
|
+
name: "",
|
|
5929
|
+
type: "uint256"
|
|
5930
|
+
}
|
|
5931
|
+
],
|
|
5932
|
+
stateMutability: "view",
|
|
5933
|
+
type: "function"
|
|
5934
|
+
},
|
|
5935
|
+
{
|
|
5936
|
+
inputs: [
|
|
5937
|
+
{
|
|
5938
|
+
internalType: "contract IERC20",
|
|
5939
|
+
name: "token",
|
|
5940
|
+
type: "address"
|
|
5941
|
+
},
|
|
5942
|
+
{
|
|
5943
|
+
internalType: "address",
|
|
5944
|
+
name: "distributor",
|
|
5945
|
+
type: "address"
|
|
5946
|
+
}
|
|
5947
|
+
],
|
|
5948
|
+
name: "getRemainingBalance",
|
|
5949
|
+
outputs: [
|
|
5950
|
+
{
|
|
5951
|
+
internalType: "uint256",
|
|
5952
|
+
name: "",
|
|
5953
|
+
type: "uint256"
|
|
5954
|
+
}
|
|
5955
|
+
],
|
|
5956
|
+
stateMutability: "view",
|
|
5957
|
+
type: "function"
|
|
5958
|
+
},
|
|
5959
|
+
{
|
|
5960
|
+
inputs: [
|
|
5961
|
+
],
|
|
5962
|
+
name: "getVault",
|
|
5963
|
+
outputs: [
|
|
5964
|
+
{
|
|
5965
|
+
internalType: "contract IVault",
|
|
5966
|
+
name: "",
|
|
5967
|
+
type: "address"
|
|
5968
|
+
}
|
|
5969
|
+
],
|
|
5970
|
+
stateMutability: "view",
|
|
5971
|
+
type: "function"
|
|
5972
|
+
},
|
|
5973
|
+
{
|
|
5974
|
+
inputs: [
|
|
5975
|
+
{
|
|
5976
|
+
internalType: "contract IERC20",
|
|
5977
|
+
name: "token",
|
|
5978
|
+
type: "address"
|
|
5979
|
+
},
|
|
5980
|
+
{
|
|
5981
|
+
internalType: "address",
|
|
5982
|
+
name: "distributor",
|
|
5983
|
+
type: "address"
|
|
5984
|
+
},
|
|
5985
|
+
{
|
|
5986
|
+
internalType: "uint256",
|
|
5987
|
+
name: "distributionId",
|
|
5988
|
+
type: "uint256"
|
|
5989
|
+
},
|
|
5990
|
+
{
|
|
5991
|
+
internalType: "address",
|
|
5992
|
+
name: "claimer",
|
|
5993
|
+
type: "address"
|
|
5994
|
+
}
|
|
5995
|
+
],
|
|
5996
|
+
name: "isClaimed",
|
|
5997
|
+
outputs: [
|
|
5998
|
+
{
|
|
5999
|
+
internalType: "bool",
|
|
6000
|
+
name: "",
|
|
6001
|
+
type: "bool"
|
|
6002
|
+
}
|
|
6003
|
+
],
|
|
6004
|
+
stateMutability: "view",
|
|
6005
|
+
type: "function"
|
|
6006
|
+
},
|
|
6007
|
+
{
|
|
6008
|
+
inputs: [
|
|
6009
|
+
{
|
|
6010
|
+
internalType: "contract IERC20",
|
|
6011
|
+
name: "token",
|
|
6012
|
+
type: "address"
|
|
6013
|
+
},
|
|
6014
|
+
{
|
|
6015
|
+
internalType: "address",
|
|
6016
|
+
name: "distributor",
|
|
6017
|
+
type: "address"
|
|
6018
|
+
},
|
|
6019
|
+
{
|
|
6020
|
+
internalType: "uint256",
|
|
6021
|
+
name: "distributionId",
|
|
6022
|
+
type: "uint256"
|
|
6023
|
+
},
|
|
6024
|
+
{
|
|
6025
|
+
internalType: "address",
|
|
6026
|
+
name: "claimer",
|
|
6027
|
+
type: "address"
|
|
6028
|
+
},
|
|
6029
|
+
{
|
|
6030
|
+
internalType: "uint256",
|
|
6031
|
+
name: "claimedBalance",
|
|
6032
|
+
type: "uint256"
|
|
6033
|
+
},
|
|
6034
|
+
{
|
|
6035
|
+
internalType: "bytes32[]",
|
|
6036
|
+
name: "merkleProof",
|
|
6037
|
+
type: "bytes32[]"
|
|
6038
|
+
}
|
|
6039
|
+
],
|
|
6040
|
+
name: "verifyClaim",
|
|
6041
|
+
outputs: [
|
|
6042
|
+
{
|
|
6043
|
+
internalType: "bool",
|
|
6044
|
+
name: "",
|
|
6045
|
+
type: "bool"
|
|
6046
|
+
}
|
|
6047
|
+
],
|
|
6048
|
+
stateMutability: "view",
|
|
6049
|
+
type: "function"
|
|
6050
|
+
}
|
|
6051
|
+
];
|
|
6052
|
+
var IBalancerMerkleOrchard = {
|
|
6053
|
+
abi: abi$7
|
|
6054
|
+
};
|
|
6055
|
+
|
|
6056
|
+
var abi$8 = [
|
|
6057
|
+
{
|
|
6058
|
+
inputs: [
|
|
6059
|
+
{
|
|
6060
|
+
internalType: "address[]",
|
|
6061
|
+
name: "assets",
|
|
6062
|
+
type: "address[]"
|
|
6063
|
+
},
|
|
6064
|
+
{
|
|
6065
|
+
internalType: "uint256",
|
|
6066
|
+
name: "amount",
|
|
6067
|
+
type: "uint256"
|
|
6068
|
+
},
|
|
6069
|
+
{
|
|
6070
|
+
internalType: "address",
|
|
6071
|
+
name: "to",
|
|
6072
|
+
type: "address"
|
|
6073
|
+
}
|
|
6074
|
+
],
|
|
6075
|
+
name: "claimRewards",
|
|
6076
|
+
outputs: [
|
|
6077
|
+
],
|
|
6078
|
+
stateMutability: "nonpayable",
|
|
6079
|
+
type: "function"
|
|
6080
|
+
},
|
|
6081
|
+
{
|
|
6082
|
+
inputs: [
|
|
6083
|
+
{
|
|
6084
|
+
internalType: "address",
|
|
6085
|
+
name: "user",
|
|
6086
|
+
type: "address"
|
|
6087
|
+
}
|
|
6088
|
+
],
|
|
6089
|
+
name: "getUserUnclaimedRewards",
|
|
6090
|
+
outputs: [
|
|
6091
|
+
{
|
|
6092
|
+
internalType: "uint256",
|
|
6093
|
+
name: "rewards",
|
|
6094
|
+
type: "uint256"
|
|
6095
|
+
}
|
|
6096
|
+
],
|
|
6097
|
+
stateMutability: "view",
|
|
6098
|
+
type: "function"
|
|
6099
|
+
}
|
|
6100
|
+
];
|
|
6101
|
+
var bytecode = "0x";
|
|
6102
|
+
var deployedBytecode = "0x";
|
|
6103
|
+
var linkReferences = {
|
|
6104
|
+
};
|
|
6105
|
+
var deployedLinkReferences = {
|
|
6106
|
+
};
|
|
6107
|
+
var IAaveIncentivesController = {
|
|
6108
|
+
abi: abi$8,
|
|
6109
|
+
bytecode: bytecode,
|
|
6110
|
+
deployedBytecode: deployedBytecode,
|
|
6111
|
+
linkReferences: linkReferences,
|
|
6112
|
+
deployedLinkReferences: deployedLinkReferences
|
|
6113
|
+
};
|
|
6114
|
+
|
|
6115
|
+
function multicall(_x5, _x6, _x7, _x8, _x9, _x10) {
|
|
6116
|
+
return _multicall.apply(this, arguments);
|
|
6117
|
+
}
|
|
6118
|
+
|
|
6119
|
+
function _multicall() {
|
|
6120
|
+
_multicall = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(network, provider, abi, calls, options, requireSuccess) {
|
|
6121
|
+
var multi, itf, res;
|
|
6122
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
6123
|
+
while (1) {
|
|
6124
|
+
switch (_context3.prev = _context3.next) {
|
|
6125
|
+
case 0:
|
|
6126
|
+
if (options === void 0) {
|
|
6127
|
+
options = {};
|
|
6128
|
+
}
|
|
6129
|
+
|
|
6130
|
+
if (requireSuccess === void 0) {
|
|
6131
|
+
requireSuccess = false;
|
|
6132
|
+
}
|
|
6133
|
+
|
|
6134
|
+
multi = new ethers.ethers.Contract(multiCallAddress[network], ["function tryAggregate(bool requireSuccess, tuple(address, bytes)[] memory calls) public view returns (tuple(bool, bytes)[] memory returnData)"], provider);
|
|
6135
|
+
itf = new abi$c.Interface(abi);
|
|
6136
|
+
_context3.prev = 4;
|
|
6137
|
+
_context3.next = 7;
|
|
6138
|
+
return multi.tryAggregate( // if false, allows individual calls to fail without causing entire multicall to fail
|
|
6139
|
+
requireSuccess, calls.map(function (call) {
|
|
6140
|
+
return [call[0].toLowerCase(), itf.encodeFunctionData(call[1], call[2])];
|
|
6141
|
+
}), options);
|
|
6142
|
+
|
|
6143
|
+
case 7:
|
|
6144
|
+
res = _context3.sent;
|
|
6145
|
+
return _context3.abrupt("return", res.map(function (_ref, i) {
|
|
6146
|
+
var success = _ref[0],
|
|
6147
|
+
returnData = _ref[1];
|
|
6148
|
+
if (!success) return null;
|
|
6149
|
+
var decodedResult = itf.decodeFunctionResult(calls[i][1], returnData); // Automatically unwrap any simple return values
|
|
6150
|
+
|
|
6151
|
+
// Automatically unwrap any simple return values
|
|
6152
|
+
return decodedResult.length > 1 ? decodedResult : decodedResult[0];
|
|
6153
|
+
}));
|
|
6154
|
+
|
|
6155
|
+
case 11:
|
|
6156
|
+
_context3.prev = 11;
|
|
6157
|
+
_context3.t0 = _context3["catch"](4);
|
|
6158
|
+
return _context3.abrupt("return", Promise.reject(_context3.t0));
|
|
6159
|
+
|
|
6160
|
+
case 14:
|
|
6161
|
+
case "end":
|
|
6162
|
+
return _context3.stop();
|
|
6163
|
+
}
|
|
6164
|
+
}
|
|
6165
|
+
}, _callee3, null, [[4, 11]]);
|
|
6166
|
+
}));
|
|
6167
|
+
return _multicall.apply(this, arguments);
|
|
6168
|
+
}
|
|
6169
|
+
|
|
6170
|
+
var MerkleTree = /*#__PURE__*/function () {
|
|
6171
|
+
function MerkleTree(elements) {
|
|
6172
|
+
this.elements = elements.filter(function (el) {
|
|
6173
|
+
return el;
|
|
6174
|
+
}).map(function (el) {
|
|
6175
|
+
return Buffer.from(web3Utils.hexToBytes(el));
|
|
6176
|
+
}); // Sort elements
|
|
6177
|
+
|
|
6178
|
+
this.elements.sort(Buffer.compare); // Deduplicate elements
|
|
6179
|
+
|
|
6180
|
+
this.elements = this.bufDedup(this.elements); // Create layers
|
|
6181
|
+
|
|
6182
|
+
this.layers = this.getLayers(this.elements);
|
|
6183
|
+
}
|
|
6184
|
+
|
|
6185
|
+
var _proto = MerkleTree.prototype;
|
|
6186
|
+
|
|
6187
|
+
_proto.getLayers = function getLayers(elements) {
|
|
6188
|
+
if (elements.length === 0) {
|
|
6189
|
+
return [[""]];
|
|
6190
|
+
}
|
|
6191
|
+
|
|
6192
|
+
var layers = [];
|
|
6193
|
+
layers.push(elements); // Get next layer until we reach the root=
|
|
6194
|
+
|
|
6195
|
+
while (layers[layers.length - 1].length > 1) {
|
|
6196
|
+
// @ts-ignore
|
|
6197
|
+
layers.push(this.getNextLayer(layers[layers.length - 1]));
|
|
6198
|
+
}
|
|
6199
|
+
|
|
6200
|
+
return layers;
|
|
6201
|
+
};
|
|
6202
|
+
|
|
6203
|
+
_proto.getNextLayer = function getNextLayer(elements) {
|
|
6204
|
+
var _this = this;
|
|
6205
|
+
|
|
6206
|
+
return elements.reduce(function (layer, el, idx, arr) {
|
|
6207
|
+
if (idx % 2 === 0) {
|
|
6208
|
+
// Hash the current element with its pair element
|
|
6209
|
+
layer.push(_this.combinedHash(el, arr[idx + 1]));
|
|
6210
|
+
}
|
|
6211
|
+
|
|
6212
|
+
return layer;
|
|
6213
|
+
}, []);
|
|
6214
|
+
};
|
|
6215
|
+
|
|
6216
|
+
_proto.combinedHash = function combinedHash(first, second) {
|
|
6217
|
+
if (!first) {
|
|
6218
|
+
return second;
|
|
6219
|
+
}
|
|
6220
|
+
|
|
6221
|
+
if (!second) {
|
|
6222
|
+
return first;
|
|
6223
|
+
}
|
|
6224
|
+
|
|
6225
|
+
return ethereumjsUtil.keccak256(this.sortAndConcat(first, second));
|
|
6226
|
+
};
|
|
6227
|
+
|
|
6228
|
+
_proto.getRoot = function getRoot() {
|
|
6229
|
+
return this.layers[this.layers.length - 1][0];
|
|
6230
|
+
};
|
|
6231
|
+
|
|
6232
|
+
_proto.getHexRoot = function getHexRoot() {
|
|
6233
|
+
return ethereumjsUtil.bufferToHex(this.getRoot());
|
|
6234
|
+
};
|
|
6235
|
+
|
|
6236
|
+
_proto.getProof = function getProof(el) {
|
|
6237
|
+
var _this2 = this;
|
|
6238
|
+
|
|
6239
|
+
var idx = this.bufIndexOf(el, this.elements);
|
|
6240
|
+
|
|
6241
|
+
if (idx === -1) {
|
|
6242
|
+
throw new Error("Element does not exist in Merkle tree");
|
|
6243
|
+
}
|
|
6244
|
+
|
|
6245
|
+
return this.layers.reduce(function (proof, layer) {
|
|
6246
|
+
var pairElement = _this2.getPairElement(idx, layer);
|
|
6247
|
+
|
|
6248
|
+
if (pairElement) {
|
|
6249
|
+
proof.push(pairElement);
|
|
6250
|
+
}
|
|
6251
|
+
|
|
6252
|
+
idx = Math.floor(idx / 2);
|
|
6253
|
+
return proof;
|
|
6254
|
+
}, []);
|
|
6255
|
+
} // external call - convert to buffer
|
|
6256
|
+
;
|
|
6257
|
+
|
|
6258
|
+
_proto.getHexProof = function getHexProof(_el) {
|
|
6259
|
+
var el = Buffer.from(web3Utils.hexToBytes(_el));
|
|
6260
|
+
var proof = this.getProof(el);
|
|
6261
|
+
return this.bufArrToHexArr(proof);
|
|
6262
|
+
};
|
|
6263
|
+
|
|
6264
|
+
_proto.getPairElement = function getPairElement(idx, layer) {
|
|
6265
|
+
var pairIdx = idx % 2 === 0 ? idx + 1 : idx - 1;
|
|
6266
|
+
|
|
6267
|
+
if (pairIdx < layer.length) {
|
|
6268
|
+
return layer[pairIdx];
|
|
6269
|
+
} else {
|
|
6270
|
+
return null;
|
|
6271
|
+
}
|
|
6272
|
+
};
|
|
6273
|
+
|
|
6274
|
+
_proto.bufIndexOf = function bufIndexOf(el, arr) {
|
|
6275
|
+
var hash; // Convert element to 32 byte hash if it is not one already
|
|
6276
|
+
|
|
6277
|
+
if (el.length !== 32 || !Buffer.isBuffer(el)) {
|
|
6278
|
+
hash = ethereumjsUtil.keccakFromString(el);
|
|
6279
|
+
} else {
|
|
6280
|
+
hash = el;
|
|
6281
|
+
}
|
|
6282
|
+
|
|
6283
|
+
for (var i = 0; i < arr.length; i++) {
|
|
6284
|
+
if (hash.equals(arr[i])) {
|
|
6285
|
+
return i;
|
|
6286
|
+
}
|
|
6287
|
+
}
|
|
6288
|
+
|
|
6289
|
+
return -1;
|
|
6290
|
+
};
|
|
6291
|
+
|
|
6292
|
+
_proto.bufDedup = function bufDedup(elements) {
|
|
6293
|
+
return elements.filter(function (el, idx) {
|
|
6294
|
+
return idx === 0 || !elements[idx - 1].equals(el);
|
|
6295
|
+
});
|
|
6296
|
+
};
|
|
6297
|
+
|
|
6298
|
+
_proto.bufArrToHexArr = function bufArrToHexArr(arr) {
|
|
6299
|
+
if (arr.some(function (el) {
|
|
6300
|
+
return !Buffer.isBuffer(el);
|
|
6301
|
+
})) {
|
|
6302
|
+
throw new Error("Array is not an array of buffers");
|
|
6303
|
+
}
|
|
6304
|
+
|
|
6305
|
+
return arr.map(function (el) {
|
|
6306
|
+
return "0x" + el.toString("hex");
|
|
6307
|
+
});
|
|
6308
|
+
};
|
|
6309
|
+
|
|
6310
|
+
_proto.sortAndConcat = function sortAndConcat() {
|
|
6311
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
6312
|
+
args[_key] = arguments[_key];
|
|
6313
|
+
}
|
|
6314
|
+
|
|
6315
|
+
return Buffer.concat([].concat(args).sort(Buffer.compare));
|
|
6316
|
+
};
|
|
6317
|
+
|
|
6318
|
+
return MerkleTree;
|
|
6319
|
+
}();
|
|
6320
|
+
|
|
6321
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6322
|
+
function scale(input, decimalPlaces) {
|
|
6323
|
+
var unscaled = typeof input === "string" ? new BigNumber(input) : input;
|
|
6324
|
+
var scalePow = new BigNumber(decimalPlaces.toString());
|
|
6325
|
+
var scaleMul = new BigNumber(10).pow(scalePow);
|
|
6326
|
+
return unscaled.times(scaleMul);
|
|
6327
|
+
}
|
|
6328
|
+
function loadTree(balances, decimals) {
|
|
6329
|
+
if (decimals === void 0) {
|
|
6330
|
+
decimals = 18;
|
|
6331
|
+
}
|
|
6332
|
+
|
|
6333
|
+
var elements = [];
|
|
6334
|
+
Object.keys(balances).forEach(function (address) {
|
|
6335
|
+
var balance = scale(balances[address], decimals).toString(10);
|
|
6336
|
+
var leaf = web3Utils.soliditySha3({
|
|
6337
|
+
t: "address",
|
|
6338
|
+
v: address
|
|
6339
|
+
}, {
|
|
6340
|
+
t: "uint",
|
|
6341
|
+
v: balance
|
|
6342
|
+
}); // @ts-ignore
|
|
6343
|
+
|
|
6344
|
+
elements.push(leaf);
|
|
6345
|
+
});
|
|
6346
|
+
return new MerkleTree(elements);
|
|
6347
|
+
}
|
|
6348
|
+
function bnum(val) {
|
|
6349
|
+
var number = typeof val === "string" ? val : val ? val.toString() : "0";
|
|
6350
|
+
return new BigNumber(number);
|
|
6351
|
+
}
|
|
6352
|
+
|
|
6353
|
+
var IpfsService = /*#__PURE__*/function () {
|
|
6354
|
+
function IpfsService() {}
|
|
6355
|
+
|
|
6356
|
+
var _proto = IpfsService.prototype;
|
|
6357
|
+
|
|
6358
|
+
_proto.get = /*#__PURE__*/function () {
|
|
6359
|
+
var _get = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(hash, protocol) {
|
|
6360
|
+
var _yield$axios$get, data;
|
|
6361
|
+
|
|
6362
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
6363
|
+
while (1) {
|
|
6364
|
+
switch (_context.prev = _context.next) {
|
|
6365
|
+
case 0:
|
|
6366
|
+
if (protocol === void 0) {
|
|
6367
|
+
protocol = "ipfs";
|
|
6368
|
+
}
|
|
6369
|
+
|
|
6370
|
+
_context.next = 3;
|
|
6371
|
+
return axios.get("https://cloudflare-ipfs.com/" + protocol + "/" + hash);
|
|
6372
|
+
|
|
6373
|
+
case 3:
|
|
6374
|
+
_yield$axios$get = _context.sent;
|
|
6375
|
+
data = _yield$axios$get.data;
|
|
6376
|
+
return _context.abrupt("return", data);
|
|
6377
|
+
|
|
6378
|
+
case 6:
|
|
6379
|
+
case "end":
|
|
6380
|
+
return _context.stop();
|
|
6381
|
+
}
|
|
6382
|
+
}
|
|
6383
|
+
}, _callee);
|
|
6384
|
+
}));
|
|
6385
|
+
|
|
6386
|
+
function get(_x, _x2) {
|
|
6387
|
+
return _get.apply(this, arguments);
|
|
6388
|
+
}
|
|
6389
|
+
|
|
6390
|
+
return get;
|
|
6391
|
+
}();
|
|
6392
|
+
|
|
6393
|
+
return IpfsService;
|
|
6394
|
+
}();
|
|
6395
|
+
var ipfsService = /*#__PURE__*/new IpfsService();
|
|
6396
|
+
|
|
6397
|
+
var ClaimService = /*#__PURE__*/function () {
|
|
6398
|
+
function ClaimService(network, signer) {
|
|
6399
|
+
this.network = network;
|
|
6400
|
+
this.signer = signer;
|
|
6401
|
+
}
|
|
6402
|
+
|
|
6403
|
+
var _proto = ClaimService.prototype;
|
|
6404
|
+
|
|
6405
|
+
_proto.getMultiTokensPendingClaims = /*#__PURE__*/function () {
|
|
6406
|
+
var _getMultiTokensPendingClaims = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(account) {
|
|
6407
|
+
var _this = this;
|
|
6408
|
+
|
|
6409
|
+
var tokenClaimsInfo, multiTokenPendingClaims, multiTokenPendingClaimsWithRewards;
|
|
6410
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
6411
|
+
while (1) {
|
|
6412
|
+
switch (_context.prev = _context.next) {
|
|
6413
|
+
case 0:
|
|
6414
|
+
_context.next = 2;
|
|
6415
|
+
return this.getTokenClaimsInfo();
|
|
6416
|
+
|
|
6417
|
+
case 2:
|
|
6418
|
+
tokenClaimsInfo = _context.sent;
|
|
6419
|
+
|
|
6420
|
+
if (!(tokenClaimsInfo != null)) {
|
|
6421
|
+
_context.next = 9;
|
|
6422
|
+
break;
|
|
6423
|
+
}
|
|
6424
|
+
|
|
6425
|
+
_context.next = 6;
|
|
6426
|
+
return Promise.all(tokenClaimsInfo.map(function (tokenClaimInfo) {
|
|
6427
|
+
return _this.getTokenPendingClaims(tokenClaimInfo, address.getAddress(account));
|
|
6428
|
+
}));
|
|
6429
|
+
|
|
6430
|
+
case 6:
|
|
6431
|
+
multiTokenPendingClaims = _context.sent;
|
|
6432
|
+
multiTokenPendingClaimsWithRewards = multiTokenPendingClaims.filter(function (pendingClaim) {
|
|
6433
|
+
return Number(pendingClaim.availableToClaim) > 0;
|
|
6434
|
+
});
|
|
6435
|
+
return _context.abrupt("return", multiTokenPendingClaimsWithRewards);
|
|
6436
|
+
|
|
6437
|
+
case 9:
|
|
6438
|
+
return _context.abrupt("return", []);
|
|
6439
|
+
|
|
6440
|
+
case 10:
|
|
6441
|
+
case "end":
|
|
6442
|
+
return _context.stop();
|
|
6443
|
+
}
|
|
6444
|
+
}
|
|
6445
|
+
}, _callee, this);
|
|
6446
|
+
}));
|
|
6447
|
+
|
|
6448
|
+
function getMultiTokensPendingClaims(_x) {
|
|
6449
|
+
return _getMultiTokensPendingClaims.apply(this, arguments);
|
|
6450
|
+
}
|
|
6451
|
+
|
|
6452
|
+
return getMultiTokensPendingClaims;
|
|
6453
|
+
}();
|
|
6454
|
+
|
|
6455
|
+
_proto.getTokenPendingClaims = /*#__PURE__*/function () {
|
|
6456
|
+
var _getTokenPendingClaims = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(tokenClaimInfo, account) {
|
|
6457
|
+
var snapshot, weekStart, claimStatus, pendingWeeks, reports, claims, availableToClaim;
|
|
6458
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
6459
|
+
while (1) {
|
|
6460
|
+
switch (_context2.prev = _context2.next) {
|
|
6461
|
+
case 0:
|
|
6462
|
+
_context2.next = 2;
|
|
6463
|
+
return this.getSnapshot(tokenClaimInfo.manifest);
|
|
6464
|
+
|
|
6465
|
+
case 2:
|
|
6466
|
+
snapshot = _context2.sent;
|
|
6467
|
+
weekStart = tokenClaimInfo.weekStart;
|
|
6468
|
+
_context2.next = 6;
|
|
6469
|
+
return this.getClaimStatus(Object.keys(snapshot).length, account, tokenClaimInfo);
|
|
6470
|
+
|
|
6471
|
+
case 6:
|
|
6472
|
+
claimStatus = _context2.sent;
|
|
6473
|
+
pendingWeeks = claimStatus.map(function (status, i) {
|
|
6474
|
+
return [i + weekStart, status];
|
|
6475
|
+
}).filter(function (_ref) {
|
|
6476
|
+
var status = _ref[1];
|
|
6477
|
+
return !status;
|
|
6478
|
+
}).map(function (_ref2) {
|
|
6479
|
+
var i = _ref2[0];
|
|
6480
|
+
return i;
|
|
6481
|
+
});
|
|
6482
|
+
_context2.next = 10;
|
|
6483
|
+
return this.getReports(snapshot, pendingWeeks);
|
|
6484
|
+
|
|
6485
|
+
case 10:
|
|
6486
|
+
reports = _context2.sent;
|
|
6487
|
+
claims = Object.entries(reports).filter(function (report) {
|
|
6488
|
+
return report[1][account];
|
|
6489
|
+
}).map(function (report) {
|
|
6490
|
+
return {
|
|
6491
|
+
id: report[0],
|
|
6492
|
+
amount: report[1][account]
|
|
6493
|
+
};
|
|
6494
|
+
}); //console.log("claims", claims);
|
|
6495
|
+
|
|
6496
|
+
availableToClaim = claims.map(function (claim) {
|
|
6497
|
+
return parseFloat(claim.amount);
|
|
6498
|
+
}).reduce(function (total, amount) {
|
|
6499
|
+
return total.plus(amount);
|
|
6500
|
+
}, bnum(0)).toString();
|
|
6501
|
+
return _context2.abrupt("return", {
|
|
6502
|
+
claims: claims,
|
|
6503
|
+
reports: reports,
|
|
6504
|
+
tokenClaimInfo: tokenClaimInfo,
|
|
6505
|
+
availableToClaim: availableToClaim
|
|
6506
|
+
});
|
|
6507
|
+
|
|
6508
|
+
case 14:
|
|
6509
|
+
case "end":
|
|
6510
|
+
return _context2.stop();
|
|
6511
|
+
}
|
|
6512
|
+
}
|
|
6513
|
+
}, _callee2, this);
|
|
6514
|
+
}));
|
|
6515
|
+
|
|
6516
|
+
function getTokenPendingClaims(_x2, _x3) {
|
|
6517
|
+
return _getTokenPendingClaims.apply(this, arguments);
|
|
6518
|
+
}
|
|
6519
|
+
|
|
6520
|
+
return getTokenPendingClaims;
|
|
6521
|
+
}();
|
|
6522
|
+
|
|
6523
|
+
_proto.multiTokenClaimRewards = /*#__PURE__*/function () {
|
|
6524
|
+
var _multiTokenClaimRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(account, multiTokenPendingClaims) {
|
|
6525
|
+
var _this2 = this;
|
|
6526
|
+
|
|
6527
|
+
var multiTokenClaims;
|
|
6528
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
6529
|
+
while (1) {
|
|
6530
|
+
switch (_context3.prev = _context3.next) {
|
|
6531
|
+
case 0:
|
|
6532
|
+
_context3.prev = 0;
|
|
6533
|
+
_context3.next = 3;
|
|
6534
|
+
return Promise.all(multiTokenPendingClaims.map(function (tokenPendingClaims, tokenIndex) {
|
|
6535
|
+
return _this2.computeClaimProofs(tokenPendingClaims, address.getAddress(account), tokenIndex);
|
|
6536
|
+
}));
|
|
6537
|
+
|
|
6538
|
+
case 3:
|
|
6539
|
+
multiTokenClaims = _context3.sent;
|
|
6540
|
+
return _context3.abrupt("return", lodash.flatten(multiTokenClaims));
|
|
6541
|
+
|
|
6542
|
+
case 7:
|
|
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));
|
|
6547
|
+
|
|
6548
|
+
case 11:
|
|
6549
|
+
case "end":
|
|
6550
|
+
return _context3.stop();
|
|
6551
|
+
}
|
|
6552
|
+
}
|
|
6553
|
+
}, _callee3, null, [[0, 7]]);
|
|
6554
|
+
}));
|
|
6555
|
+
|
|
6556
|
+
function multiTokenClaimRewards(_x4, _x5) {
|
|
6557
|
+
return _multiTokenClaimRewards.apply(this, arguments);
|
|
6558
|
+
}
|
|
6559
|
+
|
|
6560
|
+
return multiTokenClaimRewards;
|
|
6561
|
+
}();
|
|
6562
|
+
|
|
6563
|
+
_proto.computeClaimProofs = /*#__PURE__*/function () {
|
|
6564
|
+
var _computeClaimProofs = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(tokenPendingClaims, account, tokenIndex) {
|
|
6565
|
+
var _this3 = this;
|
|
6566
|
+
|
|
6567
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
6568
|
+
while (1) {
|
|
6569
|
+
switch (_context4.prev = _context4.next) {
|
|
6570
|
+
case 0:
|
|
6571
|
+
return _context4.abrupt("return", Promise.all(tokenPendingClaims.claims.map(function (claim) {
|
|
6572
|
+
var payload = {
|
|
6573
|
+
account: account,
|
|
6574
|
+
distributor: tokenPendingClaims.tokenClaimInfo.distributor,
|
|
6575
|
+
tokenIndex: tokenIndex,
|
|
6576
|
+
decimals: tokenPendingClaims.tokenClaimInfo.decimals,
|
|
6577
|
+
// objects must be cloned
|
|
6578
|
+
report: _extends({}, tokenPendingClaims.reports[claim.id]),
|
|
6579
|
+
claim: _extends({}, claim)
|
|
6580
|
+
};
|
|
6581
|
+
return _this3.computeClaimProof(payload);
|
|
6582
|
+
})));
|
|
6583
|
+
|
|
6584
|
+
case 1:
|
|
6585
|
+
case "end":
|
|
6586
|
+
return _context4.stop();
|
|
6587
|
+
}
|
|
6588
|
+
}
|
|
6589
|
+
}, _callee4);
|
|
6590
|
+
}));
|
|
6591
|
+
|
|
6592
|
+
function computeClaimProofs(_x6, _x7, _x8) {
|
|
6593
|
+
return _computeClaimProofs.apply(this, arguments);
|
|
6594
|
+
}
|
|
6595
|
+
|
|
6596
|
+
return computeClaimProofs;
|
|
6597
|
+
}();
|
|
6598
|
+
|
|
6599
|
+
_proto.computeClaimProof = function computeClaimProof(payload) {
|
|
6600
|
+
var report = payload.report,
|
|
6601
|
+
account = payload.account,
|
|
6602
|
+
claim = payload.claim,
|
|
6603
|
+
distributor = payload.distributor,
|
|
6604
|
+
tokenIndex = payload.tokenIndex,
|
|
6605
|
+
decimals = payload.decimals;
|
|
6606
|
+
var claimAmount = claim.amount;
|
|
6607
|
+
var merkleTree = loadTree(report, decimals);
|
|
6608
|
+
var scaledBalance = scale(claimAmount, decimals).toString(10);
|
|
6609
|
+
var proof = merkleTree.getHexProof(web3Utils.soliditySha3({
|
|
6610
|
+
t: "address",
|
|
6611
|
+
v: account
|
|
6612
|
+
}, {
|
|
6613
|
+
t: "uint",
|
|
6614
|
+
v: scaledBalance
|
|
6615
|
+
}));
|
|
6616
|
+
return [parseInt(claim.id), scaledBalance, distributor, tokenIndex, proof];
|
|
6617
|
+
};
|
|
6618
|
+
|
|
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");
|
|
6629
|
+
|
|
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);
|
|
6668
|
+
}
|
|
6669
|
+
|
|
6670
|
+
return getTokenClaimsInfo;
|
|
6671
|
+
}();
|
|
6672
|
+
|
|
6673
|
+
_proto.getSnapshot = /*#__PURE__*/function () {
|
|
6674
|
+
var _getSnapshot = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(manifest) {
|
|
6675
|
+
var response;
|
|
6676
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
6677
|
+
while (1) {
|
|
6678
|
+
switch (_context6.prev = _context6.next) {
|
|
6679
|
+
case 0:
|
|
6680
|
+
_context6.prev = 0;
|
|
6681
|
+
_context6.next = 3;
|
|
6682
|
+
return axios.get(manifest);
|
|
6683
|
+
|
|
6684
|
+
case 3:
|
|
6685
|
+
response = _context6.sent;
|
|
6686
|
+
return _context6.abrupt("return", response.data || {});
|
|
6687
|
+
|
|
6688
|
+
case 7:
|
|
6689
|
+
_context6.prev = 7;
|
|
6690
|
+
_context6.t0 = _context6["catch"](0);
|
|
6691
|
+
return _context6.abrupt("return", {});
|
|
6692
|
+
|
|
6693
|
+
case 10:
|
|
6694
|
+
case "end":
|
|
6695
|
+
return _context6.stop();
|
|
6696
|
+
}
|
|
6697
|
+
}
|
|
6698
|
+
}, _callee6, null, [[0, 7]]);
|
|
6699
|
+
}));
|
|
6700
|
+
|
|
6701
|
+
function getSnapshot(_x9) {
|
|
6702
|
+
return _getSnapshot.apply(this, arguments);
|
|
6703
|
+
}
|
|
6704
|
+
|
|
6705
|
+
return getSnapshot;
|
|
6706
|
+
}();
|
|
6707
|
+
|
|
6708
|
+
_proto.getClaimStatus = /*#__PURE__*/function () {
|
|
6709
|
+
var _getClaimStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(totalWeeks, account, tokenClaimInfo) {
|
|
6710
|
+
var _this4 = this;
|
|
6711
|
+
|
|
6712
|
+
var token, distributor, weekStart, claimStatusCalls, rootCalls, result, chunks, claimedResult, distributionRootResult;
|
|
6713
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
6714
|
+
while (1) {
|
|
6715
|
+
switch (_context7.prev = _context7.next) {
|
|
6716
|
+
case 0:
|
|
6717
|
+
token = tokenClaimInfo.token, distributor = tokenClaimInfo.distributor, weekStart = tokenClaimInfo.weekStart;
|
|
6718
|
+
claimStatusCalls = Array.from({
|
|
6719
|
+
length: totalWeeks
|
|
6720
|
+
}).map(function (_, i) {
|
|
6721
|
+
return [stakingAddress[_this4.network][exports.Dapp.BALANCER], "isClaimed", [token, distributor, weekStart + i, account]];
|
|
6722
|
+
});
|
|
6723
|
+
rootCalls = Array.from({
|
|
6724
|
+
length: totalWeeks
|
|
6725
|
+
}).map(function (_, i) {
|
|
6726
|
+
return [stakingAddress[_this4.network][exports.Dapp.BALANCER], "getDistributionRoot", [token, distributor, weekStart + i]];
|
|
6727
|
+
});
|
|
6728
|
+
_context7.prev = 3;
|
|
6729
|
+
_context7.next = 6;
|
|
6730
|
+
return multicall(this.network, this.signer, IBalancerMerkleOrchard.abi, [].concat(claimStatusCalls, rootCalls), {}, true);
|
|
6731
|
+
|
|
6732
|
+
case 6:
|
|
6733
|
+
result = _context7.sent;
|
|
6734
|
+
|
|
6735
|
+
if (!(result.length > 0)) {
|
|
6736
|
+
_context7.next = 12;
|
|
6737
|
+
break;
|
|
6738
|
+
}
|
|
6739
|
+
|
|
6740
|
+
chunks = lodash.chunk(lodash.flatten(result), totalWeeks);
|
|
6741
|
+
claimedResult = chunks[0];
|
|
6742
|
+
distributionRootResult = chunks[1];
|
|
6743
|
+
return _context7.abrupt("return", claimedResult.filter(function (_, index) {
|
|
6744
|
+
return distributionRootResult[index] !== ethers.ethers.constants.HashZero;
|
|
6745
|
+
}));
|
|
6746
|
+
|
|
6747
|
+
case 12:
|
|
6748
|
+
_context7.next = 17;
|
|
6749
|
+
break;
|
|
6750
|
+
|
|
6751
|
+
case 14:
|
|
6752
|
+
_context7.prev = 14;
|
|
6753
|
+
_context7.t0 = _context7["catch"](3);
|
|
6754
|
+
console.log("[Claim] Claim Status Error:", _context7.t0);
|
|
6755
|
+
|
|
6756
|
+
case 17:
|
|
6757
|
+
return _context7.abrupt("return", []);
|
|
6758
|
+
|
|
6759
|
+
case 18:
|
|
6760
|
+
case "end":
|
|
6761
|
+
return _context7.stop();
|
|
6762
|
+
}
|
|
6763
|
+
}
|
|
6764
|
+
}, _callee7, this, [[3, 14]]);
|
|
6765
|
+
}));
|
|
6766
|
+
|
|
6767
|
+
function getClaimStatus(_x10, _x11, _x12) {
|
|
6768
|
+
return _getClaimStatus.apply(this, arguments);
|
|
6769
|
+
}
|
|
6770
|
+
|
|
6771
|
+
return getClaimStatus;
|
|
6772
|
+
}();
|
|
6773
|
+
|
|
6774
|
+
_proto.getReports = /*#__PURE__*/function () {
|
|
6775
|
+
var _getReports = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(snapshot, weeks) {
|
|
6776
|
+
var reports;
|
|
6777
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
6778
|
+
while (1) {
|
|
6779
|
+
switch (_context8.prev = _context8.next) {
|
|
6780
|
+
case 0:
|
|
6781
|
+
_context8.next = 2;
|
|
6782
|
+
return Promise.all(weeks.filter(function (week) {
|
|
6783
|
+
return snapshot[week] != null;
|
|
6784
|
+
}).map(function (week) {
|
|
6785
|
+
return ipfsService.get(snapshot[week]);
|
|
6786
|
+
}));
|
|
6787
|
+
|
|
6788
|
+
case 2:
|
|
6789
|
+
reports = _context8.sent;
|
|
6790
|
+
return _context8.abrupt("return", Object.fromEntries(reports.map(function (report, i) {
|
|
6791
|
+
return [weeks[i], report];
|
|
6792
|
+
})));
|
|
6793
|
+
|
|
6794
|
+
case 4:
|
|
6795
|
+
case "end":
|
|
6796
|
+
return _context8.stop();
|
|
6797
|
+
}
|
|
6798
|
+
}
|
|
6799
|
+
}, _callee8);
|
|
6800
|
+
}));
|
|
6801
|
+
|
|
6802
|
+
function getReports(_x13, _x14) {
|
|
6803
|
+
return _getReports.apply(this, arguments);
|
|
6804
|
+
}
|
|
6805
|
+
|
|
6806
|
+
return getReports;
|
|
6807
|
+
}();
|
|
6808
|
+
|
|
6809
|
+
return ClaimService;
|
|
6810
|
+
}();
|
|
6811
|
+
|
|
6812
|
+
var Pool = /*#__PURE__*/function () {
|
|
6813
|
+
function Pool(network, signer, poolLogic, mangerLogic, utils) {
|
|
6814
|
+
this.network = network;
|
|
6815
|
+
this.poolLogic = poolLogic;
|
|
6816
|
+
this.address = poolLogic.address;
|
|
6817
|
+
this.managerLogic = mangerLogic;
|
|
6818
|
+
this.signer = signer;
|
|
6819
|
+
this.utils = utils;
|
|
6820
|
+
}
|
|
6821
|
+
/**
|
|
6822
|
+
* Return the assets with balances and deposit info of a pool
|
|
6823
|
+
* @returns {Promise<FundComposition[]>} Composition of assets with balance, deposit info
|
|
6824
|
+
*/
|
|
6825
|
+
|
|
6826
|
+
|
|
6827
|
+
var _proto = Pool.prototype;
|
|
6828
|
+
|
|
6829
|
+
_proto.getComposition =
|
|
6830
|
+
/*#__PURE__*/
|
|
6831
|
+
function () {
|
|
6832
|
+
var _getComposition = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
6833
|
+
var result, fundComposition;
|
|
6834
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
6835
|
+
while (1) {
|
|
6836
|
+
switch (_context.prev = _context.next) {
|
|
6837
|
+
case 0:
|
|
6838
|
+
_context.next = 2;
|
|
6839
|
+
return this.managerLogic.getFundComposition();
|
|
6840
|
+
|
|
6841
|
+
case 2:
|
|
6842
|
+
result = _context.sent;
|
|
6843
|
+
fundComposition = result[0].map(function (item, index) {
|
|
6844
|
+
var asset = item.asset,
|
|
6845
|
+
isDeposit = item.isDeposit;
|
|
6846
|
+
return {
|
|
6847
|
+
asset: asset,
|
|
6848
|
+
isDeposit: isDeposit,
|
|
6849
|
+
balance: result[1][index],
|
|
6850
|
+
rate: result[2][index]
|
|
6851
|
+
};
|
|
6852
|
+
});
|
|
6853
|
+
return _context.abrupt("return", fundComposition);
|
|
6854
|
+
|
|
6855
|
+
case 5:
|
|
6856
|
+
case "end":
|
|
6857
|
+
return _context.stop();
|
|
6858
|
+
}
|
|
6859
|
+
}
|
|
6860
|
+
}, _callee, this);
|
|
6861
|
+
}));
|
|
6862
|
+
|
|
6863
|
+
function getComposition() {
|
|
6864
|
+
return _getComposition.apply(this, arguments);
|
|
6865
|
+
}
|
|
6866
|
+
|
|
6867
|
+
return getComposition;
|
|
6868
|
+
}() //Invest functions
|
|
6869
|
+
|
|
6870
|
+
/**
|
|
6871
|
+
* Approve the asset that can be deposited into a pool
|
|
6872
|
+
* @param {string} nasset Address of deposit asset
|
|
6873
|
+
* @param {BigNumber | string} amount Amount to be approved
|
|
6874
|
+
* @param {any} options Transaction options
|
|
6875
|
+
* @returns {Promise<any>} Transaction
|
|
6876
|
+
*/
|
|
6877
|
+
;
|
|
6878
|
+
|
|
6879
|
+
_proto.approveDeposit =
|
|
6880
|
+
/*#__PURE__*/
|
|
6881
|
+
function () {
|
|
6882
|
+
var _approveDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(asset, amount, options) {
|
|
6883
|
+
var iERC20, tx;
|
|
6884
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
6885
|
+
while (1) {
|
|
6886
|
+
switch (_context2.prev = _context2.next) {
|
|
6887
|
+
case 0:
|
|
6888
|
+
if (options === void 0) {
|
|
6889
|
+
options = null;
|
|
6890
|
+
}
|
|
6891
|
+
|
|
6892
|
+
iERC20 = new ethers.ethers.Contract(asset, IERC20.abi, this.signer);
|
|
6893
|
+
_context2.next = 4;
|
|
6894
|
+
return iERC20.approve(this.address, amount, options);
|
|
6895
|
+
|
|
6896
|
+
case 4:
|
|
6897
|
+
tx = _context2.sent;
|
|
6898
|
+
return _context2.abrupt("return", tx);
|
|
6899
|
+
|
|
6900
|
+
case 6:
|
|
6901
|
+
case "end":
|
|
6902
|
+
return _context2.stop();
|
|
6903
|
+
}
|
|
6904
|
+
}
|
|
6905
|
+
}, _callee2, this);
|
|
6906
|
+
}));
|
|
6907
|
+
|
|
6908
|
+
function approveDeposit(_x, _x2, _x3) {
|
|
6909
|
+
return _approveDeposit.apply(this, arguments);
|
|
6910
|
+
}
|
|
6911
|
+
|
|
6912
|
+
return approveDeposit;
|
|
6913
|
+
}()
|
|
6914
|
+
/**
|
|
6915
|
+
* Deposit asset into a pool
|
|
6916
|
+
* @param {string} asset Address of asset
|
|
6917
|
+
* @param {BigNumber | string} amount Amount to be deposited
|
|
6918
|
+
* @param {any} options Transaction options
|
|
6919
|
+
* @returns {Promise<any>} Transaction
|
|
6920
|
+
*/
|
|
6921
|
+
;
|
|
6922
|
+
|
|
6923
|
+
_proto.deposit =
|
|
6924
|
+
/*#__PURE__*/
|
|
6925
|
+
function () {
|
|
6926
|
+
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(asset, amount, options) {
|
|
6927
|
+
var tx;
|
|
6928
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
6929
|
+
while (1) {
|
|
6930
|
+
switch (_context3.prev = _context3.next) {
|
|
6931
|
+
case 0:
|
|
6932
|
+
if (options === void 0) {
|
|
6933
|
+
options = null;
|
|
6934
|
+
}
|
|
6935
|
+
|
|
6936
|
+
_context3.next = 3;
|
|
6937
|
+
return this.poolLogic.deposit(asset, amount, options);
|
|
6938
|
+
|
|
6939
|
+
case 3:
|
|
6940
|
+
tx = _context3.sent;
|
|
6941
|
+
return _context3.abrupt("return", tx);
|
|
6942
|
+
|
|
6943
|
+
case 5:
|
|
6944
|
+
case "end":
|
|
6945
|
+
return _context3.stop();
|
|
6946
|
+
}
|
|
6947
|
+
}
|
|
6948
|
+
}, _callee3, this);
|
|
6949
|
+
}));
|
|
6950
|
+
|
|
6951
|
+
function deposit(_x4, _x5, _x6) {
|
|
6952
|
+
return _deposit.apply(this, arguments);
|
|
6953
|
+
}
|
|
6954
|
+
|
|
6955
|
+
return deposit;
|
|
6956
|
+
}()
|
|
6957
|
+
/**
|
|
6958
|
+
* Withdraw assets from a pool
|
|
6959
|
+
* @param fundTokenAmount Amount of pool tokens to be withdrawn
|
|
6960
|
+
* @param {any} options Transaction options
|
|
6961
|
+
* @returns {Promise<any>} Transaction
|
|
6962
|
+
*/
|
|
6963
|
+
;
|
|
6964
|
+
|
|
6965
|
+
_proto.withdraw =
|
|
6966
|
+
/*#__PURE__*/
|
|
6967
|
+
function () {
|
|
6968
|
+
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(fundTokenAmount, options) {
|
|
6969
|
+
var tx;
|
|
6970
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
6971
|
+
while (1) {
|
|
6972
|
+
switch (_context4.prev = _context4.next) {
|
|
6973
|
+
case 0:
|
|
6974
|
+
if (options === void 0) {
|
|
6975
|
+
options = null;
|
|
6976
|
+
}
|
|
6977
|
+
|
|
6978
|
+
_context4.next = 3;
|
|
6979
|
+
return this.poolLogic.withdraw(fundTokenAmount, options);
|
|
6980
|
+
|
|
6981
|
+
case 3:
|
|
6982
|
+
tx = _context4.sent;
|
|
6983
|
+
return _context4.abrupt("return", tx);
|
|
6984
|
+
|
|
6985
|
+
case 5:
|
|
6986
|
+
case "end":
|
|
6987
|
+
return _context4.stop();
|
|
6988
|
+
}
|
|
6989
|
+
}
|
|
6990
|
+
}, _callee4, this);
|
|
6991
|
+
}));
|
|
6992
|
+
|
|
6993
|
+
function withdraw(_x7, _x8) {
|
|
6994
|
+
return _withdraw.apply(this, arguments);
|
|
6995
|
+
}
|
|
6996
|
+
|
|
6997
|
+
return withdraw;
|
|
6998
|
+
}() //Manager functions
|
|
6999
|
+
|
|
7000
|
+
/**
|
|
7001
|
+
* Approve the asset for trading and providing liquidity
|
|
7002
|
+
* @param {Dapp} dapp Platform like Sushiswap or Uniswap
|
|
7003
|
+
* @param {string} asset Address of asset
|
|
7004
|
+
* @param @param {BigNumber | string} Amount to be approved
|
|
7005
|
+
* @param {any} options Transaction options
|
|
7006
|
+
* @returns {Promise<any>} Transaction
|
|
7007
|
+
*/
|
|
7008
|
+
;
|
|
7009
|
+
|
|
7010
|
+
_proto.approve =
|
|
7011
|
+
/*#__PURE__*/
|
|
7012
|
+
function () {
|
|
7013
|
+
var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(dapp, asset, amount, options) {
|
|
7014
|
+
var iERC20, approveTxData, tx;
|
|
7015
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
7016
|
+
while (1) {
|
|
7017
|
+
switch (_context5.prev = _context5.next) {
|
|
7018
|
+
case 0:
|
|
7019
|
+
if (options === void 0) {
|
|
7020
|
+
options = null;
|
|
7021
|
+
}
|
|
7022
|
+
|
|
7023
|
+
iERC20 = new ethers.ethers.utils.Interface(IERC20.abi);
|
|
7024
|
+
approveTxData = iERC20.encodeFunctionData("approve", [routerAddress[this.network][dapp], amount]);
|
|
7025
|
+
_context5.next = 5;
|
|
7026
|
+
return this.poolLogic.execTransaction(asset, approveTxData, options);
|
|
7027
|
+
|
|
7028
|
+
case 5:
|
|
7029
|
+
tx = _context5.sent;
|
|
7030
|
+
return _context5.abrupt("return", tx);
|
|
7031
|
+
|
|
7032
|
+
case 7:
|
|
7033
|
+
case "end":
|
|
7034
|
+
return _context5.stop();
|
|
7035
|
+
}
|
|
7036
|
+
}
|
|
7037
|
+
}, _callee5, this);
|
|
7038
|
+
}));
|
|
7039
|
+
|
|
7040
|
+
function approve(_x9, _x10, _x11, _x12) {
|
|
7041
|
+
return _approve.apply(this, arguments);
|
|
7042
|
+
}
|
|
7043
|
+
|
|
7044
|
+
return approve;
|
|
7045
|
+
}()
|
|
7046
|
+
/**
|
|
7047
|
+
* Approve the liquidity pool token for staking
|
|
7048
|
+
* @param {Dapp} dapp Platform like Sushiswap or Uniswap
|
|
7049
|
+
* @param {string} asset Address of liquidity pool token
|
|
7050
|
+
* @param {BigNumber | string} amount Aamount to be approved
|
|
7051
|
+
* @param {any} options Transaction options
|
|
7052
|
+
* @returns {Promise<any>} Transaction
|
|
7053
|
+
*/
|
|
7054
|
+
;
|
|
7055
|
+
|
|
7056
|
+
_proto.approveStaking =
|
|
5810
7057
|
/*#__PURE__*/
|
|
5811
7058
|
function () {
|
|
5812
7059
|
var _approveStaking = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(dapp, asset, amount, options) {
|
|
@@ -5876,35 +7123,49 @@ var Pool = /*#__PURE__*/function () {
|
|
|
5876
7123
|
break;
|
|
5877
7124
|
}
|
|
5878
7125
|
|
|
5879
|
-
apiUrl = "https://api.1inch.exchange/
|
|
7126
|
+
apiUrl = "https://api.1inch.exchange/v4.0/137/swap?fromTokenAddress=" + assetFrom + "&toTokenAddress=" + assetTo + "&amount=" + amountIn.toString() + "&fromAddress=" + this.address + "&destReceiver=" + this.address + "&slippage=" + slippage.toString() + "&disableEstimate=true";
|
|
5880
7127
|
_context7.next = 6;
|
|
5881
7128
|
return axios.get(apiUrl);
|
|
5882
7129
|
|
|
5883
7130
|
case 6:
|
|
5884
7131
|
response = _context7.sent;
|
|
5885
7132
|
swapTxData = response.data.tx.data;
|
|
5886
|
-
_context7.next =
|
|
7133
|
+
_context7.next = 21;
|
|
5887
7134
|
break;
|
|
5888
7135
|
|
|
5889
7136
|
case 10:
|
|
5890
|
-
|
|
7137
|
+
if (!(dapp === exports.Dapp.BALANCER)) {
|
|
7138
|
+
_context7.next = 16;
|
|
7139
|
+
break;
|
|
7140
|
+
}
|
|
7141
|
+
|
|
5891
7142
|
_context7.next = 13;
|
|
5892
|
-
return this.utils.
|
|
7143
|
+
return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
|
|
5893
7144
|
|
|
5894
7145
|
case 13:
|
|
7146
|
+
swapTxData = _context7.sent;
|
|
7147
|
+
_context7.next = 21;
|
|
7148
|
+
break;
|
|
7149
|
+
|
|
7150
|
+
case 16:
|
|
7151
|
+
iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
|
|
7152
|
+
_context7.next = 19;
|
|
7153
|
+
return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
|
|
7154
|
+
|
|
7155
|
+
case 19:
|
|
5895
7156
|
minAmountOut = _context7.sent;
|
|
5896
7157
|
swapTxData = iUniswapV2Router.encodeFunctionData(exports.Transaction.SWAP, [amountIn, minAmountOut, [assetFrom, assetTo], this.address, Math.floor(Date.now() / 1000) + 60 * 20 // 20 minutes from the current Unix time
|
|
5897
7158
|
]);
|
|
5898
7159
|
|
|
5899
|
-
case
|
|
5900
|
-
_context7.next =
|
|
7160
|
+
case 21:
|
|
7161
|
+
_context7.next = 23;
|
|
5901
7162
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], swapTxData, options);
|
|
5902
7163
|
|
|
5903
|
-
case
|
|
7164
|
+
case 23:
|
|
5904
7165
|
tx = _context7.sent;
|
|
5905
7166
|
return _context7.abrupt("return", tx);
|
|
5906
7167
|
|
|
5907
|
-
case
|
|
7168
|
+
case 25:
|
|
5908
7169
|
case "end":
|
|
5909
7170
|
return _context7.stop();
|
|
5910
7171
|
}
|
|
@@ -6095,7 +7356,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6095
7356
|
|
|
6096
7357
|
case 4:
|
|
6097
7358
|
poolId = _context11.sent;
|
|
6098
|
-
unStakeTxData = iMiniChefV2.encodeFunctionData(exports.Transaction.
|
|
7359
|
+
unStakeTxData = iMiniChefV2.encodeFunctionData(exports.Transaction.WITHDRAW, [poolId, amount, this.address]);
|
|
6099
7360
|
_context11.next = 8;
|
|
6100
7361
|
return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], unStakeTxData, options);
|
|
6101
7362
|
|
|
@@ -6121,7 +7382,8 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6121
7382
|
* Lend asset to a lending pool
|
|
6122
7383
|
* @param {Dapp} dapp Platform like Aave
|
|
6123
7384
|
* @param {string} asset Asset
|
|
6124
|
-
* @param
|
|
7385
|
+
* @param {BigNumber | string} amount Amount of asset to lend
|
|
7386
|
+
* @param {number} referrralCode Code from Aave referral program
|
|
6125
7387
|
* @param {any} options Transaction options
|
|
6126
7388
|
* @returns {Promise<any>} Transaction
|
|
6127
7389
|
*/
|
|
@@ -6130,26 +7392,30 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6130
7392
|
_proto.lend =
|
|
6131
7393
|
/*#__PURE__*/
|
|
6132
7394
|
function () {
|
|
6133
|
-
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) {
|
|
6134
7396
|
var iLendingPool, depositTxData, tx;
|
|
6135
7397
|
return runtime_1.wrap(function _callee12$(_context12) {
|
|
6136
7398
|
while (1) {
|
|
6137
7399
|
switch (_context12.prev = _context12.next) {
|
|
6138
7400
|
case 0:
|
|
7401
|
+
if (referrralCode === void 0) {
|
|
7402
|
+
referrralCode = 0;
|
|
7403
|
+
}
|
|
7404
|
+
|
|
6139
7405
|
if (options === void 0) {
|
|
6140
7406
|
options = null;
|
|
6141
7407
|
}
|
|
6142
7408
|
|
|
6143
7409
|
iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
|
|
6144
|
-
depositTxData = iLendingPool.encodeFunctionData(exports.Transaction.DEPOSIT, [asset, amount, this.address,
|
|
6145
|
-
_context12.next =
|
|
7410
|
+
depositTxData = iLendingPool.encodeFunctionData(exports.Transaction.DEPOSIT, [asset, amount, this.address, referrralCode]);
|
|
7411
|
+
_context12.next = 6;
|
|
6146
7412
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], depositTxData, options);
|
|
6147
7413
|
|
|
6148
|
-
case
|
|
7414
|
+
case 6:
|
|
6149
7415
|
tx = _context12.sent;
|
|
6150
7416
|
return _context12.abrupt("return", tx);
|
|
6151
7417
|
|
|
6152
|
-
case
|
|
7418
|
+
case 8:
|
|
6153
7419
|
case "end":
|
|
6154
7420
|
return _context12.stop();
|
|
6155
7421
|
}
|
|
@@ -6157,7 +7423,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6157
7423
|
}, _callee12, this);
|
|
6158
7424
|
}));
|
|
6159
7425
|
|
|
6160
|
-
function lend(_x42, _x43, _x44, _x45) {
|
|
7426
|
+
function lend(_x42, _x43, _x44, _x45, _x46) {
|
|
6161
7427
|
return _lend.apply(this, arguments);
|
|
6162
7428
|
}
|
|
6163
7429
|
|
|
@@ -6203,7 +7469,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6203
7469
|
}, _callee13, this);
|
|
6204
7470
|
}));
|
|
6205
7471
|
|
|
6206
|
-
function withdrawDeposit(
|
|
7472
|
+
function withdrawDeposit(_x47, _x48, _x49, _x50) {
|
|
6207
7473
|
return _withdrawDeposit.apply(this, arguments);
|
|
6208
7474
|
}
|
|
6209
7475
|
|
|
@@ -6214,6 +7480,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6214
7480
|
* @param {Dapp} dapp Platform like Aave
|
|
6215
7481
|
* @param {string} asset Asset
|
|
6216
7482
|
* @param {BigNumber | string} amount Amount of asset to lend
|
|
7483
|
+
* @param {number} referrralCode Code from Aave referral program
|
|
6217
7484
|
* @param {any} options Transaction options
|
|
6218
7485
|
* @returns {Promise<any>} Transaction
|
|
6219
7486
|
*/
|
|
@@ -6222,26 +7489,30 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6222
7489
|
_proto.borrow =
|
|
6223
7490
|
/*#__PURE__*/
|
|
6224
7491
|
function () {
|
|
6225
|
-
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) {
|
|
6226
7493
|
var iLendingPool, borrowTxData, tx;
|
|
6227
7494
|
return runtime_1.wrap(function _callee14$(_context14) {
|
|
6228
7495
|
while (1) {
|
|
6229
7496
|
switch (_context14.prev = _context14.next) {
|
|
6230
7497
|
case 0:
|
|
7498
|
+
if (referrralCode === void 0) {
|
|
7499
|
+
referrralCode = 0;
|
|
7500
|
+
}
|
|
7501
|
+
|
|
6231
7502
|
if (options === void 0) {
|
|
6232
7503
|
options = null;
|
|
6233
7504
|
}
|
|
6234
7505
|
|
|
6235
7506
|
iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
|
|
6236
|
-
borrowTxData = iLendingPool.encodeFunctionData(exports.Transaction.BORROW, [asset, amount, 2,
|
|
6237
|
-
_context14.next =
|
|
7507
|
+
borrowTxData = iLendingPool.encodeFunctionData(exports.Transaction.BORROW, [asset, amount, 2, referrralCode, this.address]);
|
|
7508
|
+
_context14.next = 6;
|
|
6238
7509
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], borrowTxData, options);
|
|
6239
7510
|
|
|
6240
|
-
case
|
|
7511
|
+
case 6:
|
|
6241
7512
|
tx = _context14.sent;
|
|
6242
7513
|
return _context14.abrupt("return", tx);
|
|
6243
7514
|
|
|
6244
|
-
case
|
|
7515
|
+
case 8:
|
|
6245
7516
|
case "end":
|
|
6246
7517
|
return _context14.stop();
|
|
6247
7518
|
}
|
|
@@ -6249,7 +7520,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6249
7520
|
}, _callee14, this);
|
|
6250
7521
|
}));
|
|
6251
7522
|
|
|
6252
|
-
function borrow(
|
|
7523
|
+
function borrow(_x51, _x52, _x53, _x54, _x55) {
|
|
6253
7524
|
return _borrow.apply(this, arguments);
|
|
6254
7525
|
}
|
|
6255
7526
|
|
|
@@ -6295,7 +7566,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6295
7566
|
}, _callee15, this);
|
|
6296
7567
|
}));
|
|
6297
7568
|
|
|
6298
|
-
function repay(
|
|
7569
|
+
function repay(_x56, _x57, _x58, _x59) {
|
|
6299
7570
|
return _repay.apply(this, arguments);
|
|
6300
7571
|
}
|
|
6301
7572
|
|
|
@@ -6345,7 +7616,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6345
7616
|
}, _callee16, this);
|
|
6346
7617
|
}));
|
|
6347
7618
|
|
|
6348
|
-
function harvestRewards(
|
|
7619
|
+
function harvestRewards(_x60, _x61, _x62) {
|
|
6349
7620
|
return _harvestRewards.apply(this, arguments);
|
|
6350
7621
|
}
|
|
6351
7622
|
|
|
@@ -6404,7 +7675,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6404
7675
|
}, _callee17, this);
|
|
6405
7676
|
}));
|
|
6406
7677
|
|
|
6407
|
-
function changeAssets(
|
|
7678
|
+
function changeAssets(_x63, _x64) {
|
|
6408
7679
|
return _changeAssets.apply(this, arguments);
|
|
6409
7680
|
}
|
|
6410
7681
|
|
|
@@ -6446,82 +7717,900 @@ var Pool = /*#__PURE__*/function () {
|
|
|
6446
7717
|
}, _callee18, this);
|
|
6447
7718
|
}));
|
|
6448
7719
|
|
|
6449
|
-
function setTrader(
|
|
7720
|
+
function setTrader(_x65, _x66) {
|
|
6450
7721
|
return _setTrader.apply(this, arguments);
|
|
6451
7722
|
}
|
|
6452
7723
|
|
|
6453
7724
|
return setTrader;
|
|
7725
|
+
}()
|
|
7726
|
+
/**
|
|
7727
|
+
* Invest into a Balancer pool
|
|
7728
|
+
* @param {string} poolId Balancer pool id
|
|
7729
|
+
* @param {string[] | } assetsIn Array of balancer pool assets
|
|
7730
|
+
* @param {BigNumber[] | string[]} amountsIn Array of maximum amounts to provide to pool
|
|
7731
|
+
* @param {any} options Transaction options
|
|
7732
|
+
* @returns {Promise<any>} Transaction
|
|
7733
|
+
*/
|
|
7734
|
+
;
|
|
7735
|
+
|
|
7736
|
+
_proto.joinBalancerPool =
|
|
7737
|
+
/*#__PURE__*/
|
|
7738
|
+
function () {
|
|
7739
|
+
var _joinBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19(poolId, assets, amountsIn, options) {
|
|
7740
|
+
var joinPoolTxData, tx;
|
|
7741
|
+
return runtime_1.wrap(function _callee19$(_context19) {
|
|
7742
|
+
while (1) {
|
|
7743
|
+
switch (_context19.prev = _context19.next) {
|
|
7744
|
+
case 0:
|
|
7745
|
+
if (options === void 0) {
|
|
7746
|
+
options = null;
|
|
7747
|
+
}
|
|
7748
|
+
|
|
7749
|
+
joinPoolTxData = this.utils.getBalancerJoinPoolTx(this, poolId, assets, amountsIn);
|
|
7750
|
+
_context19.next = 4;
|
|
7751
|
+
return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.BALANCER], joinPoolTxData, options);
|
|
7752
|
+
|
|
7753
|
+
case 4:
|
|
7754
|
+
tx = _context19.sent;
|
|
7755
|
+
return _context19.abrupt("return", tx);
|
|
7756
|
+
|
|
7757
|
+
case 6:
|
|
7758
|
+
case "end":
|
|
7759
|
+
return _context19.stop();
|
|
7760
|
+
}
|
|
7761
|
+
}
|
|
7762
|
+
}, _callee19, this);
|
|
7763
|
+
}));
|
|
7764
|
+
|
|
7765
|
+
function joinBalancerPool(_x67, _x68, _x69, _x70) {
|
|
7766
|
+
return _joinBalancerPool.apply(this, arguments);
|
|
7767
|
+
}
|
|
7768
|
+
|
|
7769
|
+
return joinBalancerPool;
|
|
7770
|
+
}()
|
|
7771
|
+
/**
|
|
7772
|
+
* Invest into a Balancer pool
|
|
7773
|
+
* @param {string} poolId Balancer pool id
|
|
7774
|
+
* @param {string[] | } assets Array of balancer pool assets
|
|
7775
|
+
* @param {BigNumber | string } amount Amount of pool tokens to withdraw
|
|
7776
|
+
* @param {any} options Transaction options
|
|
7777
|
+
* @returns {Promise<any>} Transaction
|
|
7778
|
+
*/
|
|
7779
|
+
;
|
|
7780
|
+
|
|
7781
|
+
_proto.exitBalancerPool =
|
|
7782
|
+
/*#__PURE__*/
|
|
7783
|
+
function () {
|
|
7784
|
+
var _exitBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee20(poolId, assets, amount, options) {
|
|
7785
|
+
var exitPoolTxData, tx;
|
|
7786
|
+
return runtime_1.wrap(function _callee20$(_context20) {
|
|
7787
|
+
while (1) {
|
|
7788
|
+
switch (_context20.prev = _context20.next) {
|
|
7789
|
+
case 0:
|
|
7790
|
+
if (options === void 0) {
|
|
7791
|
+
options = null;
|
|
7792
|
+
}
|
|
7793
|
+
|
|
7794
|
+
exitPoolTxData = this.utils.getBalancerExitPoolTx(this, poolId, assets, amount);
|
|
7795
|
+
_context20.next = 4;
|
|
7796
|
+
return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.BALANCER], exitPoolTxData, options);
|
|
7797
|
+
|
|
7798
|
+
case 4:
|
|
7799
|
+
tx = _context20.sent;
|
|
7800
|
+
return _context20.abrupt("return", tx);
|
|
7801
|
+
|
|
7802
|
+
case 6:
|
|
7803
|
+
case "end":
|
|
7804
|
+
return _context20.stop();
|
|
7805
|
+
}
|
|
7806
|
+
}
|
|
7807
|
+
}, _callee20, this);
|
|
7808
|
+
}));
|
|
7809
|
+
|
|
7810
|
+
function exitBalancerPool(_x71, _x72, _x73, _x74) {
|
|
7811
|
+
return _exitBalancerPool.apply(this, arguments);
|
|
7812
|
+
}
|
|
7813
|
+
|
|
7814
|
+
return exitBalancerPool;
|
|
7815
|
+
}()
|
|
7816
|
+
/**
|
|
7817
|
+
* Claim rewards from Balancer pools
|
|
7818
|
+
* @param {string[]} assets Array of tokens being claimed
|
|
7819
|
+
* @param {any} options Transaction options
|
|
7820
|
+
* @returns {Promise<any>} Transaction
|
|
7821
|
+
*/
|
|
7822
|
+
;
|
|
7823
|
+
|
|
7824
|
+
_proto.harvestBalancerRewards =
|
|
7825
|
+
/*#__PURE__*/
|
|
7826
|
+
function () {
|
|
7827
|
+
var _harvestBalancerRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee21(options) {
|
|
7828
|
+
var claimService, multiTokenPendingClaims, tokens, claims, iBalancerMerkleOrchard, harvestTxData, tx;
|
|
7829
|
+
return runtime_1.wrap(function _callee21$(_context21) {
|
|
7830
|
+
while (1) {
|
|
7831
|
+
switch (_context21.prev = _context21.next) {
|
|
7832
|
+
case 0:
|
|
7833
|
+
if (options === void 0) {
|
|
7834
|
+
options = null;
|
|
7835
|
+
}
|
|
7836
|
+
|
|
7837
|
+
claimService = new ClaimService(this.network, this.signer);
|
|
7838
|
+
_context21.next = 4;
|
|
7839
|
+
return claimService.getMultiTokensPendingClaims(this.address);
|
|
7840
|
+
|
|
7841
|
+
case 4:
|
|
7842
|
+
multiTokenPendingClaims = _context21.sent;
|
|
7843
|
+
tokens = multiTokenPendingClaims.map(function (tokenPendingClaims) {
|
|
7844
|
+
return tokenPendingClaims.tokenClaimInfo.token;
|
|
7845
|
+
});
|
|
7846
|
+
_context21.next = 8;
|
|
7847
|
+
return claimService.multiTokenClaimRewards(this.address, multiTokenPendingClaims);
|
|
7848
|
+
|
|
7849
|
+
case 8:
|
|
7850
|
+
claims = _context21.sent;
|
|
7851
|
+
iBalancerMerkleOrchard = new ethers.ethers.utils.Interface(IBalancerMerkleOrchard.abi);
|
|
7852
|
+
harvestTxData = iBalancerMerkleOrchard.encodeFunctionData(exports.Transaction.CLAIM_DISTRIBIUTIONS, [this.address, claims, tokens]);
|
|
7853
|
+
_context21.next = 13;
|
|
7854
|
+
return this.poolLogic.execTransaction(stakingAddress[this.network][exports.Dapp.BALANCER], harvestTxData, options);
|
|
7855
|
+
|
|
7856
|
+
case 13:
|
|
7857
|
+
tx = _context21.sent;
|
|
7858
|
+
return _context21.abrupt("return", tx);
|
|
7859
|
+
|
|
7860
|
+
case 15:
|
|
7861
|
+
case "end":
|
|
7862
|
+
return _context21.stop();
|
|
7863
|
+
}
|
|
7864
|
+
}
|
|
7865
|
+
}, _callee21, this);
|
|
7866
|
+
}));
|
|
7867
|
+
|
|
7868
|
+
function harvestBalancerRewards(_x75) {
|
|
7869
|
+
return _harvestBalancerRewards.apply(this, arguments);
|
|
7870
|
+
}
|
|
7871
|
+
|
|
7872
|
+
return harvestBalancerRewards;
|
|
7873
|
+
}()
|
|
7874
|
+
/**
|
|
7875
|
+
* Claim rewards from Aave platform
|
|
7876
|
+
* @param {string[]} assets Aave tokens (deposit/debt) hold by pool
|
|
7877
|
+
* @param {any} options Transaction options
|
|
7878
|
+
* @returns {Promise<any>} Transaction
|
|
7879
|
+
*/
|
|
7880
|
+
;
|
|
7881
|
+
|
|
7882
|
+
_proto.harvestAaveRewards =
|
|
7883
|
+
/*#__PURE__*/
|
|
7884
|
+
function () {
|
|
7885
|
+
var _harvestAaveRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee22(assets, options) {
|
|
7886
|
+
var aaveIncentivesAddress, iAaveIncentivesController, aaveIncentivesController, amount, claimTxData, tx;
|
|
7887
|
+
return runtime_1.wrap(function _callee22$(_context22) {
|
|
7888
|
+
while (1) {
|
|
7889
|
+
switch (_context22.prev = _context22.next) {
|
|
7890
|
+
case 0:
|
|
7891
|
+
if (options === void 0) {
|
|
7892
|
+
options = null;
|
|
7893
|
+
}
|
|
7894
|
+
|
|
7895
|
+
aaveIncentivesAddress = stakingAddress[this.network][exports.Dapp.AAVE];
|
|
7896
|
+
iAaveIncentivesController = new ethers.ethers.utils.Interface(IAaveIncentivesController.abi);
|
|
7897
|
+
aaveIncentivesController = new ethers.ethers.Contract(aaveIncentivesAddress, iAaveIncentivesController, this.signer);
|
|
7898
|
+
_context22.next = 6;
|
|
7899
|
+
return aaveIncentivesController.getUserUnclaimedRewards(this.address);
|
|
7900
|
+
|
|
7901
|
+
case 6:
|
|
7902
|
+
amount = _context22.sent;
|
|
7903
|
+
claimTxData = iAaveIncentivesController.encodeFunctionData(exports.Transaction.CLAIM_REWARDS, [assets, amount, this.address]);
|
|
7904
|
+
_context22.next = 10;
|
|
7905
|
+
return this.poolLogic.execTransaction(aaveIncentivesAddress, claimTxData, options);
|
|
7906
|
+
|
|
7907
|
+
case 10:
|
|
7908
|
+
tx = _context22.sent;
|
|
7909
|
+
return _context22.abrupt("return", tx);
|
|
7910
|
+
|
|
7911
|
+
case 12:
|
|
7912
|
+
case "end":
|
|
7913
|
+
return _context22.stop();
|
|
7914
|
+
}
|
|
7915
|
+
}
|
|
7916
|
+
}, _callee22, this);
|
|
7917
|
+
}));
|
|
7918
|
+
|
|
7919
|
+
function harvestAaveRewards(_x76, _x77) {
|
|
7920
|
+
return _harvestAaveRewards.apply(this, arguments);
|
|
7921
|
+
}
|
|
7922
|
+
|
|
7923
|
+
return harvestAaveRewards;
|
|
6454
7924
|
}();
|
|
6455
7925
|
|
|
6456
7926
|
return Pool;
|
|
6457
7927
|
}();
|
|
6458
7928
|
|
|
6459
|
-
var abi$
|
|
7929
|
+
var abi$9 = [
|
|
7930
|
+
{
|
|
7931
|
+
inputs: [
|
|
7932
|
+
{
|
|
7933
|
+
internalType: "address",
|
|
7934
|
+
name: "_feeToSetter",
|
|
7935
|
+
type: "address"
|
|
7936
|
+
}
|
|
7937
|
+
],
|
|
7938
|
+
stateMutability: "nonpayable",
|
|
7939
|
+
type: "constructor"
|
|
7940
|
+
},
|
|
7941
|
+
{
|
|
7942
|
+
anonymous: false,
|
|
7943
|
+
inputs: [
|
|
7944
|
+
{
|
|
7945
|
+
indexed: true,
|
|
7946
|
+
internalType: "address",
|
|
7947
|
+
name: "token0",
|
|
7948
|
+
type: "address"
|
|
7949
|
+
},
|
|
7950
|
+
{
|
|
7951
|
+
indexed: true,
|
|
7952
|
+
internalType: "address",
|
|
7953
|
+
name: "token1",
|
|
7954
|
+
type: "address"
|
|
7955
|
+
},
|
|
7956
|
+
{
|
|
7957
|
+
indexed: false,
|
|
7958
|
+
internalType: "address",
|
|
7959
|
+
name: "pair",
|
|
7960
|
+
type: "address"
|
|
7961
|
+
},
|
|
7962
|
+
{
|
|
7963
|
+
indexed: false,
|
|
7964
|
+
internalType: "uint256",
|
|
7965
|
+
name: "",
|
|
7966
|
+
type: "uint256"
|
|
7967
|
+
}
|
|
7968
|
+
],
|
|
7969
|
+
name: "PairCreated",
|
|
7970
|
+
type: "event"
|
|
7971
|
+
},
|
|
7972
|
+
{
|
|
7973
|
+
inputs: [
|
|
7974
|
+
{
|
|
7975
|
+
internalType: "uint256",
|
|
7976
|
+
name: "",
|
|
7977
|
+
type: "uint256"
|
|
7978
|
+
}
|
|
7979
|
+
],
|
|
7980
|
+
name: "allPairs",
|
|
7981
|
+
outputs: [
|
|
7982
|
+
{
|
|
7983
|
+
internalType: "address",
|
|
7984
|
+
name: "",
|
|
7985
|
+
type: "address"
|
|
7986
|
+
}
|
|
7987
|
+
],
|
|
7988
|
+
stateMutability: "view",
|
|
7989
|
+
type: "function"
|
|
7990
|
+
},
|
|
7991
|
+
{
|
|
7992
|
+
inputs: [
|
|
7993
|
+
],
|
|
7994
|
+
name: "allPairsLength",
|
|
7995
|
+
outputs: [
|
|
7996
|
+
{
|
|
7997
|
+
internalType: "uint256",
|
|
7998
|
+
name: "",
|
|
7999
|
+
type: "uint256"
|
|
8000
|
+
}
|
|
8001
|
+
],
|
|
8002
|
+
stateMutability: "view",
|
|
8003
|
+
type: "function"
|
|
8004
|
+
},
|
|
8005
|
+
{
|
|
8006
|
+
inputs: [
|
|
8007
|
+
{
|
|
8008
|
+
internalType: "address",
|
|
8009
|
+
name: "tokenA",
|
|
8010
|
+
type: "address"
|
|
8011
|
+
},
|
|
8012
|
+
{
|
|
8013
|
+
internalType: "address",
|
|
8014
|
+
name: "tokenB",
|
|
8015
|
+
type: "address"
|
|
8016
|
+
}
|
|
8017
|
+
],
|
|
8018
|
+
name: "createPair",
|
|
8019
|
+
outputs: [
|
|
8020
|
+
{
|
|
8021
|
+
internalType: "address",
|
|
8022
|
+
name: "pair",
|
|
8023
|
+
type: "address"
|
|
8024
|
+
}
|
|
8025
|
+
],
|
|
8026
|
+
stateMutability: "nonpayable",
|
|
8027
|
+
type: "function"
|
|
8028
|
+
},
|
|
8029
|
+
{
|
|
8030
|
+
inputs: [
|
|
8031
|
+
],
|
|
8032
|
+
name: "feeTo",
|
|
8033
|
+
outputs: [
|
|
8034
|
+
{
|
|
8035
|
+
internalType: "address",
|
|
8036
|
+
name: "",
|
|
8037
|
+
type: "address"
|
|
8038
|
+
}
|
|
8039
|
+
],
|
|
8040
|
+
stateMutability: "view",
|
|
8041
|
+
type: "function"
|
|
8042
|
+
},
|
|
8043
|
+
{
|
|
8044
|
+
inputs: [
|
|
8045
|
+
],
|
|
8046
|
+
name: "feeToSetter",
|
|
8047
|
+
outputs: [
|
|
8048
|
+
{
|
|
8049
|
+
internalType: "address",
|
|
8050
|
+
name: "",
|
|
8051
|
+
type: "address"
|
|
8052
|
+
}
|
|
8053
|
+
],
|
|
8054
|
+
stateMutability: "view",
|
|
8055
|
+
type: "function"
|
|
8056
|
+
},
|
|
8057
|
+
{
|
|
8058
|
+
inputs: [
|
|
8059
|
+
{
|
|
8060
|
+
internalType: "address",
|
|
8061
|
+
name: "",
|
|
8062
|
+
type: "address"
|
|
8063
|
+
},
|
|
8064
|
+
{
|
|
8065
|
+
internalType: "address",
|
|
8066
|
+
name: "",
|
|
8067
|
+
type: "address"
|
|
8068
|
+
}
|
|
8069
|
+
],
|
|
8070
|
+
name: "getPair",
|
|
8071
|
+
outputs: [
|
|
8072
|
+
{
|
|
8073
|
+
internalType: "address",
|
|
8074
|
+
name: "",
|
|
8075
|
+
type: "address"
|
|
8076
|
+
}
|
|
8077
|
+
],
|
|
8078
|
+
stateMutability: "view",
|
|
8079
|
+
type: "function"
|
|
8080
|
+
},
|
|
8081
|
+
{
|
|
8082
|
+
inputs: [
|
|
8083
|
+
],
|
|
8084
|
+
name: "migrator",
|
|
8085
|
+
outputs: [
|
|
8086
|
+
{
|
|
8087
|
+
internalType: "address",
|
|
8088
|
+
name: "",
|
|
8089
|
+
type: "address"
|
|
8090
|
+
}
|
|
8091
|
+
],
|
|
8092
|
+
stateMutability: "view",
|
|
8093
|
+
type: "function"
|
|
8094
|
+
},
|
|
8095
|
+
{
|
|
8096
|
+
inputs: [
|
|
8097
|
+
],
|
|
8098
|
+
name: "pairCodeHash",
|
|
8099
|
+
outputs: [
|
|
8100
|
+
{
|
|
8101
|
+
internalType: "bytes32",
|
|
8102
|
+
name: "",
|
|
8103
|
+
type: "bytes32"
|
|
8104
|
+
}
|
|
8105
|
+
],
|
|
8106
|
+
stateMutability: "pure",
|
|
8107
|
+
type: "function"
|
|
8108
|
+
},
|
|
8109
|
+
{
|
|
8110
|
+
inputs: [
|
|
8111
|
+
{
|
|
8112
|
+
internalType: "address",
|
|
8113
|
+
name: "_feeTo",
|
|
8114
|
+
type: "address"
|
|
8115
|
+
}
|
|
8116
|
+
],
|
|
8117
|
+
name: "setFeeTo",
|
|
8118
|
+
outputs: [
|
|
8119
|
+
],
|
|
8120
|
+
stateMutability: "nonpayable",
|
|
8121
|
+
type: "function"
|
|
8122
|
+
},
|
|
8123
|
+
{
|
|
8124
|
+
inputs: [
|
|
8125
|
+
{
|
|
8126
|
+
internalType: "address",
|
|
8127
|
+
name: "_feeToSetter",
|
|
8128
|
+
type: "address"
|
|
8129
|
+
}
|
|
8130
|
+
],
|
|
8131
|
+
name: "setFeeToSetter",
|
|
8132
|
+
outputs: [
|
|
8133
|
+
],
|
|
8134
|
+
stateMutability: "nonpayable",
|
|
8135
|
+
type: "function"
|
|
8136
|
+
},
|
|
8137
|
+
{
|
|
8138
|
+
inputs: [
|
|
8139
|
+
{
|
|
8140
|
+
internalType: "address",
|
|
8141
|
+
name: "_migrator",
|
|
8142
|
+
type: "address"
|
|
8143
|
+
}
|
|
8144
|
+
],
|
|
8145
|
+
name: "setMigrator",
|
|
8146
|
+
outputs: [
|
|
8147
|
+
],
|
|
8148
|
+
stateMutability: "nonpayable",
|
|
8149
|
+
type: "function"
|
|
8150
|
+
}
|
|
8151
|
+
];
|
|
8152
|
+
var UniswapV2Factory = {
|
|
8153
|
+
abi: abi$9
|
|
8154
|
+
};
|
|
8155
|
+
|
|
8156
|
+
var abi$a = [
|
|
8157
|
+
{
|
|
8158
|
+
anonymous: false,
|
|
8159
|
+
inputs: [
|
|
8160
|
+
{
|
|
8161
|
+
indexed: true,
|
|
8162
|
+
internalType: "address",
|
|
8163
|
+
name: "owner",
|
|
8164
|
+
type: "address"
|
|
8165
|
+
},
|
|
8166
|
+
{
|
|
8167
|
+
indexed: true,
|
|
8168
|
+
internalType: "address",
|
|
8169
|
+
name: "spender",
|
|
8170
|
+
type: "address"
|
|
8171
|
+
},
|
|
8172
|
+
{
|
|
8173
|
+
indexed: false,
|
|
8174
|
+
internalType: "uint256",
|
|
8175
|
+
name: "value",
|
|
8176
|
+
type: "uint256"
|
|
8177
|
+
}
|
|
8178
|
+
],
|
|
8179
|
+
name: "Approval",
|
|
8180
|
+
type: "event"
|
|
8181
|
+
},
|
|
8182
|
+
{
|
|
8183
|
+
anonymous: false,
|
|
8184
|
+
inputs: [
|
|
8185
|
+
{
|
|
8186
|
+
indexed: true,
|
|
8187
|
+
internalType: "address",
|
|
8188
|
+
name: "sender",
|
|
8189
|
+
type: "address"
|
|
8190
|
+
},
|
|
8191
|
+
{
|
|
8192
|
+
indexed: false,
|
|
8193
|
+
internalType: "uint256",
|
|
8194
|
+
name: "amount0",
|
|
8195
|
+
type: "uint256"
|
|
8196
|
+
},
|
|
8197
|
+
{
|
|
8198
|
+
indexed: false,
|
|
8199
|
+
internalType: "uint256",
|
|
8200
|
+
name: "amount1",
|
|
8201
|
+
type: "uint256"
|
|
8202
|
+
},
|
|
8203
|
+
{
|
|
8204
|
+
indexed: true,
|
|
8205
|
+
internalType: "address",
|
|
8206
|
+
name: "to",
|
|
8207
|
+
type: "address"
|
|
8208
|
+
}
|
|
8209
|
+
],
|
|
8210
|
+
name: "Burn",
|
|
8211
|
+
type: "event"
|
|
8212
|
+
},
|
|
8213
|
+
{
|
|
8214
|
+
anonymous: false,
|
|
8215
|
+
inputs: [
|
|
8216
|
+
{
|
|
8217
|
+
indexed: true,
|
|
8218
|
+
internalType: "address",
|
|
8219
|
+
name: "sender",
|
|
8220
|
+
type: "address"
|
|
8221
|
+
},
|
|
8222
|
+
{
|
|
8223
|
+
indexed: false,
|
|
8224
|
+
internalType: "uint256",
|
|
8225
|
+
name: "amount0",
|
|
8226
|
+
type: "uint256"
|
|
8227
|
+
},
|
|
8228
|
+
{
|
|
8229
|
+
indexed: false,
|
|
8230
|
+
internalType: "uint256",
|
|
8231
|
+
name: "amount1",
|
|
8232
|
+
type: "uint256"
|
|
8233
|
+
}
|
|
8234
|
+
],
|
|
8235
|
+
name: "Mint",
|
|
8236
|
+
type: "event"
|
|
8237
|
+
},
|
|
8238
|
+
{
|
|
8239
|
+
anonymous: false,
|
|
8240
|
+
inputs: [
|
|
8241
|
+
{
|
|
8242
|
+
indexed: true,
|
|
8243
|
+
internalType: "address",
|
|
8244
|
+
name: "sender",
|
|
8245
|
+
type: "address"
|
|
8246
|
+
},
|
|
8247
|
+
{
|
|
8248
|
+
indexed: false,
|
|
8249
|
+
internalType: "uint256",
|
|
8250
|
+
name: "amount0In",
|
|
8251
|
+
type: "uint256"
|
|
8252
|
+
},
|
|
8253
|
+
{
|
|
8254
|
+
indexed: false,
|
|
8255
|
+
internalType: "uint256",
|
|
8256
|
+
name: "amount1In",
|
|
8257
|
+
type: "uint256"
|
|
8258
|
+
},
|
|
8259
|
+
{
|
|
8260
|
+
indexed: false,
|
|
8261
|
+
internalType: "uint256",
|
|
8262
|
+
name: "amount0Out",
|
|
8263
|
+
type: "uint256"
|
|
8264
|
+
},
|
|
8265
|
+
{
|
|
8266
|
+
indexed: false,
|
|
8267
|
+
internalType: "uint256",
|
|
8268
|
+
name: "amount1Out",
|
|
8269
|
+
type: "uint256"
|
|
8270
|
+
},
|
|
8271
|
+
{
|
|
8272
|
+
indexed: true,
|
|
8273
|
+
internalType: "address",
|
|
8274
|
+
name: "to",
|
|
8275
|
+
type: "address"
|
|
8276
|
+
}
|
|
8277
|
+
],
|
|
8278
|
+
name: "Swap",
|
|
8279
|
+
type: "event"
|
|
8280
|
+
},
|
|
8281
|
+
{
|
|
8282
|
+
anonymous: false,
|
|
8283
|
+
inputs: [
|
|
8284
|
+
{
|
|
8285
|
+
indexed: false,
|
|
8286
|
+
internalType: "uint112",
|
|
8287
|
+
name: "reserve0",
|
|
8288
|
+
type: "uint112"
|
|
8289
|
+
},
|
|
8290
|
+
{
|
|
8291
|
+
indexed: false,
|
|
8292
|
+
internalType: "uint112",
|
|
8293
|
+
name: "reserve1",
|
|
8294
|
+
type: "uint112"
|
|
8295
|
+
}
|
|
8296
|
+
],
|
|
8297
|
+
name: "Sync",
|
|
8298
|
+
type: "event"
|
|
8299
|
+
},
|
|
8300
|
+
{
|
|
8301
|
+
anonymous: false,
|
|
8302
|
+
inputs: [
|
|
8303
|
+
{
|
|
8304
|
+
indexed: true,
|
|
8305
|
+
internalType: "address",
|
|
8306
|
+
name: "from",
|
|
8307
|
+
type: "address"
|
|
8308
|
+
},
|
|
8309
|
+
{
|
|
8310
|
+
indexed: true,
|
|
8311
|
+
internalType: "address",
|
|
8312
|
+
name: "to",
|
|
8313
|
+
type: "address"
|
|
8314
|
+
},
|
|
8315
|
+
{
|
|
8316
|
+
indexed: false,
|
|
8317
|
+
internalType: "uint256",
|
|
8318
|
+
name: "value",
|
|
8319
|
+
type: "uint256"
|
|
8320
|
+
}
|
|
8321
|
+
],
|
|
8322
|
+
name: "Transfer",
|
|
8323
|
+
type: "event"
|
|
8324
|
+
},
|
|
8325
|
+
{
|
|
8326
|
+
constant: true,
|
|
8327
|
+
inputs: [
|
|
8328
|
+
],
|
|
8329
|
+
name: "DOMAIN_SEPARATOR",
|
|
8330
|
+
outputs: [
|
|
8331
|
+
{
|
|
8332
|
+
internalType: "bytes32",
|
|
8333
|
+
name: "",
|
|
8334
|
+
type: "bytes32"
|
|
8335
|
+
}
|
|
8336
|
+
],
|
|
8337
|
+
payable: false,
|
|
8338
|
+
stateMutability: "view",
|
|
8339
|
+
type: "function"
|
|
8340
|
+
},
|
|
8341
|
+
{
|
|
8342
|
+
constant: true,
|
|
8343
|
+
inputs: [
|
|
8344
|
+
],
|
|
8345
|
+
name: "MINIMUM_LIQUIDITY",
|
|
8346
|
+
outputs: [
|
|
8347
|
+
{
|
|
8348
|
+
internalType: "uint256",
|
|
8349
|
+
name: "",
|
|
8350
|
+
type: "uint256"
|
|
8351
|
+
}
|
|
8352
|
+
],
|
|
8353
|
+
payable: false,
|
|
8354
|
+
stateMutability: "pure",
|
|
8355
|
+
type: "function"
|
|
8356
|
+
},
|
|
8357
|
+
{
|
|
8358
|
+
constant: true,
|
|
8359
|
+
inputs: [
|
|
8360
|
+
],
|
|
8361
|
+
name: "PERMIT_TYPEHASH",
|
|
8362
|
+
outputs: [
|
|
8363
|
+
{
|
|
8364
|
+
internalType: "bytes32",
|
|
8365
|
+
name: "",
|
|
8366
|
+
type: "bytes32"
|
|
8367
|
+
}
|
|
8368
|
+
],
|
|
8369
|
+
payable: false,
|
|
8370
|
+
stateMutability: "pure",
|
|
8371
|
+
type: "function"
|
|
8372
|
+
},
|
|
8373
|
+
{
|
|
8374
|
+
constant: true,
|
|
8375
|
+
inputs: [
|
|
8376
|
+
{
|
|
8377
|
+
internalType: "address",
|
|
8378
|
+
name: "owner",
|
|
8379
|
+
type: "address"
|
|
8380
|
+
},
|
|
8381
|
+
{
|
|
8382
|
+
internalType: "address",
|
|
8383
|
+
name: "spender",
|
|
8384
|
+
type: "address"
|
|
8385
|
+
}
|
|
8386
|
+
],
|
|
8387
|
+
name: "allowance",
|
|
8388
|
+
outputs: [
|
|
8389
|
+
{
|
|
8390
|
+
internalType: "uint256",
|
|
8391
|
+
name: "",
|
|
8392
|
+
type: "uint256"
|
|
8393
|
+
}
|
|
8394
|
+
],
|
|
8395
|
+
payable: false,
|
|
8396
|
+
stateMutability: "view",
|
|
8397
|
+
type: "function"
|
|
8398
|
+
},
|
|
8399
|
+
{
|
|
8400
|
+
constant: false,
|
|
8401
|
+
inputs: [
|
|
8402
|
+
{
|
|
8403
|
+
internalType: "address",
|
|
8404
|
+
name: "spender",
|
|
8405
|
+
type: "address"
|
|
8406
|
+
},
|
|
8407
|
+
{
|
|
8408
|
+
internalType: "uint256",
|
|
8409
|
+
name: "value",
|
|
8410
|
+
type: "uint256"
|
|
8411
|
+
}
|
|
8412
|
+
],
|
|
8413
|
+
name: "approve",
|
|
8414
|
+
outputs: [
|
|
8415
|
+
{
|
|
8416
|
+
internalType: "bool",
|
|
8417
|
+
name: "",
|
|
8418
|
+
type: "bool"
|
|
8419
|
+
}
|
|
8420
|
+
],
|
|
8421
|
+
payable: false,
|
|
8422
|
+
stateMutability: "nonpayable",
|
|
8423
|
+
type: "function"
|
|
8424
|
+
},
|
|
8425
|
+
{
|
|
8426
|
+
constant: true,
|
|
8427
|
+
inputs: [
|
|
8428
|
+
{
|
|
8429
|
+
internalType: "address",
|
|
8430
|
+
name: "owner",
|
|
8431
|
+
type: "address"
|
|
8432
|
+
}
|
|
8433
|
+
],
|
|
8434
|
+
name: "balanceOf",
|
|
8435
|
+
outputs: [
|
|
8436
|
+
{
|
|
8437
|
+
internalType: "uint256",
|
|
8438
|
+
name: "",
|
|
8439
|
+
type: "uint256"
|
|
8440
|
+
}
|
|
8441
|
+
],
|
|
8442
|
+
payable: false,
|
|
8443
|
+
stateMutability: "view",
|
|
8444
|
+
type: "function"
|
|
8445
|
+
},
|
|
8446
|
+
{
|
|
8447
|
+
constant: false,
|
|
8448
|
+
inputs: [
|
|
8449
|
+
{
|
|
8450
|
+
internalType: "address",
|
|
8451
|
+
name: "to",
|
|
8452
|
+
type: "address"
|
|
8453
|
+
}
|
|
8454
|
+
],
|
|
8455
|
+
name: "burn",
|
|
8456
|
+
outputs: [
|
|
8457
|
+
{
|
|
8458
|
+
internalType: "uint256",
|
|
8459
|
+
name: "amount0",
|
|
8460
|
+
type: "uint256"
|
|
8461
|
+
},
|
|
8462
|
+
{
|
|
8463
|
+
internalType: "uint256",
|
|
8464
|
+
name: "amount1",
|
|
8465
|
+
type: "uint256"
|
|
8466
|
+
}
|
|
8467
|
+
],
|
|
8468
|
+
payable: false,
|
|
8469
|
+
stateMutability: "nonpayable",
|
|
8470
|
+
type: "function"
|
|
8471
|
+
},
|
|
8472
|
+
{
|
|
8473
|
+
constant: true,
|
|
8474
|
+
inputs: [
|
|
8475
|
+
],
|
|
8476
|
+
name: "decimals",
|
|
8477
|
+
outputs: [
|
|
8478
|
+
{
|
|
8479
|
+
internalType: "uint8",
|
|
8480
|
+
name: "",
|
|
8481
|
+
type: "uint8"
|
|
8482
|
+
}
|
|
8483
|
+
],
|
|
8484
|
+
payable: false,
|
|
8485
|
+
stateMutability: "pure",
|
|
8486
|
+
type: "function"
|
|
8487
|
+
},
|
|
6460
8488
|
{
|
|
8489
|
+
constant: true,
|
|
6461
8490
|
inputs: [
|
|
8491
|
+
],
|
|
8492
|
+
name: "factory",
|
|
8493
|
+
outputs: [
|
|
6462
8494
|
{
|
|
6463
8495
|
internalType: "address",
|
|
6464
|
-
name: "
|
|
8496
|
+
name: "",
|
|
6465
8497
|
type: "address"
|
|
6466
8498
|
}
|
|
6467
8499
|
],
|
|
6468
|
-
|
|
6469
|
-
|
|
8500
|
+
payable: false,
|
|
8501
|
+
stateMutability: "view",
|
|
8502
|
+
type: "function"
|
|
6470
8503
|
},
|
|
6471
8504
|
{
|
|
6472
|
-
|
|
8505
|
+
constant: true,
|
|
6473
8506
|
inputs: [
|
|
8507
|
+
],
|
|
8508
|
+
name: "getReserves",
|
|
8509
|
+
outputs: [
|
|
6474
8510
|
{
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
type: "address"
|
|
8511
|
+
internalType: "uint112",
|
|
8512
|
+
name: "reserve0",
|
|
8513
|
+
type: "uint112"
|
|
6479
8514
|
},
|
|
6480
8515
|
{
|
|
6481
|
-
|
|
8516
|
+
internalType: "uint112",
|
|
8517
|
+
name: "reserve1",
|
|
8518
|
+
type: "uint112"
|
|
8519
|
+
},
|
|
8520
|
+
{
|
|
8521
|
+
internalType: "uint32",
|
|
8522
|
+
name: "blockTimestampLast",
|
|
8523
|
+
type: "uint32"
|
|
8524
|
+
}
|
|
8525
|
+
],
|
|
8526
|
+
payable: false,
|
|
8527
|
+
stateMutability: "view",
|
|
8528
|
+
type: "function"
|
|
8529
|
+
},
|
|
8530
|
+
{
|
|
8531
|
+
constant: false,
|
|
8532
|
+
inputs: [
|
|
8533
|
+
{
|
|
6482
8534
|
internalType: "address",
|
|
6483
|
-
name: "
|
|
8535
|
+
name: "",
|
|
6484
8536
|
type: "address"
|
|
6485
8537
|
},
|
|
6486
8538
|
{
|
|
6487
|
-
indexed: false,
|
|
6488
8539
|
internalType: "address",
|
|
6489
|
-
name: "
|
|
8540
|
+
name: "",
|
|
6490
8541
|
type: "address"
|
|
6491
|
-
}
|
|
8542
|
+
}
|
|
8543
|
+
],
|
|
8544
|
+
name: "initialize",
|
|
8545
|
+
outputs: [
|
|
8546
|
+
],
|
|
8547
|
+
payable: false,
|
|
8548
|
+
stateMutability: "nonpayable",
|
|
8549
|
+
type: "function"
|
|
8550
|
+
},
|
|
8551
|
+
{
|
|
8552
|
+
constant: true,
|
|
8553
|
+
inputs: [
|
|
8554
|
+
],
|
|
8555
|
+
name: "kLast",
|
|
8556
|
+
outputs: [
|
|
6492
8557
|
{
|
|
6493
|
-
indexed: false,
|
|
6494
8558
|
internalType: "uint256",
|
|
6495
8559
|
name: "",
|
|
6496
8560
|
type: "uint256"
|
|
6497
8561
|
}
|
|
6498
8562
|
],
|
|
6499
|
-
|
|
6500
|
-
|
|
8563
|
+
payable: false,
|
|
8564
|
+
stateMutability: "view",
|
|
8565
|
+
type: "function"
|
|
6501
8566
|
},
|
|
6502
8567
|
{
|
|
8568
|
+
constant: false,
|
|
6503
8569
|
inputs: [
|
|
8570
|
+
{
|
|
8571
|
+
internalType: "address",
|
|
8572
|
+
name: "to",
|
|
8573
|
+
type: "address"
|
|
8574
|
+
}
|
|
8575
|
+
],
|
|
8576
|
+
name: "mint",
|
|
8577
|
+
outputs: [
|
|
6504
8578
|
{
|
|
6505
8579
|
internalType: "uint256",
|
|
6506
|
-
name: "",
|
|
8580
|
+
name: "liquidity",
|
|
6507
8581
|
type: "uint256"
|
|
6508
8582
|
}
|
|
6509
8583
|
],
|
|
6510
|
-
|
|
8584
|
+
payable: false,
|
|
8585
|
+
stateMutability: "nonpayable",
|
|
8586
|
+
type: "function"
|
|
8587
|
+
},
|
|
8588
|
+
{
|
|
8589
|
+
constant: true,
|
|
8590
|
+
inputs: [
|
|
8591
|
+
],
|
|
8592
|
+
name: "name",
|
|
6511
8593
|
outputs: [
|
|
6512
8594
|
{
|
|
6513
|
-
internalType: "
|
|
8595
|
+
internalType: "string",
|
|
6514
8596
|
name: "",
|
|
6515
|
-
type: "
|
|
8597
|
+
type: "string"
|
|
6516
8598
|
}
|
|
6517
8599
|
],
|
|
6518
|
-
|
|
8600
|
+
payable: false,
|
|
8601
|
+
stateMutability: "pure",
|
|
6519
8602
|
type: "function"
|
|
6520
8603
|
},
|
|
6521
8604
|
{
|
|
8605
|
+
constant: true,
|
|
6522
8606
|
inputs: [
|
|
8607
|
+
{
|
|
8608
|
+
internalType: "address",
|
|
8609
|
+
name: "owner",
|
|
8610
|
+
type: "address"
|
|
8611
|
+
}
|
|
6523
8612
|
],
|
|
6524
|
-
name: "
|
|
8613
|
+
name: "nonces",
|
|
6525
8614
|
outputs: [
|
|
6526
8615
|
{
|
|
6527
8616
|
internalType: "uint256",
|
|
@@ -6529,75 +8618,167 @@ var abi$7 = [
|
|
|
6529
8618
|
type: "uint256"
|
|
6530
8619
|
}
|
|
6531
8620
|
],
|
|
8621
|
+
payable: false,
|
|
6532
8622
|
stateMutability: "view",
|
|
6533
8623
|
type: "function"
|
|
6534
8624
|
},
|
|
6535
8625
|
{
|
|
8626
|
+
constant: false,
|
|
6536
8627
|
inputs: [
|
|
6537
8628
|
{
|
|
6538
8629
|
internalType: "address",
|
|
6539
|
-
name: "
|
|
8630
|
+
name: "owner",
|
|
6540
8631
|
type: "address"
|
|
6541
8632
|
},
|
|
6542
8633
|
{
|
|
6543
8634
|
internalType: "address",
|
|
6544
|
-
name: "
|
|
8635
|
+
name: "spender",
|
|
6545
8636
|
type: "address"
|
|
8637
|
+
},
|
|
8638
|
+
{
|
|
8639
|
+
internalType: "uint256",
|
|
8640
|
+
name: "value",
|
|
8641
|
+
type: "uint256"
|
|
8642
|
+
},
|
|
8643
|
+
{
|
|
8644
|
+
internalType: "uint256",
|
|
8645
|
+
name: "deadline",
|
|
8646
|
+
type: "uint256"
|
|
8647
|
+
},
|
|
8648
|
+
{
|
|
8649
|
+
internalType: "uint8",
|
|
8650
|
+
name: "v",
|
|
8651
|
+
type: "uint8"
|
|
8652
|
+
},
|
|
8653
|
+
{
|
|
8654
|
+
internalType: "bytes32",
|
|
8655
|
+
name: "r",
|
|
8656
|
+
type: "bytes32"
|
|
8657
|
+
},
|
|
8658
|
+
{
|
|
8659
|
+
internalType: "bytes32",
|
|
8660
|
+
name: "s",
|
|
8661
|
+
type: "bytes32"
|
|
6546
8662
|
}
|
|
6547
8663
|
],
|
|
6548
|
-
name: "
|
|
8664
|
+
name: "permit",
|
|
6549
8665
|
outputs: [
|
|
6550
|
-
{
|
|
6551
|
-
internalType: "address",
|
|
6552
|
-
name: "pair",
|
|
6553
|
-
type: "address"
|
|
6554
|
-
}
|
|
6555
8666
|
],
|
|
8667
|
+
payable: false,
|
|
6556
8668
|
stateMutability: "nonpayable",
|
|
6557
8669
|
type: "function"
|
|
6558
8670
|
},
|
|
6559
8671
|
{
|
|
8672
|
+
constant: true,
|
|
6560
8673
|
inputs: [
|
|
6561
8674
|
],
|
|
6562
|
-
name: "
|
|
8675
|
+
name: "price0CumulativeLast",
|
|
6563
8676
|
outputs: [
|
|
6564
8677
|
{
|
|
6565
|
-
internalType: "
|
|
8678
|
+
internalType: "uint256",
|
|
6566
8679
|
name: "",
|
|
6567
|
-
type: "
|
|
8680
|
+
type: "uint256"
|
|
6568
8681
|
}
|
|
6569
8682
|
],
|
|
8683
|
+
payable: false,
|
|
6570
8684
|
stateMutability: "view",
|
|
6571
8685
|
type: "function"
|
|
6572
8686
|
},
|
|
6573
8687
|
{
|
|
8688
|
+
constant: true,
|
|
6574
8689
|
inputs: [
|
|
6575
8690
|
],
|
|
6576
|
-
name: "
|
|
8691
|
+
name: "price1CumulativeLast",
|
|
6577
8692
|
outputs: [
|
|
6578
8693
|
{
|
|
6579
|
-
internalType: "
|
|
8694
|
+
internalType: "uint256",
|
|
6580
8695
|
name: "",
|
|
6581
|
-
type: "
|
|
8696
|
+
type: "uint256"
|
|
6582
8697
|
}
|
|
6583
8698
|
],
|
|
8699
|
+
payable: false,
|
|
6584
8700
|
stateMutability: "view",
|
|
6585
8701
|
type: "function"
|
|
6586
8702
|
},
|
|
6587
8703
|
{
|
|
8704
|
+
constant: false,
|
|
6588
8705
|
inputs: [
|
|
6589
8706
|
{
|
|
6590
8707
|
internalType: "address",
|
|
6591
|
-
name: "",
|
|
8708
|
+
name: "to",
|
|
6592
8709
|
type: "address"
|
|
8710
|
+
}
|
|
8711
|
+
],
|
|
8712
|
+
name: "skim",
|
|
8713
|
+
outputs: [
|
|
8714
|
+
],
|
|
8715
|
+
payable: false,
|
|
8716
|
+
stateMutability: "nonpayable",
|
|
8717
|
+
type: "function"
|
|
8718
|
+
},
|
|
8719
|
+
{
|
|
8720
|
+
constant: false,
|
|
8721
|
+
inputs: [
|
|
8722
|
+
{
|
|
8723
|
+
internalType: "uint256",
|
|
8724
|
+
name: "amount0Out",
|
|
8725
|
+
type: "uint256"
|
|
8726
|
+
},
|
|
8727
|
+
{
|
|
8728
|
+
internalType: "uint256",
|
|
8729
|
+
name: "amount1Out",
|
|
8730
|
+
type: "uint256"
|
|
6593
8731
|
},
|
|
6594
8732
|
{
|
|
6595
8733
|
internalType: "address",
|
|
6596
|
-
name: "",
|
|
8734
|
+
name: "to",
|
|
6597
8735
|
type: "address"
|
|
8736
|
+
},
|
|
8737
|
+
{
|
|
8738
|
+
internalType: "bytes",
|
|
8739
|
+
name: "data",
|
|
8740
|
+
type: "bytes"
|
|
6598
8741
|
}
|
|
6599
8742
|
],
|
|
6600
|
-
name: "
|
|
8743
|
+
name: "swap",
|
|
8744
|
+
outputs: [
|
|
8745
|
+
],
|
|
8746
|
+
payable: false,
|
|
8747
|
+
stateMutability: "nonpayable",
|
|
8748
|
+
type: "function"
|
|
8749
|
+
},
|
|
8750
|
+
{
|
|
8751
|
+
constant: true,
|
|
8752
|
+
inputs: [
|
|
8753
|
+
],
|
|
8754
|
+
name: "symbol",
|
|
8755
|
+
outputs: [
|
|
8756
|
+
{
|
|
8757
|
+
internalType: "string",
|
|
8758
|
+
name: "",
|
|
8759
|
+
type: "string"
|
|
8760
|
+
}
|
|
8761
|
+
],
|
|
8762
|
+
payable: false,
|
|
8763
|
+
stateMutability: "pure",
|
|
8764
|
+
type: "function"
|
|
8765
|
+
},
|
|
8766
|
+
{
|
|
8767
|
+
constant: false,
|
|
8768
|
+
inputs: [
|
|
8769
|
+
],
|
|
8770
|
+
name: "sync",
|
|
8771
|
+
outputs: [
|
|
8772
|
+
],
|
|
8773
|
+
payable: false,
|
|
8774
|
+
stateMutability: "nonpayable",
|
|
8775
|
+
type: "function"
|
|
8776
|
+
},
|
|
8777
|
+
{
|
|
8778
|
+
constant: true,
|
|
8779
|
+
inputs: [
|
|
8780
|
+
],
|
|
8781
|
+
name: "token0",
|
|
6601
8782
|
outputs: [
|
|
6602
8783
|
{
|
|
6603
8784
|
internalType: "address",
|
|
@@ -6605,13 +8786,15 @@ var abi$7 = [
|
|
|
6605
8786
|
type: "address"
|
|
6606
8787
|
}
|
|
6607
8788
|
],
|
|
8789
|
+
payable: false,
|
|
6608
8790
|
stateMutability: "view",
|
|
6609
8791
|
type: "function"
|
|
6610
8792
|
},
|
|
6611
8793
|
{
|
|
8794
|
+
constant: true,
|
|
6612
8795
|
inputs: [
|
|
6613
8796
|
],
|
|
6614
|
-
name: "
|
|
8797
|
+
name: "token1",
|
|
6615
8798
|
outputs: [
|
|
6616
8799
|
{
|
|
6617
8800
|
internalType: "address",
|
|
@@ -6619,71 +8802,104 @@ var abi$7 = [
|
|
|
6619
8802
|
type: "address"
|
|
6620
8803
|
}
|
|
6621
8804
|
],
|
|
8805
|
+
payable: false,
|
|
6622
8806
|
stateMutability: "view",
|
|
6623
8807
|
type: "function"
|
|
6624
8808
|
},
|
|
6625
8809
|
{
|
|
8810
|
+
constant: true,
|
|
6626
8811
|
inputs: [
|
|
6627
8812
|
],
|
|
6628
|
-
name: "
|
|
8813
|
+
name: "totalSupply",
|
|
6629
8814
|
outputs: [
|
|
6630
8815
|
{
|
|
6631
|
-
internalType: "
|
|
8816
|
+
internalType: "uint256",
|
|
6632
8817
|
name: "",
|
|
6633
|
-
type: "
|
|
8818
|
+
type: "uint256"
|
|
6634
8819
|
}
|
|
6635
8820
|
],
|
|
6636
|
-
|
|
8821
|
+
payable: false,
|
|
8822
|
+
stateMutability: "view",
|
|
6637
8823
|
type: "function"
|
|
6638
8824
|
},
|
|
6639
8825
|
{
|
|
8826
|
+
constant: false,
|
|
6640
8827
|
inputs: [
|
|
6641
8828
|
{
|
|
6642
8829
|
internalType: "address",
|
|
6643
|
-
name: "
|
|
8830
|
+
name: "to",
|
|
6644
8831
|
type: "address"
|
|
8832
|
+
},
|
|
8833
|
+
{
|
|
8834
|
+
internalType: "uint256",
|
|
8835
|
+
name: "value",
|
|
8836
|
+
type: "uint256"
|
|
6645
8837
|
}
|
|
6646
8838
|
],
|
|
6647
|
-
name: "
|
|
8839
|
+
name: "transfer",
|
|
6648
8840
|
outputs: [
|
|
8841
|
+
{
|
|
8842
|
+
internalType: "bool",
|
|
8843
|
+
name: "",
|
|
8844
|
+
type: "bool"
|
|
8845
|
+
}
|
|
6649
8846
|
],
|
|
8847
|
+
payable: false,
|
|
6650
8848
|
stateMutability: "nonpayable",
|
|
6651
8849
|
type: "function"
|
|
6652
8850
|
},
|
|
6653
8851
|
{
|
|
8852
|
+
constant: false,
|
|
6654
8853
|
inputs: [
|
|
6655
8854
|
{
|
|
6656
8855
|
internalType: "address",
|
|
6657
|
-
name: "
|
|
8856
|
+
name: "from",
|
|
6658
8857
|
type: "address"
|
|
6659
|
-
}
|
|
6660
|
-
],
|
|
6661
|
-
name: "setFeeToSetter",
|
|
6662
|
-
outputs: [
|
|
6663
|
-
],
|
|
6664
|
-
stateMutability: "nonpayable",
|
|
6665
|
-
type: "function"
|
|
6666
|
-
},
|
|
6667
|
-
{
|
|
6668
|
-
inputs: [
|
|
8858
|
+
},
|
|
6669
8859
|
{
|
|
6670
8860
|
internalType: "address",
|
|
6671
|
-
name: "
|
|
8861
|
+
name: "to",
|
|
6672
8862
|
type: "address"
|
|
8863
|
+
},
|
|
8864
|
+
{
|
|
8865
|
+
internalType: "uint256",
|
|
8866
|
+
name: "value",
|
|
8867
|
+
type: "uint256"
|
|
6673
8868
|
}
|
|
6674
8869
|
],
|
|
6675
|
-
name: "
|
|
8870
|
+
name: "transferFrom",
|
|
6676
8871
|
outputs: [
|
|
8872
|
+
{
|
|
8873
|
+
internalType: "bool",
|
|
8874
|
+
name: "",
|
|
8875
|
+
type: "bool"
|
|
8876
|
+
}
|
|
6677
8877
|
],
|
|
8878
|
+
payable: false,
|
|
6678
8879
|
stateMutability: "nonpayable",
|
|
6679
8880
|
type: "function"
|
|
6680
8881
|
}
|
|
6681
8882
|
];
|
|
6682
|
-
var
|
|
6683
|
-
|
|
8883
|
+
var evm = {
|
|
8884
|
+
bytecode: {
|
|
8885
|
+
linkReferences: {
|
|
8886
|
+
},
|
|
8887
|
+
object: "",
|
|
8888
|
+
opcodes: "",
|
|
8889
|
+
sourceMap: ""
|
|
8890
|
+
},
|
|
8891
|
+
deployedBytecode: {
|
|
8892
|
+
linkReferences: {
|
|
8893
|
+
},
|
|
8894
|
+
object: "",
|
|
8895
|
+
opcodes: "",
|
|
8896
|
+
sourceMap: ""
|
|
8897
|
+
}
|
|
6684
8898
|
};
|
|
6685
|
-
|
|
6686
|
-
|
|
8899
|
+
var UniswapV2Pair = {
|
|
8900
|
+
abi: abi$a,
|
|
8901
|
+
evm: evm,
|
|
8902
|
+
"interface": [
|
|
6687
8903
|
{
|
|
6688
8904
|
anonymous: false,
|
|
6689
8905
|
inputs: [
|
|
@@ -7409,50 +9625,78 @@ var abi$8 = [
|
|
|
7409
9625
|
stateMutability: "nonpayable",
|
|
7410
9626
|
type: "function"
|
|
7411
9627
|
}
|
|
7412
|
-
]
|
|
7413
|
-
var evm = {
|
|
7414
|
-
bytecode: {
|
|
7415
|
-
linkReferences: {
|
|
7416
|
-
},
|
|
7417
|
-
object: "",
|
|
7418
|
-
opcodes: "",
|
|
7419
|
-
sourceMap: ""
|
|
7420
|
-
},
|
|
7421
|
-
deployedBytecode: {
|
|
7422
|
-
linkReferences: {
|
|
7423
|
-
},
|
|
7424
|
-
object: "",
|
|
7425
|
-
opcodes: "",
|
|
7426
|
-
sourceMap: ""
|
|
7427
|
-
}
|
|
9628
|
+
]
|
|
7428
9629
|
};
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
9630
|
+
|
|
9631
|
+
var abi$b = [
|
|
9632
|
+
{
|
|
9633
|
+
inputs: [
|
|
9634
|
+
{
|
|
9635
|
+
internalType: "contract IAuthorizer",
|
|
9636
|
+
name: "authorizer",
|
|
9637
|
+
type: "address"
|
|
9638
|
+
},
|
|
9639
|
+
{
|
|
9640
|
+
internalType: "contract IWETH",
|
|
9641
|
+
name: "weth",
|
|
9642
|
+
type: "address"
|
|
9643
|
+
},
|
|
9644
|
+
{
|
|
9645
|
+
internalType: "uint256",
|
|
9646
|
+
name: "pauseWindowDuration",
|
|
9647
|
+
type: "uint256"
|
|
9648
|
+
},
|
|
9649
|
+
{
|
|
9650
|
+
internalType: "uint256",
|
|
9651
|
+
name: "bufferPeriodDuration",
|
|
9652
|
+
type: "uint256"
|
|
9653
|
+
}
|
|
9654
|
+
],
|
|
9655
|
+
stateMutability: "nonpayable",
|
|
9656
|
+
type: "constructor"
|
|
9657
|
+
},
|
|
7433
9658
|
{
|
|
7434
9659
|
anonymous: false,
|
|
7435
9660
|
inputs: [
|
|
7436
9661
|
{
|
|
7437
9662
|
indexed: true,
|
|
7438
|
-
internalType: "
|
|
7439
|
-
name: "
|
|
9663
|
+
internalType: "contract IAuthorizer",
|
|
9664
|
+
name: "newAuthorizer",
|
|
9665
|
+
type: "address"
|
|
9666
|
+
}
|
|
9667
|
+
],
|
|
9668
|
+
name: "AuthorizerChanged",
|
|
9669
|
+
type: "event"
|
|
9670
|
+
},
|
|
9671
|
+
{
|
|
9672
|
+
anonymous: false,
|
|
9673
|
+
inputs: [
|
|
9674
|
+
{
|
|
9675
|
+
indexed: true,
|
|
9676
|
+
internalType: "contract IERC20",
|
|
9677
|
+
name: "token",
|
|
7440
9678
|
type: "address"
|
|
7441
9679
|
},
|
|
7442
9680
|
{
|
|
7443
9681
|
indexed: true,
|
|
7444
9682
|
internalType: "address",
|
|
7445
|
-
name: "
|
|
9683
|
+
name: "sender",
|
|
9684
|
+
type: "address"
|
|
9685
|
+
},
|
|
9686
|
+
{
|
|
9687
|
+
indexed: false,
|
|
9688
|
+
internalType: "address",
|
|
9689
|
+
name: "recipient",
|
|
7446
9690
|
type: "address"
|
|
7447
9691
|
},
|
|
7448
9692
|
{
|
|
7449
9693
|
indexed: false,
|
|
7450
9694
|
internalType: "uint256",
|
|
7451
|
-
name: "
|
|
9695
|
+
name: "amount",
|
|
7452
9696
|
type: "uint256"
|
|
7453
9697
|
}
|
|
7454
9698
|
],
|
|
7455
|
-
name: "
|
|
9699
|
+
name: "ExternalBalanceTransfer",
|
|
7456
9700
|
type: "event"
|
|
7457
9701
|
},
|
|
7458
9702
|
{
|
|
@@ -7460,55 +9704,192 @@ var UniswapV2Pair = {
|
|
|
7460
9704
|
inputs: [
|
|
7461
9705
|
{
|
|
7462
9706
|
indexed: true,
|
|
7463
|
-
internalType: "
|
|
7464
|
-
name: "
|
|
9707
|
+
internalType: "contract IFlashLoanRecipient",
|
|
9708
|
+
name: "recipient",
|
|
9709
|
+
type: "address"
|
|
9710
|
+
},
|
|
9711
|
+
{
|
|
9712
|
+
indexed: true,
|
|
9713
|
+
internalType: "contract IERC20",
|
|
9714
|
+
name: "token",
|
|
7465
9715
|
type: "address"
|
|
7466
9716
|
},
|
|
7467
9717
|
{
|
|
7468
9718
|
indexed: false,
|
|
7469
9719
|
internalType: "uint256",
|
|
7470
|
-
name: "
|
|
9720
|
+
name: "amount",
|
|
7471
9721
|
type: "uint256"
|
|
7472
9722
|
},
|
|
7473
9723
|
{
|
|
7474
9724
|
indexed: false,
|
|
7475
9725
|
internalType: "uint256",
|
|
7476
|
-
name: "
|
|
9726
|
+
name: "feeAmount",
|
|
7477
9727
|
type: "uint256"
|
|
9728
|
+
}
|
|
9729
|
+
],
|
|
9730
|
+
name: "FlashLoan",
|
|
9731
|
+
type: "event"
|
|
9732
|
+
},
|
|
9733
|
+
{
|
|
9734
|
+
anonymous: false,
|
|
9735
|
+
inputs: [
|
|
9736
|
+
{
|
|
9737
|
+
indexed: true,
|
|
9738
|
+
internalType: "address",
|
|
9739
|
+
name: "user",
|
|
9740
|
+
type: "address"
|
|
9741
|
+
},
|
|
9742
|
+
{
|
|
9743
|
+
indexed: true,
|
|
9744
|
+
internalType: "contract IERC20",
|
|
9745
|
+
name: "token",
|
|
9746
|
+
type: "address"
|
|
9747
|
+
},
|
|
9748
|
+
{
|
|
9749
|
+
indexed: false,
|
|
9750
|
+
internalType: "int256",
|
|
9751
|
+
name: "delta",
|
|
9752
|
+
type: "int256"
|
|
9753
|
+
}
|
|
9754
|
+
],
|
|
9755
|
+
name: "InternalBalanceChanged",
|
|
9756
|
+
type: "event"
|
|
9757
|
+
},
|
|
9758
|
+
{
|
|
9759
|
+
anonymous: false,
|
|
9760
|
+
inputs: [
|
|
9761
|
+
{
|
|
9762
|
+
indexed: false,
|
|
9763
|
+
internalType: "bool",
|
|
9764
|
+
name: "paused",
|
|
9765
|
+
type: "bool"
|
|
9766
|
+
}
|
|
9767
|
+
],
|
|
9768
|
+
name: "PausedStateChanged",
|
|
9769
|
+
type: "event"
|
|
9770
|
+
},
|
|
9771
|
+
{
|
|
9772
|
+
anonymous: false,
|
|
9773
|
+
inputs: [
|
|
9774
|
+
{
|
|
9775
|
+
indexed: true,
|
|
9776
|
+
internalType: "bytes32",
|
|
9777
|
+
name: "poolId",
|
|
9778
|
+
type: "bytes32"
|
|
7478
9779
|
},
|
|
7479
9780
|
{
|
|
7480
9781
|
indexed: true,
|
|
7481
9782
|
internalType: "address",
|
|
7482
|
-
name: "
|
|
9783
|
+
name: "liquidityProvider",
|
|
9784
|
+
type: "address"
|
|
9785
|
+
},
|
|
9786
|
+
{
|
|
9787
|
+
indexed: false,
|
|
9788
|
+
internalType: "contract IERC20[]",
|
|
9789
|
+
name: "tokens",
|
|
9790
|
+
type: "address[]"
|
|
9791
|
+
},
|
|
9792
|
+
{
|
|
9793
|
+
indexed: false,
|
|
9794
|
+
internalType: "int256[]",
|
|
9795
|
+
name: "deltas",
|
|
9796
|
+
type: "int256[]"
|
|
9797
|
+
},
|
|
9798
|
+
{
|
|
9799
|
+
indexed: false,
|
|
9800
|
+
internalType: "uint256[]",
|
|
9801
|
+
name: "protocolFeeAmounts",
|
|
9802
|
+
type: "uint256[]"
|
|
9803
|
+
}
|
|
9804
|
+
],
|
|
9805
|
+
name: "PoolBalanceChanged",
|
|
9806
|
+
type: "event"
|
|
9807
|
+
},
|
|
9808
|
+
{
|
|
9809
|
+
anonymous: false,
|
|
9810
|
+
inputs: [
|
|
9811
|
+
{
|
|
9812
|
+
indexed: true,
|
|
9813
|
+
internalType: "bytes32",
|
|
9814
|
+
name: "poolId",
|
|
9815
|
+
type: "bytes32"
|
|
9816
|
+
},
|
|
9817
|
+
{
|
|
9818
|
+
indexed: true,
|
|
9819
|
+
internalType: "address",
|
|
9820
|
+
name: "assetManager",
|
|
9821
|
+
type: "address"
|
|
9822
|
+
},
|
|
9823
|
+
{
|
|
9824
|
+
indexed: true,
|
|
9825
|
+
internalType: "contract IERC20",
|
|
9826
|
+
name: "token",
|
|
7483
9827
|
type: "address"
|
|
9828
|
+
},
|
|
9829
|
+
{
|
|
9830
|
+
indexed: false,
|
|
9831
|
+
internalType: "int256",
|
|
9832
|
+
name: "cashDelta",
|
|
9833
|
+
type: "int256"
|
|
9834
|
+
},
|
|
9835
|
+
{
|
|
9836
|
+
indexed: false,
|
|
9837
|
+
internalType: "int256",
|
|
9838
|
+
name: "managedDelta",
|
|
9839
|
+
type: "int256"
|
|
7484
9840
|
}
|
|
7485
9841
|
],
|
|
7486
|
-
name: "
|
|
9842
|
+
name: "PoolBalanceManaged",
|
|
7487
9843
|
type: "event"
|
|
7488
9844
|
},
|
|
7489
9845
|
{
|
|
7490
9846
|
anonymous: false,
|
|
7491
9847
|
inputs: [
|
|
9848
|
+
{
|
|
9849
|
+
indexed: true,
|
|
9850
|
+
internalType: "bytes32",
|
|
9851
|
+
name: "poolId",
|
|
9852
|
+
type: "bytes32"
|
|
9853
|
+
},
|
|
7492
9854
|
{
|
|
7493
9855
|
indexed: true,
|
|
7494
9856
|
internalType: "address",
|
|
7495
|
-
name: "
|
|
9857
|
+
name: "poolAddress",
|
|
7496
9858
|
type: "address"
|
|
7497
9859
|
},
|
|
7498
9860
|
{
|
|
7499
9861
|
indexed: false,
|
|
7500
|
-
internalType: "
|
|
7501
|
-
name: "
|
|
7502
|
-
type: "
|
|
9862
|
+
internalType: "enum IVault.PoolSpecialization",
|
|
9863
|
+
name: "specialization",
|
|
9864
|
+
type: "uint8"
|
|
9865
|
+
}
|
|
9866
|
+
],
|
|
9867
|
+
name: "PoolRegistered",
|
|
9868
|
+
type: "event"
|
|
9869
|
+
},
|
|
9870
|
+
{
|
|
9871
|
+
anonymous: false,
|
|
9872
|
+
inputs: [
|
|
9873
|
+
{
|
|
9874
|
+
indexed: true,
|
|
9875
|
+
internalType: "address",
|
|
9876
|
+
name: "relayer",
|
|
9877
|
+
type: "address"
|
|
9878
|
+
},
|
|
9879
|
+
{
|
|
9880
|
+
indexed: true,
|
|
9881
|
+
internalType: "address",
|
|
9882
|
+
name: "sender",
|
|
9883
|
+
type: "address"
|
|
7503
9884
|
},
|
|
7504
9885
|
{
|
|
7505
9886
|
indexed: false,
|
|
7506
|
-
internalType: "
|
|
7507
|
-
name: "
|
|
7508
|
-
type: "
|
|
9887
|
+
internalType: "bool",
|
|
9888
|
+
name: "approved",
|
|
9889
|
+
type: "bool"
|
|
7509
9890
|
}
|
|
7510
9891
|
],
|
|
7511
|
-
name: "
|
|
9892
|
+
name: "RelayerApprovalChanged",
|
|
7512
9893
|
type: "event"
|
|
7513
9894
|
},
|
|
7514
9895
|
{
|
|
@@ -7516,39 +9897,33 @@ var UniswapV2Pair = {
|
|
|
7516
9897
|
inputs: [
|
|
7517
9898
|
{
|
|
7518
9899
|
indexed: true,
|
|
7519
|
-
internalType: "
|
|
7520
|
-
name: "
|
|
7521
|
-
type: "
|
|
9900
|
+
internalType: "bytes32",
|
|
9901
|
+
name: "poolId",
|
|
9902
|
+
type: "bytes32"
|
|
7522
9903
|
},
|
|
7523
9904
|
{
|
|
7524
|
-
indexed:
|
|
7525
|
-
internalType: "
|
|
7526
|
-
name: "
|
|
7527
|
-
type: "
|
|
9905
|
+
indexed: true,
|
|
9906
|
+
internalType: "contract IERC20",
|
|
9907
|
+
name: "tokenIn",
|
|
9908
|
+
type: "address"
|
|
7528
9909
|
},
|
|
7529
9910
|
{
|
|
7530
|
-
indexed:
|
|
7531
|
-
internalType: "
|
|
7532
|
-
name: "
|
|
7533
|
-
type: "
|
|
9911
|
+
indexed: true,
|
|
9912
|
+
internalType: "contract IERC20",
|
|
9913
|
+
name: "tokenOut",
|
|
9914
|
+
type: "address"
|
|
7534
9915
|
},
|
|
7535
9916
|
{
|
|
7536
9917
|
indexed: false,
|
|
7537
9918
|
internalType: "uint256",
|
|
7538
|
-
name: "
|
|
9919
|
+
name: "amountIn",
|
|
7539
9920
|
type: "uint256"
|
|
7540
9921
|
},
|
|
7541
9922
|
{
|
|
7542
9923
|
indexed: false,
|
|
7543
9924
|
internalType: "uint256",
|
|
7544
|
-
name: "
|
|
9925
|
+
name: "amountOut",
|
|
7545
9926
|
type: "uint256"
|
|
7546
|
-
},
|
|
7547
|
-
{
|
|
7548
|
-
indexed: true,
|
|
7549
|
-
internalType: "address",
|
|
7550
|
-
name: "to",
|
|
7551
|
-
type: "address"
|
|
7552
9927
|
}
|
|
7553
9928
|
],
|
|
7554
9929
|
name: "Swap",
|
|
@@ -7558,19 +9933,19 @@ var UniswapV2Pair = {
|
|
|
7558
9933
|
anonymous: false,
|
|
7559
9934
|
inputs: [
|
|
7560
9935
|
{
|
|
7561
|
-
indexed:
|
|
7562
|
-
internalType: "
|
|
7563
|
-
name: "
|
|
7564
|
-
type: "
|
|
9936
|
+
indexed: true,
|
|
9937
|
+
internalType: "bytes32",
|
|
9938
|
+
name: "poolId",
|
|
9939
|
+
type: "bytes32"
|
|
7565
9940
|
},
|
|
7566
9941
|
{
|
|
7567
9942
|
indexed: false,
|
|
7568
|
-
internalType: "
|
|
7569
|
-
name: "
|
|
7570
|
-
type: "
|
|
9943
|
+
internalType: "contract IERC20[]",
|
|
9944
|
+
name: "tokens",
|
|
9945
|
+
type: "address[]"
|
|
7571
9946
|
}
|
|
7572
9947
|
],
|
|
7573
|
-
name: "
|
|
9948
|
+
name: "TokensDeregistered",
|
|
7574
9949
|
type: "event"
|
|
7575
9950
|
},
|
|
7576
9951
|
{
|
|
@@ -7578,584 +9953,877 @@ var UniswapV2Pair = {
|
|
|
7578
9953
|
inputs: [
|
|
7579
9954
|
{
|
|
7580
9955
|
indexed: true,
|
|
7581
|
-
internalType: "
|
|
7582
|
-
name: "
|
|
7583
|
-
type: "
|
|
9956
|
+
internalType: "bytes32",
|
|
9957
|
+
name: "poolId",
|
|
9958
|
+
type: "bytes32"
|
|
7584
9959
|
},
|
|
7585
9960
|
{
|
|
7586
|
-
indexed:
|
|
7587
|
-
internalType: "
|
|
7588
|
-
name: "
|
|
7589
|
-
type: "address"
|
|
9961
|
+
indexed: false,
|
|
9962
|
+
internalType: "contract IERC20[]",
|
|
9963
|
+
name: "tokens",
|
|
9964
|
+
type: "address[]"
|
|
7590
9965
|
},
|
|
7591
9966
|
{
|
|
7592
9967
|
indexed: false,
|
|
7593
|
-
internalType: "
|
|
7594
|
-
name: "
|
|
7595
|
-
type: "
|
|
9968
|
+
internalType: "address[]",
|
|
9969
|
+
name: "assetManagers",
|
|
9970
|
+
type: "address[]"
|
|
7596
9971
|
}
|
|
7597
9972
|
],
|
|
7598
|
-
name: "
|
|
9973
|
+
name: "TokensRegistered",
|
|
7599
9974
|
type: "event"
|
|
7600
9975
|
},
|
|
7601
9976
|
{
|
|
7602
|
-
constant: true,
|
|
7603
9977
|
inputs: [
|
|
7604
9978
|
],
|
|
7605
|
-
name: "
|
|
9979
|
+
name: "WETH",
|
|
7606
9980
|
outputs: [
|
|
7607
9981
|
{
|
|
7608
|
-
internalType: "
|
|
9982
|
+
internalType: "contract IWETH",
|
|
7609
9983
|
name: "",
|
|
7610
|
-
type: "
|
|
9984
|
+
type: "address"
|
|
7611
9985
|
}
|
|
7612
9986
|
],
|
|
7613
|
-
payable: false,
|
|
7614
9987
|
stateMutability: "view",
|
|
7615
9988
|
type: "function"
|
|
7616
9989
|
},
|
|
7617
9990
|
{
|
|
7618
|
-
constant: true,
|
|
7619
9991
|
inputs: [
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
9992
|
+
{
|
|
9993
|
+
internalType: "enum IVault.SwapKind",
|
|
9994
|
+
name: "kind",
|
|
9995
|
+
type: "uint8"
|
|
9996
|
+
},
|
|
9997
|
+
{
|
|
9998
|
+
components: [
|
|
9999
|
+
{
|
|
10000
|
+
internalType: "bytes32",
|
|
10001
|
+
name: "poolId",
|
|
10002
|
+
type: "bytes32"
|
|
10003
|
+
},
|
|
10004
|
+
{
|
|
10005
|
+
internalType: "uint256",
|
|
10006
|
+
name: "assetInIndex",
|
|
10007
|
+
type: "uint256"
|
|
10008
|
+
},
|
|
10009
|
+
{
|
|
10010
|
+
internalType: "uint256",
|
|
10011
|
+
name: "assetOutIndex",
|
|
10012
|
+
type: "uint256"
|
|
10013
|
+
},
|
|
10014
|
+
{
|
|
10015
|
+
internalType: "uint256",
|
|
10016
|
+
name: "amount",
|
|
10017
|
+
type: "uint256"
|
|
10018
|
+
},
|
|
10019
|
+
{
|
|
10020
|
+
internalType: "bytes",
|
|
10021
|
+
name: "userData",
|
|
10022
|
+
type: "bytes"
|
|
10023
|
+
}
|
|
10024
|
+
],
|
|
10025
|
+
internalType: "struct IVault.BatchSwapStep[]",
|
|
10026
|
+
name: "swaps",
|
|
10027
|
+
type: "tuple[]"
|
|
10028
|
+
},
|
|
10029
|
+
{
|
|
10030
|
+
internalType: "contract IAsset[]",
|
|
10031
|
+
name: "assets",
|
|
10032
|
+
type: "address[]"
|
|
10033
|
+
},
|
|
10034
|
+
{
|
|
10035
|
+
components: [
|
|
10036
|
+
{
|
|
10037
|
+
internalType: "address",
|
|
10038
|
+
name: "sender",
|
|
10039
|
+
type: "address"
|
|
10040
|
+
},
|
|
10041
|
+
{
|
|
10042
|
+
internalType: "bool",
|
|
10043
|
+
name: "fromInternalBalance",
|
|
10044
|
+
type: "bool"
|
|
10045
|
+
},
|
|
10046
|
+
{
|
|
10047
|
+
internalType: "address payable",
|
|
10048
|
+
name: "recipient",
|
|
10049
|
+
type: "address"
|
|
10050
|
+
},
|
|
10051
|
+
{
|
|
10052
|
+
internalType: "bool",
|
|
10053
|
+
name: "toInternalBalance",
|
|
10054
|
+
type: "bool"
|
|
10055
|
+
}
|
|
10056
|
+
],
|
|
10057
|
+
internalType: "struct IVault.FundManagement",
|
|
10058
|
+
name: "funds",
|
|
10059
|
+
type: "tuple"
|
|
10060
|
+
},
|
|
10061
|
+
{
|
|
10062
|
+
internalType: "int256[]",
|
|
10063
|
+
name: "limits",
|
|
10064
|
+
type: "int256[]"
|
|
10065
|
+
},
|
|
7623
10066
|
{
|
|
7624
10067
|
internalType: "uint256",
|
|
7625
|
-
name: "",
|
|
10068
|
+
name: "deadline",
|
|
7626
10069
|
type: "uint256"
|
|
7627
10070
|
}
|
|
7628
10071
|
],
|
|
7629
|
-
|
|
7630
|
-
|
|
10072
|
+
name: "batchSwap",
|
|
10073
|
+
outputs: [
|
|
10074
|
+
{
|
|
10075
|
+
internalType: "int256[]",
|
|
10076
|
+
name: "assetDeltas",
|
|
10077
|
+
type: "int256[]"
|
|
10078
|
+
}
|
|
10079
|
+
],
|
|
10080
|
+
stateMutability: "payable",
|
|
7631
10081
|
type: "function"
|
|
7632
10082
|
},
|
|
7633
10083
|
{
|
|
7634
|
-
constant: true,
|
|
7635
10084
|
inputs: [
|
|
7636
|
-
],
|
|
7637
|
-
name: "PERMIT_TYPEHASH",
|
|
7638
|
-
outputs: [
|
|
7639
10085
|
{
|
|
7640
10086
|
internalType: "bytes32",
|
|
7641
|
-
name: "",
|
|
10087
|
+
name: "poolId",
|
|
7642
10088
|
type: "bytes32"
|
|
10089
|
+
},
|
|
10090
|
+
{
|
|
10091
|
+
internalType: "contract IERC20[]",
|
|
10092
|
+
name: "tokens",
|
|
10093
|
+
type: "address[]"
|
|
7643
10094
|
}
|
|
7644
10095
|
],
|
|
7645
|
-
|
|
7646
|
-
|
|
10096
|
+
name: "deregisterTokens",
|
|
10097
|
+
outputs: [
|
|
10098
|
+
],
|
|
10099
|
+
stateMutability: "nonpayable",
|
|
7647
10100
|
type: "function"
|
|
7648
10101
|
},
|
|
7649
10102
|
{
|
|
7650
|
-
constant: true,
|
|
7651
10103
|
inputs: [
|
|
10104
|
+
{
|
|
10105
|
+
internalType: "bytes32",
|
|
10106
|
+
name: "poolId",
|
|
10107
|
+
type: "bytes32"
|
|
10108
|
+
},
|
|
7652
10109
|
{
|
|
7653
10110
|
internalType: "address",
|
|
7654
|
-
name: "
|
|
10111
|
+
name: "sender",
|
|
7655
10112
|
type: "address"
|
|
7656
10113
|
},
|
|
7657
10114
|
{
|
|
7658
|
-
internalType: "address",
|
|
7659
|
-
name: "
|
|
10115
|
+
internalType: "address payable",
|
|
10116
|
+
name: "recipient",
|
|
7660
10117
|
type: "address"
|
|
10118
|
+
},
|
|
10119
|
+
{
|
|
10120
|
+
components: [
|
|
10121
|
+
{
|
|
10122
|
+
internalType: "contract IAsset[]",
|
|
10123
|
+
name: "assets",
|
|
10124
|
+
type: "address[]"
|
|
10125
|
+
},
|
|
10126
|
+
{
|
|
10127
|
+
internalType: "uint256[]",
|
|
10128
|
+
name: "minAmountsOut",
|
|
10129
|
+
type: "uint256[]"
|
|
10130
|
+
},
|
|
10131
|
+
{
|
|
10132
|
+
internalType: "bytes",
|
|
10133
|
+
name: "userData",
|
|
10134
|
+
type: "bytes"
|
|
10135
|
+
},
|
|
10136
|
+
{
|
|
10137
|
+
internalType: "bool",
|
|
10138
|
+
name: "toInternalBalance",
|
|
10139
|
+
type: "bool"
|
|
10140
|
+
}
|
|
10141
|
+
],
|
|
10142
|
+
internalType: "struct IVault.ExitPoolRequest",
|
|
10143
|
+
name: "request",
|
|
10144
|
+
type: "tuple"
|
|
7661
10145
|
}
|
|
7662
10146
|
],
|
|
7663
|
-
name: "
|
|
10147
|
+
name: "exitPool",
|
|
7664
10148
|
outputs: [
|
|
7665
|
-
{
|
|
7666
|
-
internalType: "uint256",
|
|
7667
|
-
name: "",
|
|
7668
|
-
type: "uint256"
|
|
7669
|
-
}
|
|
7670
10149
|
],
|
|
7671
|
-
|
|
7672
|
-
stateMutability: "view",
|
|
10150
|
+
stateMutability: "nonpayable",
|
|
7673
10151
|
type: "function"
|
|
7674
10152
|
},
|
|
7675
10153
|
{
|
|
7676
|
-
constant: false,
|
|
7677
10154
|
inputs: [
|
|
7678
10155
|
{
|
|
7679
|
-
internalType: "
|
|
7680
|
-
name: "
|
|
10156
|
+
internalType: "contract IFlashLoanRecipient",
|
|
10157
|
+
name: "recipient",
|
|
7681
10158
|
type: "address"
|
|
7682
10159
|
},
|
|
7683
10160
|
{
|
|
7684
|
-
internalType: "
|
|
7685
|
-
name: "
|
|
7686
|
-
type: "
|
|
10161
|
+
internalType: "contract IERC20[]",
|
|
10162
|
+
name: "tokens",
|
|
10163
|
+
type: "address[]"
|
|
10164
|
+
},
|
|
10165
|
+
{
|
|
10166
|
+
internalType: "uint256[]",
|
|
10167
|
+
name: "amounts",
|
|
10168
|
+
type: "uint256[]"
|
|
10169
|
+
},
|
|
10170
|
+
{
|
|
10171
|
+
internalType: "bytes",
|
|
10172
|
+
name: "userData",
|
|
10173
|
+
type: "bytes"
|
|
7687
10174
|
}
|
|
7688
10175
|
],
|
|
7689
|
-
name: "
|
|
10176
|
+
name: "flashLoan",
|
|
7690
10177
|
outputs: [
|
|
7691
|
-
{
|
|
7692
|
-
internalType: "bool",
|
|
7693
|
-
name: "",
|
|
7694
|
-
type: "bool"
|
|
7695
|
-
}
|
|
7696
10178
|
],
|
|
7697
|
-
payable: false,
|
|
7698
10179
|
stateMutability: "nonpayable",
|
|
7699
10180
|
type: "function"
|
|
7700
10181
|
},
|
|
7701
10182
|
{
|
|
7702
|
-
constant: true,
|
|
7703
10183
|
inputs: [
|
|
7704
10184
|
{
|
|
7705
|
-
internalType: "
|
|
7706
|
-
name: "
|
|
7707
|
-
type: "
|
|
10185
|
+
internalType: "bytes4",
|
|
10186
|
+
name: "selector",
|
|
10187
|
+
type: "bytes4"
|
|
7708
10188
|
}
|
|
7709
10189
|
],
|
|
7710
|
-
name: "
|
|
10190
|
+
name: "getActionId",
|
|
7711
10191
|
outputs: [
|
|
7712
10192
|
{
|
|
7713
|
-
internalType: "
|
|
10193
|
+
internalType: "bytes32",
|
|
7714
10194
|
name: "",
|
|
7715
|
-
type: "
|
|
10195
|
+
type: "bytes32"
|
|
7716
10196
|
}
|
|
7717
10197
|
],
|
|
7718
|
-
payable: false,
|
|
7719
10198
|
stateMutability: "view",
|
|
7720
10199
|
type: "function"
|
|
7721
10200
|
},
|
|
7722
10201
|
{
|
|
7723
|
-
constant: false,
|
|
7724
10202
|
inputs: [
|
|
10203
|
+
],
|
|
10204
|
+
name: "getAuthorizer",
|
|
10205
|
+
outputs: [
|
|
7725
10206
|
{
|
|
7726
|
-
internalType: "
|
|
7727
|
-
name: "
|
|
10207
|
+
internalType: "contract IAuthorizer",
|
|
10208
|
+
name: "",
|
|
7728
10209
|
type: "address"
|
|
7729
10210
|
}
|
|
7730
10211
|
],
|
|
7731
|
-
|
|
10212
|
+
stateMutability: "view",
|
|
10213
|
+
type: "function"
|
|
10214
|
+
},
|
|
10215
|
+
{
|
|
10216
|
+
inputs: [
|
|
10217
|
+
],
|
|
10218
|
+
name: "getDomainSeparator",
|
|
7732
10219
|
outputs: [
|
|
7733
10220
|
{
|
|
7734
|
-
internalType: "
|
|
7735
|
-
name: "
|
|
7736
|
-
type: "
|
|
7737
|
-
},
|
|
7738
|
-
{
|
|
7739
|
-
internalType: "uint256",
|
|
7740
|
-
name: "amount1",
|
|
7741
|
-
type: "uint256"
|
|
10221
|
+
internalType: "bytes32",
|
|
10222
|
+
name: "",
|
|
10223
|
+
type: "bytes32"
|
|
7742
10224
|
}
|
|
7743
10225
|
],
|
|
7744
|
-
|
|
7745
|
-
stateMutability: "nonpayable",
|
|
10226
|
+
stateMutability: "view",
|
|
7746
10227
|
type: "function"
|
|
7747
10228
|
},
|
|
7748
10229
|
{
|
|
7749
|
-
constant: true,
|
|
7750
10230
|
inputs: [
|
|
10231
|
+
{
|
|
10232
|
+
internalType: "address",
|
|
10233
|
+
name: "user",
|
|
10234
|
+
type: "address"
|
|
10235
|
+
},
|
|
10236
|
+
{
|
|
10237
|
+
internalType: "contract IERC20[]",
|
|
10238
|
+
name: "tokens",
|
|
10239
|
+
type: "address[]"
|
|
10240
|
+
}
|
|
7751
10241
|
],
|
|
7752
|
-
name: "
|
|
10242
|
+
name: "getInternalBalance",
|
|
7753
10243
|
outputs: [
|
|
7754
10244
|
{
|
|
7755
|
-
internalType: "
|
|
7756
|
-
name: "",
|
|
7757
|
-
type: "
|
|
10245
|
+
internalType: "uint256[]",
|
|
10246
|
+
name: "balances",
|
|
10247
|
+
type: "uint256[]"
|
|
7758
10248
|
}
|
|
7759
10249
|
],
|
|
7760
|
-
|
|
7761
|
-
stateMutability: "pure",
|
|
10250
|
+
stateMutability: "view",
|
|
7762
10251
|
type: "function"
|
|
7763
10252
|
},
|
|
7764
10253
|
{
|
|
7765
|
-
constant: true,
|
|
7766
10254
|
inputs: [
|
|
10255
|
+
{
|
|
10256
|
+
internalType: "address",
|
|
10257
|
+
name: "user",
|
|
10258
|
+
type: "address"
|
|
10259
|
+
}
|
|
7767
10260
|
],
|
|
7768
|
-
name: "
|
|
10261
|
+
name: "getNextNonce",
|
|
7769
10262
|
outputs: [
|
|
7770
10263
|
{
|
|
7771
|
-
internalType: "
|
|
10264
|
+
internalType: "uint256",
|
|
7772
10265
|
name: "",
|
|
7773
|
-
type: "
|
|
10266
|
+
type: "uint256"
|
|
7774
10267
|
}
|
|
7775
10268
|
],
|
|
7776
|
-
payable: false,
|
|
7777
10269
|
stateMutability: "view",
|
|
7778
10270
|
type: "function"
|
|
7779
10271
|
},
|
|
7780
10272
|
{
|
|
7781
|
-
constant: true,
|
|
7782
10273
|
inputs: [
|
|
7783
10274
|
],
|
|
7784
|
-
name: "
|
|
10275
|
+
name: "getPausedState",
|
|
7785
10276
|
outputs: [
|
|
7786
10277
|
{
|
|
7787
|
-
internalType: "
|
|
7788
|
-
name: "
|
|
7789
|
-
type: "
|
|
10278
|
+
internalType: "bool",
|
|
10279
|
+
name: "paused",
|
|
10280
|
+
type: "bool"
|
|
7790
10281
|
},
|
|
7791
10282
|
{
|
|
7792
|
-
internalType: "
|
|
7793
|
-
name: "
|
|
7794
|
-
type: "
|
|
10283
|
+
internalType: "uint256",
|
|
10284
|
+
name: "pauseWindowEndTime",
|
|
10285
|
+
type: "uint256"
|
|
7795
10286
|
},
|
|
7796
10287
|
{
|
|
7797
|
-
internalType: "
|
|
7798
|
-
name: "
|
|
7799
|
-
type: "
|
|
10288
|
+
internalType: "uint256",
|
|
10289
|
+
name: "bufferPeriodEndTime",
|
|
10290
|
+
type: "uint256"
|
|
7800
10291
|
}
|
|
7801
10292
|
],
|
|
7802
|
-
payable: false,
|
|
7803
10293
|
stateMutability: "view",
|
|
7804
10294
|
type: "function"
|
|
7805
10295
|
},
|
|
7806
10296
|
{
|
|
7807
|
-
constant: false,
|
|
7808
10297
|
inputs: [
|
|
10298
|
+
{
|
|
10299
|
+
internalType: "bytes32",
|
|
10300
|
+
name: "poolId",
|
|
10301
|
+
type: "bytes32"
|
|
10302
|
+
}
|
|
10303
|
+
],
|
|
10304
|
+
name: "getPool",
|
|
10305
|
+
outputs: [
|
|
7809
10306
|
{
|
|
7810
10307
|
internalType: "address",
|
|
7811
10308
|
name: "",
|
|
7812
10309
|
type: "address"
|
|
7813
10310
|
},
|
|
7814
10311
|
{
|
|
7815
|
-
internalType: "
|
|
10312
|
+
internalType: "enum IVault.PoolSpecialization",
|
|
7816
10313
|
name: "",
|
|
7817
|
-
type: "
|
|
10314
|
+
type: "uint8"
|
|
7818
10315
|
}
|
|
7819
10316
|
],
|
|
7820
|
-
|
|
7821
|
-
outputs: [
|
|
7822
|
-
],
|
|
7823
|
-
payable: false,
|
|
7824
|
-
stateMutability: "nonpayable",
|
|
10317
|
+
stateMutability: "view",
|
|
7825
10318
|
type: "function"
|
|
7826
10319
|
},
|
|
7827
10320
|
{
|
|
7828
|
-
constant: true,
|
|
7829
10321
|
inputs: [
|
|
10322
|
+
{
|
|
10323
|
+
internalType: "bytes32",
|
|
10324
|
+
name: "poolId",
|
|
10325
|
+
type: "bytes32"
|
|
10326
|
+
},
|
|
10327
|
+
{
|
|
10328
|
+
internalType: "contract IERC20",
|
|
10329
|
+
name: "token",
|
|
10330
|
+
type: "address"
|
|
10331
|
+
}
|
|
7830
10332
|
],
|
|
7831
|
-
name: "
|
|
10333
|
+
name: "getPoolTokenInfo",
|
|
7832
10334
|
outputs: [
|
|
7833
10335
|
{
|
|
7834
10336
|
internalType: "uint256",
|
|
7835
|
-
name: "",
|
|
10337
|
+
name: "cash",
|
|
10338
|
+
type: "uint256"
|
|
10339
|
+
},
|
|
10340
|
+
{
|
|
10341
|
+
internalType: "uint256",
|
|
10342
|
+
name: "managed",
|
|
10343
|
+
type: "uint256"
|
|
10344
|
+
},
|
|
10345
|
+
{
|
|
10346
|
+
internalType: "uint256",
|
|
10347
|
+
name: "lastChangeBlock",
|
|
7836
10348
|
type: "uint256"
|
|
10349
|
+
},
|
|
10350
|
+
{
|
|
10351
|
+
internalType: "address",
|
|
10352
|
+
name: "assetManager",
|
|
10353
|
+
type: "address"
|
|
7837
10354
|
}
|
|
7838
10355
|
],
|
|
7839
|
-
payable: false,
|
|
7840
10356
|
stateMutability: "view",
|
|
7841
10357
|
type: "function"
|
|
7842
10358
|
},
|
|
7843
10359
|
{
|
|
7844
|
-
constant: false,
|
|
7845
10360
|
inputs: [
|
|
7846
10361
|
{
|
|
7847
|
-
internalType: "
|
|
7848
|
-
name: "
|
|
7849
|
-
type: "
|
|
10362
|
+
internalType: "bytes32",
|
|
10363
|
+
name: "poolId",
|
|
10364
|
+
type: "bytes32"
|
|
7850
10365
|
}
|
|
7851
10366
|
],
|
|
7852
|
-
name: "
|
|
10367
|
+
name: "getPoolTokens",
|
|
7853
10368
|
outputs: [
|
|
10369
|
+
{
|
|
10370
|
+
internalType: "contract IERC20[]",
|
|
10371
|
+
name: "tokens",
|
|
10372
|
+
type: "address[]"
|
|
10373
|
+
},
|
|
10374
|
+
{
|
|
10375
|
+
internalType: "uint256[]",
|
|
10376
|
+
name: "balances",
|
|
10377
|
+
type: "uint256[]"
|
|
10378
|
+
},
|
|
7854
10379
|
{
|
|
7855
10380
|
internalType: "uint256",
|
|
7856
|
-
name: "
|
|
10381
|
+
name: "lastChangeBlock",
|
|
7857
10382
|
type: "uint256"
|
|
7858
10383
|
}
|
|
7859
10384
|
],
|
|
7860
|
-
|
|
7861
|
-
stateMutability: "nonpayable",
|
|
10385
|
+
stateMutability: "view",
|
|
7862
10386
|
type: "function"
|
|
7863
10387
|
},
|
|
7864
10388
|
{
|
|
7865
|
-
constant: true,
|
|
7866
10389
|
inputs: [
|
|
7867
10390
|
],
|
|
7868
|
-
name: "
|
|
10391
|
+
name: "getProtocolFeesCollector",
|
|
7869
10392
|
outputs: [
|
|
7870
10393
|
{
|
|
7871
|
-
internalType: "
|
|
10394
|
+
internalType: "contract ProtocolFeesCollector",
|
|
7872
10395
|
name: "",
|
|
7873
|
-
type: "
|
|
10396
|
+
type: "address"
|
|
7874
10397
|
}
|
|
7875
10398
|
],
|
|
7876
|
-
|
|
7877
|
-
stateMutability: "pure",
|
|
10399
|
+
stateMutability: "view",
|
|
7878
10400
|
type: "function"
|
|
7879
10401
|
},
|
|
7880
10402
|
{
|
|
7881
|
-
constant: true,
|
|
7882
10403
|
inputs: [
|
|
7883
10404
|
{
|
|
7884
10405
|
internalType: "address",
|
|
7885
|
-
name: "
|
|
10406
|
+
name: "user",
|
|
10407
|
+
type: "address"
|
|
10408
|
+
},
|
|
10409
|
+
{
|
|
10410
|
+
internalType: "address",
|
|
10411
|
+
name: "relayer",
|
|
7886
10412
|
type: "address"
|
|
7887
10413
|
}
|
|
7888
10414
|
],
|
|
7889
|
-
name: "
|
|
10415
|
+
name: "hasApprovedRelayer",
|
|
7890
10416
|
outputs: [
|
|
7891
10417
|
{
|
|
7892
|
-
internalType: "
|
|
10418
|
+
internalType: "bool",
|
|
7893
10419
|
name: "",
|
|
7894
|
-
type: "
|
|
10420
|
+
type: "bool"
|
|
7895
10421
|
}
|
|
7896
10422
|
],
|
|
7897
|
-
payable: false,
|
|
7898
10423
|
stateMutability: "view",
|
|
7899
10424
|
type: "function"
|
|
7900
10425
|
},
|
|
7901
10426
|
{
|
|
7902
|
-
constant: false,
|
|
7903
10427
|
inputs: [
|
|
7904
10428
|
{
|
|
7905
|
-
internalType: "
|
|
7906
|
-
name: "
|
|
7907
|
-
type: "
|
|
10429
|
+
internalType: "bytes32",
|
|
10430
|
+
name: "poolId",
|
|
10431
|
+
type: "bytes32"
|
|
7908
10432
|
},
|
|
7909
10433
|
{
|
|
7910
10434
|
internalType: "address",
|
|
7911
|
-
name: "
|
|
10435
|
+
name: "sender",
|
|
7912
10436
|
type: "address"
|
|
7913
10437
|
},
|
|
7914
10438
|
{
|
|
7915
|
-
internalType: "
|
|
7916
|
-
name: "
|
|
7917
|
-
type: "
|
|
7918
|
-
},
|
|
7919
|
-
{
|
|
7920
|
-
internalType: "uint256",
|
|
7921
|
-
name: "deadline",
|
|
7922
|
-
type: "uint256"
|
|
7923
|
-
},
|
|
7924
|
-
{
|
|
7925
|
-
internalType: "uint8",
|
|
7926
|
-
name: "v",
|
|
7927
|
-
type: "uint8"
|
|
10439
|
+
internalType: "address",
|
|
10440
|
+
name: "recipient",
|
|
10441
|
+
type: "address"
|
|
7928
10442
|
},
|
|
7929
10443
|
{
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
10444
|
+
components: [
|
|
10445
|
+
{
|
|
10446
|
+
internalType: "contract IAsset[]",
|
|
10447
|
+
name: "assets",
|
|
10448
|
+
type: "address[]"
|
|
10449
|
+
},
|
|
10450
|
+
{
|
|
10451
|
+
internalType: "uint256[]",
|
|
10452
|
+
name: "maxAmountsIn",
|
|
10453
|
+
type: "uint256[]"
|
|
10454
|
+
},
|
|
10455
|
+
{
|
|
10456
|
+
internalType: "bytes",
|
|
10457
|
+
name: "userData",
|
|
10458
|
+
type: "bytes"
|
|
10459
|
+
},
|
|
10460
|
+
{
|
|
10461
|
+
internalType: "bool",
|
|
10462
|
+
name: "fromInternalBalance",
|
|
10463
|
+
type: "bool"
|
|
10464
|
+
}
|
|
10465
|
+
],
|
|
10466
|
+
internalType: "struct IVault.JoinPoolRequest",
|
|
10467
|
+
name: "request",
|
|
10468
|
+
type: "tuple"
|
|
10469
|
+
}
|
|
10470
|
+
],
|
|
10471
|
+
name: "joinPool",
|
|
10472
|
+
outputs: [
|
|
10473
|
+
],
|
|
10474
|
+
stateMutability: "payable",
|
|
10475
|
+
type: "function"
|
|
10476
|
+
},
|
|
10477
|
+
{
|
|
10478
|
+
inputs: [
|
|
7934
10479
|
{
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
10480
|
+
components: [
|
|
10481
|
+
{
|
|
10482
|
+
internalType: "enum IVault.PoolBalanceOpKind",
|
|
10483
|
+
name: "kind",
|
|
10484
|
+
type: "uint8"
|
|
10485
|
+
},
|
|
10486
|
+
{
|
|
10487
|
+
internalType: "bytes32",
|
|
10488
|
+
name: "poolId",
|
|
10489
|
+
type: "bytes32"
|
|
10490
|
+
},
|
|
10491
|
+
{
|
|
10492
|
+
internalType: "contract IERC20",
|
|
10493
|
+
name: "token",
|
|
10494
|
+
type: "address"
|
|
10495
|
+
},
|
|
10496
|
+
{
|
|
10497
|
+
internalType: "uint256",
|
|
10498
|
+
name: "amount",
|
|
10499
|
+
type: "uint256"
|
|
10500
|
+
}
|
|
10501
|
+
],
|
|
10502
|
+
internalType: "struct IVault.PoolBalanceOp[]",
|
|
10503
|
+
name: "ops",
|
|
10504
|
+
type: "tuple[]"
|
|
7938
10505
|
}
|
|
7939
10506
|
],
|
|
7940
|
-
name: "
|
|
10507
|
+
name: "managePoolBalance",
|
|
7941
10508
|
outputs: [
|
|
7942
10509
|
],
|
|
7943
|
-
payable: false,
|
|
7944
10510
|
stateMutability: "nonpayable",
|
|
7945
10511
|
type: "function"
|
|
7946
10512
|
},
|
|
7947
10513
|
{
|
|
7948
|
-
constant: true,
|
|
7949
10514
|
inputs: [
|
|
10515
|
+
{
|
|
10516
|
+
components: [
|
|
10517
|
+
{
|
|
10518
|
+
internalType: "enum IVault.UserBalanceOpKind",
|
|
10519
|
+
name: "kind",
|
|
10520
|
+
type: "uint8"
|
|
10521
|
+
},
|
|
10522
|
+
{
|
|
10523
|
+
internalType: "contract IAsset",
|
|
10524
|
+
name: "asset",
|
|
10525
|
+
type: "address"
|
|
10526
|
+
},
|
|
10527
|
+
{
|
|
10528
|
+
internalType: "uint256",
|
|
10529
|
+
name: "amount",
|
|
10530
|
+
type: "uint256"
|
|
10531
|
+
},
|
|
10532
|
+
{
|
|
10533
|
+
internalType: "address",
|
|
10534
|
+
name: "sender",
|
|
10535
|
+
type: "address"
|
|
10536
|
+
},
|
|
10537
|
+
{
|
|
10538
|
+
internalType: "address payable",
|
|
10539
|
+
name: "recipient",
|
|
10540
|
+
type: "address"
|
|
10541
|
+
}
|
|
10542
|
+
],
|
|
10543
|
+
internalType: "struct IVault.UserBalanceOp[]",
|
|
10544
|
+
name: "ops",
|
|
10545
|
+
type: "tuple[]"
|
|
10546
|
+
}
|
|
7950
10547
|
],
|
|
7951
|
-
name: "
|
|
10548
|
+
name: "manageUserBalance",
|
|
7952
10549
|
outputs: [
|
|
10550
|
+
],
|
|
10551
|
+
stateMutability: "payable",
|
|
10552
|
+
type: "function"
|
|
10553
|
+
},
|
|
10554
|
+
{
|
|
10555
|
+
inputs: [
|
|
7953
10556
|
{
|
|
7954
|
-
internalType: "
|
|
7955
|
-
name: "",
|
|
7956
|
-
type: "
|
|
10557
|
+
internalType: "enum IVault.SwapKind",
|
|
10558
|
+
name: "kind",
|
|
10559
|
+
type: "uint8"
|
|
10560
|
+
},
|
|
10561
|
+
{
|
|
10562
|
+
components: [
|
|
10563
|
+
{
|
|
10564
|
+
internalType: "bytes32",
|
|
10565
|
+
name: "poolId",
|
|
10566
|
+
type: "bytes32"
|
|
10567
|
+
},
|
|
10568
|
+
{
|
|
10569
|
+
internalType: "uint256",
|
|
10570
|
+
name: "assetInIndex",
|
|
10571
|
+
type: "uint256"
|
|
10572
|
+
},
|
|
10573
|
+
{
|
|
10574
|
+
internalType: "uint256",
|
|
10575
|
+
name: "assetOutIndex",
|
|
10576
|
+
type: "uint256"
|
|
10577
|
+
},
|
|
10578
|
+
{
|
|
10579
|
+
internalType: "uint256",
|
|
10580
|
+
name: "amount",
|
|
10581
|
+
type: "uint256"
|
|
10582
|
+
},
|
|
10583
|
+
{
|
|
10584
|
+
internalType: "bytes",
|
|
10585
|
+
name: "userData",
|
|
10586
|
+
type: "bytes"
|
|
10587
|
+
}
|
|
10588
|
+
],
|
|
10589
|
+
internalType: "struct IVault.BatchSwapStep[]",
|
|
10590
|
+
name: "swaps",
|
|
10591
|
+
type: "tuple[]"
|
|
10592
|
+
},
|
|
10593
|
+
{
|
|
10594
|
+
internalType: "contract IAsset[]",
|
|
10595
|
+
name: "assets",
|
|
10596
|
+
type: "address[]"
|
|
10597
|
+
},
|
|
10598
|
+
{
|
|
10599
|
+
components: [
|
|
10600
|
+
{
|
|
10601
|
+
internalType: "address",
|
|
10602
|
+
name: "sender",
|
|
10603
|
+
type: "address"
|
|
10604
|
+
},
|
|
10605
|
+
{
|
|
10606
|
+
internalType: "bool",
|
|
10607
|
+
name: "fromInternalBalance",
|
|
10608
|
+
type: "bool"
|
|
10609
|
+
},
|
|
10610
|
+
{
|
|
10611
|
+
internalType: "address payable",
|
|
10612
|
+
name: "recipient",
|
|
10613
|
+
type: "address"
|
|
10614
|
+
},
|
|
10615
|
+
{
|
|
10616
|
+
internalType: "bool",
|
|
10617
|
+
name: "toInternalBalance",
|
|
10618
|
+
type: "bool"
|
|
10619
|
+
}
|
|
10620
|
+
],
|
|
10621
|
+
internalType: "struct IVault.FundManagement",
|
|
10622
|
+
name: "funds",
|
|
10623
|
+
type: "tuple"
|
|
7957
10624
|
}
|
|
7958
10625
|
],
|
|
7959
|
-
|
|
7960
|
-
stateMutability: "view",
|
|
7961
|
-
type: "function"
|
|
7962
|
-
},
|
|
7963
|
-
{
|
|
7964
|
-
constant: true,
|
|
7965
|
-
inputs: [
|
|
7966
|
-
],
|
|
7967
|
-
name: "price1CumulativeLast",
|
|
10626
|
+
name: "queryBatchSwap",
|
|
7968
10627
|
outputs: [
|
|
7969
10628
|
{
|
|
7970
|
-
internalType: "
|
|
10629
|
+
internalType: "int256[]",
|
|
7971
10630
|
name: "",
|
|
7972
|
-
type: "
|
|
10631
|
+
type: "int256[]"
|
|
7973
10632
|
}
|
|
7974
10633
|
],
|
|
7975
|
-
|
|
7976
|
-
stateMutability: "view",
|
|
10634
|
+
stateMutability: "nonpayable",
|
|
7977
10635
|
type: "function"
|
|
7978
10636
|
},
|
|
7979
10637
|
{
|
|
7980
|
-
constant: false,
|
|
7981
10638
|
inputs: [
|
|
7982
10639
|
{
|
|
7983
|
-
internalType: "
|
|
7984
|
-
name: "
|
|
7985
|
-
type: "
|
|
10640
|
+
internalType: "enum IVault.PoolSpecialization",
|
|
10641
|
+
name: "specialization",
|
|
10642
|
+
type: "uint8"
|
|
7986
10643
|
}
|
|
7987
10644
|
],
|
|
7988
|
-
name: "
|
|
10645
|
+
name: "registerPool",
|
|
7989
10646
|
outputs: [
|
|
10647
|
+
{
|
|
10648
|
+
internalType: "bytes32",
|
|
10649
|
+
name: "",
|
|
10650
|
+
type: "bytes32"
|
|
10651
|
+
}
|
|
7990
10652
|
],
|
|
7991
|
-
payable: false,
|
|
7992
10653
|
stateMutability: "nonpayable",
|
|
7993
10654
|
type: "function"
|
|
7994
10655
|
},
|
|
7995
10656
|
{
|
|
7996
|
-
constant: false,
|
|
7997
10657
|
inputs: [
|
|
7998
10658
|
{
|
|
7999
|
-
internalType: "
|
|
8000
|
-
name: "
|
|
8001
|
-
type: "
|
|
8002
|
-
},
|
|
8003
|
-
{
|
|
8004
|
-
internalType: "uint256",
|
|
8005
|
-
name: "amount1Out",
|
|
8006
|
-
type: "uint256"
|
|
10659
|
+
internalType: "bytes32",
|
|
10660
|
+
name: "poolId",
|
|
10661
|
+
type: "bytes32"
|
|
8007
10662
|
},
|
|
8008
10663
|
{
|
|
8009
|
-
internalType: "
|
|
8010
|
-
name: "
|
|
8011
|
-
type: "address"
|
|
10664
|
+
internalType: "contract IERC20[]",
|
|
10665
|
+
name: "tokens",
|
|
10666
|
+
type: "address[]"
|
|
8012
10667
|
},
|
|
8013
10668
|
{
|
|
8014
|
-
internalType: "
|
|
8015
|
-
name: "
|
|
8016
|
-
type: "
|
|
10669
|
+
internalType: "address[]",
|
|
10670
|
+
name: "assetManagers",
|
|
10671
|
+
type: "address[]"
|
|
8017
10672
|
}
|
|
8018
10673
|
],
|
|
8019
|
-
name: "
|
|
10674
|
+
name: "registerTokens",
|
|
8020
10675
|
outputs: [
|
|
8021
10676
|
],
|
|
8022
|
-
payable: false,
|
|
8023
10677
|
stateMutability: "nonpayable",
|
|
8024
10678
|
type: "function"
|
|
8025
10679
|
},
|
|
8026
10680
|
{
|
|
8027
|
-
constant: true,
|
|
8028
10681
|
inputs: [
|
|
8029
|
-
],
|
|
8030
|
-
name: "symbol",
|
|
8031
|
-
outputs: [
|
|
8032
10682
|
{
|
|
8033
|
-
internalType: "
|
|
8034
|
-
name: "",
|
|
8035
|
-
type: "
|
|
10683
|
+
internalType: "contract IAuthorizer",
|
|
10684
|
+
name: "newAuthorizer",
|
|
10685
|
+
type: "address"
|
|
8036
10686
|
}
|
|
8037
10687
|
],
|
|
8038
|
-
|
|
8039
|
-
stateMutability: "pure",
|
|
8040
|
-
type: "function"
|
|
8041
|
-
},
|
|
8042
|
-
{
|
|
8043
|
-
constant: false,
|
|
8044
|
-
inputs: [
|
|
8045
|
-
],
|
|
8046
|
-
name: "sync",
|
|
10688
|
+
name: "setAuthorizer",
|
|
8047
10689
|
outputs: [
|
|
8048
10690
|
],
|
|
8049
|
-
payable: false,
|
|
8050
10691
|
stateMutability: "nonpayable",
|
|
8051
10692
|
type: "function"
|
|
8052
10693
|
},
|
|
8053
10694
|
{
|
|
8054
|
-
constant: true,
|
|
8055
|
-
inputs: [
|
|
8056
|
-
],
|
|
8057
|
-
name: "token0",
|
|
8058
|
-
outputs: [
|
|
8059
|
-
{
|
|
8060
|
-
internalType: "address",
|
|
8061
|
-
name: "",
|
|
8062
|
-
type: "address"
|
|
8063
|
-
}
|
|
8064
|
-
],
|
|
8065
|
-
payable: false,
|
|
8066
|
-
stateMutability: "view",
|
|
8067
|
-
type: "function"
|
|
8068
|
-
},
|
|
8069
|
-
{
|
|
8070
|
-
constant: true,
|
|
8071
10695
|
inputs: [
|
|
8072
|
-
],
|
|
8073
|
-
name: "token1",
|
|
8074
|
-
outputs: [
|
|
8075
10696
|
{
|
|
8076
|
-
internalType: "
|
|
8077
|
-
name: "",
|
|
8078
|
-
type: "
|
|
10697
|
+
internalType: "bool",
|
|
10698
|
+
name: "paused",
|
|
10699
|
+
type: "bool"
|
|
8079
10700
|
}
|
|
8080
10701
|
],
|
|
8081
|
-
|
|
8082
|
-
stateMutability: "view",
|
|
8083
|
-
type: "function"
|
|
8084
|
-
},
|
|
8085
|
-
{
|
|
8086
|
-
constant: true,
|
|
8087
|
-
inputs: [
|
|
8088
|
-
],
|
|
8089
|
-
name: "totalSupply",
|
|
10702
|
+
name: "setPaused",
|
|
8090
10703
|
outputs: [
|
|
8091
|
-
{
|
|
8092
|
-
internalType: "uint256",
|
|
8093
|
-
name: "",
|
|
8094
|
-
type: "uint256"
|
|
8095
|
-
}
|
|
8096
10704
|
],
|
|
8097
|
-
|
|
8098
|
-
stateMutability: "view",
|
|
10705
|
+
stateMutability: "nonpayable",
|
|
8099
10706
|
type: "function"
|
|
8100
10707
|
},
|
|
8101
10708
|
{
|
|
8102
|
-
constant: false,
|
|
8103
10709
|
inputs: [
|
|
8104
10710
|
{
|
|
8105
10711
|
internalType: "address",
|
|
8106
|
-
name: "
|
|
10712
|
+
name: "sender",
|
|
8107
10713
|
type: "address"
|
|
8108
10714
|
},
|
|
8109
10715
|
{
|
|
8110
|
-
internalType: "
|
|
8111
|
-
name: "
|
|
8112
|
-
type: "
|
|
8113
|
-
}
|
|
8114
|
-
],
|
|
8115
|
-
name: "transfer",
|
|
8116
|
-
outputs: [
|
|
10716
|
+
internalType: "address",
|
|
10717
|
+
name: "relayer",
|
|
10718
|
+
type: "address"
|
|
10719
|
+
},
|
|
8117
10720
|
{
|
|
8118
10721
|
internalType: "bool",
|
|
8119
|
-
name: "",
|
|
10722
|
+
name: "approved",
|
|
8120
10723
|
type: "bool"
|
|
8121
10724
|
}
|
|
8122
10725
|
],
|
|
8123
|
-
|
|
10726
|
+
name: "setRelayerApproval",
|
|
10727
|
+
outputs: [
|
|
10728
|
+
],
|
|
8124
10729
|
stateMutability: "nonpayable",
|
|
8125
10730
|
type: "function"
|
|
8126
10731
|
},
|
|
8127
10732
|
{
|
|
8128
|
-
constant: false,
|
|
8129
10733
|
inputs: [
|
|
8130
10734
|
{
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
10735
|
+
components: [
|
|
10736
|
+
{
|
|
10737
|
+
internalType: "bytes32",
|
|
10738
|
+
name: "poolId",
|
|
10739
|
+
type: "bytes32"
|
|
10740
|
+
},
|
|
10741
|
+
{
|
|
10742
|
+
internalType: "enum IVault.SwapKind",
|
|
10743
|
+
name: "kind",
|
|
10744
|
+
type: "uint8"
|
|
10745
|
+
},
|
|
10746
|
+
{
|
|
10747
|
+
internalType: "contract IAsset",
|
|
10748
|
+
name: "assetIn",
|
|
10749
|
+
type: "address"
|
|
10750
|
+
},
|
|
10751
|
+
{
|
|
10752
|
+
internalType: "contract IAsset",
|
|
10753
|
+
name: "assetOut",
|
|
10754
|
+
type: "address"
|
|
10755
|
+
},
|
|
10756
|
+
{
|
|
10757
|
+
internalType: "uint256",
|
|
10758
|
+
name: "amount",
|
|
10759
|
+
type: "uint256"
|
|
10760
|
+
},
|
|
10761
|
+
{
|
|
10762
|
+
internalType: "bytes",
|
|
10763
|
+
name: "userData",
|
|
10764
|
+
type: "bytes"
|
|
10765
|
+
}
|
|
10766
|
+
],
|
|
10767
|
+
internalType: "struct IVault.SingleSwap",
|
|
10768
|
+
name: "singleSwap",
|
|
10769
|
+
type: "tuple"
|
|
8134
10770
|
},
|
|
8135
10771
|
{
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
10772
|
+
components: [
|
|
10773
|
+
{
|
|
10774
|
+
internalType: "address",
|
|
10775
|
+
name: "sender",
|
|
10776
|
+
type: "address"
|
|
10777
|
+
},
|
|
10778
|
+
{
|
|
10779
|
+
internalType: "bool",
|
|
10780
|
+
name: "fromInternalBalance",
|
|
10781
|
+
type: "bool"
|
|
10782
|
+
},
|
|
10783
|
+
{
|
|
10784
|
+
internalType: "address payable",
|
|
10785
|
+
name: "recipient",
|
|
10786
|
+
type: "address"
|
|
10787
|
+
},
|
|
10788
|
+
{
|
|
10789
|
+
internalType: "bool",
|
|
10790
|
+
name: "toInternalBalance",
|
|
10791
|
+
type: "bool"
|
|
10792
|
+
}
|
|
10793
|
+
],
|
|
10794
|
+
internalType: "struct IVault.FundManagement",
|
|
10795
|
+
name: "funds",
|
|
10796
|
+
type: "tuple"
|
|
8139
10797
|
},
|
|
8140
10798
|
{
|
|
8141
10799
|
internalType: "uint256",
|
|
8142
|
-
name: "
|
|
10800
|
+
name: "limit",
|
|
10801
|
+
type: "uint256"
|
|
10802
|
+
},
|
|
10803
|
+
{
|
|
10804
|
+
internalType: "uint256",
|
|
10805
|
+
name: "deadline",
|
|
8143
10806
|
type: "uint256"
|
|
8144
10807
|
}
|
|
8145
10808
|
],
|
|
8146
|
-
name: "
|
|
10809
|
+
name: "swap",
|
|
8147
10810
|
outputs: [
|
|
8148
10811
|
{
|
|
8149
|
-
internalType: "
|
|
8150
|
-
name: "",
|
|
8151
|
-
type: "
|
|
10812
|
+
internalType: "uint256",
|
|
10813
|
+
name: "amountCalculated",
|
|
10814
|
+
type: "uint256"
|
|
8152
10815
|
}
|
|
8153
10816
|
],
|
|
8154
|
-
|
|
8155
|
-
stateMutability: "nonpayable",
|
|
10817
|
+
stateMutability: "payable",
|
|
8156
10818
|
type: "function"
|
|
10819
|
+
},
|
|
10820
|
+
{
|
|
10821
|
+
stateMutability: "payable",
|
|
10822
|
+
type: "receive"
|
|
8157
10823
|
}
|
|
8158
|
-
]
|
|
10824
|
+
];
|
|
10825
|
+
var IBalancerV2Vault = {
|
|
10826
|
+
abi: abi$b
|
|
8159
10827
|
};
|
|
8160
10828
|
|
|
8161
10829
|
var Utils = /*#__PURE__*/function () {
|
|
@@ -8389,6 +11057,145 @@ var Utils = /*#__PURE__*/function () {
|
|
|
8389
11057
|
return getMinAmountOut;
|
|
8390
11058
|
}();
|
|
8391
11059
|
|
|
11060
|
+
_proto.getBalancerSwapTx = /*#__PURE__*/function () {
|
|
11061
|
+
var _getBalancerSwapTx = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(pool, assetFrom, assetTo, amountIn, slippage // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11062
|
+
) {
|
|
11063
|
+
var sor$1, isFetched, swapType, _yield$sor$getSwaps, swaps, tokenAddresses, returnAmount, minimumAmountOut, iBalancerV2Vault, swap, swapTx, limits, _swapTx;
|
|
11064
|
+
|
|
11065
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
11066
|
+
while (1) {
|
|
11067
|
+
switch (_context5.prev = _context5.next) {
|
|
11068
|
+
case 0:
|
|
11069
|
+
sor$1 = new sor.SOR(this.signer.provider, networkChainIdMap[this.network], balancerSubgraph[this.network]); // isFetched will be true on success
|
|
11070
|
+
|
|
11071
|
+
_context5.next = 3;
|
|
11072
|
+
return sor$1.fetchPools();
|
|
11073
|
+
|
|
11074
|
+
case 3:
|
|
11075
|
+
isFetched = _context5.sent;
|
|
11076
|
+
|
|
11077
|
+
if (isFetched) {
|
|
11078
|
+
_context5.next = 6;
|
|
11079
|
+
break;
|
|
11080
|
+
}
|
|
11081
|
+
|
|
11082
|
+
throw new Error("Error fetching balancer pools");
|
|
11083
|
+
|
|
11084
|
+
case 6:
|
|
11085
|
+
swapType = sor.SwapTypes.SwapExactIn;
|
|
11086
|
+
_context5.next = 9;
|
|
11087
|
+
return sor$1.getSwaps(assetFrom, assetTo, swapType, ethers.ethers.BigNumber.from(amountIn));
|
|
11088
|
+
|
|
11089
|
+
case 9:
|
|
11090
|
+
_yield$sor$getSwaps = _context5.sent;
|
|
11091
|
+
swaps = _yield$sor$getSwaps.swaps;
|
|
11092
|
+
tokenAddresses = _yield$sor$getSwaps.tokenAddresses;
|
|
11093
|
+
returnAmount = _yield$sor$getSwaps.returnAmount;
|
|
11094
|
+
minimumAmountOut = returnAmount.mul(10000 - slippage * 100).div(10000);
|
|
11095
|
+
iBalancerV2Vault = new ethers.ethers.utils.Interface(IBalancerV2Vault.abi);
|
|
11096
|
+
|
|
11097
|
+
if (!(swaps.length === 1)) {
|
|
11098
|
+
_context5.next = 21;
|
|
11099
|
+
break;
|
|
11100
|
+
}
|
|
11101
|
+
|
|
11102
|
+
swap = swaps[0]; //do single swap
|
|
11103
|
+
|
|
11104
|
+
swapTx = iBalancerV2Vault.encodeFunctionData("swap", [[swap.poolId, sor.SwapTypes.SwapExactIn, tokenAddresses[swap.assetInIndex], tokenAddresses[swap.assetOutIndex], swap.amount, swap.userData], [pool.address, false, pool.address, false], minimumAmountOut, Math.floor(Date.now() / 1000) + 60 * 20 // 20 minutes from the current Unix time
|
|
11105
|
+
]);
|
|
11106
|
+
return _context5.abrupt("return", swapTx);
|
|
11107
|
+
|
|
11108
|
+
case 21:
|
|
11109
|
+
// Limits:
|
|
11110
|
+
// +ve means max to send
|
|
11111
|
+
// -ve mean min to receive
|
|
11112
|
+
// For a multihop the intermediate tokens should be 0
|
|
11113
|
+
limits = [];
|
|
11114
|
+
tokenAddresses.forEach(function (token, i) {
|
|
11115
|
+
if (token.toLowerCase() === assetFrom.toLowerCase()) {
|
|
11116
|
+
limits[i] = amountIn.toString();
|
|
11117
|
+
} else if (token.toLowerCase() === assetTo.toLowerCase()) {
|
|
11118
|
+
limits[i] = minimumAmountOut.mul(-1).toString();
|
|
11119
|
+
} else {
|
|
11120
|
+
limits[i] = "0";
|
|
11121
|
+
}
|
|
11122
|
+
});
|
|
11123
|
+
_swapTx = iBalancerV2Vault.encodeFunctionData("batchSwap", [sor.SwapTypes.SwapExactIn, swaps, tokenAddresses, [pool.address, false, pool.address, false], limits, Math.floor(Date.now() / 1000) + 60 * 20 // 20 minutes from the current Unix time
|
|
11124
|
+
]);
|
|
11125
|
+
return _context5.abrupt("return", _swapTx);
|
|
11126
|
+
|
|
11127
|
+
case 25:
|
|
11128
|
+
case "end":
|
|
11129
|
+
return _context5.stop();
|
|
11130
|
+
}
|
|
11131
|
+
}
|
|
11132
|
+
}, _callee5, this);
|
|
11133
|
+
}));
|
|
11134
|
+
|
|
11135
|
+
function getBalancerSwapTx(_x13, _x14, _x15, _x16, _x17) {
|
|
11136
|
+
return _getBalancerSwapTx.apply(this, arguments);
|
|
11137
|
+
}
|
|
11138
|
+
|
|
11139
|
+
return getBalancerSwapTx;
|
|
11140
|
+
}();
|
|
11141
|
+
|
|
11142
|
+
_proto.getBalancerJoinPoolTx = /*#__PURE__*/function () {
|
|
11143
|
+
var _getBalancerJoinPoolTx = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(pool, balancerPoolId, assets, amountsIn // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11144
|
+
) {
|
|
11145
|
+
var iBalancerV2Vault, txData, joinPoolTx;
|
|
11146
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
11147
|
+
while (1) {
|
|
11148
|
+
switch (_context6.prev = _context6.next) {
|
|
11149
|
+
case 0:
|
|
11150
|
+
iBalancerV2Vault = new ethers.ethers.utils.Interface(IBalancerV2Vault.abi);
|
|
11151
|
+
txData = [balancerPoolId, pool.address, pool.address, [assets, amountsIn, ethers.ethers.utils.defaultAbiCoder.encode(["uint256", "uint256[]", "uint256"], [1, amountsIn, 0]), false]];
|
|
11152
|
+
joinPoolTx = iBalancerV2Vault.encodeFunctionData("joinPool", txData);
|
|
11153
|
+
return _context6.abrupt("return", joinPoolTx);
|
|
11154
|
+
|
|
11155
|
+
case 4:
|
|
11156
|
+
case "end":
|
|
11157
|
+
return _context6.stop();
|
|
11158
|
+
}
|
|
11159
|
+
}
|
|
11160
|
+
}, _callee6);
|
|
11161
|
+
}));
|
|
11162
|
+
|
|
11163
|
+
function getBalancerJoinPoolTx(_x18, _x19, _x20, _x21) {
|
|
11164
|
+
return _getBalancerJoinPoolTx.apply(this, arguments);
|
|
11165
|
+
}
|
|
11166
|
+
|
|
11167
|
+
return getBalancerJoinPoolTx;
|
|
11168
|
+
}();
|
|
11169
|
+
|
|
11170
|
+
_proto.getBalancerExitPoolTx = /*#__PURE__*/function () {
|
|
11171
|
+
var _getBalancerExitPoolTx = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(pool, balancerPoolId, assets, amount // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11172
|
+
) {
|
|
11173
|
+
var minimumAmountOut, iBalancerV2Vault, txData, exitPoolTx;
|
|
11174
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
11175
|
+
while (1) {
|
|
11176
|
+
switch (_context7.prev = _context7.next) {
|
|
11177
|
+
case 0:
|
|
11178
|
+
minimumAmountOut = new Array(assets.length).fill(0);
|
|
11179
|
+
iBalancerV2Vault = new ethers.ethers.utils.Interface(IBalancerV2Vault.abi);
|
|
11180
|
+
txData = [balancerPoolId, pool.address, pool.address, [assets, minimumAmountOut, ethers.ethers.utils.defaultAbiCoder.encode(["uint256", "uint256"], [1, amount]), false]];
|
|
11181
|
+
exitPoolTx = iBalancerV2Vault.encodeFunctionData("exitPool", txData);
|
|
11182
|
+
return _context7.abrupt("return", exitPoolTx);
|
|
11183
|
+
|
|
11184
|
+
case 5:
|
|
11185
|
+
case "end":
|
|
11186
|
+
return _context7.stop();
|
|
11187
|
+
}
|
|
11188
|
+
}
|
|
11189
|
+
}, _callee7);
|
|
11190
|
+
}));
|
|
11191
|
+
|
|
11192
|
+
function getBalancerExitPoolTx(_x22, _x23, _x24, _x25) {
|
|
11193
|
+
return _getBalancerExitPoolTx.apply(this, arguments);
|
|
11194
|
+
}
|
|
11195
|
+
|
|
11196
|
+
return getBalancerExitPoolTx;
|
|
11197
|
+
}();
|
|
11198
|
+
|
|
8392
11199
|
return Utils;
|
|
8393
11200
|
}();
|
|
8394
11201
|
|