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