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