@dhedge/v2-sdk 1.4.3 → 1.5.2

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.
Files changed (38) hide show
  1. package/dist/config.d.ts +1 -0
  2. package/dist/entities/dhedge.d.ts +6 -0
  3. package/dist/entities/pool.d.ts +8 -0
  4. package/dist/services/aave/assets.d.ts +2 -0
  5. package/dist/services/aave/incentives.d.ts +2 -0
  6. package/dist/services/chainLink/price.d.ts +2 -0
  7. package/dist/services/oneInch/protocols.d.ts +1 -0
  8. package/dist/services/toros/easySwapper.d.ts +7 -0
  9. package/dist/services/toros/pool.d.ts +3 -0
  10. package/dist/test/constants.d.ts +8 -6
  11. package/dist/types.d.ts +2 -1
  12. package/dist/v2-sdk.cjs.development.js +4569 -115
  13. package/dist/v2-sdk.cjs.development.js.map +1 -1
  14. package/dist/v2-sdk.cjs.production.min.js +1 -1
  15. package/dist/v2-sdk.cjs.production.min.js.map +1 -1
  16. package/dist/v2-sdk.esm.js +4567 -113
  17. package/dist/v2-sdk.esm.js.map +1 -1
  18. package/package.json +1 -1
  19. package/src/abi/IAaveV3Incentives.json +614 -0
  20. package/src/abi/IAaveV3LendingPool.json +1241 -0
  21. package/src/abi/IAaveV3PoolAddressProvider.json +468 -0
  22. package/src/abi/IDhedgeEasySwapper.json +443 -0
  23. package/src/abi/IPriceOracle.json +244 -0
  24. package/src/config.ts +18 -4
  25. package/src/entities/dhedge.ts +9 -0
  26. package/src/entities/pool.ts +90 -47
  27. package/src/services/aave/assets.ts +26 -0
  28. package/src/services/aave/incentives.ts +23 -0
  29. package/src/services/chainLink/price.ts +26 -0
  30. package/src/services/oneInch/protocols.ts +18 -0
  31. package/src/services/toros/easySwapper.ts +120 -0
  32. package/src/services/toros/pool.ts +14 -0
  33. package/src/test/1inch.test.ts +3 -3
  34. package/src/test/aave.test.ts +40 -13
  35. package/src/test/constants.ts +14 -9
  36. package/src/test/toros.test.ts +117 -0
  37. package/src/test/wallet.ts +5 -5
  38. package/src/types.ts +2 -1
@@ -9,7 +9,7 @@ var axios = _interopDefault(require('axios'));
9
9
  var lodash = require('lodash');
10
10
  var address = require('@ethersproject/address');
11
11
  require('lodash/set');
12
- var abi$j = require('@ethersproject/abi');
12
+ var abi$o = require('@ethersproject/abi');
13
13
  var BigNumber = _interopDefault(require('bignumber.js'));
14
14
  var web3Utils = require('web3-utils');
15
15
  var ethereumjsUtil = require('ethereumjs-util');
@@ -3840,6 +3840,7 @@ var ManagerLogic = {
3840
3840
  Dapp["SYNTHETIX"] = "synthetix";
3841
3841
  Dapp["AAVEV3"] = "aavev3";
3842
3842
  Dapp["ARRAKIS"] = "arrakis";
3843
+ Dapp["TOROS"] = "toros";
3843
3844
  })(exports.Dapp || (exports.Dapp = {}));
3844
3845
 
