@dhedge/v2-sdk 1.4.3 → 1.5.0

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.
@@ -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;
@@ -3870,7 +3871,7 @@ var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _routerAddress, _Netwo
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] = "0x9e080df81d9Db50348ef40F630fAE74f5Aea1f68", _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] = "0x15B7199AA9b9CaE9e611d858ab458aea8D36555B", _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
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), _stakingAddress[Network.OPTIMISM] = {}, _stakingAddress);
3876
3877
  var nonfungiblePositionManagerAddress = (_nonfungiblePositionM = {}, _nonfungiblePositionM[Network.POLYGON] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[Network.OPTIMISM] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM);
@@ -9324,6 +9325,1639 @@ function _getUniswapV3SwapTxData() {
9324
9325
  return _getUniswapV3SwapTxData.apply(this, arguments);
9325
9326
  }
9326
9327
 
9328
+ var abi$g = [
9329
+ {
9330
+ inputs: [
9331
+ {
9332
+ internalType: "address payable",
9333
+ name: "_feeSink",
9334
+ type: "address"
9335
+ },
9336
+ {
9337
+ components: [
9338
+ {
9339
+ internalType: "contract IUniswapV2RouterSwapOnly",
9340
+ name: "swapRouter",
9341
+ type: "address"
9342
+ },
9343
+ {
9344
+ internalType: "contract IUniswapV2Router",
9345
+ name: "assetType2Router",
9346
+ type: "address"
9347
+ },
9348
+ {
9349
+ internalType: "contract IUniswapV2Router",
9350
+ name: "assetType5Router",
9351
+ type: "address"
9352
+ },
9353
+ {
9354
+ components: [
9355
+ {
9356
+ internalType: "contract ISynthetix",
9357
+ name: "snxProxy",
9358
+ type: "address"
9359
+ },
9360
+ {
9361
+ internalType: "contract IERC20",
9362
+ name: "swapSUSDToAsset",
9363
+ type: "address"
9364
+ },
9365
+ {
9366
+ internalType: "contract ISynthAddressProxy",
9367
+ name: "sUSDProxy",
9368
+ type: "address"
9369
+ }
9370
+ ],
9371
+ internalType: "struct EasySwapperStructs.SynthetixProps",
9372
+ name: "synthetixProps",
9373
+ type: "tuple"
9374
+ },
9375
+ {
9376
+ internalType: "contract IERC20",
9377
+ name: "weth",
9378
+ type: "address"
9379
+ }
9380
+ ],
9381
+ internalType: "struct EasySwapperStructs.WithdrawProps",
9382
+ name: "_withdrawProps",
9383
+ type: "tuple"
9384
+ }
9385
+ ],
9386
+ stateMutability: "nonpayable",
9387
+ type: "constructor"
9388
+ },
9389
+ {
9390
+ anonymous: false,
9391
+ inputs: [
9392
+ {
9393
+ indexed: false,
9394
+ internalType: "address",
9395
+ name: "pool",
9396
+ type: "address"
9397
+ },
9398
+ {
9399
+ indexed: false,
9400
+ internalType: "address",
9401
+ name: "depositor",
9402
+ type: "address"
9403
+ },
9404
+ {
9405
+ indexed: false,
9406
+ internalType: "address",
9407
+ name: "depositAsset",
9408
+ type: "address"
9409
+ },
9410
+ {
9411
+ indexed: false,
9412
+ internalType: "uint256",
9413
+ name: "amount",
9414
+ type: "uint256"
9415
+ },
9416
+ {
9417
+ indexed: false,
9418
+ internalType: "address",
9419
+ name: "poolDepositAsset",
9420
+ type: "address"
9421
+ },
9422
+ {
9423
+ indexed: false,
9424
+ internalType: "uint256",
9425
+ name: "liquidityMinted",
9426
+ type: "uint256"
9427
+ }
9428
+ ],
9429
+ name: "Deposit",
9430
+ type: "event"
9431
+ },
9432
+ {
9433
+ anonymous: false,
9434
+ inputs: [
9435
+ {
9436
+ indexed: true,
9437
+ internalType: "address",
9438
+ name: "previousOwner",
9439
+ type: "address"
9440
+ },
9441
+ {
9442
+ indexed: true,
9443
+ internalType: "address",
9444
+ name: "newOwner",
9445
+ type: "address"
9446
+ }
9447
+ ],
9448
+ name: "OwnershipTransferred",
9449
+ type: "event"
9450
+ },
9451
+ {
9452
+ inputs: [
9453
+ {
9454
+ internalType: "address",
9455
+ name: "",
9456
+ type: "address"
9457
+ }
9458
+ ],
9459
+ name: "allowedPools",
9460
+ outputs: [
9461
+ {
9462
+ internalType: "bool",
9463
+ name: "",
9464
+ type: "bool"
9465
+ }
9466
+ ],
9467
+ stateMutability: "view",
9468
+ type: "function"
9469
+ },
9470
+ {
9471
+ inputs: [
9472
+ {
9473
+ internalType: "address",
9474
+ name: "pool",
9475
+ type: "address"
9476
+ },
9477
+ {
9478
+ internalType: "contract IERC20",
9479
+ name: "depositAsset",
9480
+ type: "address"
9481
+ },
9482
+ {
9483
+ internalType: "uint256",
9484
+ name: "amount",
9485
+ type: "uint256"
9486
+ },
9487
+ {
9488
+ internalType: "contract IERC20",
9489
+ name: "poolDepositAsset",
9490
+ type: "address"
9491
+ },
9492
+ {
9493
+ internalType: "uint256",
9494
+ name: "expectedLiquidityMinted",
9495
+ type: "uint256"
9496
+ }
9497
+ ],
9498
+ name: "deposit",
9499
+ outputs: [
9500
+ {
9501
+ internalType: "uint256",
9502
+ name: "liquidityMinted",
9503
+ type: "uint256"
9504
+ }
9505
+ ],
9506
+ stateMutability: "nonpayable",
9507
+ type: "function"
9508
+ },
9509
+ {
9510
+ inputs: [
9511
+ {
9512
+ internalType: "address",
9513
+ name: "pool",
9514
+ type: "address"
9515
+ },
9516
+ {
9517
+ internalType: "contract IERC20",
9518
+ name: "depositAsset",
9519
+ type: "address"
9520
+ },
9521
+ {
9522
+ internalType: "uint256",
9523
+ name: "amount",
9524
+ type: "uint256"
9525
+ },
9526
+ {
9527
+ internalType: "contract IERC20",
9528
+ name: "poolDepositAsset",
9529
+ type: "address"
9530
+ }
9531
+ ],
9532
+ name: "depositQuote",
9533
+ outputs: [
9534
+ {
9535
+ internalType: "uint256",
9536
+ name: "expectedLiquidityMinted",
9537
+ type: "uint256"
9538
+ }
9539
+ ],
9540
+ stateMutability: "view",
9541
+ type: "function"
9542
+ },
9543
+ {
9544
+ inputs: [
9545
+ ],
9546
+ name: "feeDenominator",
9547
+ outputs: [
9548
+ {
9549
+ internalType: "uint256",
9550
+ name: "",
9551
+ type: "uint256"
9552
+ }
9553
+ ],
9554
+ stateMutability: "view",
9555
+ type: "function"
9556
+ },
9557
+ {
9558
+ inputs: [
9559
+ ],
9560
+ name: "feeNumerator",
9561
+ outputs: [
9562
+ {
9563
+ internalType: "uint256",
9564
+ name: "",
9565
+ type: "uint256"
9566
+ }
9567
+ ],
9568
+ stateMutability: "view",
9569
+ type: "function"
9570
+ },
9571
+ {
9572
+ inputs: [
9573
+ ],
9574
+ name: "feeSink",
9575
+ outputs: [
9576
+ {
9577
+ internalType: "address payable",
9578
+ name: "",
9579
+ type: "address"
9580
+ }
9581
+ ],
9582
+ stateMutability: "view",
9583
+ type: "function"
9584
+ },
9585
+ {
9586
+ inputs: [
9587
+ ],
9588
+ name: "owner",
9589
+ outputs: [
9590
+ {
9591
+ internalType: "address",
9592
+ name: "",
9593
+ type: "address"
9594
+ }
9595
+ ],
9596
+ stateMutability: "view",
9597
+ type: "function"
9598
+ },
9599
+ {
9600
+ inputs: [
9601
+ ],
9602
+ name: "renounceOwnership",
9603
+ outputs: [
9604
+ ],
9605
+ stateMutability: "nonpayable",
9606
+ type: "function"
9607
+ },
9608
+ {
9609
+ inputs: [
9610
+ {
9611
+ internalType: "uint256",
9612
+ name: "numerator",
9613
+ type: "uint256"
9614
+ },
9615
+ {
9616
+ internalType: "uint256",
9617
+ name: "denominator",
9618
+ type: "uint256"
9619
+ }
9620
+ ],
9621
+ name: "setFee",
9622
+ outputs: [
9623
+ ],
9624
+ stateMutability: "nonpayable",
9625
+ type: "function"
9626
+ },
9627
+ {
9628
+ inputs: [
9629
+ {
9630
+ internalType: "address payable",
9631
+ name: "sink",
9632
+ type: "address"
9633
+ }
9634
+ ],
9635
+ name: "setFeeSink",
9636
+ outputs: [
9637
+ ],
9638
+ stateMutability: "nonpayable",
9639
+ type: "function"
9640
+ },
9641
+ {
9642
+ inputs: [
9643
+ {
9644
+ internalType: "address",
9645
+ name: "pool",
9646
+ type: "address"
9647
+ },
9648
+ {
9649
+ internalType: "bool",
9650
+ name: "allowed",
9651
+ type: "bool"
9652
+ }
9653
+ ],
9654
+ name: "setPoolAllowed",
9655
+ outputs: [
9656
+ ],
9657
+ stateMutability: "nonpayable",
9658
+ type: "function"
9659
+ },
9660
+ {
9661
+ inputs: [
9662
+ {
9663
+ internalType: "contract IUniswapV2RouterSwapOnly",
9664
+ name: "_swapRouter",
9665
+ type: "address"
9666
+ }
9667
+ ],
9668
+ name: "setSwapRouter",
9669
+ outputs: [
9670
+ ],
9671
+ stateMutability: "nonpayable",
9672
+ type: "function"
9673
+ },
9674
+ {
9675
+ inputs: [
9676
+ {
9677
+ internalType: "address",
9678
+ name: "newOwner",
9679
+ type: "address"
9680
+ }
9681
+ ],
9682
+ name: "transferOwnership",
9683
+ outputs: [
9684
+ ],
9685
+ stateMutability: "nonpayable",
9686
+ type: "function"
9687
+ },
9688
+ {
9689
+ inputs: [
9690
+ ],
9691
+ name: "weth",
9692
+ outputs: [
9693
+ {
9694
+ internalType: "contract IERC20",
9695
+ name: "",
9696
+ type: "address"
9697
+ }
9698
+ ],
9699
+ stateMutability: "view",
9700
+ type: "function"
9701
+ },
9702
+ {
9703
+ inputs: [
9704
+ {
9705
+ internalType: "address",
9706
+ name: "pool",
9707
+ type: "address"
9708
+ },
9709
+ {
9710
+ internalType: "uint256",
9711
+ name: "fundTokenAmount",
9712
+ type: "uint256"
9713
+ },
9714
+ {
9715
+ internalType: "contract IERC20",
9716
+ name: "withdrawalAsset",
9717
+ type: "address"
9718
+ },
9719
+ {
9720
+ internalType: "uint256",
9721
+ name: "expectedAmountOut",
9722
+ type: "uint256"
9723
+ }
9724
+ ],
9725
+ name: "withdraw",
9726
+ outputs: [
9727
+ ],
9728
+ stateMutability: "nonpayable",
9729
+ type: "function"
9730
+ },
9731
+ {
9732
+ inputs: [
9733
+ ],
9734
+ name: "withdrawProps",
9735
+ outputs: [
9736
+ {
9737
+ internalType: "contract IUniswapV2RouterSwapOnly",
9738
+ name: "swapRouter",
9739
+ type: "address"
9740
+ },
9741
+ {
9742
+ internalType: "contract IUniswapV2Router",
9743
+ name: "assetType2Router",
9744
+ type: "address"
9745
+ },
9746
+ {
9747
+ internalType: "contract IUniswapV2Router",
9748
+ name: "assetType5Router",
9749
+ type: "address"
9750
+ },
9751
+ {
9752
+ components: [
9753
+ {
9754
+ internalType: "contract ISynthetix",
9755
+ name: "snxProxy",
9756
+ type: "address"
9757
+ },
9758
+ {
9759
+ internalType: "contract IERC20",
9760
+ name: "swapSUSDToAsset",
9761
+ type: "address"
9762
+ },
9763
+ {
9764
+ internalType: "contract ISynthAddressProxy",
9765
+ name: "sUSDProxy",
9766
+ type: "address"
9767
+ }
9768
+ ],
9769
+ internalType: "struct EasySwapperStructs.SynthetixProps",
9770
+ name: "synthetixProps",
9771
+ type: "tuple"
9772
+ },
9773
+ {
9774
+ internalType: "contract IERC20",
9775
+ name: "weth",
9776
+ type: "address"
9777
+ }
9778
+ ],
9779
+ stateMutability: "view",
9780
+ type: "function"
9781
+ }
9782
+ ];
9783
+ var IDhedgeEasySwapper = {
9784
+ abi: abi$g
9785
+ };
9786
+
9787
+ var abi$h = [
9788
+ {
9789
+ inputs: [
9790
+ {
9791
+ internalType: "string",
9792
+ name: "marketId",
9793
+ type: "string"
9794
+ },
9795
+ {
9796
+ internalType: "address",
9797
+ name: "owner",
9798
+ type: "address"
9799
+ }
9800
+ ],
9801
+ stateMutability: "nonpayable",
9802
+ type: "constructor"
9803
+ },
9804
+ {
9805
+ anonymous: false,
9806
+ inputs: [
9807
+ {
9808
+ indexed: true,
9809
+ internalType: "address",
9810
+ name: "oldAddress",
9811
+ type: "address"
9812
+ },
9813
+ {
9814
+ indexed: true,
9815
+ internalType: "address",
9816
+ name: "newAddress",
9817
+ type: "address"
9818
+ }
9819
+ ],
9820
+ name: "ACLAdminUpdated",
9821
+ type: "event"
9822
+ },
9823
+ {
9824
+ anonymous: false,
9825
+ inputs: [
9826
+ {
9827
+ indexed: true,
9828
+ internalType: "address",
9829
+ name: "oldAddress",
9830
+ type: "address"
9831
+ },
9832
+ {
9833
+ indexed: true,
9834
+ internalType: "address",
9835
+ name: "newAddress",
9836
+ type: "address"
9837
+ }
9838
+ ],
9839
+ name: "ACLManagerUpdated",
9840
+ type: "event"
9841
+ },
9842
+ {
9843
+ anonymous: false,
9844
+ inputs: [
9845
+ {
9846
+ indexed: true,
9847
+ internalType: "bytes32",
9848
+ name: "id",
9849
+ type: "bytes32"
9850
+ },
9851
+ {
9852
+ indexed: true,
9853
+ internalType: "address",
9854
+ name: "oldAddress",
9855
+ type: "address"
9856
+ },
9857
+ {
9858
+ indexed: true,
9859
+ internalType: "address",
9860
+ name: "newAddress",
9861
+ type: "address"
9862
+ }
9863
+ ],
9864
+ name: "AddressSet",
9865
+ type: "event"
9866
+ },
9867
+ {
9868
+ anonymous: false,
9869
+ inputs: [
9870
+ {
9871
+ indexed: true,
9872
+ internalType: "bytes32",
9873
+ name: "id",
9874
+ type: "bytes32"
9875
+ },
9876
+ {
9877
+ indexed: true,
9878
+ internalType: "address",
9879
+ name: "proxyAddress",
9880
+ type: "address"
9881
+ },
9882
+ {
9883
+ indexed: false,
9884
+ internalType: "address",
9885
+ name: "oldImplementationAddress",
9886
+ type: "address"
9887
+ },
9888
+ {
9889
+ indexed: true,
9890
+ internalType: "address",
9891
+ name: "newImplementationAddress",
9892
+ type: "address"
9893
+ }
9894
+ ],
9895
+ name: "AddressSetAsProxy",
9896
+ type: "event"
9897
+ },
9898
+ {
9899
+ anonymous: false,
9900
+ inputs: [
9901
+ {
9902
+ indexed: true,
9903
+ internalType: "string",
9904
+ name: "oldMarketId",
9905
+ type: "string"
9906
+ },
9907
+ {
9908
+ indexed: true,
9909
+ internalType: "string",
9910
+ name: "newMarketId",
9911
+ type: "string"
9912
+ }
9913
+ ],
9914
+ name: "MarketIdSet",
9915
+ type: "event"
9916
+ },
9917
+ {
9918
+ anonymous: false,
9919
+ inputs: [
9920
+ {
9921
+ indexed: true,
9922
+ internalType: "address",
9923
+ name: "previousOwner",
9924
+ type: "address"
9925
+ },
9926
+ {
9927
+ indexed: true,
9928
+ internalType: "address",
9929
+ name: "newOwner",
9930
+ type: "address"
9931
+ }
9932
+ ],
9933
+ name: "OwnershipTransferred",
9934
+ type: "event"
9935
+ },
9936
+ {
9937
+ anonymous: false,
9938
+ inputs: [
9939
+ {
9940
+ indexed: true,
9941
+ internalType: "address",
9942
+ name: "oldAddress",
9943
+ type: "address"
9944
+ },
9945
+ {
9946
+ indexed: true,
9947
+ internalType: "address",
9948
+ name: "newAddress",
9949
+ type: "address"
9950
+ }
9951
+ ],
9952
+ name: "PoolConfiguratorUpdated",
9953
+ type: "event"
9954
+ },
9955
+ {
9956
+ anonymous: false,
9957
+ inputs: [
9958
+ {
9959
+ indexed: true,
9960
+ internalType: "address",
9961
+ name: "oldAddress",
9962
+ type: "address"
9963
+ },
9964
+ {
9965
+ indexed: true,
9966
+ internalType: "address",
9967
+ name: "newAddress",
9968
+ type: "address"
9969
+ }
9970
+ ],
9971
+ name: "PoolDataProviderUpdated",
9972
+ type: "event"
9973
+ },
9974
+ {
9975
+ anonymous: false,
9976
+ inputs: [
9977
+ {
9978
+ indexed: true,
9979
+ internalType: "address",
9980
+ name: "oldAddress",
9981
+ type: "address"
9982
+ },
9983
+ {
9984
+ indexed: true,
9985
+ internalType: "address",
9986
+ name: "newAddress",
9987
+ type: "address"
9988
+ }
9989
+ ],
9990
+ name: "PoolUpdated",
9991
+ type: "event"
9992
+ },
9993
+ {
9994
+ anonymous: false,
9995
+ inputs: [
9996
+ {
9997
+ indexed: true,
9998
+ internalType: "address",
9999
+ name: "oldAddress",
10000
+ type: "address"
10001
+ },
10002
+ {
10003
+ indexed: true,
10004
+ internalType: "address",
10005
+ name: "newAddress",
10006
+ type: "address"
10007
+ }
10008
+ ],
10009
+ name: "PriceOracleSentinelUpdated",
10010
+ type: "event"
10011
+ },
10012
+ {
10013
+ anonymous: false,
10014
+ inputs: [
10015
+ {
10016
+ indexed: true,
10017
+ internalType: "address",
10018
+ name: "oldAddress",
10019
+ type: "address"
10020
+ },
10021
+ {
10022
+ indexed: true,
10023
+ internalType: "address",
10024
+ name: "newAddress",
10025
+ type: "address"
10026
+ }
10027
+ ],
10028
+ name: "PriceOracleUpdated",
10029
+ type: "event"
10030
+ },
10031
+ {
10032
+ anonymous: false,
10033
+ inputs: [
10034
+ {
10035
+ indexed: true,
10036
+ internalType: "bytes32",
10037
+ name: "id",
10038
+ type: "bytes32"
10039
+ },
10040
+ {
10041
+ indexed: true,
10042
+ internalType: "address",
10043
+ name: "proxyAddress",
10044
+ type: "address"
10045
+ },
10046
+ {
10047
+ indexed: true,
10048
+ internalType: "address",
10049
+ name: "implementationAddress",
10050
+ type: "address"
10051
+ }
10052
+ ],
10053
+ name: "ProxyCreated",
10054
+ type: "event"
10055
+ },
10056
+ {
10057
+ inputs: [
10058
+ ],
10059
+ name: "getACLAdmin",
10060
+ outputs: [
10061
+ {
10062
+ internalType: "address",
10063
+ name: "",
10064
+ type: "address"
10065
+ }
10066
+ ],
10067
+ stateMutability: "view",
10068
+ type: "function"
10069
+ },
10070
+ {
10071
+ inputs: [
10072
+ ],
10073
+ name: "getACLManager",
10074
+ outputs: [
10075
+ {
10076
+ internalType: "address",
10077
+ name: "",
10078
+ type: "address"
10079
+ }
10080
+ ],
10081
+ stateMutability: "view",
10082
+ type: "function"
10083
+ },
10084
+ {
10085
+ inputs: [
10086
+ {
10087
+ internalType: "bytes32",
10088
+ name: "id",
10089
+ type: "bytes32"
10090
+ }
10091
+ ],
10092
+ name: "getAddress",
10093
+ outputs: [
10094
+ {
10095
+ internalType: "address",
10096
+ name: "",
10097
+ type: "address"
10098
+ }
10099
+ ],
10100
+ stateMutability: "view",
10101
+ type: "function"
10102
+ },
10103
+ {
10104
+ inputs: [
10105
+ ],
10106
+ name: "getMarketId",
10107
+ outputs: [
10108
+ {
10109
+ internalType: "string",
10110
+ name: "",
10111
+ type: "string"
10112
+ }
10113
+ ],
10114
+ stateMutability: "view",
10115
+ type: "function"
10116
+ },
10117
+ {
10118
+ inputs: [
10119
+ ],
10120
+ name: "getPool",
10121
+ outputs: [
10122
+ {
10123
+ internalType: "address",
10124
+ name: "",
10125
+ type: "address"
10126
+ }
10127
+ ],
10128
+ stateMutability: "view",
10129
+ type: "function"
10130
+ },
10131
+ {
10132
+ inputs: [
10133
+ ],
10134
+ name: "getPoolConfigurator",
10135
+ outputs: [
10136
+ {
10137
+ internalType: "address",
10138
+ name: "",
10139
+ type: "address"
10140
+ }
10141
+ ],
10142
+ stateMutability: "view",
10143
+ type: "function"
10144
+ },
10145
+ {
10146
+ inputs: [
10147
+ ],
10148
+ name: "getPoolDataProvider",
10149
+ outputs: [
10150
+ {
10151
+ internalType: "address",
10152
+ name: "",
10153
+ type: "address"
10154
+ }
10155
+ ],
10156
+ stateMutability: "view",
10157
+ type: "function"
10158
+ },
10159
+ {
10160
+ inputs: [
10161
+ ],
10162
+ name: "getPriceOracle",
10163
+ outputs: [
10164
+ {
10165
+ internalType: "address",
10166
+ name: "",
10167
+ type: "address"
10168
+ }
10169
+ ],
10170
+ stateMutability: "view",
10171
+ type: "function"
10172
+ },
10173
+ {
10174
+ inputs: [
10175
+ ],
10176
+ name: "getPriceOracleSentinel",
10177
+ outputs: [
10178
+ {
10179
+ internalType: "address",
10180
+ name: "",
10181
+ type: "address"
10182
+ }
10183
+ ],
10184
+ stateMutability: "view",
10185
+ type: "function"
10186
+ },
10187
+ {
10188
+ inputs: [
10189
+ ],
10190
+ name: "owner",
10191
+ outputs: [
10192
+ {
10193
+ internalType: "address",
10194
+ name: "",
10195
+ type: "address"
10196
+ }
10197
+ ],
10198
+ stateMutability: "view",
10199
+ type: "function"
10200
+ },
10201
+ {
10202
+ inputs: [
10203
+ ],
10204
+ name: "renounceOwnership",
10205
+ outputs: [
10206
+ ],
10207
+ stateMutability: "nonpayable",
10208
+ type: "function"
10209
+ },
10210
+ {
10211
+ inputs: [
10212
+ {
10213
+ internalType: "address",
10214
+ name: "newAclAdmin",
10215
+ type: "address"
10216
+ }
10217
+ ],
10218
+ name: "setACLAdmin",
10219
+ outputs: [
10220
+ ],
10221
+ stateMutability: "nonpayable",
10222
+ type: "function"
10223
+ },
10224
+ {
10225
+ inputs: [
10226
+ {
10227
+ internalType: "address",
10228
+ name: "newAclManager",
10229
+ type: "address"
10230
+ }
10231
+ ],
10232
+ name: "setACLManager",
10233
+ outputs: [
10234
+ ],
10235
+ stateMutability: "nonpayable",
10236
+ type: "function"
10237
+ },
10238
+ {
10239
+ inputs: [
10240
+ {
10241
+ internalType: "bytes32",
10242
+ name: "id",
10243
+ type: "bytes32"
10244
+ },
10245
+ {
10246
+ internalType: "address",
10247
+ name: "newAddress",
10248
+ type: "address"
10249
+ }
10250
+ ],
10251
+ name: "setAddress",
10252
+ outputs: [
10253
+ ],
10254
+ stateMutability: "nonpayable",
10255
+ type: "function"
10256
+ },
10257
+ {
10258
+ inputs: [
10259
+ {
10260
+ internalType: "bytes32",
10261
+ name: "id",
10262
+ type: "bytes32"
10263
+ },
10264
+ {
10265
+ internalType: "address",
10266
+ name: "newImplementationAddress",
10267
+ type: "address"
10268
+ }
10269
+ ],
10270
+ name: "setAddressAsProxy",
10271
+ outputs: [
10272
+ ],
10273
+ stateMutability: "nonpayable",
10274
+ type: "function"
10275
+ },
10276
+ {
10277
+ inputs: [
10278
+ {
10279
+ internalType: "string",
10280
+ name: "newMarketId",
10281
+ type: "string"
10282
+ }
10283
+ ],
10284
+ name: "setMarketId",
10285
+ outputs: [
10286
+ ],
10287
+ stateMutability: "nonpayable",
10288
+ type: "function"
10289
+ },
10290
+ {
10291
+ inputs: [
10292
+ {
10293
+ internalType: "address",
10294
+ name: "newPoolConfiguratorImpl",
10295
+ type: "address"
10296
+ }
10297
+ ],
10298
+ name: "setPoolConfiguratorImpl",
10299
+ outputs: [
10300
+ ],
10301
+ stateMutability: "nonpayable",
10302
+ type: "function"
10303
+ },
10304
+ {
10305
+ inputs: [
10306
+ {
10307
+ internalType: "address",
10308
+ name: "newDataProvider",
10309
+ type: "address"
10310
+ }
10311
+ ],
10312
+ name: "setPoolDataProvider",
10313
+ outputs: [
10314
+ ],
10315
+ stateMutability: "nonpayable",
10316
+ type: "function"
10317
+ },
10318
+ {
10319
+ inputs: [
10320
+ {
10321
+ internalType: "address",
10322
+ name: "newPoolImpl",
10323
+ type: "address"
10324
+ }
10325
+ ],
10326
+ name: "setPoolImpl",
10327
+ outputs: [
10328
+ ],
10329
+ stateMutability: "nonpayable",
10330
+ type: "function"
10331
+ },
10332
+ {
10333
+ inputs: [
10334
+ {
10335
+ internalType: "address",
10336
+ name: "newPriceOracle",
10337
+ type: "address"
10338
+ }
10339
+ ],
10340
+ name: "setPriceOracle",
10341
+ outputs: [
10342
+ ],
10343
+ stateMutability: "nonpayable",
10344
+ type: "function"
10345
+ },
10346
+ {
10347
+ inputs: [
10348
+ {
10349
+ internalType: "address",
10350
+ name: "newPriceOracleSentinel",
10351
+ type: "address"
10352
+ }
10353
+ ],
10354
+ name: "setPriceOracleSentinel",
10355
+ outputs: [
10356
+ ],
10357
+ stateMutability: "nonpayable",
10358
+ type: "function"
10359
+ },
10360
+ {
10361
+ inputs: [
10362
+ {
10363
+ internalType: "address",
10364
+ name: "newOwner",
10365
+ type: "address"
10366
+ }
10367
+ ],
10368
+ name: "transferOwnership",
10369
+ outputs: [
10370
+ ],
10371
+ stateMutability: "nonpayable",
10372
+ type: "function"
10373
+ }
10374
+ ];
10375
+ var IAaveV3PoolAddressProvider = {
10376
+ abi: abi$h
10377
+ };
10378
+
10379
+ var abi$i = [
10380
+ {
10381
+ inputs: [
10382
+ {
10383
+ internalType: "address[]",
10384
+ name: "_assets",
10385
+ type: "address[]"
10386
+ },
10387
+ {
10388
+ internalType: "address[]",
10389
+ name: "_sources",
10390
+ type: "address[]"
10391
+ },
10392
+ {
10393
+ internalType: "address",
10394
+ name: "_fallbackOracle",
10395
+ type: "address"
10396
+ }
10397
+ ],
10398
+ payable: false,
10399
+ stateMutability: "nonpayable",
10400
+ type: "constructor"
10401
+ },
10402
+ {
10403
+ anonymous: false,
10404
+ inputs: [
10405
+ {
10406
+ indexed: true,
10407
+ internalType: "address",
10408
+ name: "asset",
10409
+ type: "address"
10410
+ },
10411
+ {
10412
+ indexed: true,
10413
+ internalType: "address",
10414
+ name: "source",
10415
+ type: "address"
10416
+ }
10417
+ ],
10418
+ name: "AssetSourceUpdated",
10419
+ type: "event"
10420
+ },
10421
+ {
10422
+ anonymous: false,
10423
+ inputs: [
10424
+ {
10425
+ indexed: true,
10426
+ internalType: "address",
10427
+ name: "fallbackOracle",
10428
+ type: "address"
10429
+ }
10430
+ ],
10431
+ name: "FallbackOracleUpdated",
10432
+ type: "event"
10433
+ },
10434
+ {
10435
+ anonymous: false,
10436
+ inputs: [
10437
+ {
10438
+ indexed: true,
10439
+ internalType: "address",
10440
+ name: "previousOwner",
10441
+ type: "address"
10442
+ },
10443
+ {
10444
+ indexed: true,
10445
+ internalType: "address",
10446
+ name: "newOwner",
10447
+ type: "address"
10448
+ }
10449
+ ],
10450
+ name: "OwnershipTransferred",
10451
+ type: "event"
10452
+ },
10453
+ {
10454
+ constant: true,
10455
+ inputs: [
10456
+ ],
10457
+ name: "isOwner",
10458
+ outputs: [
10459
+ {
10460
+ internalType: "bool",
10461
+ name: "",
10462
+ type: "bool"
10463
+ }
10464
+ ],
10465
+ payable: false,
10466
+ stateMutability: "view",
10467
+ type: "function"
10468
+ },
10469
+ {
10470
+ constant: true,
10471
+ inputs: [
10472
+ ],
10473
+ name: "owner",
10474
+ outputs: [
10475
+ {
10476
+ internalType: "address",
10477
+ name: "",
10478
+ type: "address"
10479
+ }
10480
+ ],
10481
+ payable: false,
10482
+ stateMutability: "view",
10483
+ type: "function"
10484
+ },
10485
+ {
10486
+ constant: false,
10487
+ inputs: [
10488
+ ],
10489
+ name: "renounceOwnership",
10490
+ outputs: [
10491
+ ],
10492
+ payable: false,
10493
+ stateMutability: "nonpayable",
10494
+ type: "function"
10495
+ },
10496
+ {
10497
+ constant: false,
10498
+ inputs: [
10499
+ {
10500
+ internalType: "address",
10501
+ name: "newOwner",
10502
+ type: "address"
10503
+ }
10504
+ ],
10505
+ name: "transferOwnership",
10506
+ outputs: [
10507
+ ],
10508
+ payable: false,
10509
+ stateMutability: "nonpayable",
10510
+ type: "function"
10511
+ },
10512
+ {
10513
+ constant: false,
10514
+ inputs: [
10515
+ {
10516
+ internalType: "address[]",
10517
+ name: "_assets",
10518
+ type: "address[]"
10519
+ },
10520
+ {
10521
+ internalType: "address[]",
10522
+ name: "_sources",
10523
+ type: "address[]"
10524
+ }
10525
+ ],
10526
+ name: "setAssetSources",
10527
+ outputs: [
10528
+ ],
10529
+ payable: false,
10530
+ stateMutability: "nonpayable",
10531
+ type: "function"
10532
+ },
10533
+ {
10534
+ constant: false,
10535
+ inputs: [
10536
+ {
10537
+ internalType: "address",
10538
+ name: "_fallbackOracle",
10539
+ type: "address"
10540
+ }
10541
+ ],
10542
+ name: "setFallbackOracle",
10543
+ outputs: [
10544
+ ],
10545
+ payable: false,
10546
+ stateMutability: "nonpayable",
10547
+ type: "function"
10548
+ },
10549
+ {
10550
+ constant: true,
10551
+ inputs: [
10552
+ {
10553
+ internalType: "address",
10554
+ name: "_asset",
10555
+ type: "address"
10556
+ }
10557
+ ],
10558
+ name: "getAssetPrice",
10559
+ outputs: [
10560
+ {
10561
+ internalType: "uint256",
10562
+ name: "",
10563
+ type: "uint256"
10564
+ }
10565
+ ],
10566
+ payable: false,
10567
+ stateMutability: "view",
10568
+ type: "function"
10569
+ },
10570
+ {
10571
+ constant: true,
10572
+ inputs: [
10573
+ {
10574
+ internalType: "address[]",
10575
+ name: "_assets",
10576
+ type: "address[]"
10577
+ }
10578
+ ],
10579
+ name: "getAssetsPrices",
10580
+ outputs: [
10581
+ {
10582
+ internalType: "uint256[]",
10583
+ name: "",
10584
+ type: "uint256[]"
10585
+ }
10586
+ ],
10587
+ payable: false,
10588
+ stateMutability: "view",
10589
+ type: "function"
10590
+ },
10591
+ {
10592
+ constant: true,
10593
+ inputs: [
10594
+ {
10595
+ internalType: "address",
10596
+ name: "_asset",
10597
+ type: "address"
10598
+ }
10599
+ ],
10600
+ name: "getSourceOfAsset",
10601
+ outputs: [
10602
+ {
10603
+ internalType: "address",
10604
+ name: "",
10605
+ type: "address"
10606
+ }
10607
+ ],
10608
+ payable: false,
10609
+ stateMutability: "view",
10610
+ type: "function"
10611
+ },
10612
+ {
10613
+ constant: true,
10614
+ inputs: [
10615
+ ],
10616
+ name: "getFallbackOracle",
10617
+ outputs: [
10618
+ {
10619
+ internalType: "address",
10620
+ name: "",
10621
+ type: "address"
10622
+ }
10623
+ ],
10624
+ payable: false,
10625
+ stateMutability: "view",
10626
+ type: "function"
10627
+ }
10628
+ ];
10629
+ var IPriceOracle = {
10630
+ abi: abi$i
10631
+ };
10632
+
10633
+ function getChainlinkPriceInUsd(_x, _x2) {
10634
+ return _getChainlinkPriceInUsd.apply(this, arguments);
10635
+ }
10636
+
10637
+ function _getChainlinkPriceInUsd() {
10638
+ _getChainlinkPriceInUsd = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, asset) {
10639
+ var lendingPoolAddressProvider, priceOracleAddress, priceOracle;
10640
+ return runtime_1.wrap(function _callee$(_context) {
10641
+ while (1) {
10642
+ switch (_context.prev = _context.next) {
10643
+ case 0:
10644
+ //Workaround as Chainlink doesn't have feed registry on Polygon/Optimism
10645
+ //Use oracle from Aave which uses Chainlink
10646
+ lendingPoolAddressProvider = new ethers.Contract("0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", IAaveV3PoolAddressProvider.abi, pool.signer);
10647
+ _context.next = 3;
10648
+ return lendingPoolAddressProvider.getPriceOracle();
10649
+
10650
+ case 3:
10651
+ priceOracleAddress = _context.sent;
10652
+ priceOracle = new ethers.Contract(priceOracleAddress, IPriceOracle.abi, pool.signer);
10653
+ _context.next = 7;
10654
+ return priceOracle.getAssetPrice(asset);
10655
+
10656
+ case 7:
10657
+ return _context.abrupt("return", _context.sent);
10658
+
10659
+ case 8:
10660
+ case "end":
10661
+ return _context.stop();
10662
+ }
10663
+ }
10664
+ }, _callee);
10665
+ }));
10666
+ return _getChainlinkPriceInUsd.apply(this, arguments);
10667
+ }
10668
+
10669
+ function loadPool(_x, _x2) {
10670
+ return _loadPool.apply(this, arguments);
10671
+ }
10672
+
10673
+ function _loadPool() {
10674
+ _loadPool = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, poolAddress) {
10675
+ var dhedge;
10676
+ return runtime_1.wrap(function _callee$(_context) {
10677
+ while (1) {
10678
+ switch (_context.prev = _context.next) {
10679
+ case 0:
10680
+ dhedge = new Dhedge(pool.signer, pool.network);
10681
+ _context.next = 3;
10682
+ return dhedge.loadPool(poolAddress);
10683
+
10684
+ case 3:
10685
+ return _context.abrupt("return", _context.sent);
10686
+
10687
+ case 4:
10688
+ case "end":
10689
+ return _context.stop();
10690
+ }
10691
+ }
10692
+ }, _callee);
10693
+ }));
10694
+ return _loadPool.apply(this, arguments);
10695
+ }
10696
+
10697
+ function isPool(_x3, _x4) {
10698
+ return _isPool.apply(this, arguments);
10699
+ }
10700
+
10701
+ function _isPool() {
10702
+ _isPool = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, poolAddress) {
10703
+ var dhedge;
10704
+ return runtime_1.wrap(function _callee2$(_context2) {
10705
+ while (1) {
10706
+ switch (_context2.prev = _context2.next) {
10707
+ case 0:
10708
+ dhedge = new Dhedge(pool.signer, pool.network);
10709
+ _context2.next = 3;
10710
+ return dhedge.validatePool(poolAddress);
10711
+
10712
+ case 3:
10713
+ return _context2.abrupt("return", _context2.sent);
10714
+
10715
+ case 4:
10716
+ case "end":
10717
+ return _context2.stop();
10718
+ }
10719
+ }
10720
+ }, _callee2);
10721
+ }));
10722
+ return _isPool.apply(this, arguments);
10723
+ }
10724
+
10725
+ function getPoolDepositAsset(_x, _x2) {
10726
+ return _getPoolDepositAsset.apply(this, arguments);
10727
+ }
10728
+
10729
+ function _getPoolDepositAsset() {
10730
+ _getPoolDepositAsset = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, poolAddress) {
10731
+ var _composition$find;
10732
+
10733
+ var torosPool, composition;
10734
+ return runtime_1.wrap(function _callee$(_context) {
10735
+ while (1) {
10736
+ switch (_context.prev = _context.next) {
10737
+ case 0:
10738
+ _context.next = 2;
10739
+ return loadPool(pool, poolAddress);
10740
+
10741
+ case 2:
10742
+ torosPool = _context.sent;
10743
+ _context.next = 5;
10744
+ return torosPool.getComposition();
10745
+
10746
+ case 5:
10747
+ composition = _context.sent;
10748
+ return _context.abrupt("return", (_composition$find = composition.find(function (e) {
10749
+ return e.isDeposit;
10750
+ })) == null ? void 0 : _composition$find.asset);
10751
+
10752
+ case 7:
10753
+ case "end":
10754
+ return _context.stop();
10755
+ }
10756
+ }
10757
+ }, _callee);
10758
+ }));
10759
+ return _getPoolDepositAsset.apply(this, arguments);
10760
+ }
10761
+
10762
+ function getTorosPoolTokenPrice(_x3, _x4) {
10763
+ return _getTorosPoolTokenPrice.apply(this, arguments);
10764
+ }
10765
+
10766
+ function _getTorosPoolTokenPrice() {
10767
+ _getTorosPoolTokenPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, poolAddress) {
10768
+ var torosPool;
10769
+ return runtime_1.wrap(function _callee2$(_context2) {
10770
+ while (1) {
10771
+ switch (_context2.prev = _context2.next) {
10772
+ case 0:
10773
+ _context2.next = 2;
10774
+ return loadPool(pool, poolAddress);
10775
+
10776
+ case 2:
10777
+ torosPool = _context2.sent;
10778
+ _context2.next = 5;
10779
+ return torosPool.poolLogic.tokenPrice();
10780
+
10781
+ case 5:
10782
+ return _context2.abrupt("return", _context2.sent);
10783
+
10784
+ case 6:
10785
+ case "end":
10786
+ return _context2.stop();
10787
+ }
10788
+ }
10789
+ }, _callee2);
10790
+ }));
10791
+ return _getTorosPoolTokenPrice.apply(this, arguments);
10792
+ }
10793
+
10794
+ function getEasySwapperDepositQuote(_x5, _x6, _x7, _x8, _x9) {
10795
+ return _getEasySwapperDepositQuote.apply(this, arguments);
10796
+ }
10797
+
10798
+ function _getEasySwapperDepositQuote() {
10799
+ _getEasySwapperDepositQuote = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(pool, torosAsset, investAsset, depositAsset, amountIn) {
10800
+ var easySwapper;
10801
+ return runtime_1.wrap(function _callee3$(_context3) {
10802
+ while (1) {
10803
+ switch (_context3.prev = _context3.next) {
10804
+ case 0:
10805
+ easySwapper = new ethers.Contract(routerAddress[pool.network][Dapp.TOROS], IDhedgeEasySwapper.abi, pool.signer);
10806
+ _context3.next = 3;
10807
+ return easySwapper.depositQuote(torosAsset, investAsset, amountIn, depositAsset);
10808
+
10809
+ case 3:
10810
+ return _context3.abrupt("return", _context3.sent);
10811
+
10812
+ case 4:
10813
+ case "end":
10814
+ return _context3.stop();
10815
+ }
10816
+ }
10817
+ }, _callee3);
10818
+ }));
10819
+ return _getEasySwapperDepositQuote.apply(this, arguments);
10820
+ }
10821
+
10822
+ function getEasySwapperWithdrawalQuote(_x10, _x11, _x12, _x13) {
10823
+ return _getEasySwapperWithdrawalQuote.apply(this, arguments);
10824
+ }
10825
+
10826
+ function _getEasySwapperWithdrawalQuote() {
10827
+ _getEasySwapperWithdrawalQuote = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(pool, torosAsset, investAsset, amountIn) {
10828
+ var _yield$Promise$all, torosTokenPrice, assetPrice, assetDecimals;
10829
+
10830
+ return runtime_1.wrap(function _callee4$(_context4) {
10831
+ while (1) {
10832
+ switch (_context4.prev = _context4.next) {
10833
+ case 0:
10834
+ _context4.next = 2;
10835
+ return Promise.all([getTorosPoolTokenPrice(pool, torosAsset), getChainlinkPriceInUsd(pool, investAsset), pool.utils.getDecimals(investAsset)]);
10836
+
10837
+ case 2:
10838
+ _yield$Promise$all = _context4.sent;
10839
+ torosTokenPrice = _yield$Promise$all[0];
10840
+ assetPrice = _yield$Promise$all[1];
10841
+ assetDecimals = _yield$Promise$all[2];
10842
+ return _context4.abrupt("return", amountIn.mul(torosTokenPrice).div(assetPrice).div(1e10).div(Math.pow(10, 18 - assetDecimals)));
10843
+
10844
+ case 7:
10845
+ case "end":
10846
+ return _context4.stop();
10847
+ }
10848
+ }
10849
+ }, _callee4);
10850
+ }));
10851
+ return _getEasySwapperWithdrawalQuote.apply(this, arguments);
10852
+ }
10853
+
10854
+ function getEasySwapperTxData(_x14, _x15, _x16, _x17, _x18) {
10855
+ return _getEasySwapperTxData.apply(this, arguments);
10856
+ }
10857
+
10858
+ function _getEasySwapperTxData() {
10859
+ _getEasySwapperTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(pool, assetFrom, assetTo, amountIn, slippage // eslint-disable-next-line @typescript-eslint/no-explicit-any
10860
+ ) {
10861
+ var isWithdrawal, _ref, torosAsset, investAsset, iDhedgeEasySwapper, minAmountOut, depositAsset, _minAmountOut;
10862
+
10863
+ return runtime_1.wrap(function _callee5$(_context5) {
10864
+ while (1) {
10865
+ switch (_context5.prev = _context5.next) {
10866
+ case 0:
10867
+ _context5.next = 2;
10868
+ return isPool(pool, assetFrom);
10869
+
10870
+ case 2:
10871
+ isWithdrawal = _context5.sent;
10872
+ _ref = isWithdrawal ? [assetFrom, assetTo] : [assetTo, assetFrom], torosAsset = _ref[0], investAsset = _ref[1];
10873
+ iDhedgeEasySwapper = new ethers.utils.Interface(IDhedgeEasySwapper.abi);
10874
+
10875
+ if (!isWithdrawal) {
10876
+ _context5.next = 12;
10877
+ break;
10878
+ }
10879
+
10880
+ _context5.next = 8;
10881
+ return getEasySwapperWithdrawalQuote(pool, torosAsset, investAsset, amountIn);
10882
+
10883
+ case 8:
10884
+ minAmountOut = _context5.sent;
10885
+ return _context5.abrupt("return", iDhedgeEasySwapper.encodeFunctionData("withdraw", [torosAsset, amountIn, investAsset, minAmountOut.mul(10000 - slippage * 100).div(10000)]));
10886
+
10887
+ case 12:
10888
+ _context5.next = 14;
10889
+ return getPoolDepositAsset(pool, torosAsset);
10890
+
10891
+ case 14:
10892
+ depositAsset = _context5.sent;
10893
+
10894
+ if (depositAsset) {
10895
+ _context5.next = 17;
10896
+ break;
10897
+ }
10898
+
10899
+ throw new Error("no deposit assets");
10900
+
10901
+ case 17:
10902
+ _context5.next = 19;
10903
+ return getEasySwapperDepositQuote(pool, torosAsset, investAsset, depositAsset, amountIn);
10904
+
10905
+ case 19:
10906
+ _minAmountOut = _context5.sent;
10907
+ return _context5.abrupt("return", iDhedgeEasySwapper.encodeFunctionData("deposit", [torosAsset, investAsset, amountIn, depositAsset, _minAmountOut.mul(10000 - slippage * 100).div(10000)]));
10908
+
10909
+ case 21:
10910
+ case "end":
10911
+ return _context5.stop();
10912
+ }
10913
+ }
10914
+ }, _callee5);
10915
+ }));
10916
+ return _getEasySwapperTxData.apply(this, arguments);
10917
+ }
10918
+
10919
+ var excludedProtocols = ["OPTIMISM_PMM6"]; //Clipper
10920
+
10921
+ function getOneInchProtocols(_x) {
10922
+ return _getOneInchProtocols.apply(this, arguments);
10923
+ }
10924
+
10925
+ function _getOneInchProtocols() {
10926
+ _getOneInchProtocols = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(chainId) {
10927
+ var response, protocols, filteredProtocols;
10928
+ return runtime_1.wrap(function _callee$(_context) {
10929
+ while (1) {
10930
+ switch (_context.prev = _context.next) {
10931
+ case 0:
10932
+ _context.prev = 0;
10933
+ _context.next = 3;
10934
+ return axios.get("https://api.1inch.io/v4.0/" + chainId + "/liquidity-sources");
10935
+
10936
+ case 3:
10937
+ response = _context.sent;
10938
+ protocols = response.data.protocols.map(function (e) {
10939
+ return e.id;
10940
+ });
10941
+ filteredProtocols = protocols.filter(function (e) {
10942
+ return !excludedProtocols.includes(e);
10943
+ });
10944
+ return _context.abrupt("return", "&protocols=" + filteredProtocols.join(","));
10945
+
10946
+ case 9:
10947
+ _context.prev = 9;
10948
+ _context.t0 = _context["catch"](0);
10949
+ return _context.abrupt("return", "");
10950
+
10951
+ case 12:
10952
+ case "end":
10953
+ return _context.stop();
10954
+ }
10955
+ }
10956
+ }, _callee, null, [[0, 9]]);
10957
+ }));
10958
+ return _getOneInchProtocols.apply(this, arguments);
10959
+ }
10960
+
9327
10961
  var Pool = /*#__PURE__*/function () {
9328
10962
  function Pool(network, signer, poolLogic, mangerLogic, utils, factory) {
9329
10963
  this.network = network;
@@ -9713,7 +11347,7 @@ var Pool = /*#__PURE__*/function () {
9713
11347
  /*#__PURE__*/
9714
11348
  function () {
9715
11349
  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;
11350
+ var swapTxData, chainId, protocols, apiUrl, response, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
9717
11351
  return runtime_1.wrap(function _callee9$(_context9) {
9718
11352
  while (1) {
9719
11353
  switch (_context9.prev = _context9.next) {
@@ -9726,73 +11360,73 @@ var Pool = /*#__PURE__*/function () {
9726
11360
  options = null;
9727
11361
  }
9728
11362
 
9729
- if (!(dapp === Dapp.ONEINCH)) {
9730
- _context9.next = 11;
9731
- break;
9732
- }
11363
+ _context9.t0 = dapp;
11364
+ _context9.next = _context9.t0 === Dapp.ONEINCH ? 5 : _context9.t0 === Dapp.BALANCER ? 15 : _context9.t0 === Dapp.SYNTHETIX ? 19 : _context9.t0 === Dapp.TOROS ? 26 : 30;
11365
+ break;
9733
11366
 
11367
+ case 5:
9734
11368
  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;
11369
+ _context9.next = 8;
11370
+ return getOneInchProtocols(chainId);
11371
+
11372
+ case 8:
11373
+ protocols = _context9.sent;
11374
+ 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;
11375
+ _context9.next = 12;
9737
11376
  return axios.get(apiUrl);
9738
11377
 
9739
- case 7:
11378
+ case 12:
9740
11379
  response = _context9.sent;
9741
11380
  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
- }
11381
+ return _context9.abrupt("break", 35);
9750
11382
 
9751
- _context9.next = 14;
11383
+ case 15:
11384
+ _context9.next = 17;
9752
11385
  return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
9753
11386
 
9754
- case 14:
9755
- swapTxData = _context9.sent;
9756
- _context9.next = 31;
9757
- break;
9758
-
9759
11387
  case 17:
9760
- if (!(dapp === Dapp.SYNTHETIX)) {
9761
- _context9.next = 26;
9762
- break;
9763
- }
11388
+ swapTxData = _context9.sent;
11389
+ return _context9.abrupt("break", 35);
9764
11390
 
11391
+ case 19:
9765
11392
  iSynthetix = new ethers.utils.Interface(ISynthetix.abi);
9766
11393
  assets = [assetFrom, assetTo].map(function (asset) {
9767
11394
  return ethers.utils.formatBytes32String(asset);
9768
11395
  });
9769
- _context9.next = 22;
11396
+ _context9.next = 23;
9770
11397
  return this.factory.owner();
9771
11398
 
9772
- case 22:
11399
+ case 23:
9773
11400
  daoAddress = _context9.sent;
9774
11401
  swapTxData = iSynthetix.encodeFunctionData(Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
9775
- _context9.next = 31;
9776
- break;
11402
+ return _context9.abrupt("break", 35);
9777
11403
 
9778
11404
  case 26:
11405
+ _context9.next = 28;
11406
+ return getEasySwapperTxData(this, assetFrom, assetTo, ethers.BigNumber.from(amountIn), slippage);
11407
+
11408
+ case 28:
11409
+ swapTxData = _context9.sent;
11410
+ return _context9.abrupt("break", 35);
11411
+
11412
+ case 30:
9779
11413
  iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
9780
- _context9.next = 29;
11414
+ _context9.next = 33;
9781
11415
  return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
9782
11416
 
9783
- case 29:
11417
+ case 33:
9784
11418
  minAmountOut = _context9.sent;
9785
11419
  swapTxData = iUniswapV2Router.encodeFunctionData(Transaction.SWAP, [amountIn, minAmountOut, [assetFrom, assetTo], this.address, deadline]);
9786
11420
 
9787
- case 31:
9788
- _context9.next = 33;
11421
+ case 35:
11422
+ _context9.next = 37;
9789
11423
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], swapTxData, options);
9790
11424
 
9791
- case 33:
11425
+ case 37:
9792
11426
  tx = _context9.sent;
9793
11427
  return _context9.abrupt("return", tx);
9794
11428
 
9795
- case 35:
11429
+ case 39:
9796
11430
  case "end":
9797
11431
  return _context9.stop();
9798
11432
  }
@@ -10671,7 +12305,7 @@ var Pool = /*#__PURE__*/function () {
10671
12305
  options = null;
10672
12306
  }
10673
12307
 
10674
- if (!((!minPrice || !maxPrice) && (!minTick || !maxTick))) {
12308
+ if (!((minPrice === null || maxPrice === null) && (minTick === null || maxTick === null))) {
10675
12309
  _context27.next = 3;
10676
12310
  break;
10677
12311
  }
@@ -11005,7 +12639,7 @@ var Pool = /*#__PURE__*/function () {
11005
12639
  return Pool;
11006
12640
  }();
11007
12641
 
11008
- var abi$g = [
12642
+ var abi$j = [
11009
12643
  {
11010
12644
  inputs: [
11011
12645
  {
@@ -11229,10 +12863,10 @@ var abi$g = [
11229
12863
  }
11230
12864
  ];
11231
12865
  var UniswapV2Factory = {
11232
- abi: abi$g
12866
+ abi: abi$j
11233
12867
  };
11234
12868
 
11235
- var abi$h = [
12869
+ var abi$k = [
11236
12870
  {
11237
12871
  anonymous: false,
11238
12872
  inputs: [
@@ -11976,7 +13610,7 @@ var evm = {
11976
13610
  }
11977
13611
  };
11978
13612
  var UniswapV2Pair = {
11979
- abi: abi$h,
13613
+ abi: abi$k,
11980
13614
  evm: evm,
11981
13615
  "interface": [
11982
13616
  {
@@ -12707,7 +14341,7 @@ var UniswapV2Pair = {
12707
14341
  ]
12708
14342
  };
12709
14343
 
12710
- var abi$i = [
14344
+ var abi$l = [
12711
14345
  {
12712
14346
  inputs: [
12713
14347
  {
@@ -13902,7 +15536,7 @@ var abi$i = [
13902
15536
  }
13903
15537
  ];
13904
15538
  var IBalancerV2Vault = {
13905
- abi: abi$i
15539
+ abi: abi$l
13906
15540
  };
13907
15541
 
13908
15542
  var Utils = /*#__PURE__*/function () {
@@ -14440,7 +16074,17 @@ var Dhedge = /*#__PURE__*/function () {
14440
16074
  }
14441
16075
 
14442
16076
  return loadPool;
14443
- }();
16077
+ }()
16078
+ /**
16079
+ * Check if pool address is valid
16080
+ * @param {string} address Pool address
16081
+ * @returns {boolean} Is valid pool address
16082
+ */
16083
+ ;
16084
+
16085
+ _proto.validatePool = function validatePool(address) {
16086
+ return this.factory.isPool(address);
16087
+ };
14444
16088
 
14445
16089
  return Dhedge;
14446
16090
  }();