3845
3846
  (function (Transaction) {
@@ -3864,14 +3865,15 @@ var ManagerLogic = {
3864
3865
  Transaction["REMOVE_LIQUIDITY_UNSTAKE"] = "removeLiquidityAndUnstake";
3865
3866
  })(exports.Transaction || (exports.Transaction = {}));
3866
3867
 
3867
- var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress;
3868
+ var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _Network$OPTIMISM2, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM3, _aaveAddressProvider, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress;
3868
3869
 
3869
3870
  require("dotenv").config();
3870
3871
 
3871
3872
  var factoryAddress = (_factoryAddress = {}, _factoryAddress[exports.Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[exports.Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress);
3872
- var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x1111111254fb6c44bac0bed2854e76f90643097d", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xbc91a120cCD8F80b819EAF32F0996daC3Fa76a6C", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x1111111254760F7ab3F16433eea9304126DCd199", _Network$OPTIMISM), _routerAddress);
3873
+ var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x1111111254fb6c44bac0bed2854e76f90643097d", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xbc91a120cCD8F80b819EAF32F0996daC3Fa76a6C", _Network$POLYGON[exports.Dapp.TOROS] = "0x42B1DDcFa1c43E06F483BA0Dd1b9cC923043677f", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x1111111254760F7ab3F16433eea9304126DCd199", _Network$OPTIMISM[exports.Dapp.TOROS] = "0xf8C62BD5f2fEf9E1a329c197F32E77AD6866B022", _Network$OPTIMISM), _routerAddress);
3873
3874
  var dappFactoryAddress = (_dappFactoryAddress = {}, _dappFactoryAddress[exports.Network.POLYGON] = (_Network$POLYGON2 = {}, _Network$POLYGON2[exports.Dapp.SUSHISWAP] = "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", _Network$POLYGON2[exports.Dapp.QUICKSWAP] = "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32", _Network$POLYGON2), _dappFactoryAddress[exports.Network.OPTIMISM] = {}, _dappFactoryAddress);
3874
- var stakingAddress = (_stakingAddress = {}, _stakingAddress[exports.Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[exports.Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[exports.Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[exports.Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3), _stakingAddress[exports.Network.OPTIMISM] = {}, _stakingAddress);
3875
+ var stakingAddress = (_stakingAddress = {}, _stakingAddress[exports.Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[exports.Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[exports.Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[exports.Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3[exports.Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$POLYGON3), _stakingAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM2 = {}, _Network$OPTIMISM2[exports.Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$OPTIMISM2), _stakingAddress);
3876
+ var aaveAddressProvider = (_aaveAddressProvider = {}, _aaveAddressProvider[exports.Network.POLYGON] = (_Network$POLYGON4 = {}, _Network$POLYGON4[exports.Dapp.AAVE] = "0xd05e3E715d945B59290df0ae8eF85c1BdB684744", _Network$POLYGON4[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$POLYGON4), _aaveAddressProvider[exports.Network.OPTIMISM] = (_Network$OPTIMISM3 = {}, _Network$OPTIMISM3[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$OPTIMISM3), _aaveAddressProvider);
3875
3877
  var nonfungiblePositionManagerAddress = (_nonfungiblePositionM = {}, _nonfungiblePositionM[exports.Network.POLYGON] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[exports.Network.OPTIMISM] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM);
3876
3878
  var networkChainIdMap = (_networkChainIdMap = {}, _networkChainIdMap[exports.Network.POLYGON] = 137, _networkChainIdMap[exports.Network.OPTIMISM] = 10, _networkChainIdMap);
3877
3879
  var balancerSubgraph = (_balancerSubgraph = {}, _balancerSubgraph[exports.Network.POLYGON] = "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2", _balancerSubgraph[exports.Network.OPTIMISM] = "", _balancerSubgraph);
@@ -8083,7 +8085,7 @@ function _multicall() {
8083
8085
  }
8084
8086
 
8085
8087
  multi = new ethers.ethers.Contract(multiCallAddress[network], ["function tryAggregate(bool requireSuccess, tuple(address, bytes)[] memory calls) public view returns (tuple(bool, bytes)[] memory returnData)"], provider);
8086
- itf = new abi$j.Interface(abi);
8088
+ itf = new abi$o.Interface(abi);
8087
8089
  _context3.prev = 4;
8088
8090
  _context3.next = 7;
8089
8091
  return multi.tryAggregate( // if false, allows individual calls to fail without causing entire multicall to fail
@@ -9323,6 +9325,4400 @@ function _getUniswapV3SwapTxData() {
9323
9325
  return _getUniswapV3SwapTxData.apply(this, arguments);
9324
9326
  }
9325
9327
 
9328
+ var abi$g = [
9329
+ {
9330
+ inputs: [
9331
+ {
9332
+ internalType: "address payable",
9333
+ name: "_feeSink",
9334
+ type: "address"
9335
+ },
9336
+ {
9337
+ components: [
9338
+ {
9339
+ internalType: "contract IUniswapV2RouterSwapOnly",
9340
+ name: "swapRouter",
9341
+ type: "address"
9342
+ },
9343
+ {
9344
+ internalType: "contract IUniswapV2Router",
9345
+ name: "assetType2Router",
9346
+ type: "address"
9347
+ },
9348
+ {
9349
+ internalType: "contract IUniswapV2Router",
9350
+ name: "assetType5Router",
9351
+ type: "address"
9352
+ },
9353
+ {
9354
+ components: [
9355
+ {
9356
+ internalType: "contract ISynthetix",
9357
+ name: "snxProxy",
9358
+ type: "address"
9359
+ },
9360
+ {
9361
+ internalType: "contract IERC20",
9362
+ name: "swapSUSDToAsset",
9363
+ type: "address"
9364
+ },
9365
+ {
9366
+ internalType: "contract ISynthAddressProxy",
9367
+ name: "sUSDProxy",
9368
+ type: "address"
9369
+ }
9370
+ ],
9371
+ internalType: "struct EasySwapperStructs.SynthetixProps",
9372
+ name: "synthetixProps",
9373
+ type: "tuple"
9374
+ },
9375
+ {
9376
+ internalType: "contract IERC20",
9377
+ name: "weth",
9378
+ type: "address"
9379
+ }
9380
+ ],
9381
+ internalType: "struct EasySwapperStructs.WithdrawProps",
9382
+ name: "_withdrawProps",
9383
+ type: "tuple"
9384
+ }
9385
+ ],
9386
+ stateMutability: "nonpayable",
9387
+ type: "constructor"
9388
+ },
9389
+ {
9390
+ anonymous: false,
9391
+ inputs: [
9392
+ {
9393
+ indexed: false,
9394
+ internalType: "address",
9395
+ name: "pool",
9396
+ type: "address"
9397
+ },
9398
+ {
9399
+ indexed: false,
9400
+ internalType: "address",
9401
+ name: "depositor",
9402
+ type: "address"
9403
+ },
9404
+ {
9405
+ indexed: false,
9406
+ internalType: "address",
9407
+ name: "depositAsset",
9408
+ type: "address"
9409
+ },
9410
+ {
9411
+ indexed: false,
9412
+ internalType: "uint256",
9413
+ name: "amount",
9414
+ type: "uint256"
9415
+ },
9416
+ {
9417
+ indexed: false,
9418
+ internalType: "address",
9419
+ name: "poolDepositAsset",
9420
+ type: "address"
9421
+ },
9422
+ {
9423
+ indexed: false,
9424
+ internalType: "uint256",
9425
+ name: "liquidityMinted",
9426
+ type: "uint256"
9427
+ }
9428
+ ],
9429
+ name: "Deposit",
9430
+ type: "event"
9431
+ },
9432
+ {
9433
+ anonymous: false,
9434
+ inputs: [
9435
+ {
9436
+ indexed: true,
9437
+ internalType: "address",
9438
+ name: "previousOwner",
9439
+ type: "address"
9440
+ },
9441
+ {
9442
+ indexed: true,
9443
+ internalType: "address",
9444
+ name: "newOwner",
9445
+ type: "address"
9446
+ }
9447
+ ],
9448
+ name: "OwnershipTransferred",
9449
+ type: "event"
9450
+ },
9451
+ {
9452
+ inputs: [
9453
+ {
9454
+ internalType: "address",
9455
+ name: "",
9456
+ type: "address"
9457
+ }
9458
+ ],
9459
+ name: "allowedPools",
9460
+ outputs: [
9461
+ {
9462
+ internalType: "bool",
9463
+ name: "",
9464
+ type: "bool"
9465
+ }
9466
+ ],
9467
+ stateMutability: "view",
9468
+ type: "function"
9469
+ },
9470
+ {
9471
+ inputs: [
9472
+ {
9473
+ internalType: "address",
9474
+ name: "pool",
9475
+ type: "address"
9476
+ },
9477
+ {
9478
+ internalType: "contract IERC20",
9479
+ name: "depositAsset",
9480
+ type: "address"
9481
+ },
9482
+ {
9483
+ internalType: "uint256",
9484
+ name: "amount",
9485
+ type: "uint256"
9486
+ },
9487
+ {
9488
+ internalType: "contract IERC20",
9489
+ name: "poolDepositAsset",
9490
+ type: "address"
9491
+ },
9492
+ {
9493
+ internalType: "uint256",
9494
+ name: "expectedLiquidityMinted",
9495
+ type: "uint256"
9496
+ }
9497
+ ],
9498
+ name: "deposit",
9499
+ outputs: [
9500
+ {
9501
+ internalType: "uint256",
9502
+ name: "liquidityMinted",
9503
+ type: "uint256"
9504
+ }
9505
+ ],
9506
+ stateMutability: "nonpayable",
9507
+ type: "function"
9508
+ },
9509
+ {
9510
+ inputs: [
9511
+ {
9512
+ internalType: "address",
9513
+ name: "pool",
9514
+ type: "address"
9515
+ },
9516
+ {
9517
+ internalType: "contract IERC20",
9518
+ name: "depositAsset",
9519
+ type: "address"
9520
+ },
9521
+ {
9522
+ internalType: "uint256",
9523
+ name: "amount",
9524
+ type: "uint256"
9525
+ },
9526
+ {
9527
+ internalType: "contract IERC20",
9528
+ name: "poolDepositAsset",
9529
+ type: "address"
9530
+ }
9531
+ ],
9532
+ name: "depositQuote",
9533
+ outputs: [
9534
+ {
9535
+ internalType: "uint256",
9536
+ name: "expectedLiquidityMinted",
9537
+ type: "uint256"
9538
+ }
9539
+ ],
9540
+ stateMutability: "view",
9541
+ type: "function"
9542
+ },
9543
+ {
9544
+ inputs: [
9545
+ ],
9546
+ name: "feeDenominator",
9547
+ outputs: [
9548
+ {
9549
+ internalType: "uint256",
9550
+ name: "",
9551
+ type: "uint256"
9552
+ }
9553
+ ],
9554
+ stateMutability: "view",
9555
+ type: "function"
9556
+ },
9557
+ {
9558
+ inputs: [
9559
+ ],
9560
+ name: "feeNumerator",
9561
+ outputs: [
9562
+ {
9563
+ internalType: "uint256",
9564
+ name: "",
9565
+ type: "uint256"
9566
+ }
9567
+ ],
9568
+ stateMutability: "view",
9569
+ type: "function"
9570
+ },
9571
+ {
9572
+ inputs: [
9573
+ ],
9574
+ name: "feeSink",
9575
+ outputs: [
9576
+ {
9577
+ internalType: "address payable",
9578
+ name: "",
9579
+ type: "address"
9580
+ }
9581
+ ],
9582
+ stateMutability: "view",
9583
+ type: "function"
9584
+ },
9585
+ {
9586
+ inputs: [
9587
+ ],
9588
+ name: "owner",
9589
+ outputs: [
9590
+ {
9591
+ internalType: "address",
9592
+ name: "",
9593
+ type: "address"
9594
+ }
9595
+ ],
9596
+ stateMutability: "view",
9597
+ type: "function"
9598
+ },
9599
+ {
9600
+ inputs: [
9601
+ ],
9602
+ name: "renounceOwnership",
9603
+ outputs: [
9604
+ ],
9605
+ stateMutability: "nonpayable",
9606
+ type: "function"
9607
+ },
9608
+ {
9609
+ inputs: [
9610
+ {
9611
+ internalType: "uint256",
9612
+ name: "numerator",
9613
+ type: "uint256"
9614
+ },
9615
+ {
9616
+ internalType: "uint256",
9617
+ name: "denominator",
9618
+ type: "uint256"
9619
+ }
9620
+ ],
9621
+ name: "setFee",
9622
+ outputs: [
9623
+ ],
9624
+ stateMutability: "nonpayable",
9625
+ type: "function"
9626
+ },
9627
+ {
9628
+ inputs: [
9629
+ {
9630
+ internalType: "address payable",
9631
+ name: "sink",
9632
+ type: "address"
9633
+ }
9634
+ ],
9635
+ name: "setFeeSink",
9636
+ outputs: [
9637
+ ],
9638
+ stateMutability: "nonpayable",
9639
+ type: "function"
9640
+ },
9641
+ {
9642
+ inputs: [
9643
+ {
9644
+ internalType: "address",
9645
+ name: "pool",
9646
+ type: "address"
9647
+ },
9648
+ {
9649
+ internalType: "bool",
9650
+ name: "allowed",
9651
+ type: "bool"
9652
+ }
9653
+ ],
9654
+ name: "setPoolAllowed",
9655
+ outputs: [
9656
+ ],
9657
+ stateMutability: "nonpayable",
9658
+ type: "function"
9659
+ },
9660
+ {
9661
+ inputs: [
9662
+ {
9663
+ internalType: "contract IUniswapV2RouterSwapOnly",
9664
+ name: "_swapRouter",
9665
+ type: "address"
9666
+ }
9667
+ ],
9668
+ name: "setSwapRouter",
9669
+ outputs: [
9670
+ ],
9671
+ stateMutability: "nonpayable",
9672
+ type: "function"
9673
+ },
9674
+ {
9675
+ inputs: [
9676
+ {
9677
+ internalType: "address",
9678
+ name: "newOwner",
9679
+ type: "address"
9680
+ }
9681
+ ],
9682
+ name: "transferOwnership",
9683
+ outputs: [
9684
+ ],
9685
+ stateMutability: "nonpayable",
9686
+ type: "function"
9687
+ },
9688
+ {
9689
+ inputs: [
9690
+ ],
9691
+ name: "weth",
9692
+ outputs: [
9693
+ {
9694
+ internalType: "contract IERC20",
9695
+ name: "",
9696
+ type: "address"
9697
+ }
9698
+ ],
9699
+ stateMutability: "view",
9700
+ type: "function"
9701
+ },
9702
+ {
9703
+ inputs: [
9704
+ {
9705
+ internalType: "address",
9706
+ name: "pool",
9707
+ type: "address"
9708
+ },
9709
+ {
9710
+ internalType: "uint256",
9711
+ name: "fundTokenAmount",
9712
+ type: "uint256"
9713
+ },
9714
+ {
9715
+ internalType: "contract IERC20",
9716
+ name: "withdrawalAsset",
9717
+ type: "address"
9718
+ },
9719
+ {
9720
+ internalType: "uint256",
9721
+ name: "expectedAmountOut",
9722
+ type: "uint256"
9723
+ }
9724
+ ],
9725
+ name: "withdraw",
9726
+ outputs: [
9727
+ ],
9728
+ stateMutability: "nonpayable",
9729
+ type: "function"
9730
+ },
9731
+ {
9732
+ inputs: [
9733
+ ],
9734
+ name: "withdrawProps",
9735
+ outputs: [
9736
+ {
9737
+ internalType: "contract IUniswapV2RouterSwapOnly",
9738
+ name: "swapRouter",
9739
+ type: "address"
9740
+ },
9741
+ {
9742
+ internalType: "contract IUniswapV2Router",
9743
+ name: "assetType2Router",
9744
+ type: "address"
9745
+ },
9746
+ {
9747
+ internalType: "contract IUniswapV2Router",
9748
+ name: "assetType5Router",
9749
+ type: "address"
9750
+ },
9751
+ {
9752
+ components: [
9753
+ {
9754
+ internalType: "contract ISynthetix",
9755
+ name: "snxProxy",
9756
+ type: "address"
9757
+ },
9758
+ {
9759
+ internalType: "contract IERC20",
9760
+ name: "swapSUSDToAsset",
9761
+ type: "address"
9762
+ },
9763
+ {
9764
+ internalType: "contract ISynthAddressProxy",
9765
+ name: "sUSDProxy",
9766
+ type: "address"
9767
+ }
9768
+ ],
9769
+ internalType: "struct EasySwapperStructs.SynthetixProps",
9770
+ name: "synthetixProps",
9771
+ type: "tuple"
9772
+ },
9773
+ {
9774
+ internalType: "contract IERC20",
9775
+ name: "weth",
9776
+ type: "address"
9777
+ }
9778
+ ],
9779
+ stateMutability: "view",
9780
+ type: "function"
9781
+ }
9782
+ ];
9783
+ var IDhedgeEasySwapper = {
9784
+ abi: abi$g
9785
+ };
9786
+
9787
+ var abi$h = [
9788
+ {
9789
+ inputs: [
9790
+ {
9791
+ internalType: "string",
9792
+ name: "marketId",
9793
+ type: "string"
9794
+ },
9795
+ {
9796
+ internalType: "address",
9797
+ name: "owner",
9798
+ type: "address"
9799
+ }
9800
+ ],
9801
+ stateMutability: "nonpayable",
9802
+ type: "constructor"
9803
+ },
9804
+ {
9805
+ anonymous: false,
9806
+ inputs: [
9807
+ {
9808
+ indexed: true,
9809
+ internalType: "address",
9810
+ name: "oldAddress",
9811
+ type: "address"
9812
+ },
9813
+ {
9814
+ indexed: true,
9815
+ internalType: "address",
9816
+ name: "newAddress",
9817
+ type: "address"
9818
+ }
9819
+ ],
9820
+ name: "ACLAdminUpdated",
9821
+ type: "event"
9822
+ },
9823
+ {
9824
+ anonymous: false,
9825
+ inputs: [
9826
+ {
9827
+ indexed: true,
9828
+ internalType: "address",
9829
+ name: "oldAddress",
9830
+ type: "address"
9831
+ },
9832
+ {
9833
+ indexed: true,
9834
+ internalType: "address",
9835
+ name: "newAddress",
9836
+ type: "address"
9837
+ }
9838
+ ],
9839
+ name: "ACLManagerUpdated",
9840
+ type: "event"
9841
+ },
9842
+ {
9843
+ anonymous: false,
9844
+ inputs: [
9845
+ {
9846
+ indexed: true,
9847
+ internalType: "bytes32",
9848
+ name: "id",
9849
+ type: "bytes32"
9850
+ },
9851
+ {
9852
+ indexed: true,
9853
+ internalType: "address",
9854
+ name: "oldAddress",
9855
+ type: "address"
9856
+ },
9857
+ {
9858
+ indexed: true,
9859
+ internalType: "address",
9860
+ name: "newAddress",
9861
+ type: "address"
9862
+ }
9863
+ ],
9864
+ name: "AddressSet",
9865
+ type: "event"
9866
+ },
9867
+ {
9868
+ anonymous: false,
9869
+ inputs: [
9870
+ {
9871
+ indexed: true,
9872
+ internalType: "bytes32",
9873
+ name: "id",
9874
+ type: "bytes32"
9875
+ },
9876
+ {
9877
+ indexed: true,
9878
+ internalType: "address",
9879
+ name: "proxyAddress",
9880
+ type: "address"
9881
+ },
9882
+ {
9883
+ indexed: false,
9884
+ internalType: "address",
9885
+ name: "oldImplementationAddress",
9886
+ type: "address"
9887
+ },
9888
+ {
9889
+ indexed: true,
9890
+ internalType: "address",
9891
+ name: "newImplementationAddress",
9892
+ type: "address"
9893
+ }
9894
+ ],
9895
+ name: "AddressSetAsProxy",
9896
+ type: "event"
9897
+ },
9898
+ {
9899
+ anonymous: false,
9900
+ inputs: [
9901
+ {
9902
+ indexed: true,
9903
+ internalType: "string",
9904
+ name: "oldMarketId",
9905
+ type: "string"
9906
+ },
9907
+ {
9908
+ indexed: true,
9909
+ internalType: "string",
9910
+ name: "newMarketId",
9911
+ type: "string"
9912
+ }
9913
+ ],
9914
+ name: "MarketIdSet",
9915
+ type: "event"
9916
+ },
9917
+ {
9918
+ anonymous: false,
9919
+ inputs: [
9920
+ {
9921
+ indexed: true,
9922
+ internalType: "address",
9923
+ name: "previousOwner",
9924
+ type: "address"
9925
+ },
9926
+ {
9927
+ indexed: true,
9928
+ internalType: "address",
9929
+ name: "newOwner",
9930
+ type: "address"
9931
+ }
9932
+ ],
9933
+ name: "OwnershipTransferred",
9934
+ type: "event"
9935
+ },
9936
+ {
9937
+ anonymous: false,
9938
+ inputs: [
9939
+ {
9940
+ indexed: true,
9941
+ internalType: "address",
9942
+ name: "oldAddress",
9943
+ type: "address"
9944
+ },
9945
+ {
9946
+ indexed: true,
9947
+ internalType: "address",
9948
+ name: "newAddress",
9949
+ type: "address"
9950
+ }
9951
+ ],
9952
+ name: "PoolConfiguratorUpdated",
9953
+ type: "event"
9954
+ },
9955
+ {
9956
+ anonymous: false,
9957
+ inputs: [
9958
+ {
9959
+ indexed: true,
9960
+ internalType: "address",
9961
+ name: "oldAddress",
9962
+ type: "address"
9963
+ },
9964
+ {
9965
+ indexed: true,
9966
+ internalType: "address",
9967
+ name: "newAddress",
9968
+ type: "address"
9969
+ }
9970
+ ],
9971
+ name: "PoolDataProviderUpdated",
9972
+ type: "event"
9973
+ },
9974
+ {
9975
+ anonymous: false,
9976
+ inputs: [
9977
+ {
9978
+ indexed: true,
9979
+ internalType: "address",
9980
+ name: "oldAddress",
9981
+ type: "address"
9982
+ },
9983
+ {
9984
+ indexed: true,
9985
+ internalType: "address",
9986
+ name: "newAddress",
9987
+ type: "address"
9988
+ }
9989
+ ],
9990
+ name: "PoolUpdated",
9991
+ type: "event"
9992
+ },
9993
+ {
9994
+ anonymous: false,
9995
+ inputs: [
9996
+ {
9997
+ indexed: true,
9998
+ internalType: "address",
9999
+ name: "oldAddress",
10000
+ type: "address"
10001
+ },
10002
+ {
10003
+ indexed: true,
10004
+ internalType: "address",
10005
+ name: "newAddress",
10006
+ type: "address"
10007
+ }
10008
+ ],
10009
+ name: "PriceOracleSentinelUpdated",
10010
+ type: "event"
10011
+ },
10012
+ {
10013
+ anonymous: false,
10014
+ inputs: [
10015
+ {
10016
+ indexed: true,
10017
+ internalType: "address",
10018
+ name: "oldAddress",
10019
+ type: "address"
10020
+ },
10021
+ {
10022
+ indexed: true,
10023
+ internalType: "address",
10024
+ name: "newAddress",
10025
+ type: "address"
10026
+ }
10027
+ ],
10028
+ name: "PriceOracleUpdated",
10029
+ type: "event"
10030
+ },
10031
+ {
10032
+ anonymous: false,
10033
+ inputs: [
10034
+ {
10035
+ indexed: true,
10036
+ internalType: "bytes32",
10037
+ name: "id",
10038
+ type: "bytes32"
10039
+ },
10040
+ {
10041
+ indexed: true,
10042
+ internalType: "address",
10043
+ name: "proxyAddress",
10044
+ type: "address"
10045
+ },
10046
+ {
10047
+ indexed: true,
10048
+ internalType: "address",
10049
+ name: "implementationAddress",
10050
+ type: "address"
10051
+ }
10052
+ ],
10053
+ name: "ProxyCreated",
10054
+ type: "event"
10055
+ },
10056
+ {
10057
+ inputs: [
10058
+ ],
10059
+ name: "getACLAdmin",
10060
+ outputs: [
10061
+ {
10062
+ internalType: "address",
10063
+ name: "",
10064
+ type: "address"
10065
+ }
10066
+ ],
10067
+ stateMutability: "view",
10068
+ type: "function"
10069
+ },
10070
+ {
10071
+ inputs: [
10072
+ ],
10073
+ name: "getACLManager",
10074
+ outputs: [
10075
+ {
10076
+ internalType: "address",
10077
+ name: "",
10078
+ type: "address"
10079
+ }
10080
+ ],
10081
+ stateMutability: "view",
10082
+ type: "function"
10083
+ },
10084
+ {
10085
+ inputs: [
10086
+ {
10087
+ internalType: "bytes32",
10088
+ name: "id",
10089
+ type: "bytes32"
10090
+ }
10091
+ ],
10092
+ name: "getAddress",
10093
+ outputs: [
10094
+ {
10095
+ internalType: "address",
10096
+ name: "",
10097
+ type: "address"
10098
+ }
10099
+ ],
10100
+ stateMutability: "view",
10101
+ type: "function"
10102
+ },
10103
+ {
10104
+ inputs: [
10105
+ ],
10106
+ name: "getMarketId",
10107
+ outputs: [
10108
+ {
10109
+ internalType: "string",
10110
+ name: "",
10111
+ type: "string"
10112
+ }
10113
+ ],
10114
+ stateMutability: "view",
10115
+ type: "function"
10116
+ },
10117
+ {
10118
+ inputs: [
10119
+ ],
10120
+ name: "getPool",
10121
+ outputs: [
10122
+ {
10123
+ internalType: "address",
10124
+ name: "",
10125
+ type: "address"
10126
+ }
10127
+ ],
10128
+ stateMutability: "view",
10129
+ type: "function"
10130
+ },
10131
+ {
10132
+ inputs: [
10133
+ ],
10134
+ name: "getPoolConfigurator",
10135
+ outputs: [
10136
+ {
10137
+ internalType: "address",
10138
+ name: "",
10139
+ type: "address"
10140
+ }
10141
+ ],
10142
+ stateMutability: "view",
10143
+ type: "function"
10144
+ },
10145
+ {
10146
+ inputs: [
10147
+ ],
10148
+ name: "getPoolDataProvider",
10149
+ outputs: [
10150
+ {
10151
+ internalType: "address",
10152
+ name: "",
10153
+ type: "address"
10154
+ }
10155
+ ],
10156
+ stateMutability: "view",
10157
+ type: "function"
10158
+ },
10159
+ {
10160
+ inputs: [
10161
+ ],
10162
+ name: "getPriceOracle",
10163
+ outputs: [
10164
+ {
10165
+ internalType: "address",
10166
+ name: "",
10167
+ type: "address"
10168
+ }
10169
+ ],
10170
+ stateMutability: "view",
10171
+ type: "function"
10172
+ },
10173
+ {
10174
+ inputs: [
10175
+ ],
10176
+ name: "getPriceOracleSentinel",
10177
+ outputs: [
10178
+ {
10179
+ internalType: "address",
10180
+ name: "",
10181
+ type: "address"
10182
+ }
10183
+ ],
10184
+ stateMutability: "view",
10185
+ type: "function"
10186
+ },
10187
+ {
10188
+ inputs: [
10189
+ ],
10190
+ name: "owner",
10191
+ outputs: [
10192
+ {
10193
+ internalType: "address",
10194
+ name: "",
10195
+ type: "address"
10196
+ }
10197
+ ],
10198
+ stateMutability: "view",
10199
+ type: "function"
10200
+ },
10201
+ {
10202
+ inputs: [
10203
+ ],
10204
+ name: "renounceOwnership",
10205
+ outputs: [
10206
+ ],
10207
+ stateMutability: "nonpayable",
10208
+ type: "function"
10209
+ },
10210
+ {
10211
+ inputs: [
10212
+ {
10213
+ internalType: "address",
10214
+ name: "newAclAdmin",
10215
+ type: "address"
10216
+ }
10217
+ ],
10218
+ name: "setACLAdmin",
10219
+ outputs: [
10220
+ ],
10221
+ stateMutability: "nonpayable",
10222
+ type: "function"
10223
+ },
10224
+ {
10225
+ inputs: [
10226
+ {
10227
+ internalType: "address",
10228
+ name: "newAclManager",
10229
+ type: "address"
10230
+ }
10231
+ ],
10232
+ name: "setACLManager",
10233
+ outputs: [
10234
+ ],
10235
+ stateMutability: "nonpayable",
10236
+ type: "function"
10237
+ },
10238
+ {
10239
+ inputs: [
10240
+ {
10241
+ internalType: "bytes32",
10242
+ name: "id",
10243
+ type: "bytes32"
10244
+ },
10245
+ {
10246
+ internalType: "address",
10247
+ name: "newAddress",
10248
+ type: "address"
10249
+ }
10250
+ ],
10251
+ name: "setAddress",
10252
+ outputs: [
10253
+ ],
10254
+ stateMutability: "nonpayable",
10255
+ type: "function"
10256
+ },
10257
+ {
10258
+ inputs: [
10259
+ {
10260
+ internalType: "bytes32",
10261
+ name: "id",
10262
+ type: "bytes32"
10263
+ },
10264
+ {
10265
+ internalType: "address",
10266
+ name: "newImplementationAddress",
10267
+ type: "address"
10268
+ }
10269
+ ],
10270
+ name: "setAddressAsProxy",
10271
+ outputs: [
10272
+ ],
10273
+ stateMutability: "nonpayable",
10274
+ type: "function"
10275
+ },
10276
+ {
10277
+ inputs: [
10278
+ {
10279
+ internalType: "string",
10280
+ name: "newMarketId",
10281
+ type: "string"
10282
+ }
10283
+ ],
10284
+ name: "setMarketId",
10285
+ outputs: [
10286
+ ],
10287
+ stateMutability: "nonpayable",
10288
+ type: "function"
10289
+ },
10290
+ {
10291
+ inputs: [
10292
+ {
10293
+ internalType: "address",
10294
+ name: "newPoolConfiguratorImpl",
10295
+ type: "address"
10296
+ }
10297
+ ],
10298
+ name: "setPoolConfiguratorImpl",
10299
+ outputs: [
10300
+ ],
10301
+ stateMutability: "nonpayable",
10302
+ type: "function"
10303
+ },
10304
+ {
10305
+ inputs: [
10306
+ {
10307
+ internalType: "address",
10308
+ name: "newDataProvider",
10309
+ type: "address"
10310
+ }
10311
+ ],
10312
+ name: "setPoolDataProvider",
10313
+ outputs: [
10314
+ ],
10315
+ stateMutability: "nonpayable",
10316
+ type: "function"
10317
+ },
10318
+ {
10319
+ inputs: [
10320
+ {
10321
+ internalType: "address",
10322
+ name: "newPoolImpl",
10323
+ type: "address"
10324
+ }
10325
+ ],
10326
+ name: "setPoolImpl",
10327
+ outputs: [
10328
+ ],
10329
+ stateMutability: "nonpayable",
10330
+ type: "function"
10331
+ },
10332
+ {
10333
+ inputs: [
10334
+ {
10335
+ internalType: "address",
10336
+ name: "newPriceOracle",
10337
+ type: "address"
10338
+ }
10339
+ ],
10340
+ name: "setPriceOracle",
10341
+ outputs: [
10342
+ ],
10343
+ stateMutability: "nonpayable",
10344
+ type: "function"
10345
+ },
10346
+ {
10347
+ inputs: [
10348
+ {
10349
+ internalType: "address",
10350
+ name: "newPriceOracleSentinel",
10351
+ type: "address"
10352
+ }
10353
+ ],
10354
+ name: "setPriceOracleSentinel",
10355
+ outputs: [
10356
+ ],
10357
+ stateMutability: "nonpayable",
10358
+ type: "function"
10359
+ },
10360
+ {
10361
+ inputs: [
10362
+ {
10363
+ internalType: "address",
10364
+ name: "newOwner",
10365
+ type: "address"
10366
+ }
10367
+ ],
10368
+ name: "transferOwnership",
10369
+ outputs: [
10370
+ ],
10371
+ stateMutability: "nonpayable",
10372
+ type: "function"
10373
+ }
10374
+ ];
10375
+ var IAaveV3PoolAddressProvider = {
10376
+ abi: abi$h
10377
+ };
10378
+
10379
+ var abi$i = [
10380
+ {
10381
+ inputs: [
10382
+ {
10383
+ internalType: "address[]",
10384
+ name: "_assets",
10385
+ type: "address[]"
10386
+ },
10387
+ {
10388
+ internalType: "address[]",
10389
+ name: "_sources",
10390
+ type: "address[]"
10391
+ },
10392
+ {
10393
+ internalType: "address",
10394
+ name: "_fallbackOracle",
10395
+ type: "address"
10396
+ }
10397
+ ],
10398
+ payable: false,
10399
+ stateMutability: "nonpayable",
10400
+ type: "constructor"
10401
+ },
10402
+ {
10403
+ anonymous: false,
10404
+ inputs: [
10405
+ {
10406
+ indexed: true,
10407
+ internalType: "address",
10408
+ name: "asset",
10409
+ type: "address"
10410
+ },
10411
+ {
10412
+ indexed: true,
10413
+ internalType: "address",
10414
+ name: "source",
10415
+ type: "address"
10416
+ }
10417
+ ],
10418
+ name: "AssetSourceUpdated",
10419
+ type: "event"
10420
+ },
10421
+ {
10422
+ anonymous: false,
10423
+ inputs: [
10424
+ {
10425
+ indexed: true,
10426
+ internalType: "address",
10427
+ name: "fallbackOracle",
10428
+ type: "address"
10429
+ }
10430
+ ],
10431
+ name: "FallbackOracleUpdated",
10432
+ type: "event"
10433
+ },
10434
+ {
10435
+ anonymous: false,
10436
+ inputs: [
10437
+ {
10438
+ indexed: true,
10439
+ internalType: "address",
10440
+ name: "previousOwner",
10441
+ type: "address"
10442
+ },
10443
+ {
10444
+ indexed: true,
10445
+ internalType: "address",
10446
+ name: "newOwner",
10447
+ type: "address"
10448
+ }
10449
+ ],
10450
+ name: "OwnershipTransferred",
10451
+ type: "event"
10452
+ },
10453
+ {
10454
+ constant: true,
10455
+ inputs: [
10456
+ ],
10457
+ name: "isOwner",
10458
+ outputs: [
10459
+ {
10460
+ internalType: "bool",
10461
+ name: "",
10462
+ type: "bool"
10463
+ }
10464
+ ],
10465
+ payable: false,
10466
+ stateMutability: "view",
10467
+ type: "function"
10468
+ },
10469
+ {
10470
+ constant: true,
10471
+ inputs: [
10472
+ ],
10473
+ name: "owner",
10474
+ outputs: [
10475
+ {
10476
+ internalType: "address",
10477
+ name: "",
10478
+ type: "address"
10479
+ }
10480
+ ],
10481
+ payable: false,
10482
+ stateMutability: "view",
10483
+ type: "function"
10484
+ },
10485
+ {
10486
+ constant: false,
10487
+ inputs: [
10488
+ ],
10489
+ name: "renounceOwnership",
10490
+ outputs: [
10491
+ ],
10492
+ payable: false,
10493
+ stateMutability: "nonpayable",
10494
+ type: "function"
10495
+ },
10496
+ {
10497
+ constant: false,
10498
+ inputs: [
10499
+ {
10500
+ internalType: "address",
10501
+ name: "newOwner",
10502
+ type: "address"
10503
+ }
10504
+ ],
10505
+ name: "transferOwnership",
10506
+ outputs: [
10507
+ ],
10508
+ payable: false,
10509
+ stateMutability: "nonpayable",
10510
+ type: "function"
10511
+ },
10512
+ {
10513
+ constant: false,
10514
+ inputs: [
10515
+ {
10516
+ internalType: "address[]",
10517
+ name: "_assets",
10518
+ type: "address[]"
10519
+ },
10520
+ {
10521
+ internalType: "address[]",
10522
+ name: "_sources",
10523
+ type: "address[]"
10524
+ }
10525
+ ],
10526
+ name: "setAssetSources",
10527
+ outputs: [
10528
+ ],
10529
+ payable: false,
10530
+ stateMutability: "nonpayable",
10531
+ type: "function"
10532
+ },
10533
+ {
10534
+ constant: false,
10535
+ inputs: [
10536
+ {
10537
+ internalType: "address",
10538
+ name: "_fallbackOracle",
10539
+ type: "address"
10540
+ }
10541
+ ],
10542
+ name: "setFallbackOracle",
10543
+ outputs: [
10544
+ ],
10545
+ payable: false,
10546
+ stateMutability: "nonpayable",
10547
+ type: "function"
10548
+ },
10549
+ {
10550
+ constant: true,
10551
+ inputs: [
10552
+ {
10553
+ internalType: "address",
10554
+ name: "_asset",
10555
+ type: "address"
10556
+ }
10557
+ ],
10558
+ name: "getAssetPrice",
10559
+ outputs: [
10560
+ {
10561
+ internalType: "uint256",
10562
+ name: "",
10563
+ type: "uint256"
10564
+ }
10565
+ ],
10566
+ payable: false,
10567
+ stateMutability: "view",
10568
+ type: "function"
10569
+ },
10570
+ {
10571
+ constant: true,
10572
+ inputs: [
10573
+ {
10574
+ internalType: "address[]",
10575
+ name: "_assets",
10576
+ type: "address[]"
10577
+ }
10578
+ ],
10579
+ name: "getAssetsPrices",
10580
+ outputs: [
10581
+ {
10582
+ internalType: "uint256[]",
10583
+ name: "",
10584
+ type: "uint256[]"
10585
+ }
10586
+ ],
10587
+ payable: false,
10588
+ stateMutability: "view",
10589
+ type: "function"
10590
+ },
10591
+ {
10592
+ constant: true,
10593
+ inputs: [
10594
+ {
10595
+ internalType: "address",
10596
+ name: "_asset",
10597
+ type: "address"
10598
+ }
10599
+ ],
10600
+ name: "getSourceOfAsset",
10601
+ outputs: [
10602
+ {
10603
+ internalType: "address",
10604
+ name: "",
10605
+ type: "address"
10606
+ }
10607
+ ],
10608
+ payable: false,
10609
+ stateMutability: "view",
10610
+ type: "function"
10611
+ },
10612
+ {
10613
+ constant: true,
10614
+ inputs: [
10615
+ ],
10616
+ name: "getFallbackOracle",
10617
+ outputs: [
10618
+ {
10619
+ internalType: "address",
10620
+ name: "",
10621
+ type: "address"
10622
+ }
10623
+ ],
10624
+ payable: false,
10625
+ stateMutability: "view",
10626
+ type: "function"
10627
+ }
10628
+ ];
10629
+ var IPriceOracle = {
10630
+ abi: abi$i
10631
+ };
10632
+
10633
+ function getChainlinkPriceInUsd(_x, _x2) {
10634
+ return _getChainlinkPriceInUsd.apply(this, arguments);
10635
+ }
10636
+
10637
+ function _getChainlinkPriceInUsd() {
10638
+ _getChainlinkPriceInUsd = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, asset) {
10639
+ var lendingPoolAddressProvider, priceOracleAddress, priceOracle;
10640
+ return runtime_1.wrap(function _callee$(_context) {
10641
+ while (1) {
10642
+ switch (_context.prev = _context.next) {
10643
+ case 0:
10644
+ //Workaround as Chainlink doesn't have feed registry on Polygon/Optimism
10645
+ //Use oracle from Aave which uses Chainlink
10646
+ lendingPoolAddressProvider = new ethers.ethers.Contract(aaveAddressProvider[pool.network][exports.Dapp.AAVEV3], IAaveV3PoolAddressProvider.abi, pool.signer);
10647
+ _context.next = 3;
10648
+ return lendingPoolAddressProvider.getPriceOracle();
10649
+
10650
+ case 3:
10651
+ priceOracleAddress = _context.sent;
10652
+ priceOracle = new ethers.ethers.Contract(priceOracleAddress, IPriceOracle.abi, pool.signer);
10653
+ _context.next = 7;
10654
+ return priceOracle.getAssetPrice(asset);
10655
+
10656
+ case 7:
10657
+ return _context.abrupt("return", _context.sent);
10658
+
10659
+ case 8:
10660
+ case "end":
10661
+ return _context.stop();
10662
+ }
10663
+ }
10664
+ }, _callee);
10665
+ }));
10666
+ return _getChainlinkPriceInUsd.apply(this, arguments);
10667
+ }
10668
+
10669
+ function loadPool(_x, _x2) {
10670
+ return _loadPool.apply(this, arguments);
10671
+ }
10672
+
10673
+ function _loadPool() {
10674
+ _loadPool = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, poolAddress) {
10675
+ var dhedge;
10676
+ return runtime_1.wrap(function _callee$(_context) {
10677
+ while (1) {
10678
+ switch (_context.prev = _context.next) {
10679
+ case 0:
10680
+ dhedge = new Dhedge(pool.signer, pool.network);
10681
+ _context.next = 3;
10682
+ return dhedge.loadPool(poolAddress);
10683
+
10684
+ case 3:
10685
+ return _context.abrupt("return", _context.sent);
10686
+
10687
+ case 4:
10688
+ case "end":
10689
+ return _context.stop();
10690
+ }
10691
+ }
10692
+ }, _callee);
10693
+ }));
10694
+ return _loadPool.apply(this, arguments);
10695
+ }
10696
+
10697
+ function isPool(_x3, _x4) {
10698
+ return _isPool.apply(this, arguments);
10699
+ }
10700
+
10701
+ function _isPool() {
10702
+ _isPool = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, poolAddress) {
10703
+ var dhedge;
10704
+ return runtime_1.wrap(function _callee2$(_context2) {
10705
+ while (1) {
10706
+ switch (_context2.prev = _context2.next) {
10707
+ case 0:
10708
+ dhedge = new Dhedge(pool.signer, pool.network);
10709
+ _context2.next = 3;
10710
+ return dhedge.validatePool(poolAddress);
10711
+
10712
+ case 3:
10713
+ return _context2.abrupt("return", _context2.sent);
10714
+
10715
+ case 4:
10716
+ case "end":
10717
+ return _context2.stop();
10718
+ }
10719
+ }
10720
+ }, _callee2);
10721
+ }));
10722
+ return _isPool.apply(this, arguments);
10723
+ }
10724
+
10725
+ function getPoolDepositAsset(_x, _x2, _x3) {
10726
+ return _getPoolDepositAsset.apply(this, arguments);
10727
+ }
10728
+
10729
+ function _getPoolDepositAsset() {
10730
+ _getPoolDepositAsset = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, poolAddress, investAsset) {
10731
+ var _composition$find, _composition$find2;
10732
+
10733
+ var torosPool, composition;
10734
+ return runtime_1.wrap(function _callee$(_context) {
10735
+ while (1) {
10736
+ switch (_context.prev = _context.next) {
10737
+ case 0:
10738
+ _context.next = 2;
10739
+ return loadPool(pool, poolAddress);
10740
+
10741
+ case 2:
10742
+ torosPool = _context.sent;
10743
+ _context.next = 5;
10744
+ return torosPool.getComposition();
10745
+
10746
+ case 5:
10747
+ composition = _context.sent;
10748
+
10749
+ if (!((_composition$find = composition.find(function (e) {
10750
+ return e.asset.toLowerCase() === investAsset.toLowerCase();
10751
+ })) != null && _composition$find.isDeposit)) {
10752
+ _context.next = 8;
10753
+ break;
10754
+ }
10755
+
10756
+ return _context.abrupt("return", investAsset);
10757
+
10758
+ case 8:
10759
+ return _context.abrupt("return", (_composition$find2 = composition.find(function (e) {
10760
+ return e.isDeposit;
10761
+ })) == null ? void 0 : _composition$find2.asset);
10762
+
10763
+ case 9:
10764
+ case "end":
10765
+ return _context.stop();
10766
+ }
10767
+ }
10768
+ }, _callee);
10769
+ }));
10770
+ return _getPoolDepositAsset.apply(this, arguments);
10771
+ }
10772
+
10773
+ function getTorosPoolTokenPrice(_x4, _x5) {
10774
+ return _getTorosPoolTokenPrice.apply(this, arguments);
10775
+ }
10776
+
10777
+ function _getTorosPoolTokenPrice() {
10778
+ _getTorosPoolTokenPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, poolAddress) {
10779
+ var torosPool;
10780
+ return runtime_1.wrap(function _callee2$(_context2) {
10781
+ while (1) {
10782
+ switch (_context2.prev = _context2.next) {
10783
+ case 0:
10784
+ _context2.next = 2;
10785
+ return loadPool(pool, poolAddress);
10786
+
10787
+ case 2:
10788
+ torosPool = _context2.sent;
10789
+ _context2.next = 5;
10790
+ return torosPool.poolLogic.tokenPrice();
10791
+
10792
+ case 5:
10793
+ return _context2.abrupt("return", _context2.sent);
10794
+
10795
+ case 6:
10796
+ case "end":
10797
+ return _context2.stop();
10798
+ }
10799
+ }
10800
+ }, _callee2);
10801
+ }));
10802
+ return _getTorosPoolTokenPrice.apply(this, arguments);
10803
+ }
10804
+
10805
+ function getEasySwapperDepositQuote(_x6, _x7, _x8, _x9, _x10) {
10806
+ return _getEasySwapperDepositQuote.apply(this, arguments);
10807
+ }
10808
+
10809
+ function _getEasySwapperDepositQuote() {
10810
+ _getEasySwapperDepositQuote = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(pool, torosAsset, investAsset, depositAsset, amountIn) {
10811
+ var easySwapper;
10812
+ return runtime_1.wrap(function _callee3$(_context3) {
10813
+ while (1) {
10814
+ switch (_context3.prev = _context3.next) {
10815
+ case 0:
10816
+ easySwapper = new ethers.ethers.Contract(routerAddress[pool.network][exports.Dapp.TOROS], IDhedgeEasySwapper.abi, pool.signer);
10817
+ _context3.next = 3;
10818
+ return easySwapper.depositQuote(torosAsset, investAsset, amountIn, depositAsset);
10819
+
10820
+ case 3:
10821
+ return _context3.abrupt("return", _context3.sent);
10822
+
10823
+ case 4:
10824
+ case "end":
10825
+ return _context3.stop();
10826
+ }
10827
+ }
10828
+ }, _callee3);
10829
+ }));
10830
+ return _getEasySwapperDepositQuote.apply(this, arguments);
10831
+ }
10832
+
10833
+ function getEasySwapperWithdrawalQuote(_x11, _x12, _x13, _x14) {
10834
+ return _getEasySwapperWithdrawalQuote.apply(this, arguments);
10835
+ }
10836
+
10837
+ function _getEasySwapperWithdrawalQuote() {
10838
+ _getEasySwapperWithdrawalQuote = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(pool, torosAsset, investAsset, amountIn) {
10839
+ var _yield$Promise$all, torosTokenPrice, assetPrice, assetDecimals;
10840
+
10841
+ return runtime_1.wrap(function _callee4$(_context4) {
10842
+ while (1) {
10843
+ switch (_context4.prev = _context4.next) {
10844
+ case 0:
10845
+ _context4.next = 2;
10846
+ return Promise.all([getTorosPoolTokenPrice(pool, torosAsset), getChainlinkPriceInUsd(pool, investAsset), pool.utils.getDecimals(investAsset)]);
10847
+
10848
+ case 2:
10849
+ _yield$Promise$all = _context4.sent;
10850
+ torosTokenPrice = _yield$Promise$all[0];
10851
+ assetPrice = _yield$Promise$all[1];
10852
+ assetDecimals = _yield$Promise$all[2];
10853
+ return _context4.abrupt("return", amountIn.mul(torosTokenPrice).div(assetPrice).div(1e10).div(Math.pow(10, 18 - assetDecimals)));
10854
+
10855
+ case 7:
10856
+ case "end":
10857
+ return _context4.stop();
10858
+ }
10859
+ }
10860
+ }, _callee4);
10861
+ }));
10862
+ return _getEasySwapperWithdrawalQuote.apply(this, arguments);
10863
+ }
10864
+
10865
+ function getEasySwapperTxData(_x15, _x16, _x17, _x18, _x19) {
10866
+ return _getEasySwapperTxData.apply(this, arguments);
10867
+ }
10868
+
10869
+ function _getEasySwapperTxData() {
10870
+ _getEasySwapperTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(pool, assetFrom, assetTo, amountIn, slippage // eslint-disable-next-line @typescript-eslint/no-explicit-any
10871
+ ) {
10872
+ var isWithdrawal, _ref, torosAsset, investAsset, iDhedgeEasySwapper, minAmountOut, depositAsset, _minAmountOut;
10873
+
10874
+ return runtime_1.wrap(function _callee5$(_context5) {
10875
+ while (1) {
10876
+ switch (_context5.prev = _context5.next) {
10877
+ case 0:
10878
+ _context5.next = 2;
10879
+ return isPool(pool, assetFrom);
10880
+
10881
+ case 2:
10882
+ isWithdrawal = _context5.sent;
10883
+ _ref = isWithdrawal ? [assetFrom, assetTo] : [assetTo, assetFrom], torosAsset = _ref[0], investAsset = _ref[1];
10884
+ iDhedgeEasySwapper = new ethers.ethers.utils.Interface(IDhedgeEasySwapper.abi);
10885
+
10886
+ if (!isWithdrawal) {
10887
+ _context5.next = 12;
10888
+ break;
10889
+ }
10890
+
10891
+ _context5.next = 8;
10892
+ return getEasySwapperWithdrawalQuote(pool, torosAsset, investAsset, amountIn);
10893
+
10894
+ case 8:
10895
+ minAmountOut = _context5.sent;
10896
+ return _context5.abrupt("return", iDhedgeEasySwapper.encodeFunctionData("withdraw", [torosAsset, amountIn, investAsset, minAmountOut.mul(10000 - slippage * 100).div(10000)]));
10897
+
10898
+ case 12:
10899
+ _context5.next = 14;
10900
+ return getPoolDepositAsset(pool, torosAsset, investAsset);
10901
+
10902
+ case 14:
10903
+ depositAsset = _context5.sent;
10904
+
10905
+ if (depositAsset) {
10906
+ _context5.next = 17;
10907
+ break;
10908
+ }
10909
+
10910
+ throw new Error("no deposit assets");
10911
+
10912
+ case 17:
10913
+ _context5.next = 19;
10914
+ return getEasySwapperDepositQuote(pool, torosAsset, investAsset, depositAsset, amountIn);
10915
+
10916
+ case 19:
10917
+ _minAmountOut = _context5.sent;
10918
+ return _context5.abrupt("return", iDhedgeEasySwapper.encodeFunctionData("deposit", [torosAsset, investAsset, amountIn, depositAsset, _minAmountOut.mul(10000 - slippage * 100).div(10000)]));
10919
+
10920
+ case 21:
10921
+ case "end":
10922
+ return _context5.stop();
10923
+ }
10924
+ }
10925
+ }, _callee5);
10926
+ }));
10927
+ return _getEasySwapperTxData.apply(this, arguments);
10928
+ }
10929
+
10930
+ var excludedProtocols = ["OPTIMISM_PMM6"]; //Clipper
10931
+
10932
+ function getOneInchProtocols(_x) {
10933
+ return _getOneInchProtocols.apply(this, arguments);
10934
+ }
10935
+
10936
+ function _getOneInchProtocols() {
10937
+ _getOneInchProtocols = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(chainId) {
10938
+ var response, protocols, filteredProtocols;
10939
+ return runtime_1.wrap(function _callee$(_context) {
10940
+ while (1) {
10941
+ switch (_context.prev = _context.next) {
10942
+ case 0:
10943
+ _context.prev = 0;
10944
+ _context.next = 3;
10945
+ return axios.get("https://api.1inch.io/v4.0/" + chainId + "/liquidity-sources");
10946
+
10947
+ case 3:
10948
+ response = _context.sent;
10949
+ protocols = response.data.protocols.map(function (e) {
10950
+ return e.id;
10951
+ });
10952
+ filteredProtocols = protocols.filter(function (e) {
10953
+ return !excludedProtocols.includes(e);
10954
+ });
10955
+ return _context.abrupt("return", "&protocols=" + filteredProtocols.join(","));
10956
+
10957
+ case 9:
10958
+ _context.prev = 9;
10959
+ _context.t0 = _context["catch"](0);
10960
+ return _context.abrupt("return", "");
10961
+
10962
+ case 12:
10963
+ case "end":
10964
+ return _context.stop();
10965
+ }
10966
+ }
10967
+ }, _callee, null, [[0, 9]]);
10968
+ }));
10969
+ return _getOneInchProtocols.apply(this, arguments);
10970
+ }
10971
+
10972
+ var abi$j = [
10973
+ {
10974
+ inputs: [
10975
+ {
10976
+ internalType: "address",
10977
+ name: "emissionManager",
10978
+ type: "address"
10979
+ }
10980
+ ],
10981
+ stateMutability: "nonpayable",
10982
+ type: "constructor"
10983
+ },
10984
+ {
10985
+ anonymous: false,
10986
+ inputs: [
10987
+ {
10988
+ indexed: true,
10989
+ internalType: "address",
10990
+ name: "asset",
10991
+ type: "address"
10992
+ },
10993
+ {
10994
+ indexed: true,
10995
+ internalType: "address",
10996
+ name: "reward",
10997
+ type: "address"
10998
+ },
10999
+ {
11000
+ indexed: true,
11001
+ internalType: "address",
11002
+ name: "user",
11003
+ type: "address"
11004
+ },
11005
+ {
11006
+ indexed: false,
11007
+ internalType: "uint256",
11008
+ name: "assetIndex",
11009
+ type: "uint256"
11010
+ },
11011
+ {
11012
+ indexed: false,
11013
+ internalType: "uint256",
11014
+ name: "userIndex",
11015
+ type: "uint256"
11016
+ },
11017
+ {
11018
+ indexed: false,
11019
+ internalType: "uint256",
11020
+ name: "rewardsAccrued",
11021
+ type: "uint256"
11022
+ }
11023
+ ],
11024
+ name: "Accrued",
11025
+ type: "event"
11026
+ },
11027
+ {
11028
+ anonymous: false,
11029
+ inputs: [
11030
+ {
11031
+ indexed: true,
11032
+ internalType: "address",
11033
+ name: "asset",
11034
+ type: "address"
11035
+ },
11036
+ {
11037
+ indexed: true,
11038
+ internalType: "address",
11039
+ name: "reward",
11040
+ type: "address"
11041
+ },
11042
+ {
11043
+ indexed: false,
11044
+ internalType: "uint256",
11045
+ name: "oldEmission",
11046
+ type: "uint256"
11047
+ },
11048
+ {
11049
+ indexed: false,
11050
+ internalType: "uint256",
11051
+ name: "newEmission",
11052
+ type: "uint256"
11053
+ },
11054
+ {
11055
+ indexed: false,
11056
+ internalType: "uint256",
11057
+ name: "oldDistributionEnd",
11058
+ type: "uint256"
11059
+ },
11060
+ {
11061
+ indexed: false,
11062
+ internalType: "uint256",
11063
+ name: "newDistributionEnd",
11064
+ type: "uint256"
11065
+ },
11066
+ {
11067
+ indexed: false,
11068
+ internalType: "uint256",
11069
+ name: "assetIndex",
11070
+ type: "uint256"
11071
+ }
11072
+ ],
11073
+ name: "AssetConfigUpdated",
11074
+ type: "event"
11075
+ },
11076
+ {
11077
+ anonymous: false,
11078
+ inputs: [
11079
+ {
11080
+ indexed: true,
11081
+ internalType: "address",
11082
+ name: "user",
11083
+ type: "address"
11084
+ },
11085
+ {
11086
+ indexed: true,
11087
+ internalType: "address",
11088
+ name: "claimer",
11089
+ type: "address"
11090
+ }
11091
+ ],
11092
+ name: "ClaimerSet",
11093
+ type: "event"
11094
+ },
11095
+ {
11096
+ anonymous: false,
11097
+ inputs: [
11098
+ {
11099
+ indexed: true,
11100
+ internalType: "address",
11101
+ name: "oldEmissionManager",
11102
+ type: "address"
11103
+ },
11104
+ {
11105
+ indexed: true,
11106
+ internalType: "address",
11107
+ name: "newEmissionManager",
11108
+ type: "address"
11109
+ }
11110
+ ],
11111
+ name: "EmissionManagerUpdated",
11112
+ type: "event"
11113
+ },
11114
+ {
11115
+ anonymous: false,
11116
+ inputs: [
11117
+ {
11118
+ indexed: true,
11119
+ internalType: "address",
11120
+ name: "reward",
11121
+ type: "address"
11122
+ },
11123
+ {
11124
+ indexed: true,
11125
+ internalType: "address",
11126
+ name: "rewardOracle",
11127
+ type: "address"
11128
+ }
11129
+ ],
11130
+ name: "RewardOracleUpdated",
11131
+ type: "event"
11132
+ },
11133
+ {
11134
+ anonymous: false,
11135
+ inputs: [
11136
+ {
11137
+ indexed: true,
11138
+ internalType: "address",
11139
+ name: "user",
11140
+ type: "address"
11141
+ },
11142
+ {
11143
+ indexed: true,
11144
+ internalType: "address",
11145
+ name: "reward",
11146
+ type: "address"
11147
+ },
11148
+ {
11149
+ indexed: true,
11150
+ internalType: "address",
11151
+ name: "to",
11152
+ type: "address"
11153
+ },
11154
+ {
11155
+ indexed: false,
11156
+ internalType: "address",
11157
+ name: "claimer",
11158
+ type: "address"
11159
+ },
11160
+ {
11161
+ indexed: false,
11162
+ internalType: "uint256",
11163
+ name: "amount",
11164
+ type: "uint256"
11165
+ }
11166
+ ],
11167
+ name: "RewardsClaimed",
11168
+ type: "event"
11169
+ },
11170
+ {
11171
+ anonymous: false,
11172
+ inputs: [
11173
+ {
11174
+ indexed: true,
11175
+ internalType: "address",
11176
+ name: "reward",
11177
+ type: "address"
11178
+ },
11179
+ {
11180
+ indexed: true,
11181
+ internalType: "address",
11182
+ name: "transferStrategy",
11183
+ type: "address"
11184
+ }
11185
+ ],
11186
+ name: "TransferStrategyInstalled",
11187
+ type: "event"
11188
+ },
11189
+ {
11190
+ inputs: [
11191
+ ],
11192
+ name: "REVISION",
11193
+ outputs: [
11194
+ {
11195
+ internalType: "uint256",
11196
+ name: "",
11197
+ type: "uint256"
11198
+ }
11199
+ ],
11200
+ stateMutability: "view",
11201
+ type: "function"
11202
+ },
11203
+ {
11204
+ inputs: [
11205
+ {
11206
+ internalType: "address[]",
11207
+ name: "assets",
11208
+ type: "address[]"
11209
+ },
11210
+ {
11211
+ internalType: "address",
11212
+ name: "to",
11213
+ type: "address"
11214
+ }
11215
+ ],
11216
+ name: "claimAllRewards",
11217
+ outputs: [
11218
+ {
11219
+ internalType: "address[]",
11220
+ name: "rewardsList",
11221
+ type: "address[]"
11222
+ },
11223
+ {
11224
+ internalType: "uint256[]",
11225
+ name: "claimedAmounts",
11226
+ type: "uint256[]"
11227
+ }
11228
+ ],
11229
+ stateMutability: "nonpayable",
11230
+ type: "function"
11231
+ },
11232
+ {
11233
+ inputs: [
11234
+ {
11235
+ internalType: "address[]",
11236
+ name: "assets",
11237
+ type: "address[]"
11238
+ },
11239
+ {
11240
+ internalType: "address",
11241
+ name: "user",
11242
+ type: "address"
11243
+ },
11244
+ {
11245
+ internalType: "address",
11246
+ name: "to",
11247
+ type: "address"
11248
+ }
11249
+ ],
11250
+ name: "claimAllRewardsOnBehalf",
11251
+ outputs: [
11252
+ {
11253
+ internalType: "address[]",
11254
+ name: "rewardsList",
11255
+ type: "address[]"
11256
+ },
11257
+ {
11258
+ internalType: "uint256[]",
11259
+ name: "claimedAmounts",
11260
+ type: "uint256[]"
11261
+ }
11262
+ ],
11263
+ stateMutability: "nonpayable",
11264
+ type: "function"
11265
+ },
11266
+ {
11267
+ inputs: [
11268
+ {
11269
+ internalType: "address[]",
11270
+ name: "assets",
11271
+ type: "address[]"
11272
+ }
11273
+ ],
11274
+ name: "claimAllRewardsToSelf",
11275
+ outputs: [
11276
+ {
11277
+ internalType: "address[]",
11278
+ name: "rewardsList",
11279
+ type: "address[]"
11280
+ },
11281
+ {
11282
+ internalType: "uint256[]",
11283
+ name: "claimedAmounts",
11284
+ type: "uint256[]"
11285
+ }
11286
+ ],
11287
+ stateMutability: "nonpayable",
11288
+ type: "function"
11289
+ },
11290
+ {
11291
+ inputs: [
11292
+ {
11293
+ internalType: "address[]",
11294
+ name: "assets",
11295
+ type: "address[]"
11296
+ },
11297
+ {
11298
+ internalType: "uint256",
11299
+ name: "amount",
11300
+ type: "uint256"
11301
+ },
11302
+ {
11303
+ internalType: "address",
11304
+ name: "to",
11305
+ type: "address"
11306
+ },
11307
+ {
11308
+ internalType: "address",
11309
+ name: "reward",
11310
+ type: "address"
11311
+ }
11312
+ ],
11313
+ name: "claimRewards",
11314
+ outputs: [
11315
+ {
11316
+ internalType: "uint256",
11317
+ name: "",
11318
+ type: "uint256"
11319
+ }
11320
+ ],
11321
+ stateMutability: "nonpayable",
11322
+ type: "function"
11323
+ },
11324
+ {
11325
+ inputs: [
11326
+ {
11327
+ internalType: "address[]",
11328
+ name: "assets",
11329
+ type: "address[]"
11330
+ },
11331
+ {
11332
+ internalType: "uint256",
11333
+ name: "amount",
11334
+ type: "uint256"
11335
+ },
11336
+ {
11337
+ internalType: "address",
11338
+ name: "user",
11339
+ type: "address"
11340
+ },
11341
+ {
11342
+ internalType: "address",
11343
+ name: "to",
11344
+ type: "address"
11345
+ },
11346
+ {
11347
+ internalType: "address",
11348
+ name: "reward",
11349
+ type: "address"
11350
+ }
11351
+ ],
11352
+ name: "claimRewardsOnBehalf",
11353
+ outputs: [
11354
+ {
11355
+ internalType: "uint256",
11356
+ name: "",
11357
+ type: "uint256"
11358
+ }
11359
+ ],
11360
+ stateMutability: "nonpayable",
11361
+ type: "function"
11362
+ },
11363
+ {
11364
+ inputs: [
11365
+ {
11366
+ internalType: "address[]",
11367
+ name: "assets",
11368
+ type: "address[]"
11369
+ },
11370
+ {
11371
+ internalType: "uint256",
11372
+ name: "amount",
11373
+ type: "uint256"
11374
+ },
11375
+ {
11376
+ internalType: "address",
11377
+ name: "reward",
11378
+ type: "address"
11379
+ }
11380
+ ],
11381
+ name: "claimRewardsToSelf",
11382
+ outputs: [
11383
+ {
11384
+ internalType: "uint256",
11385
+ name: "",
11386
+ type: "uint256"
11387
+ }
11388
+ ],
11389
+ stateMutability: "nonpayable",
11390
+ type: "function"
11391
+ },
11392
+ {
11393
+ inputs: [
11394
+ {
11395
+ components: [
11396
+ {
11397
+ internalType: "uint88",
11398
+ name: "emissionPerSecond",
11399
+ type: "uint88"
11400
+ },
11401
+ {
11402
+ internalType: "uint256",
11403
+ name: "totalSupply",
11404
+ type: "uint256"
11405
+ },
11406
+ {
11407
+ internalType: "uint32",
11408
+ name: "distributionEnd",
11409
+ type: "uint32"
11410
+ },
11411
+ {
11412
+ internalType: "address",
11413
+ name: "asset",
11414
+ type: "address"
11415
+ },
11416
+ {
11417
+ internalType: "address",
11418
+ name: "reward",
11419
+ type: "address"
11420
+ },
11421
+ {
11422
+ internalType: "contract ITransferStrategyBase",
11423
+ name: "transferStrategy",
11424
+ type: "address"
11425
+ },
11426
+ {
11427
+ internalType: "contract IEACAggregatorProxy",
11428
+ name: "rewardOracle",
11429
+ type: "address"
11430
+ }
11431
+ ],
11432
+ internalType: "struct RewardsDataTypes.RewardsConfigInput[]",
11433
+ name: "config",
11434
+ type: "tuple[]"
11435
+ }
11436
+ ],
11437
+ name: "configureAssets",
11438
+ outputs: [
11439
+ ],
11440
+ stateMutability: "nonpayable",
11441
+ type: "function"
11442
+ },
11443
+ {
11444
+ inputs: [
11445
+ {
11446
+ internalType: "address[]",
11447
+ name: "assets",
11448
+ type: "address[]"
11449
+ },
11450
+ {
11451
+ internalType: "address",
11452
+ name: "user",
11453
+ type: "address"
11454
+ }
11455
+ ],
11456
+ name: "getAllUserRewards",
11457
+ outputs: [
11458
+ {
11459
+ internalType: "address[]",
11460
+ name: "rewardsList",
11461
+ type: "address[]"
11462
+ },
11463
+ {
11464
+ internalType: "uint256[]",
11465
+ name: "unclaimedAmounts",
11466
+ type: "uint256[]"
11467
+ }
11468
+ ],
11469
+ stateMutability: "view",
11470
+ type: "function"
11471
+ },
11472
+ {
11473
+ inputs: [
11474
+ {
11475
+ internalType: "address",
11476
+ name: "asset",
11477
+ type: "address"
11478
+ }
11479
+ ],
11480
+ name: "getAssetDecimals",
11481
+ outputs: [
11482
+ {
11483
+ internalType: "uint8",
11484
+ name: "",
11485
+ type: "uint8"
11486
+ }
11487
+ ],
11488
+ stateMutability: "view",
11489
+ type: "function"
11490
+ },
11491
+ {
11492
+ inputs: [
11493
+ {
11494
+ internalType: "address",
11495
+ name: "user",
11496
+ type: "address"
11497
+ }
11498
+ ],
11499
+ name: "getClaimer",
11500
+ outputs: [
11501
+ {
11502
+ internalType: "address",
11503
+ name: "",
11504
+ type: "address"
11505
+ }
11506
+ ],
11507
+ stateMutability: "view",
11508
+ type: "function"
11509
+ },
11510
+ {
11511
+ inputs: [
11512
+ {
11513
+ internalType: "address",
11514
+ name: "asset",
11515
+ type: "address"
11516
+ },
11517
+ {
11518
+ internalType: "address",
11519
+ name: "reward",
11520
+ type: "address"
11521
+ }
11522
+ ],
11523
+ name: "getDistributionEnd",
11524
+ outputs: [
11525
+ {
11526
+ internalType: "uint256",
11527
+ name: "",
11528
+ type: "uint256"
11529
+ }
11530
+ ],
11531
+ stateMutability: "view",
11532
+ type: "function"
11533
+ },
11534
+ {
11535
+ inputs: [
11536
+ ],
11537
+ name: "getEmissionManager",
11538
+ outputs: [
11539
+ {
11540
+ internalType: "address",
11541
+ name: "",
11542
+ type: "address"
11543
+ }
11544
+ ],
11545
+ stateMutability: "view",
11546
+ type: "function"
11547
+ },
11548
+ {
11549
+ inputs: [
11550
+ {
11551
+ internalType: "address",
11552
+ name: "reward",
11553
+ type: "address"
11554
+ }
11555
+ ],
11556
+ name: "getRewardOracle",
11557
+ outputs: [
11558
+ {
11559
+ internalType: "address",
11560
+ name: "",
11561
+ type: "address"
11562
+ }
11563
+ ],
11564
+ stateMutability: "view",
11565
+ type: "function"
11566
+ },
11567
+ {
11568
+ inputs: [
11569
+ {
11570
+ internalType: "address",
11571
+ name: "asset",
11572
+ type: "address"
11573
+ }
11574
+ ],
11575
+ name: "getRewardsByAsset",
11576
+ outputs: [
11577
+ {
11578
+ internalType: "address[]",
11579
+ name: "",
11580
+ type: "address[]"
11581
+ }
11582
+ ],
11583
+ stateMutability: "view",
11584
+ type: "function"
11585
+ },
11586
+ {
11587
+ inputs: [
11588
+ {
11589
+ internalType: "address",
11590
+ name: "asset",
11591
+ type: "address"
11592
+ },
11593
+ {
11594
+ internalType: "address",
11595
+ name: "reward",
11596
+ type: "address"
11597
+ }
11598
+ ],
11599
+ name: "getRewardsData",
11600
+ outputs: [
11601
+ {
11602
+ internalType: "uint256",
11603
+ name: "",
11604
+ type: "uint256"
11605
+ },
11606
+ {
11607
+ internalType: "uint256",
11608
+ name: "",
11609
+ type: "uint256"
11610
+ },
11611
+ {
11612
+ internalType: "uint256",
11613
+ name: "",
11614
+ type: "uint256"
11615
+ },
11616
+ {
11617
+ internalType: "uint256",
11618
+ name: "",
11619
+ type: "uint256"
11620
+ }
11621
+ ],
11622
+ stateMutability: "view",
11623
+ type: "function"
11624
+ },
11625
+ {
11626
+ inputs: [
11627
+ ],
11628
+ name: "getRewardsList",
11629
+ outputs: [
11630
+ {
11631
+ internalType: "address[]",
11632
+ name: "",
11633
+ type: "address[]"
11634
+ }
11635
+ ],
11636
+ stateMutability: "view",
11637
+ type: "function"
11638
+ },
11639
+ {
11640
+ inputs: [
11641
+ {
11642
+ internalType: "address",
11643
+ name: "reward",
11644
+ type: "address"
11645
+ }
11646
+ ],
11647
+ name: "getTransferStrategy",
11648
+ outputs: [
11649
+ {
11650
+ internalType: "address",
11651
+ name: "",
11652
+ type: "address"
11653
+ }
11654
+ ],
11655
+ stateMutability: "view",
11656
+ type: "function"
11657
+ },
11658
+ {
11659
+ inputs: [
11660
+ {
11661
+ internalType: "address",
11662
+ name: "user",
11663
+ type: "address"
11664
+ },
11665
+ {
11666
+ internalType: "address",
11667
+ name: "reward",
11668
+ type: "address"
11669
+ }
11670
+ ],
11671
+ name: "getUserAccruedRewards",
11672
+ outputs: [
11673
+ {
11674
+ internalType: "uint256",
11675
+ name: "",
11676
+ type: "uint256"
11677
+ }
11678
+ ],
11679
+ stateMutability: "view",
11680
+ type: "function"
11681
+ },
11682
+ {
11683
+ inputs: [
11684
+ {
11685
+ internalType: "address",
11686
+ name: "user",
11687
+ type: "address"
11688
+ },
11689
+ {
11690
+ internalType: "address",
11691
+ name: "asset",
11692
+ type: "address"
11693
+ },
11694
+ {
11695
+ internalType: "address",
11696
+ name: "reward",
11697
+ type: "address"
11698
+ }
11699
+ ],
11700
+ name: "getUserAssetIndex",
11701
+ outputs: [
11702
+ {
11703
+ internalType: "uint256",
11704
+ name: "",
11705
+ type: "uint256"
11706
+ }
11707
+ ],
11708
+ stateMutability: "view",
11709
+ type: "function"
11710
+ },
11711
+ {
11712
+ inputs: [
11713
+ {
11714
+ internalType: "address[]",
11715
+ name: "assets",
11716
+ type: "address[]"
11717
+ },
11718
+ {
11719
+ internalType: "address",
11720
+ name: "user",
11721
+ type: "address"
11722
+ },
11723
+ {
11724
+ internalType: "address",
11725
+ name: "reward",
11726
+ type: "address"
11727
+ }
11728
+ ],
11729
+ name: "getUserRewards",
11730
+ outputs: [
11731
+ {
11732
+ internalType: "uint256",
11733
+ name: "",
11734
+ type: "uint256"
11735
+ }
11736
+ ],
11737
+ stateMutability: "view",
11738
+ type: "function"
11739
+ },
11740
+ {
11741
+ inputs: [
11742
+ {
11743
+ internalType: "address",
11744
+ name: "user",
11745
+ type: "address"
11746
+ },
11747
+ {
11748
+ internalType: "uint256",
11749
+ name: "totalSupply",
11750
+ type: "uint256"
11751
+ },
11752
+ {
11753
+ internalType: "uint256",
11754
+ name: "userBalance",
11755
+ type: "uint256"
11756
+ }
11757
+ ],
11758
+ name: "handleAction",
11759
+ outputs: [
11760
+ ],
11761
+ stateMutability: "nonpayable",
11762
+ type: "function"
11763
+ },
11764
+ {
11765
+ inputs: [
11766
+ {
11767
+ internalType: "address",
11768
+ name: "emissionManager",
11769
+ type: "address"
11770
+ }
11771
+ ],
11772
+ name: "initialize",
11773
+ outputs: [
11774
+ ],
11775
+ stateMutability: "nonpayable",
11776
+ type: "function"
11777
+ },
11778
+ {
11779
+ inputs: [
11780
+ {
11781
+ internalType: "address",
11782
+ name: "user",
11783
+ type: "address"
11784
+ },
11785
+ {
11786
+ internalType: "address",
11787
+ name: "caller",
11788
+ type: "address"
11789
+ }
11790
+ ],
11791
+ name: "setClaimer",
11792
+ outputs: [
11793
+ ],
11794
+ stateMutability: "nonpayable",
11795
+ type: "function"
11796
+ },
11797
+ {
11798
+ inputs: [
11799
+ {
11800
+ internalType: "address",
11801
+ name: "asset",
11802
+ type: "address"
11803
+ },
11804
+ {
11805
+ internalType: "address",
11806
+ name: "reward",
11807
+ type: "address"
11808
+ },
11809
+ {
11810
+ internalType: "uint32",
11811
+ name: "newDistributionEnd",
11812
+ type: "uint32"
11813
+ }
11814
+ ],
11815
+ name: "setDistributionEnd",
11816
+ outputs: [
11817
+ ],
11818
+ stateMutability: "nonpayable",
11819
+ type: "function"
11820
+ },
11821
+ {
11822
+ inputs: [
11823
+ {
11824
+ internalType: "address",
11825
+ name: "emissionManager",
11826
+ type: "address"
11827
+ }
11828
+ ],
11829
+ name: "setEmissionManager",
11830
+ outputs: [
11831
+ ],
11832
+ stateMutability: "nonpayable",
11833
+ type: "function"
11834
+ },
11835
+ {
11836
+ inputs: [
11837
+ {
11838
+ internalType: "address",
11839
+ name: "asset",
11840
+ type: "address"
11841
+ },
11842
+ {
11843
+ internalType: "address[]",
11844
+ name: "rewards",
11845
+ type: "address[]"
11846
+ },
11847
+ {
11848
+ internalType: "uint88[]",
11849
+ name: "newEmissionsPerSecond",
11850
+ type: "uint88[]"
11851
+ }
11852
+ ],
11853
+ name: "setEmissionPerSecond",
11854
+ outputs: [
11855
+ ],
11856
+ stateMutability: "nonpayable",
11857
+ type: "function"
11858
+ },
11859
+ {
11860
+ inputs: [
11861
+ {
11862
+ internalType: "address",
11863
+ name: "reward",
11864
+ type: "address"
11865
+ },
11866
+ {
11867
+ internalType: "contract IEACAggregatorProxy",
11868
+ name: "rewardOracle",
11869
+ type: "address"
11870
+ }
11871
+ ],
11872
+ name: "setRewardOracle",
11873
+ outputs: [
11874
+ ],
11875
+ stateMutability: "nonpayable",
11876
+ type: "function"
11877
+ },
11878
+ {
11879
+ inputs: [
11880
+ {
11881
+ internalType: "address",
11882
+ name: "reward",
11883
+ type: "address"
11884
+ },
11885
+ {
11886
+ internalType: "contract ITransferStrategyBase",
11887
+ name: "transferStrategy",
11888
+ type: "address"
11889
+ }
11890
+ ],
11891
+ name: "setTransferStrategy",
11892
+ outputs: [
11893
+ ],
11894
+ stateMutability: "nonpayable",
11895
+ type: "function"
11896
+ }
11897
+ ];
11898
+ var IAaveV3Incentives = {
11899
+ abi: abi$j
11900
+ };
11901
+
11902
+ var abi$k = [
11903
+ {
11904
+ inputs: [
11905
+ {
11906
+ internalType: "contract IPoolAddressesProvider",
11907
+ name: "provider",
11908
+ type: "address"
11909
+ }
11910
+ ],
11911
+ stateMutability: "nonpayable",
11912
+ type: "constructor"
11913
+ },
11914
+ {
11915
+ anonymous: false,
11916
+ inputs: [
11917
+ {
11918
+ indexed: true,
11919
+ internalType: "address",
11920
+ name: "reserve",
11921
+ type: "address"
11922
+ },
11923
+ {
11924
+ indexed: true,
11925
+ internalType: "address",
11926
+ name: "backer",
11927
+ type: "address"
11928
+ },
11929
+ {
11930
+ indexed: false,
11931
+ internalType: "uint256",
11932
+ name: "amount",
11933
+ type: "uint256"
11934
+ },
11935
+ {
11936
+ indexed: false,
11937
+ internalType: "uint256",
11938
+ name: "fee",
11939
+ type: "uint256"
11940
+ }
11941
+ ],
11942
+ name: "BackUnbacked",
11943
+ type: "event"
11944
+ },
11945
+ {
11946
+ anonymous: false,
11947
+ inputs: [
11948
+ {
11949
+ indexed: true,
11950
+ internalType: "address",
11951
+ name: "reserve",
11952
+ type: "address"
11953
+ },
11954
+ {
11955
+ indexed: false,
11956
+ internalType: "address",
11957
+ name: "user",
11958
+ type: "address"
11959
+ },
11960
+ {
11961
+ indexed: true,
11962
+ internalType: "address",
11963
+ name: "onBehalfOf",
11964
+ type: "address"
11965
+ },
11966
+ {
11967
+ indexed: false,
11968
+ internalType: "uint256",
11969
+ name: "amount",
11970
+ type: "uint256"
11971
+ },
11972
+ {
11973
+ indexed: false,
11974
+ internalType: "enum DataTypes.InterestRateMode",
11975
+ name: "interestRateMode",
11976
+ type: "uint8"
11977
+ },
11978
+ {
11979
+ indexed: false,
11980
+ internalType: "uint256",
11981
+ name: "borrowRate",
11982
+ type: "uint256"
11983
+ },
11984
+ {
11985
+ indexed: true,
11986
+ internalType: "uint16",
11987
+ name: "referralCode",
11988
+ type: "uint16"
11989
+ }
11990
+ ],
11991
+ name: "Borrow",
11992
+ type: "event"
11993
+ },
11994
+ {
11995
+ anonymous: false,
11996
+ inputs: [
11997
+ {
11998
+ indexed: true,
11999
+ internalType: "address",
12000
+ name: "target",
12001
+ type: "address"
12002
+ },
12003
+ {
12004
+ indexed: false,
12005
+ internalType: "address",
12006
+ name: "initiator",
12007
+ type: "address"
12008
+ },
12009
+ {
12010
+ indexed: true,
12011
+ internalType: "address",
12012
+ name: "asset",
12013
+ type: "address"
12014
+ },
12015
+ {
12016
+ indexed: false,
12017
+ internalType: "uint256",
12018
+ name: "amount",
12019
+ type: "uint256"
12020
+ },
12021
+ {
12022
+ indexed: false,
12023
+ internalType: "enum DataTypes.InterestRateMode",
12024
+ name: "interestRateMode",
12025
+ type: "uint8"
12026
+ },
12027
+ {
12028
+ indexed: false,
12029
+ internalType: "uint256",
12030
+ name: "premium",
12031
+ type: "uint256"
12032
+ },
12033
+ {
12034
+ indexed: true,
12035
+ internalType: "uint16",
12036
+ name: "referralCode",
12037
+ type: "uint16"
12038
+ }
12039
+ ],
12040
+ name: "FlashLoan",
12041
+ type: "event"
12042
+ },
12043
+ {
12044
+ anonymous: false,
12045
+ inputs: [
12046
+ {
12047
+ indexed: true,
12048
+ internalType: "address",
12049
+ name: "asset",
12050
+ type: "address"
12051
+ },
12052
+ {
12053
+ indexed: false,
12054
+ internalType: "uint256",
12055
+ name: "totalDebt",
12056
+ type: "uint256"
12057
+ }
12058
+ ],
12059
+ name: "IsolationModeTotalDebtUpdated",
12060
+ type: "event"
12061
+ },
12062
+ {
12063
+ anonymous: false,
12064
+ inputs: [
12065
+ {
12066
+ indexed: true,
12067
+ internalType: "address",
12068
+ name: "collateralAsset",
12069
+ type: "address"
12070
+ },
12071
+ {
12072
+ indexed: true,
12073
+ internalType: "address",
12074
+ name: "debtAsset",
12075
+ type: "address"
12076
+ },
12077
+ {
12078
+ indexed: true,
12079
+ internalType: "address",
12080
+ name: "user",
12081
+ type: "address"
12082
+ },
12083
+ {
12084
+ indexed: false,
12085
+ internalType: "uint256",
12086
+ name: "debtToCover",
12087
+ type: "uint256"
12088
+ },
12089
+ {
12090
+ indexed: false,
12091
+ internalType: "uint256",
12092
+ name: "liquidatedCollateralAmount",
12093
+ type: "uint256"
12094
+ },
12095
+ {
12096
+ indexed: false,
12097
+ internalType: "address",
12098
+ name: "liquidator",
12099
+ type: "address"
12100
+ },
12101
+ {
12102
+ indexed: false,
12103
+ internalType: "bool",
12104
+ name: "receiveAToken",
12105
+ type: "bool"
12106
+ }
12107
+ ],
12108
+ name: "LiquidationCall",
12109
+ type: "event"
12110
+ },
12111
+ {
12112
+ anonymous: false,
12113
+ inputs: [
12114
+ {
12115
+ indexed: true,
12116
+ internalType: "address",
12117
+ name: "reserve",
12118
+ type: "address"
12119
+ },
12120
+ {
12121
+ indexed: false,
12122
+ internalType: "address",
12123
+ name: "user",
12124
+ type: "address"
12125
+ },
12126
+ {
12127
+ indexed: true,
12128
+ internalType: "address",
12129
+ name: "onBehalfOf",
12130
+ type: "address"
12131
+ },
12132
+ {
12133
+ indexed: false,
12134
+ internalType: "uint256",
12135
+ name: "amount",
12136
+ type: "uint256"
12137
+ },
12138
+ {
12139
+ indexed: true,
12140
+ internalType: "uint16",
12141
+ name: "referralCode",
12142
+ type: "uint16"
12143
+ }
12144
+ ],
12145
+ name: "MintUnbacked",
12146
+ type: "event"
12147
+ },
12148
+ {
12149
+ anonymous: false,
12150
+ inputs: [
12151
+ {
12152
+ indexed: true,
12153
+ internalType: "address",
12154
+ name: "reserve",
12155
+ type: "address"
12156
+ },
12157
+ {
12158
+ indexed: false,
12159
+ internalType: "uint256",
12160
+ name: "amountMinted",
12161
+ type: "uint256"
12162
+ }
12163
+ ],
12164
+ name: "MintedToTreasury",
12165
+ type: "event"
12166
+ },
12167
+ {
12168
+ anonymous: false,
12169
+ inputs: [
12170
+ {
12171
+ indexed: true,
12172
+ internalType: "address",
12173
+ name: "reserve",
12174
+ type: "address"
12175
+ },
12176
+ {
12177
+ indexed: true,
12178
+ internalType: "address",
12179
+ name: "user",
12180
+ type: "address"
12181
+ }
12182
+ ],
12183
+ name: "RebalanceStableBorrowRate",
12184
+ type: "event"
12185
+ },
12186
+ {
12187
+ anonymous: false,
12188
+ inputs: [
12189
+ {
12190
+ indexed: true,
12191
+ internalType: "address",
12192
+ name: "reserve",
12193
+ type: "address"
12194
+ },
12195
+ {
12196
+ indexed: true,
12197
+ internalType: "address",
12198
+ name: "user",
12199
+ type: "address"
12200
+ },
12201
+ {
12202
+ indexed: true,
12203
+ internalType: "address",
12204
+ name: "repayer",
12205
+ type: "address"
12206
+ },
12207
+ {
12208
+ indexed: false,
12209
+ internalType: "uint256",
12210
+ name: "amount",
12211
+ type: "uint256"
12212
+ },
12213
+ {
12214
+ indexed: false,
12215
+ internalType: "bool",
12216
+ name: "useATokens",
12217
+ type: "bool"
12218
+ }
12219
+ ],
12220
+ name: "Repay",
12221
+ type: "event"
12222
+ },
12223
+ {
12224
+ anonymous: false,
12225
+ inputs: [
12226
+ {
12227
+ indexed: true,
12228
+ internalType: "address",
12229
+ name: "reserve",
12230
+ type: "address"
12231
+ },
12232
+ {
12233
+ indexed: false,
12234
+ internalType: "uint256",
12235
+ name: "liquidityRate",
12236
+ type: "uint256"
12237
+ },
12238
+ {
12239
+ indexed: false,
12240
+ internalType: "uint256",
12241
+ name: "stableBorrowRate",
12242
+ type: "uint256"
12243
+ },
12244
+ {
12245
+ indexed: false,
12246
+ internalType: "uint256",
12247
+ name: "variableBorrowRate",
12248
+ type: "uint256"
12249
+ },
12250
+ {
12251
+ indexed: false,
12252
+ internalType: "uint256",
12253
+ name: "liquidityIndex",
12254
+ type: "uint256"
12255
+ },
12256
+ {
12257
+ indexed: false,
12258
+ internalType: "uint256",
12259
+ name: "variableBorrowIndex",
12260
+ type: "uint256"
12261
+ }
12262
+ ],
12263
+ name: "ReserveDataUpdated",
12264
+ type: "event"
12265
+ },
12266
+ {
12267
+ anonymous: false,
12268
+ inputs: [
12269
+ {
12270
+ indexed: true,
12271
+ internalType: "address",
12272
+ name: "reserve",
12273
+ type: "address"
12274
+ },
12275
+ {
12276
+ indexed: true,
12277
+ internalType: "address",
12278
+ name: "user",
12279
+ type: "address"
12280
+ }
12281
+ ],
12282
+ name: "ReserveUsedAsCollateralDisabled",
12283
+ type: "event"
12284
+ },
12285
+ {
12286
+ anonymous: false,
12287
+ inputs: [
12288
+ {
12289
+ indexed: true,
12290
+ internalType: "address",
12291
+ name: "reserve",
12292
+ type: "address"
12293
+ },
12294
+ {
12295
+ indexed: true,
12296
+ internalType: "address",
12297
+ name: "user",
12298
+ type: "address"
12299
+ }
12300
+ ],
12301
+ name: "ReserveUsedAsCollateralEnabled",
12302
+ type: "event"
12303
+ },
12304
+ {
12305
+ anonymous: false,
12306
+ inputs: [
12307
+ {
12308
+ indexed: true,
12309
+ internalType: "address",
12310
+ name: "reserve",
12311
+ type: "address"
12312
+ },
12313
+ {
12314
+ indexed: false,
12315
+ internalType: "address",
12316
+ name: "user",
12317
+ type: "address"
12318
+ },
12319
+ {
12320
+ indexed: true,
12321
+ internalType: "address",
12322
+ name: "onBehalfOf",
12323
+ type: "address"
12324
+ },
12325
+ {
12326
+ indexed: false,
12327
+ internalType: "uint256",
12328
+ name: "amount",
12329
+ type: "uint256"
12330
+ },
12331
+ {
12332
+ indexed: true,
12333
+ internalType: "uint16",
12334
+ name: "referralCode",
12335
+ type: "uint16"
12336
+ }
12337
+ ],
12338
+ name: "Supply",
12339
+ type: "event"
12340
+ },
12341
+ {
12342
+ anonymous: false,
12343
+ inputs: [
12344
+ {
12345
+ indexed: true,
12346
+ internalType: "address",
12347
+ name: "reserve",
12348
+ type: "address"
12349
+ },
12350
+ {
12351
+ indexed: true,
12352
+ internalType: "address",
12353
+ name: "user",
12354
+ type: "address"
12355
+ },
12356
+ {
12357
+ indexed: false,
12358
+ internalType: "enum DataTypes.InterestRateMode",
12359
+ name: "interestRateMode",
12360
+ type: "uint8"
12361
+ }
12362
+ ],
12363
+ name: "SwapBorrowRateMode",
12364
+ type: "event"
12365
+ },
12366
+ {
12367
+ anonymous: false,
12368
+ inputs: [
12369
+ {
12370
+ indexed: true,
12371
+ internalType: "address",
12372
+ name: "user",
12373
+ type: "address"
12374
+ },
12375
+ {
12376
+ indexed: false,
12377
+ internalType: "uint8",
12378
+ name: "categoryId",
12379
+ type: "uint8"
12380
+ }
12381
+ ],
12382
+ name: "UserEModeSet",
12383
+ type: "event"
12384
+ },
12385
+ {
12386
+ anonymous: false,
12387
+ inputs: [
12388
+ {
12389
+ indexed: true,
12390
+ internalType: "address",
12391
+ name: "reserve",
12392
+ type: "address"
12393
+ },
12394
+ {
12395
+ indexed: true,
12396
+ internalType: "address",
12397
+ name: "user",
12398
+ type: "address"
12399
+ },
12400
+ {
12401
+ indexed: true,
12402
+ internalType: "address",
12403
+ name: "to",
12404
+ type: "address"
12405
+ },
12406
+ {
12407
+ indexed: false,
12408
+ internalType: "uint256",
12409
+ name: "amount",
12410
+ type: "uint256"
12411
+ }
12412
+ ],
12413
+ name: "Withdraw",
12414
+ type: "event"
12415
+ },
12416
+ {
12417
+ inputs: [
12418
+ ],
12419
+ name: "ADDRESSES_PROVIDER",
12420
+ outputs: [
12421
+ {
12422
+ internalType: "contract IPoolAddressesProvider",
12423
+ name: "",
12424
+ type: "address"
12425
+ }
12426
+ ],
12427
+ stateMutability: "view",
12428
+ type: "function"
12429
+ },
12430
+ {
12431
+ inputs: [
12432
+ ],
12433
+ name: "BRIDGE_PROTOCOL_FEE",
12434
+ outputs: [
12435
+ {
12436
+ internalType: "uint256",
12437
+ name: "",
12438
+ type: "uint256"
12439
+ }
12440
+ ],
12441
+ stateMutability: "view",
12442
+ type: "function"
12443
+ },
12444
+ {
12445
+ inputs: [
12446
+ ],
12447
+ name: "FLASHLOAN_PREMIUM_TOTAL",
12448
+ outputs: [
12449
+ {
12450
+ internalType: "uint128",
12451
+ name: "",
12452
+ type: "uint128"
12453
+ }
12454
+ ],
12455
+ stateMutability: "view",
12456
+ type: "function"
12457
+ },
12458
+ {
12459
+ inputs: [
12460
+ ],
12461
+ name: "FLASHLOAN_PREMIUM_TO_PROTOCOL",
12462
+ outputs: [
12463
+ {
12464
+ internalType: "uint128",
12465
+ name: "",
12466
+ type: "uint128"
12467
+ }
12468
+ ],
12469
+ stateMutability: "view",
12470
+ type: "function"
12471
+ },
12472
+ {
12473
+ inputs: [
12474
+ ],
12475
+ name: "MAX_NUMBER_RESERVES",
12476
+ outputs: [
12477
+ {
12478
+ internalType: "uint16",
12479
+ name: "",
12480
+ type: "uint16"
12481
+ }
12482
+ ],
12483
+ stateMutability: "view",
12484
+ type: "function"
12485
+ },
12486
+ {
12487
+ inputs: [
12488
+ ],
12489
+ name: "MAX_STABLE_RATE_BORROW_SIZE_PERCENT",
12490
+ outputs: [
12491
+ {
12492
+ internalType: "uint256",
12493
+ name: "",
12494
+ type: "uint256"
12495
+ }
12496
+ ],
12497
+ stateMutability: "view",
12498
+ type: "function"
12499
+ },
12500
+ {
12501
+ inputs: [
12502
+ ],
12503
+ name: "POOL_REVISION",
12504
+ outputs: [
12505
+ {
12506
+ internalType: "uint256",
12507
+ name: "",
12508
+ type: "uint256"
12509
+ }
12510
+ ],
12511
+ stateMutability: "view",
12512
+ type: "function"
12513
+ },
12514
+ {
12515
+ inputs: [
12516
+ {
12517
+ internalType: "address",
12518
+ name: "asset",
12519
+ type: "address"
12520
+ },
12521
+ {
12522
+ internalType: "uint256",
12523
+ name: "amount",
12524
+ type: "uint256"
12525
+ },
12526
+ {
12527
+ internalType: "uint256",
12528
+ name: "fee",
12529
+ type: "uint256"
12530
+ }
12531
+ ],
12532
+ name: "backUnbacked",
12533
+ outputs: [
12534
+ ],
12535
+ stateMutability: "nonpayable",
12536
+ type: "function"
12537
+ },
12538
+ {
12539
+ inputs: [
12540
+ {
12541
+ internalType: "address",
12542
+ name: "asset",
12543
+ type: "address"
12544
+ },
12545
+ {
12546
+ internalType: "uint256",
12547
+ name: "amount",
12548
+ type: "uint256"
12549
+ },
12550
+ {
12551
+ internalType: "uint256",
12552
+ name: "interestRateMode",
12553
+ type: "uint256"
12554
+ },
12555
+ {
12556
+ internalType: "uint16",
12557
+ name: "referralCode",
12558
+ type: "uint16"
12559
+ },
12560
+ {
12561
+ internalType: "address",
12562
+ name: "onBehalfOf",
12563
+ type: "address"
12564
+ }
12565
+ ],
12566
+ name: "borrow",
12567
+ outputs: [
12568
+ ],
12569
+ stateMutability: "nonpayable",
12570
+ type: "function"
12571
+ },
12572
+ {
12573
+ inputs: [
12574
+ {
12575
+ internalType: "uint8",
12576
+ name: "id",
12577
+ type: "uint8"
12578
+ },
12579
+ {
12580
+ components: [
12581
+ {
12582
+ internalType: "uint16",
12583
+ name: "ltv",
12584
+ type: "uint16"
12585
+ },
12586
+ {
12587
+ internalType: "uint16",
12588
+ name: "liquidationThreshold",
12589
+ type: "uint16"
12590
+ },
12591
+ {
12592
+ internalType: "uint16",
12593
+ name: "liquidationBonus",
12594
+ type: "uint16"
12595
+ },
12596
+ {
12597
+ internalType: "address",
12598
+ name: "priceSource",
12599
+ type: "address"
12600
+ },
12601
+ {
12602
+ internalType: "string",
12603
+ name: "label",
12604
+ type: "string"
12605
+ }
12606
+ ],
12607
+ internalType: "struct DataTypes.EModeCategory",
12608
+ name: "category",
12609
+ type: "tuple"
12610
+ }
12611
+ ],
12612
+ name: "configureEModeCategory",
12613
+ outputs: [
12614
+ ],
12615
+ stateMutability: "nonpayable",
12616
+ type: "function"
12617
+ },
12618
+ {
12619
+ inputs: [
12620
+ {
12621
+ internalType: "address",
12622
+ name: "asset",
12623
+ type: "address"
12624
+ },
12625
+ {
12626
+ internalType: "uint256",
12627
+ name: "amount",
12628
+ type: "uint256"
12629
+ },
12630
+ {
12631
+ internalType: "address",
12632
+ name: "onBehalfOf",
12633
+ type: "address"
12634
+ },
12635
+ {
12636
+ internalType: "uint16",
12637
+ name: "referralCode",
12638
+ type: "uint16"
12639
+ }
12640
+ ],
12641
+ name: "deposit",
12642
+ outputs: [
12643
+ ],
12644
+ stateMutability: "nonpayable",
12645
+ type: "function"
12646
+ },
12647
+ {
12648
+ inputs: [
12649
+ {
12650
+ internalType: "address",
12651
+ name: "asset",
12652
+ type: "address"
12653
+ }
12654
+ ],
12655
+ name: "dropReserve",
12656
+ outputs: [
12657
+ ],
12658
+ stateMutability: "nonpayable",
12659
+ type: "function"
12660
+ },
12661
+ {
12662
+ inputs: [
12663
+ {
12664
+ internalType: "address",
12665
+ name: "asset",
12666
+ type: "address"
12667
+ },
12668
+ {
12669
+ internalType: "address",
12670
+ name: "from",
12671
+ type: "address"
12672
+ },
12673
+ {
12674
+ internalType: "address",
12675
+ name: "to",
12676
+ type: "address"
12677
+ },
12678
+ {
12679
+ internalType: "uint256",
12680
+ name: "amount",
12681
+ type: "uint256"
12682
+ },
12683
+ {
12684
+ internalType: "uint256",
12685
+ name: "balanceFromBefore",
12686
+ type: "uint256"
12687
+ },
12688
+ {
12689
+ internalType: "uint256",
12690
+ name: "balanceToBefore",
12691
+ type: "uint256"
12692
+ }
12693
+ ],
12694
+ name: "finalizeTransfer",
12695
+ outputs: [
12696
+ ],
12697
+ stateMutability: "nonpayable",
12698
+ type: "function"
12699
+ },
12700
+ {
12701
+ inputs: [
12702
+ {
12703
+ internalType: "address",
12704
+ name: "receiverAddress",
12705
+ type: "address"
12706
+ },
12707
+ {
12708
+ internalType: "address[]",
12709
+ name: "assets",
12710
+ type: "address[]"
12711
+ },
12712
+ {
12713
+ internalType: "uint256[]",
12714
+ name: "amounts",
12715
+ type: "uint256[]"
12716
+ },
12717
+ {
12718
+ internalType: "uint256[]",
12719
+ name: "interestRateModes",
12720
+ type: "uint256[]"
12721
+ },
12722
+ {
12723
+ internalType: "address",
12724
+ name: "onBehalfOf",
12725
+ type: "address"
12726
+ },
12727
+ {
12728
+ internalType: "bytes",
12729
+ name: "params",
12730
+ type: "bytes"
12731
+ },
12732
+ {
12733
+ internalType: "uint16",
12734
+ name: "referralCode",
12735
+ type: "uint16"
12736
+ }
12737
+ ],
12738
+ name: "flashLoan",
12739
+ outputs: [
12740
+ ],
12741
+ stateMutability: "nonpayable",
12742
+ type: "function"
12743
+ },
12744
+ {
12745
+ inputs: [
12746
+ {
12747
+ internalType: "address",
12748
+ name: "receiverAddress",
12749
+ type: "address"
12750
+ },
12751
+ {
12752
+ internalType: "address",
12753
+ name: "asset",
12754
+ type: "address"
12755
+ },
12756
+ {
12757
+ internalType: "uint256",
12758
+ name: "amount",
12759
+ type: "uint256"
12760
+ },
12761
+ {
12762
+ internalType: "bytes",
12763
+ name: "params",
12764
+ type: "bytes"
12765
+ },
12766
+ {
12767
+ internalType: "uint16",
12768
+ name: "referralCode",
12769
+ type: "uint16"
12770
+ }
12771
+ ],
12772
+ name: "flashLoanSimple",
12773
+ outputs: [
12774
+ ],
12775
+ stateMutability: "nonpayable",
12776
+ type: "function"
12777
+ },
12778
+ {
12779
+ inputs: [
12780
+ {
12781
+ internalType: "address",
12782
+ name: "asset",
12783
+ type: "address"
12784
+ }
12785
+ ],
12786
+ name: "getConfiguration",
12787
+ outputs: [
12788
+ {
12789
+ components: [
12790
+ {
12791
+ internalType: "uint256",
12792
+ name: "data",
12793
+ type: "uint256"
12794
+ }
12795
+ ],
12796
+ internalType: "struct DataTypes.ReserveConfigurationMap",
12797
+ name: "",
12798
+ type: "tuple"
12799
+ }
12800
+ ],
12801
+ stateMutability: "view",
12802
+ type: "function"
12803
+ },
12804
+ {
12805
+ inputs: [
12806
+ {
12807
+ internalType: "uint8",
12808
+ name: "id",
12809
+ type: "uint8"
12810
+ }
12811
+ ],
12812
+ name: "getEModeCategoryData",
12813
+ outputs: [
12814
+ {
12815
+ components: [
12816
+ {
12817
+ internalType: "uint16",
12818
+ name: "ltv",
12819
+ type: "uint16"
12820
+ },
12821
+ {
12822
+ internalType: "uint16",
12823
+ name: "liquidationThreshold",
12824
+ type: "uint16"
12825
+ },
12826
+ {
12827
+ internalType: "uint16",
12828
+ name: "liquidationBonus",
12829
+ type: "uint16"
12830
+ },
12831
+ {
12832
+ internalType: "address",
12833
+ name: "priceSource",
12834
+ type: "address"
12835
+ },
12836
+ {
12837
+ internalType: "string",
12838
+ name: "label",
12839
+ type: "string"
12840
+ }
12841
+ ],
12842
+ internalType: "struct DataTypes.EModeCategory",
12843
+ name: "",
12844
+ type: "tuple"
12845
+ }
12846
+ ],
12847
+ stateMutability: "view",
12848
+ type: "function"
12849
+ },
12850
+ {
12851
+ inputs: [
12852
+ {
12853
+ internalType: "uint16",
12854
+ name: "id",
12855
+ type: "uint16"
12856
+ }
12857
+ ],
12858
+ name: "getReserveAddressById",
12859
+ outputs: [
12860
+ {
12861
+ internalType: "address",
12862
+ name: "",
12863
+ type: "address"
12864
+ }
12865
+ ],
12866
+ stateMutability: "view",
12867
+ type: "function"
12868
+ },
12869
+ {
12870
+ inputs: [
12871
+ {
12872
+ internalType: "address",
12873
+ name: "asset",
12874
+ type: "address"
12875
+ }
12876
+ ],
12877
+ name: "getReserveData",
12878
+ outputs: [
12879
+ {
12880
+ components: [
12881
+ {
12882
+ components: [
12883
+ {
12884
+ internalType: "uint256",
12885
+ name: "data",
12886
+ type: "uint256"
12887
+ }
12888
+ ],
12889
+ internalType: "struct DataTypes.ReserveConfigurationMap",
12890
+ name: "configuration",
12891
+ type: "tuple"
12892
+ },
12893
+ {
12894
+ internalType: "uint128",
12895
+ name: "liquidityIndex",
12896
+ type: "uint128"
12897
+ },
12898
+ {
12899
+ internalType: "uint128",
12900
+ name: "currentLiquidityRate",
12901
+ type: "uint128"
12902
+ },
12903
+ {
12904
+ internalType: "uint128",
12905
+ name: "variableBorrowIndex",
12906
+ type: "uint128"
12907
+ },
12908
+ {
12909
+ internalType: "uint128",
12910
+ name: "currentVariableBorrowRate",
12911
+ type: "uint128"
12912
+ },
12913
+ {
12914
+ internalType: "uint128",
12915
+ name: "currentStableBorrowRate",
12916
+ type: "uint128"
12917
+ },
12918
+ {
12919
+ internalType: "uint40",
12920
+ name: "lastUpdateTimestamp",
12921
+ type: "uint40"
12922
+ },
12923
+ {
12924
+ internalType: "uint16",
12925
+ name: "id",
12926
+ type: "uint16"
12927
+ },
12928
+ {
12929
+ internalType: "address",
12930
+ name: "aTokenAddress",
12931
+ type: "address"
12932
+ },
12933
+ {
12934
+ internalType: "address",
12935
+ name: "stableDebtTokenAddress",
12936
+ type: "address"
12937
+ },
12938
+ {
12939
+ internalType: "address",
12940
+ name: "variableDebtTokenAddress",
12941
+ type: "address"
12942
+ },
12943
+ {
12944
+ internalType: "address",
12945
+ name: "interestRateStrategyAddress",
12946
+ type: "address"
12947
+ },
12948
+ {
12949
+ internalType: "uint128",
12950
+ name: "accruedToTreasury",
12951
+ type: "uint128"
12952
+ },
12953
+ {
12954
+ internalType: "uint128",
12955
+ name: "unbacked",
12956
+ type: "uint128"
12957
+ },
12958
+ {
12959
+ internalType: "uint128",
12960
+ name: "isolationModeTotalDebt",
12961
+ type: "uint128"
12962
+ }
12963
+ ],
12964
+ internalType: "struct DataTypes.ReserveData",
12965
+ name: "",
12966
+ type: "tuple"
12967
+ }
12968
+ ],
12969
+ stateMutability: "view",
12970
+ type: "function"
12971
+ },
12972
+ {
12973
+ inputs: [
12974
+ {
12975
+ internalType: "address",
12976
+ name: "asset",
12977
+ type: "address"
12978
+ }
12979
+ ],
12980
+ name: "getReserveNormalizedIncome",
12981
+ outputs: [
12982
+ {
12983
+ internalType: "uint256",
12984
+ name: "",
12985
+ type: "uint256"
12986
+ }
12987
+ ],
12988
+ stateMutability: "view",
12989
+ type: "function"
12990
+ },
12991
+ {
12992
+ inputs: [
12993
+ {
12994
+ internalType: "address",
12995
+ name: "asset",
12996
+ type: "address"
12997
+ }
12998
+ ],
12999
+ name: "getReserveNormalizedVariableDebt",
13000
+ outputs: [
13001
+ {
13002
+ internalType: "uint256",
13003
+ name: "",
13004
+ type: "uint256"
13005
+ }
13006
+ ],
13007
+ stateMutability: "view",
13008
+ type: "function"
13009
+ },
13010
+ {
13011
+ inputs: [
13012
+ ],
13013
+ name: "getReservesList",
13014
+ outputs: [
13015
+ {
13016
+ internalType: "address[]",
13017
+ name: "",
13018
+ type: "address[]"
13019
+ }
13020
+ ],
13021
+ stateMutability: "view",
13022
+ type: "function"
13023
+ },
13024
+ {
13025
+ inputs: [
13026
+ {
13027
+ internalType: "address",
13028
+ name: "user",
13029
+ type: "address"
13030
+ }
13031
+ ],
13032
+ name: "getUserAccountData",
13033
+ outputs: [
13034
+ {
13035
+ internalType: "uint256",
13036
+ name: "totalCollateralBase",
13037
+ type: "uint256"
13038
+ },
13039
+ {
13040
+ internalType: "uint256",
13041
+ name: "totalDebtBase",
13042
+ type: "uint256"
13043
+ },
13044
+ {
13045
+ internalType: "uint256",
13046
+ name: "availableBorrowsBase",
13047
+ type: "uint256"
13048
+ },
13049
+ {
13050
+ internalType: "uint256",
13051
+ name: "currentLiquidationThreshold",
13052
+ type: "uint256"
13053
+ },
13054
+ {
13055
+ internalType: "uint256",
13056
+ name: "ltv",
13057
+ type: "uint256"
13058
+ },
13059
+ {
13060
+ internalType: "uint256",
13061
+ name: "healthFactor",
13062
+ type: "uint256"
13063
+ }
13064
+ ],
13065
+ stateMutability: "view",
13066
+ type: "function"
13067
+ },
13068
+ {
13069
+ inputs: [
13070
+ {
13071
+ internalType: "address",
13072
+ name: "user",
13073
+ type: "address"
13074
+ }
13075
+ ],
13076
+ name: "getUserConfiguration",
13077
+ outputs: [
13078
+ {
13079
+ components: [
13080
+ {
13081
+ internalType: "uint256",
13082
+ name: "data",
13083
+ type: "uint256"
13084
+ }
13085
+ ],
13086
+ internalType: "struct DataTypes.UserConfigurationMap",
13087
+ name: "",
13088
+ type: "tuple"
13089
+ }
13090
+ ],
13091
+ stateMutability: "view",
13092
+ type: "function"
13093
+ },
13094
+ {
13095
+ inputs: [
13096
+ {
13097
+ internalType: "address",
13098
+ name: "user",
13099
+ type: "address"
13100
+ }
13101
+ ],
13102
+ name: "getUserEMode",
13103
+ outputs: [
13104
+ {
13105
+ internalType: "uint256",
13106
+ name: "",
13107
+ type: "uint256"
13108
+ }
13109
+ ],
13110
+ stateMutability: "view",
13111
+ type: "function"
13112
+ },
13113
+ {
13114
+ inputs: [
13115
+ {
13116
+ internalType: "address",
13117
+ name: "asset",
13118
+ type: "address"
13119
+ },
13120
+ {
13121
+ internalType: "address",
13122
+ name: "aTokenAddress",
13123
+ type: "address"
13124
+ },
13125
+ {
13126
+ internalType: "address",
13127
+ name: "stableDebtAddress",
13128
+ type: "address"
13129
+ },
13130
+ {
13131
+ internalType: "address",
13132
+ name: "variableDebtAddress",
13133
+ type: "address"
13134
+ },
13135
+ {
13136
+ internalType: "address",
13137
+ name: "interestRateStrategyAddress",
13138
+ type: "address"
13139
+ }
13140
+ ],
13141
+ name: "initReserve",
13142
+ outputs: [
13143
+ ],
13144
+ stateMutability: "nonpayable",
13145
+ type: "function"
13146
+ },
13147
+ {
13148
+ inputs: [
13149
+ {
13150
+ internalType: "contract IPoolAddressesProvider",
13151
+ name: "provider",
13152
+ type: "address"
13153
+ }
13154
+ ],
13155
+ name: "initialize",
13156
+ outputs: [
13157
+ ],
13158
+ stateMutability: "nonpayable",
13159
+ type: "function"
13160
+ },
13161
+ {
13162
+ inputs: [
13163
+ {
13164
+ internalType: "address",
13165
+ name: "collateralAsset",
13166
+ type: "address"
13167
+ },
13168
+ {
13169
+ internalType: "address",
13170
+ name: "debtAsset",
13171
+ type: "address"
13172
+ },
13173
+ {
13174
+ internalType: "address",
13175
+ name: "user",
13176
+ type: "address"
13177
+ },
13178
+ {
13179
+ internalType: "uint256",
13180
+ name: "debtToCover",
13181
+ type: "uint256"
13182
+ },
13183
+ {
13184
+ internalType: "bool",
13185
+ name: "receiveAToken",
13186
+ type: "bool"
13187
+ }
13188
+ ],
13189
+ name: "liquidationCall",
13190
+ outputs: [
13191
+ ],
13192
+ stateMutability: "nonpayable",
13193
+ type: "function"
13194
+ },
13195
+ {
13196
+ inputs: [
13197
+ {
13198
+ internalType: "address[]",
13199
+ name: "assets",
13200
+ type: "address[]"
13201
+ }
13202
+ ],
13203
+ name: "mintToTreasury",
13204
+ outputs: [
13205
+ ],
13206
+ stateMutability: "nonpayable",
13207
+ type: "function"
13208
+ },
13209
+ {
13210
+ inputs: [
13211
+ {
13212
+ internalType: "address",
13213
+ name: "asset",
13214
+ type: "address"
13215
+ },
13216
+ {
13217
+ internalType: "uint256",
13218
+ name: "amount",
13219
+ type: "uint256"
13220
+ },
13221
+ {
13222
+ internalType: "address",
13223
+ name: "onBehalfOf",
13224
+ type: "address"
13225
+ },
13226
+ {
13227
+ internalType: "uint16",
13228
+ name: "referralCode",
13229
+ type: "uint16"
13230
+ }
13231
+ ],
13232
+ name: "mintUnbacked",
13233
+ outputs: [
13234
+ ],
13235
+ stateMutability: "nonpayable",
13236
+ type: "function"
13237
+ },
13238
+ {
13239
+ inputs: [
13240
+ {
13241
+ internalType: "address",
13242
+ name: "asset",
13243
+ type: "address"
13244
+ },
13245
+ {
13246
+ internalType: "address",
13247
+ name: "user",
13248
+ type: "address"
13249
+ }
13250
+ ],
13251
+ name: "rebalanceStableBorrowRate",
13252
+ outputs: [
13253
+ ],
13254
+ stateMutability: "nonpayable",
13255
+ type: "function"
13256
+ },
13257
+ {
13258
+ inputs: [
13259
+ {
13260
+ internalType: "address",
13261
+ name: "asset",
13262
+ type: "address"
13263
+ },
13264
+ {
13265
+ internalType: "uint256",
13266
+ name: "amount",
13267
+ type: "uint256"
13268
+ },
13269
+ {
13270
+ internalType: "uint256",
13271
+ name: "interestRateMode",
13272
+ type: "uint256"
13273
+ },
13274
+ {
13275
+ internalType: "address",
13276
+ name: "onBehalfOf",
13277
+ type: "address"
13278
+ }
13279
+ ],
13280
+ name: "repay",
13281
+ outputs: [
13282
+ {
13283
+ internalType: "uint256",
13284
+ name: "",
13285
+ type: "uint256"
13286
+ }
13287
+ ],
13288
+ stateMutability: "nonpayable",
13289
+ type: "function"
13290
+ },
13291
+ {
13292
+ inputs: [
13293
+ {
13294
+ internalType: "address",
13295
+ name: "asset",
13296
+ type: "address"
13297
+ },
13298
+ {
13299
+ internalType: "uint256",
13300
+ name: "amount",
13301
+ type: "uint256"
13302
+ },
13303
+ {
13304
+ internalType: "uint256",
13305
+ name: "interestRateMode",
13306
+ type: "uint256"
13307
+ }
13308
+ ],
13309
+ name: "repayWithATokens",
13310
+ outputs: [
13311
+ {
13312
+ internalType: "uint256",
13313
+ name: "",
13314
+ type: "uint256"
13315
+ }
13316
+ ],
13317
+ stateMutability: "nonpayable",
13318
+ type: "function"
13319
+ },
13320
+ {
13321
+ inputs: [
13322
+ {
13323
+ internalType: "address",
13324
+ name: "asset",
13325
+ type: "address"
13326
+ },
13327
+ {
13328
+ internalType: "uint256",
13329
+ name: "amount",
13330
+ type: "uint256"
13331
+ },
13332
+ {
13333
+ internalType: "uint256",
13334
+ name: "interestRateMode",
13335
+ type: "uint256"
13336
+ },
13337
+ {
13338
+ internalType: "address",
13339
+ name: "onBehalfOf",
13340
+ type: "address"
13341
+ },
13342
+ {
13343
+ internalType: "uint256",
13344
+ name: "deadline",
13345
+ type: "uint256"
13346
+ },
13347
+ {
13348
+ internalType: "uint8",
13349
+ name: "permitV",
13350
+ type: "uint8"
13351
+ },
13352
+ {
13353
+ internalType: "bytes32",
13354
+ name: "permitR",
13355
+ type: "bytes32"
13356
+ },
13357
+ {
13358
+ internalType: "bytes32",
13359
+ name: "permitS",
13360
+ type: "bytes32"
13361
+ }
13362
+ ],
13363
+ name: "repayWithPermit",
13364
+ outputs: [
13365
+ {
13366
+ internalType: "uint256",
13367
+ name: "",
13368
+ type: "uint256"
13369
+ }
13370
+ ],
13371
+ stateMutability: "nonpayable",
13372
+ type: "function"
13373
+ },
13374
+ {
13375
+ inputs: [
13376
+ {
13377
+ internalType: "address",
13378
+ name: "token",
13379
+ type: "address"
13380
+ },
13381
+ {
13382
+ internalType: "address",
13383
+ name: "to",
13384
+ type: "address"
13385
+ },
13386
+ {
13387
+ internalType: "uint256",
13388
+ name: "amount",
13389
+ type: "uint256"
13390
+ }
13391
+ ],
13392
+ name: "rescueTokens",
13393
+ outputs: [
13394
+ ],
13395
+ stateMutability: "nonpayable",
13396
+ type: "function"
13397
+ },
13398
+ {
13399
+ inputs: [
13400
+ {
13401
+ internalType: "address",
13402
+ name: "asset",
13403
+ type: "address"
13404
+ }
13405
+ ],
13406
+ name: "resetIsolationModeTotalDebt",
13407
+ outputs: [
13408
+ ],
13409
+ stateMutability: "nonpayable",
13410
+ type: "function"
13411
+ },
13412
+ {
13413
+ inputs: [
13414
+ {
13415
+ internalType: "address",
13416
+ name: "asset",
13417
+ type: "address"
13418
+ },
13419
+ {
13420
+ components: [
13421
+ {
13422
+ internalType: "uint256",
13423
+ name: "data",
13424
+ type: "uint256"
13425
+ }
13426
+ ],
13427
+ internalType: "struct DataTypes.ReserveConfigurationMap",
13428
+ name: "configuration",
13429
+ type: "tuple"
13430
+ }
13431
+ ],
13432
+ name: "setConfiguration",
13433
+ outputs: [
13434
+ ],
13435
+ stateMutability: "nonpayable",
13436
+ type: "function"
13437
+ },
13438
+ {
13439
+ inputs: [
13440
+ {
13441
+ internalType: "address",
13442
+ name: "asset",
13443
+ type: "address"
13444
+ },
13445
+ {
13446
+ internalType: "address",
13447
+ name: "rateStrategyAddress",
13448
+ type: "address"
13449
+ }
13450
+ ],
13451
+ name: "setReserveInterestRateStrategyAddress",
13452
+ outputs: [
13453
+ ],
13454
+ stateMutability: "nonpayable",
13455
+ type: "function"
13456
+ },
13457
+ {
13458
+ inputs: [
13459
+ {
13460
+ internalType: "uint8",
13461
+ name: "categoryId",
13462
+ type: "uint8"
13463
+ }
13464
+ ],
13465
+ name: "setUserEMode",
13466
+ outputs: [
13467
+ ],
13468
+ stateMutability: "nonpayable",
13469
+ type: "function"
13470
+ },
13471
+ {
13472
+ inputs: [
13473
+ {
13474
+ internalType: "address",
13475
+ name: "asset",
13476
+ type: "address"
13477
+ },
13478
+ {
13479
+ internalType: "bool",
13480
+ name: "useAsCollateral",
13481
+ type: "bool"
13482
+ }
13483
+ ],
13484
+ name: "setUserUseReserveAsCollateral",
13485
+ outputs: [
13486
+ ],
13487
+ stateMutability: "nonpayable",
13488
+ type: "function"
13489
+ },
13490
+ {
13491
+ inputs: [
13492
+ {
13493
+ internalType: "address",
13494
+ name: "asset",
13495
+ type: "address"
13496
+ },
13497
+ {
13498
+ internalType: "uint256",
13499
+ name: "amount",
13500
+ type: "uint256"
13501
+ },
13502
+ {
13503
+ internalType: "address",
13504
+ name: "onBehalfOf",
13505
+ type: "address"
13506
+ },
13507
+ {
13508
+ internalType: "uint16",
13509
+ name: "referralCode",
13510
+ type: "uint16"
13511
+ }
13512
+ ],
13513
+ name: "supply",
13514
+ outputs: [
13515
+ ],
13516
+ stateMutability: "nonpayable",
13517
+ type: "function"
13518
+ },
13519
+ {
13520
+ inputs: [
13521
+ {
13522
+ internalType: "address",
13523
+ name: "asset",
13524
+ type: "address"
13525
+ },
13526
+ {
13527
+ internalType: "uint256",
13528
+ name: "amount",
13529
+ type: "uint256"
13530
+ },
13531
+ {
13532
+ internalType: "address",
13533
+ name: "onBehalfOf",
13534
+ type: "address"
13535
+ },
13536
+ {
13537
+ internalType: "uint16",
13538
+ name: "referralCode",
13539
+ type: "uint16"
13540
+ },
13541
+ {
13542
+ internalType: "uint256",
13543
+ name: "deadline",
13544
+ type: "uint256"
13545
+ },
13546
+ {
13547
+ internalType: "uint8",
13548
+ name: "permitV",
13549
+ type: "uint8"
13550
+ },
13551
+ {
13552
+ internalType: "bytes32",
13553
+ name: "permitR",
13554
+ type: "bytes32"
13555
+ },
13556
+ {
13557
+ internalType: "bytes32",
13558
+ name: "permitS",
13559
+ type: "bytes32"
13560
+ }
13561
+ ],
13562
+ name: "supplyWithPermit",
13563
+ outputs: [
13564
+ ],
13565
+ stateMutability: "nonpayable",
13566
+ type: "function"
13567
+ },
13568
+ {
13569
+ inputs: [
13570
+ {
13571
+ internalType: "address",
13572
+ name: "asset",
13573
+ type: "address"
13574
+ },
13575
+ {
13576
+ internalType: "uint256",
13577
+ name: "interestRateMode",
13578
+ type: "uint256"
13579
+ }
13580
+ ],
13581
+ name: "swapBorrowRateMode",
13582
+ outputs: [
13583
+ ],
13584
+ stateMutability: "nonpayable",
13585
+ type: "function"
13586
+ },
13587
+ {
13588
+ inputs: [
13589
+ {
13590
+ internalType: "uint256",
13591
+ name: "protocolFee",
13592
+ type: "uint256"
13593
+ }
13594
+ ],
13595
+ name: "updateBridgeProtocolFee",
13596
+ outputs: [
13597
+ ],
13598
+ stateMutability: "nonpayable",
13599
+ type: "function"
13600
+ },
13601
+ {
13602
+ inputs: [
13603
+ {
13604
+ internalType: "uint128",
13605
+ name: "flashLoanPremiumTotal",
13606
+ type: "uint128"
13607
+ },
13608
+ {
13609
+ internalType: "uint128",
13610
+ name: "flashLoanPremiumToProtocol",
13611
+ type: "uint128"
13612
+ }
13613
+ ],
13614
+ name: "updateFlashloanPremiums",
13615
+ outputs: [
13616
+ ],
13617
+ stateMutability: "nonpayable",
13618
+ type: "function"
13619
+ },
13620
+ {
13621
+ inputs: [
13622
+ {
13623
+ internalType: "address",
13624
+ name: "asset",
13625
+ type: "address"
13626
+ },
13627
+ {
13628
+ internalType: "uint256",
13629
+ name: "amount",
13630
+ type: "uint256"
13631
+ },
13632
+ {
13633
+ internalType: "address",
13634
+ name: "to",
13635
+ type: "address"
13636
+ }
13637
+ ],
13638
+ name: "withdraw",
13639
+ outputs: [
13640
+ {
13641
+ internalType: "uint256",
13642
+ name: "",
13643
+ type: "uint256"
13644
+ }
13645
+ ],
13646
+ stateMutability: "nonpayable",
13647
+ type: "function"
13648
+ }
13649
+ ];
13650
+ var ILendingPoolV3 = {
13651
+ abi: abi$k
13652
+ };
13653
+
13654
+ function getAaveAssetsForUnderlying(_x, _x2, _x3) {
13655
+ return _getAaveAssetsForUnderlying.apply(this, arguments);
13656
+ }
13657
+
13658
+ function _getAaveAssetsForUnderlying() {
13659
+ _getAaveAssetsForUnderlying = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, dapp, assets) {
13660
+ var iLendingPool, lendingPool, reserveData, aTokens, debtTokens;
13661
+ return runtime_1.wrap(function _callee$(_context) {
13662
+ while (1) {
13663
+ switch (_context.prev = _context.next) {
13664
+ case 0:
13665
+ iLendingPool = dapp === exports.Dapp.AAVEV3 ? ILendingPoolV3 : ILendingPool;
13666
+ lendingPool = new ethers.ethers.Contract(routerAddress[pool.network][dapp], iLendingPool.abi, pool.signer);
13667
+ _context.next = 4;
13668
+ return Promise.all(assets.map(function (e) {
13669
+ return lendingPool.getReserveData(e);
13670
+ }));
13671
+
13672
+ case 4:
13673
+ reserveData = _context.sent;
13674
+ aTokens = reserveData.map(function (e) {
13675
+ return e.aTokenAddress;
13676
+ });
13677
+ debtTokens = reserveData.map(function (e) {
13678
+ return e.variableDebtTokenAddress;
13679
+ });
13680
+ return _context.abrupt("return", aTokens.concat(debtTokens));
13681
+
13682
+ case 8:
13683
+ case "end":
13684
+ return _context.stop();
13685
+ }
13686
+ }
13687
+ }, _callee);
13688
+ }));
13689
+ return _getAaveAssetsForUnderlying.apply(this, arguments);
13690
+ }
13691
+
13692
+ function getAaveV3ClaimTxData(_x, _x2, _x3) {
13693
+ return _getAaveV3ClaimTxData.apply(this, arguments);
13694
+ }
13695
+
13696
+ function _getAaveV3ClaimTxData() {
13697
+ _getAaveV3ClaimTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, assets, rewardAsset) {
13698
+ var iAaveIncentives, aaveAsset, claimTxData;
13699
+ return runtime_1.wrap(function _callee$(_context) {
13700
+ while (1) {
13701
+ switch (_context.prev = _context.next) {
13702
+ case 0:
13703
+ iAaveIncentives = new ethers.ethers.utils.Interface(IAaveV3Incentives.abi);
13704
+ _context.next = 3;
13705
+ return getAaveAssetsForUnderlying(pool, exports.Dapp.AAVEV3, assets);
13706
+
13707
+ case 3:
13708
+ aaveAsset = _context.sent;
13709
+ claimTxData = iAaveIncentives.encodeFunctionData("claimRewards", [aaveAsset, ethers.ethers.constants.MaxUint256, pool.address, rewardAsset]);
13710
+ return _context.abrupt("return", claimTxData);
13711
+
13712
+ case 6:
13713
+ case "end":
13714
+ return _context.stop();
13715
+ }
13716
+ }
13717
+ }, _callee);
13718
+ }));
13719
+ return _getAaveV3ClaimTxData.apply(this, arguments);
13720
+ }
13721
+
9326
13722
  var Pool = /*#__PURE__*/function () {
9327
13723
  function Pool(network, signer, poolLogic, mangerLogic, utils, factory) {
9328
13724
  this.network = network;
@@ -9712,7 +14108,7 @@ var Pool = /*#__PURE__*/function () {
9712
14108
  /*#__PURE__*/
9713
14109
  function () {
9714
14110
  var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(dapp, assetFrom, assetTo, amountIn, slippage, options) {
9715
- var swapTxData, chainId, apiUrl, response, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
14111
+ var swapTxData, chainId, protocols, apiUrl, response, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
9716
14112
  return runtime_1.wrap(function _callee9$(_context9) {
9717
14113
  while (1) {
9718
14114
  switch (_context9.prev = _context9.next) {
@@ -9725,73 +14121,73 @@ var Pool = /*#__PURE__*/function () {
9725
14121
  options = null;
9726
14122
  }
9727
14123
 
9728
- if (!(dapp === exports.Dapp.ONEINCH)) {
9729
- _context9.next = 11;
9730
- break;
9731
- }
14124
+ _context9.t0 = dapp;
14125
+ _context9.next = _context9.t0 === exports.Dapp.ONEINCH ? 5 : _context9.t0 === exports.Dapp.BALANCER ? 15 : _context9.t0 === exports.Dapp.SYNTHETIX ? 19 : _context9.t0 === exports.Dapp.TOROS ? 26 : 30;
14126
+ break;
9732
14127
 
14128
+ case 5:
9733
14129
  chainId = networkChainIdMap[this.network];
9734
- apiUrl = "https://api.1inch.exchange/v4.0/" + chainId + "/swap?fromTokenAddress=" + assetFrom + "&toTokenAddress=" + assetTo + "&amount=" + amountIn.toString() + "&fromAddress=" + this.address + "&destReceiver=" + this.address + "&slippage=" + slippage.toString() + "&disableEstimate=true";
9735
- _context9.next = 7;
14130
+ _context9.next = 8;
14131
+ return getOneInchProtocols(chainId);
14132
+
14133
+ case 8:
14134
+ protocols = _context9.sent;
14135
+ apiUrl = "https://api.1inch.exchange/v4.0/" + chainId + "/swap?fromTokenAddress=" + assetFrom + "&toTokenAddress=" + assetTo + "&amount=" + amountIn.toString() + "&fromAddress=" + this.address + "&destReceiver=" + this.address + "&slippage=" + slippage.toString() + "&disableEstimate=true" + protocols;
14136
+ _context9.next = 12;
9736
14137
  return axios.get(apiUrl);
9737
14138
 
9738
- case 7:
14139
+ case 12:
9739
14140
  response = _context9.sent;
9740
14141
  swapTxData = response.data.tx.data;
9741
- _context9.next = 31;
9742
- break;
9743
-
9744
- case 11:
9745
- if (!(dapp === exports.Dapp.BALANCER)) {
9746
- _context9.next = 17;
9747
- break;
9748
- }
14142
+ return _context9.abrupt("break", 35);
9749
14143
 
9750
- _context9.next = 14;
14144
+ case 15:
14145
+ _context9.next = 17;
9751
14146
  return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
9752
14147
 
9753
- case 14:
9754
- swapTxData = _context9.sent;
9755
- _context9.next = 31;
9756
- break;
9757
-
9758
14148
  case 17:
9759
- if (!(dapp === exports.Dapp.SYNTHETIX)) {
9760
- _context9.next = 26;
9761
- break;
9762
- }
14149
+ swapTxData = _context9.sent;
14150
+ return _context9.abrupt("break", 35);
9763
14151
 
14152
+ case 19:
9764
14153
  iSynthetix = new ethers.ethers.utils.Interface(ISynthetix.abi);
9765
14154
  assets = [assetFrom, assetTo].map(function (asset) {
9766
14155
  return ethers.ethers.utils.formatBytes32String(asset);
9767
14156
  });
9768
- _context9.next = 22;
14157
+ _context9.next = 23;
9769
14158
  return this.factory.owner();
9770
14159
 
9771
- case 22:
14160
+ case 23:
9772
14161
  daoAddress = _context9.sent;
9773
14162
  swapTxData = iSynthetix.encodeFunctionData(exports.Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
9774
- _context9.next = 31;
9775
- break;
14163
+ return _context9.abrupt("break", 35);
9776
14164
 
9777
14165
  case 26:
14166
+ _context9.next = 28;
14167
+ return getEasySwapperTxData(this, assetFrom, assetTo, ethers.ethers.BigNumber.from(amountIn), slippage);
14168
+
14169
+ case 28:
14170
+ swapTxData = _context9.sent;
14171
+ return _context9.abrupt("break", 35);
14172
+
14173
+ case 30:
9778
14174
  iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
9779
- _context9.next = 29;
14175
+ _context9.next = 33;
9780
14176
  return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
9781
14177
 
9782
- case 29:
14178
+ case 33:
9783
14179
  minAmountOut = _context9.sent;
9784
14180
  swapTxData = iUniswapV2Router.encodeFunctionData(exports.Transaction.SWAP, [amountIn, minAmountOut, [assetFrom, assetTo], this.address, deadline]);
9785
14181
 
9786
- case 31:
9787
- _context9.next = 33;
14182
+ case 35:
14183
+ _context9.next = 37;
9788
14184
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], swapTxData, options);
9789
14185
 
9790
- case 33:
14186
+ case 37:
9791
14187
  tx = _context9.sent;
9792
14188
  return _context9.abrupt("return", tx);
9793
14189
 
9794
- case 35:
14190
+ case 39:
9795
14191
  case "end":
9796
14192
  return _context9.stop();
9797
14193
  }
@@ -10641,6 +15037,54 @@ var Pool = /*#__PURE__*/function () {
10641
15037
 
10642
15038
  return harvestAaveRewards;
10643
15039
  }()
15040
+ /**
15041
+ * Claim rewards from Aave platform
15042
+ * @param {string[]} assets Assets invested in Aave
15043
+ * @param {string} rewardAssets Reward token address
15044
+ * @param {any} options Transaction options
15045
+ * @returns {Promise<any>} Transaction
15046
+ */
15047
+ ;
15048
+
15049
+ _proto.harvestAaveV3Rewards =
15050
+ /*#__PURE__*/
15051
+ function () {
15052
+ var _harvestAaveV3Rewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee27(assets, rewardAsset, options) {
15053
+ var claimTxData, tx;
15054
+ return runtime_1.wrap(function _callee27$(_context27) {
15055
+ while (1) {
15056
+ switch (_context27.prev = _context27.next) {
15057
+ case 0:
15058
+ if (options === void 0) {
15059
+ options = null;
15060
+ }
15061
+
15062
+ _context27.next = 3;
15063
+ return getAaveV3ClaimTxData(this, assets, rewardAsset);
15064
+
15065
+ case 3:
15066
+ claimTxData = _context27.sent;
15067
+ _context27.next = 6;
15068
+ return this.poolLogic.execTransaction(stakingAddress[this.network][exports.Dapp.AAVEV3], claimTxData, options);
15069
+
15070
+ case 6:
15071
+ tx = _context27.sent;
15072
+ return _context27.abrupt("return", tx);
15073
+
15074
+ case 8:
15075
+ case "end":
15076
+ return _context27.stop();
15077
+ }
15078
+ }
15079
+ }, _callee27, this);
15080
+ }));
15081
+
15082
+ function harvestAaveV3Rewards(_x92, _x93, _x94) {
15083
+ return _harvestAaveV3Rewards.apply(this, arguments);
15084
+ }
15085
+
15086
+ return harvestAaveV3Rewards;
15087
+ }()
10644
15088
  /**
10645
15089
  * Create UniswapV3 liquidity pool
10646
15090
  * @param {string} assetA First asset
@@ -10660,18 +15104,18 @@ var Pool = /*#__PURE__*/function () {
10660
15104
  _proto.addLiquidityUniswapV3 =
10661
15105
  /*#__PURE__*/
10662
15106
  function () {
10663
- var _addLiquidityUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee27(assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount, options) {
15107
+ var _addLiquidityUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee28(assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount, options) {
10664
15108
  var iNonfungiblePositionManager, mintTxParams, mintTxData, tx;
10665
- return runtime_1.wrap(function _callee27$(_context27) {
15109
+ return runtime_1.wrap(function _callee28$(_context28) {
10666
15110
  while (1) {
10667
- switch (_context27.prev = _context27.next) {
15111
+ switch (_context28.prev = _context28.next) {
10668
15112
  case 0:
10669
15113
  if (options === void 0) {
10670
15114
  options = null;
10671
15115
  }
10672
15116
 
10673
- if (!((!minPrice || !maxPrice) && (!minTick || !maxTick))) {
10674
- _context27.next = 3;
15117
+ if (!((minPrice === null || maxPrice === null) && (minTick === null || maxTick === null))) {
15118
+ _context28.next = 3;
10675
15119
  break;
10676
15120
  }
10677
15121
 
@@ -10679,28 +15123,28 @@ var Pool = /*#__PURE__*/function () {
10679
15123
 
10680
15124
  case 3:
10681
15125
  iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
10682
- _context27.next = 6;
15126
+ _context28.next = 6;
10683
15127
  return getUniswapV3MintParams(this, assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount);
10684
15128
 
10685
15129
  case 6:
10686
- mintTxParams = _context27.sent;
15130
+ mintTxParams = _context28.sent;
10687
15131
  mintTxData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.MINT, [mintTxParams]);
10688
- _context27.next = 10;
15132
+ _context28.next = 10;
10689
15133
  return this.poolLogic.execTransaction(nonfungiblePositionManagerAddress[this.network], mintTxData, options);
10690
15134
 
10691
15135
  case 10:
10692
- tx = _context27.sent;
10693
- return _context27.abrupt("return", tx);
15136
+ tx = _context28.sent;
15137
+ return _context28.abrupt("return", tx);
10694
15138
 
10695
15139
  case 12:
10696
15140
  case "end":
10697
- return _context27.stop();
15141
+ return _context28.stop();
10698
15142
  }
10699
15143
  }
10700
- }, _callee27, this);
15144
+ }, _callee28, this);
10701
15145
  }));
10702
15146
 
10703
- function addLiquidityUniswapV3(_x92, _x93, _x94, _x95, _x96, _x97, _x98, _x99, _x100, _x101) {
15147
+ function addLiquidityUniswapV3(_x95, _x96, _x97, _x98, _x99, _x100, _x101, _x102, _x103, _x104) {
10704
15148
  return _addLiquidityUniswapV.apply(this, arguments);
10705
15149
  }
10706
15150
 
@@ -10719,12 +15163,12 @@ var Pool = /*#__PURE__*/function () {
10719
15163
  _proto.decreaseLiquidity =
10720
15164
  /*#__PURE__*/
10721
15165
  function () {
10722
- var _decreaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee28(dapp, tokenId, amount, options) {
15166
+ var _decreaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee29(dapp, tokenId, amount, options) {
10723
15167
  var txData, dappAddress, abi, liquidity, decreaseLiquidityTxData, collectTxData, multicallParams, burnTxData, _abi, _liquidity, tx;
10724
15168
 
10725
- return runtime_1.wrap(function _callee28$(_context28) {
15169
+ return runtime_1.wrap(function _callee29$(_context29) {
10726
15170
  while (1) {
10727
- switch (_context28.prev = _context28.next) {
15171
+ switch (_context29.prev = _context29.next) {
10728
15172
  case 0:
10729
15173
  if (amount === void 0) {
10730
15174
  amount = 100;
@@ -10735,17 +15179,17 @@ var Pool = /*#__PURE__*/function () {
10735
15179
  }
10736
15180
 
10737
15181
  if (!(dapp === exports.Dapp.UNISWAPV3)) {
10738
- _context28.next = 15;
15182
+ _context29.next = 15;
10739
15183
  break;
10740
15184
  }
10741
15185
 
10742
15186
  dappAddress = nonfungiblePositionManagerAddress[this.network];
10743
15187
  abi = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
10744
- _context28.next = 7;
15188
+ _context29.next = 7;
10745
15189
  return getUniswapV3Liquidity(tokenId, this);
10746
15190
 
10747
15191
  case 7:
10748
- liquidity = _context28.sent.mul(Math.round(amount * 1e4)).div(1e6);
15192
+ liquidity = _context29.sent.mul(Math.round(amount * 1e4)).div(1e6);
10749
15193
  decreaseLiquidityTxData = abi.encodeFunctionData(exports.Transaction.DECREASE_LIQUIDITY, [[tokenId, liquidity, 0, 0, deadline]]);
10750
15194
  collectTxData = abi.encodeFunctionData(exports.Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
10751
15195
  multicallParams = [decreaseLiquidityTxData, collectTxData];
@@ -10756,46 +15200,46 @@ var Pool = /*#__PURE__*/function () {
10756
15200
  }
10757
15201
 
10758
15202
  txData = abi.encodeFunctionData(exports.Transaction.MULTI_CALL, [multicallParams]);
10759
- _context28.next = 25;
15203
+ _context29.next = 25;
10760
15204
  break;
10761
15205
 
10762
15206
  case 15:
10763
15207
  if (!(dapp === exports.Dapp.ARRAKIS)) {
10764
- _context28.next = 24;
15208
+ _context29.next = 24;
10765
15209
  break;
10766
15210
  }
10767
15211
 
10768
15212
  dappAddress = routerAddress[this.network][dapp];
10769
15213
  _abi = new ethers.ethers.utils.Interface(IArrakisV1RouterStaking.abi);
10770
- _context28.next = 20;
15214
+ _context29.next = 20;
10771
15215
  return this.utils.getBalance(tokenId, this.address);
10772
15216
 
10773
15217
  case 20:
10774
- _liquidity = _context28.sent.mul(Math.round(amount * 1e4)).div(1e6);
15218
+ _liquidity = _context29.sent.mul(Math.round(amount * 1e4)).div(1e6);
10775
15219
  txData = _abi.encodeFunctionData(exports.Transaction.REMOVE_LIQUIDITY_UNSTAKE, [tokenId, _liquidity, 0, 0, this.address]);
10776
- _context28.next = 25;
15220
+ _context29.next = 25;
10777
15221
  break;
10778
15222
 
10779
15223
  case 24:
10780
15224
  throw new Error("dapp not supported");
10781
15225
 
10782
15226
  case 25:
10783
- _context28.next = 27;
15227
+ _context29.next = 27;
10784
15228
  return this.poolLogic.execTransaction(dappAddress, txData, options);
10785
15229
 
10786
15230
  case 27:
10787
- tx = _context28.sent;
10788
- return _context28.abrupt("return", tx);
15231
+ tx = _context29.sent;
15232
+ return _context29.abrupt("return", tx);
10789
15233
 
10790
15234
  case 29:
10791
15235
  case "end":
10792
- return _context28.stop();
15236
+ return _context29.stop();
10793
15237
  }
10794
15238
  }
10795
- }, _callee28, this);
15239
+ }, _callee29, this);
10796
15240
  }));
10797
15241
 
10798
- function decreaseLiquidity(_x102, _x103, _x104, _x105) {
15242
+ function decreaseLiquidity(_x105, _x106, _x107, _x108) {
10799
15243
  return _decreaseLiquidity.apply(this, arguments);
10800
15244
  }
10801
15245
 
@@ -10815,60 +15259,60 @@ var Pool = /*#__PURE__*/function () {
10815
15259
  _proto.increaseLiquidity =
10816
15260
  /*#__PURE__*/
10817
15261
  function () {
10818
- var _increaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee29(dapp, tokenId, amountA, amountB, options) {
15262
+ var _increaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee30(dapp, tokenId, amountA, amountB, options) {
10819
15263
  var txData, dappAddress, abi, _abi2, tx;
10820
15264
 
10821
- return runtime_1.wrap(function _callee29$(_context29) {
15265
+ return runtime_1.wrap(function _callee30$(_context30) {
10822
15266
  while (1) {
10823
- switch (_context29.prev = _context29.next) {
15267
+ switch (_context30.prev = _context30.next) {
10824
15268
  case 0:
10825
15269
  if (options === void 0) {
10826
15270
  options = null;
10827
15271
  }
10828
15272
 
10829
15273
  if (!(dapp === exports.Dapp.UNISWAPV3)) {
10830
- _context29.next = 7;
15274
+ _context30.next = 7;
10831
15275
  break;
10832
15276
  }
10833
15277
 
10834
15278
  dappAddress = nonfungiblePositionManagerAddress[this.network];
10835
15279
  abi = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
10836
15280
  txData = abi.encodeFunctionData(exports.Transaction.INCREASE_LIQUIDITY, [[tokenId, amountA, amountB, 0, 0, deadline]]);
10837
- _context29.next = 14;
15281
+ _context30.next = 14;
10838
15282
  break;
10839
15283
 
10840
15284
  case 7:
10841
15285
  if (!(dapp === exports.Dapp.ARRAKIS)) {
10842
- _context29.next = 13;
15286
+ _context30.next = 13;
10843
15287
  break;
10844
15288
  }
10845
15289
 
10846
15290
  dappAddress = routerAddress[this.network][dapp];
10847
15291
  _abi2 = new ethers.ethers.utils.Interface(IArrakisV1RouterStaking.abi);
10848
15292
  txData = _abi2.encodeFunctionData(exports.Transaction.ADD_LIQUIDITY_STAKE, [tokenId, amountA, amountB, 0, 0, this.address]);
10849
- _context29.next = 14;
15293
+ _context30.next = 14;
10850
15294
  break;
10851
15295
 
10852
15296
  case 13:
10853
15297
  throw new Error("dapp not supported");
10854
15298
 
10855
15299
  case 14:
10856
- _context29.next = 16;
15300
+ _context30.next = 16;
10857
15301
  return this.poolLogic.execTransaction(dappAddress, txData, options);
10858
15302
 
10859
15303
  case 16:
10860
- tx = _context29.sent;
10861
- return _context29.abrupt("return", tx);
15304
+ tx = _context30.sent;
15305
+ return _context30.abrupt("return", tx);
10862
15306
 
10863
15307
  case 18:
10864
15308
  case "end":
10865
- return _context29.stop();
15309
+ return _context30.stop();
10866
15310
  }
10867
15311
  }
10868
- }, _callee29, this);
15312
+ }, _callee30, this);
10869
15313
  }));
10870
15314
 
10871
- function increaseLiquidity(_x106, _x107, _x108, _x109, _x110) {
15315
+ function increaseLiquidity(_x109, _x110, _x111, _x112, _x113) {
10872
15316
  return _increaseLiquidity.apply(this, arguments);
10873
15317
  }
10874
15318
 
@@ -10886,59 +15330,59 @@ var Pool = /*#__PURE__*/function () {
10886
15330
  _proto.claimFees =
10887
15331
  /*#__PURE__*/
10888
15332
  function () {
10889
- var _claimFees = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee30(dapp, tokenId, options) {
15333
+ var _claimFees = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee31(dapp, tokenId, options) {
10890
15334
  var txData, contractAddress, iNonfungiblePositionManager, abi, tx;
10891
- return runtime_1.wrap(function _callee30$(_context30) {
15335
+ return runtime_1.wrap(function _callee31$(_context31) {
10892
15336
  while (1) {
10893
- switch (_context30.prev = _context30.next) {
15337
+ switch (_context31.prev = _context31.next) {
10894
15338
  case 0:
10895
15339
  if (options === void 0) {
10896
15340
  options = null;
10897
15341
  }
10898
15342
 
10899
15343
  if (!(dapp === exports.Dapp.UNISWAPV3)) {
10900
- _context30.next = 7;
15344
+ _context31.next = 7;
10901
15345
  break;
10902
15346
  }
10903
15347
 
10904
15348
  contractAddress = nonfungiblePositionManagerAddress[this.network];
10905
15349
  iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
10906
15350
  txData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
10907
- _context30.next = 14;
15351
+ _context31.next = 14;
10908
15352
  break;
10909
15353
 
10910
15354
  case 7:
10911
15355
  if (!(dapp === exports.Dapp.ARRAKIS || dapp === exports.Dapp.BALANCER)) {
10912
- _context30.next = 13;
15356
+ _context31.next = 13;
10913
15357
  break;
10914
15358
  }
10915
15359
 
10916
15360
  contractAddress = tokenId;
10917
15361
  abi = new ethers.ethers.utils.Interface(ILiquidityGaugeV4.abi);
10918
15362
  txData = abi.encodeFunctionData("claim_rewards()", []);
10919
- _context30.next = 14;
15363
+ _context31.next = 14;
10920
15364
  break;
10921
15365
 
10922
15366
  case 13:
10923
15367
  throw new Error("dapp not supported");
10924
15368
 
10925
15369
  case 14:
10926
- _context30.next = 16;
15370
+ _context31.next = 16;
10927
15371
  return this.poolLogic.execTransaction(contractAddress, txData, options);
10928
15372
 
10929
15373
  case 16:
10930
- tx = _context30.sent;
10931
- return _context30.abrupt("return", tx);
15374
+ tx = _context31.sent;
15375
+ return _context31.abrupt("return", tx);
10932
15376
 
10933
15377
  case 18:
10934
15378
  case "end":
10935
- return _context30.stop();
15379
+ return _context31.stop();
10936
15380
  }
10937
15381
  }
10938
- }, _callee30, this);
15382
+ }, _callee31, this);
10939
15383
  }));
10940
15384
 
10941
- function claimFees(_x111, _x112, _x113) {
15385
+ function claimFees(_x114, _x115, _x116) {
10942
15386
  return _claimFees.apply(this, arguments);
10943
15387
  }
10944
15388
 
@@ -10960,11 +15404,11 @@ var Pool = /*#__PURE__*/function () {
10960
15404
  _proto.tradeUniswapV3 =
10961
15405
  /*#__PURE__*/
10962
15406
  function () {
10963
- var _tradeUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee31(assetFrom, assetTo, amountIn, feeAmount, slippage, options) {
15407
+ var _tradeUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee32(assetFrom, assetTo, amountIn, feeAmount, slippage, options) {
10964
15408
  var swapxData, tx;
10965
- return runtime_1.wrap(function _callee31$(_context31) {
15409
+ return runtime_1.wrap(function _callee32$(_context32) {
10966
15410
  while (1) {
10967
- switch (_context31.prev = _context31.next) {
15411
+ switch (_context32.prev = _context32.next) {
10968
15412
  case 0:
10969
15413
  if (slippage === void 0) {
10970
15414
  slippage = 0.5;
@@ -10974,27 +15418,27 @@ var Pool = /*#__PURE__*/function () {
10974
15418
  options = null;
10975
15419
  }
10976
15420
 
10977
- _context31.next = 4;
15421
+ _context32.next = 4;
10978
15422
  return getUniswapV3SwapTxData(this, assetFrom, assetTo, amountIn, slippage, feeAmount);
10979
15423
 
10980
15424
  case 4:
10981
- swapxData = _context31.sent;
10982
- _context31.next = 7;
15425
+ swapxData = _context32.sent;
15426
+ _context32.next = 7;
10983
15427
  return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.UNISWAPV3], swapxData, options);
10984
15428
 
10985
15429
  case 7:
10986
- tx = _context31.sent;
10987
- return _context31.abrupt("return", tx);
15430
+ tx = _context32.sent;
15431
+ return _context32.abrupt("return", tx);
10988
15432
 
10989
15433
  case 9:
10990
15434
  case "end":
10991
- return _context31.stop();
15435
+ return _context32.stop();
10992
15436
  }
10993
15437
  }
10994
- }, _callee31, this);
15438
+ }, _callee32, this);
10995
15439
  }));
10996
15440
 
10997
- function tradeUniswapV3(_x114, _x115, _x116, _x117, _x118, _x119) {
15441
+ function tradeUniswapV3(_x117, _x118, _x119, _x120, _x121, _x122) {
10998
15442
  return _tradeUniswapV.apply(this, arguments);
10999
15443
  }
11000
15444
 
@@ -11004,7 +15448,7 @@ var Pool = /*#__PURE__*/function () {
11004
15448
  return Pool;
11005
15449
  }();
11006
15450
 
11007
- var abi$g = [
15451
+ var abi$l = [
11008
15452
  {
11009
15453
  inputs: [
11010
15454
  {
@@ -11228,10 +15672,10 @@ var abi$g = [
11228
15672
  }
11229
15673
  ];
11230
15674
  var UniswapV2Factory = {
11231
- abi: abi$g
15675
+ abi: abi$l
11232
15676
  };
11233
15677
 
11234
- var abi$h = [
15678
+ var abi$m = [
11235
15679
  {
11236
15680
  anonymous: false,
11237
15681
  inputs: [
@@ -11975,7 +16419,7 @@ var evm = {
11975
16419
  }
11976
16420
  };
11977
16421
  var UniswapV2Pair = {
11978
- abi: abi$h,
16422
+ abi: abi$m,
11979
16423
  evm: evm,
11980
16424
  "interface": [
11981
16425
  {
@@ -12706,7 +17150,7 @@ var UniswapV2Pair = {
12706
17150
  ]
12707
17151
  };
12708
17152
 
12709
- var abi$i = [
17153
+ var abi$n = [
12710
17154
  {
12711
17155
  inputs: [
12712
17156
  {
@@ -13901,7 +18345,7 @@ var abi$i = [
13901
18345
  }
13902
18346
  ];
13903
18347
  var IBalancerV2Vault = {
13904
- abi: abi$i
18348
+ abi: abi$n
13905
18349
  };
13906
18350
 
13907
18351
  var Utils = /*#__PURE__*/function () {
@@ -14439,7 +18883,17 @@ var Dhedge = /*#__PURE__*/function () {
14439
18883
  }
14440
18884
 
14441
18885
  return loadPool;
14442
- }();
18886
+ }()
18887
+ /**
18888
+ * Check if pool address is valid
18889
+ * @param {string} address Pool address
18890
+ * @returns {boolean} Is valid pool address
18891
+ */
18892
+ ;
18893
+
18894
+ _proto.validatePool = function validatePool(address) {
18895
+ return this.factory.isPool(address);
18896
+ };
14443
18897
 
14444
18898
  return Dhedge;
14445
18899
  }();