@dhedge/v2-sdk 2.2.1 → 2.2.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.
- package/dist/config.d.ts +3 -0
- package/dist/entities/pool.d.ts +3 -1
- package/dist/services/dytm/index.d.ts +7 -0
- package/dist/services/toros/completeWithdrawal.d.ts +2 -2
- package/dist/services/toros/easySwapper.d.ts +4 -1
- package/dist/services/toros/initWithdrawal.d.ts +4 -1
- package/dist/types.d.ts +1 -0
- package/dist/v2-sdk.cjs.development.js +474 -123
- package/dist/v2-sdk.cjs.development.js.map +1 -1
- package/dist/v2-sdk.cjs.production.min.js +1 -1
- package/dist/v2-sdk.cjs.production.min.js.map +1 -1
- package/dist/v2-sdk.esm.js +474 -123
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/dytm/IOffice.json +191 -0
- package/src/config.ts +20 -2
- package/src/entities/pool.ts +66 -32
- package/src/services/dytm/index.ts +77 -0
- package/src/services/toros/completeWithdrawal.ts +23 -7
- package/src/services/toros/easySwapper.ts +9 -7
- package/src/services/toros/initWithdrawal.ts +10 -6
- package/src/test/dytm.test.ts +241 -0
- package/src/types.ts +1 -0
|
@@ -4592,6 +4592,7 @@ var ManagerLogic = {
|
|
|
4592
4592
|
Dapp["ODOS"] = "odos";
|
|
4593
4593
|
Dapp["PENDLE"] = "pendle";
|
|
4594
4594
|
Dapp["KYBERSWAP"] = "kyberswap";
|
|
4595
|
+
Dapp["DYTM"] = "dytm";
|
|
4595
4596
|
Dapp["HYPERLIQUID"] = "hyperliquid";
|
|
4596
4597
|
Dapp["COWSWAP"] = "cowswap";
|
|
4597
4598
|
Dapp["ONDO"] = "ondo";
|
|
@@ -4618,7 +4619,7 @@ var ManagerLogic = {
|
|
|
4618
4619
|
Transaction["REMOVE_LIQUIDITY_UNSTAKE"] = "removeLiquidityAndUnstake";
|
|
4619
4620
|
})(exports.Transaction || (exports.Transaction = {}));
|
|
4620
4621
|
|
|
4621
|
-
var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _Network$BASE, _Network$ETHEREUM, _Network$PLASMA, _Network$HYPERLIQUID, _routerAddress, _gpv2SettlementAddres, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _Network$OPTIMISM2, _Network$ARBITRUM2, _Network$BASE2, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM3, _Network$ARBITRUM3, _Network$BASE3, _Network$ETHEREUM2, _Network$PLASMA2, _aaveAddressProvider, _Network$POLYGON5, _Network$OPTIMISM4, _Network$ARBITRUM4, _Network$BASE4, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress, _lyraNetworkMap, _flatMoneyContractAdd, _limitOrderAddress, _OdosSwapFeeRecipient;
|
|
4622
|
+
var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _Network$BASE, _Network$ETHEREUM, _Network$PLASMA, _Network$HYPERLIQUID, _routerAddress, _gpv2SettlementAddres, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _Network$OPTIMISM2, _Network$ARBITRUM2, _Network$BASE2, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM3, _Network$ARBITRUM3, _Network$BASE3, _Network$ETHEREUM2, _Network$PLASMA2, _aaveAddressProvider, _Network$POLYGON5, _Network$OPTIMISM4, _Network$ARBITRUM4, _Network$BASE4, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress, _lyraNetworkMap, _flatMoneyContractAdd, _limitOrderAddress, _OdosSwapFeeRecipient, _dytmContractAddresse;
|
|
4622
4623
|
|
|
4623
4624
|
require("dotenv").config();
|
|
4624
4625
|
/** dHEDGE PoolFactory proxy address per network — used by `Dhedge.createPool` and pool lookups. */
|
|
@@ -4627,7 +4628,7 @@ require("dotenv").config();
|
|
|
4627
4628
|
var factoryAddress = (_factoryAddress = {}, _factoryAddress[exports.Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[exports.Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress[exports.Network.ARBITRUM] = "0xfffb5fb14606eb3a548c113026355020ddf27535", _factoryAddress[exports.Network.BASE] = "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F", _factoryAddress[exports.Network.ETHEREUM] = "0x96D33bCF84DdE326014248E2896F79bbb9c13D6d", _factoryAddress[exports.Network.PLASMA] = "0xAec4975Fc8ad911464D2948D771488b30F6eEE87", _factoryAddress[exports.Network.HYPERLIQUID] = "0xe91505e2ab653dd128c71e9690eeefd28cc5b333", _factoryAddress);
|
|
4628
4629
|
/** Router/spender address for each (network, Dapp). Target of `pool.approve`/`pool.trade`. */
|
|
4629
4630
|
|
|
4630
|
-
var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[exports.Dapp.TOROS] = "0x45b90480D6F643dE2f128db091A357C3c90399f2", _Network$POLYGON[exports.Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$POLYGON[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$POLYGON[exports.Dapp.COWSWAP] = "0x893223Be4e941fAA8A8DB93D0C097fCac37801ce", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$OPTIMISM[exports.Dapp.TOROS] = "0x2Ed1bd7f66e47113672f3870308b5E867C5bb743", _Network$OPTIMISM[exports.Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[exports.Dapp.VELODROMEV2] = "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858", _Network$OPTIMISM[exports.Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[exports.Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM[exports.Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$OPTIMISM[exports.Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$OPTIMISM[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$OPTIMISM), _routerAddress[exports.Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$ARBITRUM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$ARBITRUM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM[exports.Dapp.TOROS] = "0xA5679C4272A056Bb83f039961fae7D99C48529F5", _Network$ARBITRUM[exports.Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$ARBITRUM[exports.Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$ARBITRUM[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$ARBITRUM), _routerAddress[exports.Network.BASE] = (_Network$BASE = {}, _Network$BASE[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$BASE[exports.Dapp.AERODROME] = "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43", _Network$BASE[exports.Dapp.AAVEV3] = "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5", _Network$BASE[exports.Dapp.TOROS] = "0xf067575Eb60c7587C11e867907AA7284833704d1", _Network$BASE[exports.Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$BASE[exports.Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$BASE[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$BASE), _routerAddress[exports.Network.ETHEREUM] = (_Network$ETHEREUM = {}, _Network$ETHEREUM[exports.Dapp.AAVEV3] = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", _Network$ETHEREUM[exports.Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$ETHEREUM[exports.Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$ETHEREUM[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$ETHEREUM[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$ETHEREUM[exports.Dapp.ONDO] = "0xde41399145F23936b03dD1474eC16c1519c0DC2a", _Network$ETHEREUM), _routerAddress[exports.Network.PLASMA] = (_Network$PLASMA = {}, _Network$PLASMA[exports.Dapp.AAVEV3] = "0x925a2A7214Ed92428B5b1B090F80b25700095e12", _Network$PLASMA[exports.Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$PLASMA[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$PLASMA), _routerAddress[exports.Network.HYPERLIQUID] = (_Network$HYPERLIQUID = {}, _Network$HYPERLIQUID[exports.Dapp.HYPERLIQUID] = "0x6b9e773128f453f5c2c60935ee2de2cbc5390a24", _Network$HYPERLIQUID), _routerAddress);
|
|
4631
|
+
var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[exports.Dapp.TOROS] = "0x45b90480D6F643dE2f128db091A357C3c90399f2", _Network$POLYGON[exports.Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$POLYGON[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$POLYGON[exports.Dapp.COWSWAP] = "0x893223Be4e941fAA8A8DB93D0C097fCac37801ce", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$OPTIMISM[exports.Dapp.TOROS] = "0x2Ed1bd7f66e47113672f3870308b5E867C5bb743", _Network$OPTIMISM[exports.Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[exports.Dapp.VELODROMEV2] = "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858", _Network$OPTIMISM[exports.Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[exports.Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM[exports.Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$OPTIMISM[exports.Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$OPTIMISM[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$OPTIMISM), _routerAddress[exports.Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$ARBITRUM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$ARBITRUM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM[exports.Dapp.TOROS] = "0xA5679C4272A056Bb83f039961fae7D99C48529F5", _Network$ARBITRUM[exports.Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$ARBITRUM[exports.Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$ARBITRUM[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$ARBITRUM[exports.Dapp.DYTM] = "0x0fF1CEE337d7af25eEF4c1a7A2CaF83f98d80001", _Network$ARBITRUM), _routerAddress[exports.Network.BASE] = (_Network$BASE = {}, _Network$BASE[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$BASE[exports.Dapp.AERODROME] = "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43", _Network$BASE[exports.Dapp.AAVEV3] = "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5", _Network$BASE[exports.Dapp.TOROS] = "0xf067575Eb60c7587C11e867907AA7284833704d1", _Network$BASE[exports.Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$BASE[exports.Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$BASE[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$BASE), _routerAddress[exports.Network.ETHEREUM] = (_Network$ETHEREUM = {}, _Network$ETHEREUM[exports.Dapp.AAVEV3] = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", _Network$ETHEREUM[exports.Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$ETHEREUM[exports.Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$ETHEREUM[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$ETHEREUM[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$ETHEREUM[exports.Dapp.ONDO] = "0xde41399145F23936b03dD1474eC16c1519c0DC2a", _Network$ETHEREUM[exports.Dapp.DYTM] = "0x0ff1ce991105DD1a8e26bC8a974Fd0154398Df0f", _Network$ETHEREUM), _routerAddress[exports.Network.PLASMA] = (_Network$PLASMA = {}, _Network$PLASMA[exports.Dapp.AAVEV3] = "0x925a2A7214Ed92428B5b1B090F80b25700095e12", _Network$PLASMA[exports.Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$PLASMA[exports.Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$PLASMA), _routerAddress[exports.Network.HYPERLIQUID] = (_Network$HYPERLIQUID = {}, _Network$HYPERLIQUID[exports.Dapp.HYPERLIQUID] = "0x6b9e773128f453f5c2c60935ee2de2cbc5390a24", _Network$HYPERLIQUID), _routerAddress);
|
|
4631
4632
|
/** CoW Protocol GPv2Settlement address per network (where pre-signed orders are submitted). */
|
|
4632
4633
|
|
|
4633
4634
|
var gpv2SettlementAddress = (_gpv2SettlementAddres = {}, _gpv2SettlementAddres[exports.Network.POLYGON] = "0x9008D19f58AAbD9eD0D60971565AA8510560ab41", _gpv2SettlementAddres);
|
|
@@ -4681,6 +4682,11 @@ var flatMoneyContractAddresses = (_flatMoneyContractAdd = {}, _flatMoneyContract
|
|
|
4681
4682
|
|
|
4682
4683
|
var limitOrderAddress = (_limitOrderAddress = {}, _limitOrderAddress[exports.Network.POLYGON] = "0xB71410736d2C8F2DAf30dA9D332dA10534d2624d", _limitOrderAddress[exports.Network.OPTIMISM] = "0x3bFE2a472d2964Ea4070725b7Fb0A868b3f08b63", _limitOrderAddress[exports.Network.ARBITRUM] = "0x26a687e8244f1866E9Aa2D400c8b9957Aa8e6Ad4", _limitOrderAddress[exports.Network.BASE] = "0xFcBEc28c43E356693971a24bf3F2Fd7D965E2ebA", _limitOrderAddress[exports.Network.ETHEREUM] = "0x95B19De479bc693721cab39Da98FfECE062f5Ea4", _limitOrderAddress[exports.Network.PLASMA] = "", _limitOrderAddress[exports.Network.HYPERLIQUID] = "", _limitOrderAddress);
|
|
4683
4684
|
var OdosSwapFeeRecipient = (_OdosSwapFeeRecipient = {}, _OdosSwapFeeRecipient[exports.Network.POLYGON] = "0x090e7fbD87A673eE3D0B6ccACf0e1d94fB90DA59", _OdosSwapFeeRecipient[exports.Network.OPTIMISM] = "0x813123A13d01d3F07d434673Fdc89cBBA523f14d", _OdosSwapFeeRecipient[exports.Network.ARBITRUM] = "0xfbD2B4216f422DC1eEe1Cff4Fb64B726F099dEF5", _OdosSwapFeeRecipient[exports.Network.BASE] = "0x5619AD05b0253a7e647Bd2E4C01c7f40CEaB0879", _OdosSwapFeeRecipient[exports.Network.ETHEREUM] = "0xfbD2B4216f422DC1eEe1Cff4Fb64B726F099dEF5", _OdosSwapFeeRecipient[exports.Network.PLASMA] = "", _OdosSwapFeeRecipient[exports.Network.HYPERLIQUID] = "", _OdosSwapFeeRecipient);
|
|
4685
|
+
var dytmContractAddresses = (_dytmContractAddresse = {}, _dytmContractAddresse[exports.Network.ARBITRUM] = {
|
|
4686
|
+
Periphery: "0x1FBe7Bb394BE505C08e9ee419Dd166c71004e51B"
|
|
4687
|
+
}, _dytmContractAddresse[exports.Network.ETHEREUM] = {
|
|
4688
|
+
Periphery: "0xbc632a1A4bD878D7e7D14ea6CfE0DDe3Fc291D1a"
|
|
4689
|
+
}, _dytmContractAddresse);
|
|
4684
4690
|
|
|
4685
4691
|
var abi$3 = [
|
|
4686
4692
|
{
|
|
@@ -12212,7 +12218,11 @@ var getInitWithdrawalTxData = /*#__PURE__*/function () {
|
|
|
12212
12218
|
case 2:
|
|
12213
12219
|
complexAssetsData = _context7.sent;
|
|
12214
12220
|
iEasySwapperV2 = new ethers.ethers.utils.Interface(IEasySwapperV2);
|
|
12215
|
-
return _context7.abrupt("return",
|
|
12221
|
+
return _context7.abrupt("return", {
|
|
12222
|
+
swapTxData: iEasySwapperV2.encodeFunctionData("initWithdrawal", [torosAsset, amountIn, complexAssetsData]),
|
|
12223
|
+
minAmountOut: null // not be used when building multicall tx data
|
|
12224
|
+
|
|
12225
|
+
});
|
|
12216
12226
|
|
|
12217
12227
|
case 5:
|
|
12218
12228
|
case "end":
|
|
@@ -12328,7 +12338,7 @@ function getEasySwapperTxData(_x10, _x11, _x12, _x13, _x14) {
|
|
|
12328
12338
|
function _getEasySwapperTxData() {
|
|
12329
12339
|
_getEasySwapperTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(pool, assetFrom, assetTo, amountIn, slippage // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12330
12340
|
) {
|
|
12331
|
-
var isWithdrawal, _ref, torosAsset, investAsset, iEasySwapperV2, depositAsset, minAmountOut;
|
|
12341
|
+
var isWithdrawal, _ref, torosAsset, investAsset, iEasySwapperV2, depositAsset, minAmountOut, _minAmountOut;
|
|
12332
12342
|
|
|
12333
12343
|
return runtime_1.wrap(function _callee4$(_context4) {
|
|
12334
12344
|
while (1) {
|
|
@@ -12377,9 +12387,13 @@ function _getEasySwapperTxData() {
|
|
|
12377
12387
|
|
|
12378
12388
|
case 18:
|
|
12379
12389
|
minAmountOut = _context4.sent;
|
|
12380
|
-
|
|
12390
|
+
_minAmountOut = minAmountOut.mul(10000 - slippage * 100).div(10000);
|
|
12391
|
+
return _context4.abrupt("return", {
|
|
12392
|
+
swapTxData: iEasySwapperV2.encodeFunctionData("depositWithCustomCooldown", [torosAsset, depositAsset, amountIn, _minAmountOut]),
|
|
12393
|
+
minAmountOut: _minAmountOut
|
|
12394
|
+
});
|
|
12381
12395
|
|
|
12382
|
-
case
|
|
12396
|
+
case 21:
|
|
12383
12397
|
case "end":
|
|
12384
12398
|
return _context4.stop();
|
|
12385
12399
|
}
|
|
@@ -27890,24 +27904,32 @@ var getSwapWithdrawData = /*#__PURE__*/function () {
|
|
|
27890
27904
|
}();
|
|
27891
27905
|
|
|
27892
27906
|
var createCompleteWithdrawalTxArguments = /*#__PURE__*/function () {
|
|
27893
|
-
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(pool, receiveToken, slippage) {
|
|
27894
|
-
var easySwapper, trackedAssets, swapTrackedAssets, assetHandlerAddress, assetHandler, receiveTokenPriceD18, receiveTokenErc20, receiveTokenDecimals, tAssetInfos, swapDestMinDestAmount, withdrawalVaultAddress, balanceOfReceiveToken, estimatedMinReceiveAmount, swapData;
|
|
27907
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(pool, receiveToken, slippage, _trackedAssets) {
|
|
27908
|
+
var easySwapper, trackedAssets, swapTrackedAssets, assetHandlerAddress, assetHandler, receiveTokenPriceD18, receiveTokenErc20, receiveTokenDecimals, tAssetInfos, swapDestMinDestAmount, withdrawalVaultAddress, balanceOfReceiveToken, trackedAsset, estimatedMinReceiveAmount, swapData;
|
|
27895
27909
|
return runtime_1.wrap(function _callee3$(_context5) {
|
|
27896
27910
|
while (1) {
|
|
27897
27911
|
switch (_context5.prev = _context5.next) {
|
|
27898
27912
|
case 0:
|
|
27899
27913
|
easySwapper = new ethers.ethers.Contract(routerAddress[pool.network][exports.Dapp.TOROS], IEasySwapperV2, pool.signer);
|
|
27900
|
-
|
|
27914
|
+
trackedAssets = _trackedAssets;
|
|
27915
|
+
|
|
27916
|
+
if (!(trackedAssets.length === 0)) {
|
|
27917
|
+
_context5.next = 6;
|
|
27918
|
+
break;
|
|
27919
|
+
}
|
|
27920
|
+
|
|
27921
|
+
_context5.next = 5;
|
|
27901
27922
|
return easySwapper.getTrackedAssets(pool.address);
|
|
27902
27923
|
|
|
27903
|
-
case
|
|
27924
|
+
case 5:
|
|
27904
27925
|
trackedAssets = _context5.sent;
|
|
27905
27926
|
|
|
27927
|
+
case 6:
|
|
27906
27928
|
if (!(trackedAssets.length === 0 || trackedAssets.every(function (_ref3) {
|
|
27907
27929
|
var token = _ref3.token;
|
|
27908
27930
|
return token.toLowerCase() === receiveToken.toLowerCase();
|
|
27909
27931
|
}))) {
|
|
27910
|
-
_context5.next =
|
|
27932
|
+
_context5.next = 8;
|
|
27911
27933
|
break;
|
|
27912
27934
|
}
|
|
27913
27935
|
|
|
@@ -27917,35 +27939,35 @@ var createCompleteWithdrawalTxArguments = /*#__PURE__*/function () {
|
|
|
27917
27939
|
estimatedMinReceiveAmount: null
|
|
27918
27940
|
});
|
|
27919
27941
|
|
|
27920
|
-
case
|
|
27942
|
+
case 8:
|
|
27921
27943
|
swapTrackedAssets = trackedAssets.filter(function (_ref4) {
|
|
27922
27944
|
var token = _ref4.token;
|
|
27923
27945
|
return token.toLowerCase() !== receiveToken.toLowerCase();
|
|
27924
27946
|
});
|
|
27925
|
-
_context5.next =
|
|
27947
|
+
_context5.next = 11;
|
|
27926
27948
|
return pool.factory.callStatic.getAssetHandler();
|
|
27927
27949
|
|
|
27928
|
-
case
|
|
27950
|
+
case 11:
|
|
27929
27951
|
assetHandlerAddress = _context5.sent;
|
|
27930
27952
|
assetHandler = new ethers.ethers.Contract(assetHandlerAddress, AssetHandlerAbi.abi, pool.signer);
|
|
27931
27953
|
_context5.t0 = BigNumber__default;
|
|
27932
|
-
_context5.next =
|
|
27954
|
+
_context5.next = 16;
|
|
27933
27955
|
return assetHandler.getUSDPrice(receiveToken);
|
|
27934
27956
|
|
|
27935
|
-
case
|
|
27957
|
+
case 16:
|
|
27936
27958
|
_context5.t1 = _context5.sent.toString();
|
|
27937
27959
|
receiveTokenPriceD18 = new _context5.t0(_context5.t1);
|
|
27938
|
-
_context5.next =
|
|
27960
|
+
_context5.next = 20;
|
|
27939
27961
|
return new ethers.ethers.Contract(receiveToken, IERC20.abi, pool.signer);
|
|
27940
27962
|
|
|
27941
|
-
case
|
|
27963
|
+
case 20:
|
|
27942
27964
|
receiveTokenErc20 = _context5.sent;
|
|
27943
|
-
_context5.next =
|
|
27965
|
+
_context5.next = 23;
|
|
27944
27966
|
return receiveTokenErc20.decimals();
|
|
27945
27967
|
|
|
27946
|
-
case
|
|
27968
|
+
case 23:
|
|
27947
27969
|
receiveTokenDecimals = _context5.sent;
|
|
27948
|
-
_context5.next =
|
|
27970
|
+
_context5.next = 26;
|
|
27949
27971
|
return Promise.all(swapTrackedAssets.map( /*#__PURE__*/function () {
|
|
27950
27972
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(swapTAsset) {
|
|
27951
27973
|
var swapTAssetPriceD18, swapTAssetTokenErc20, swapTAssetDecimals, tokenBalanceBN, estimatedValueToSwapD0, adjustedSlippage, estimatedMinReceiveAmount;
|
|
@@ -27997,34 +28019,47 @@ var createCompleteWithdrawalTxArguments = /*#__PURE__*/function () {
|
|
|
27997
28019
|
}, _callee2);
|
|
27998
28020
|
}));
|
|
27999
28021
|
|
|
28000
|
-
return function (
|
|
28022
|
+
return function (_x9) {
|
|
28001
28023
|
return _ref5.apply(this, arguments);
|
|
28002
28024
|
};
|
|
28003
28025
|
}()));
|
|
28004
28026
|
|
|
28005
|
-
case
|
|
28027
|
+
case 26:
|
|
28006
28028
|
tAssetInfos = _context5.sent;
|
|
28007
28029
|
swapDestMinDestAmount = tAssetInfos.reduce(function (acc, _ref6) {
|
|
28008
28030
|
var estimatedMinReceiveAmount = _ref6.estimatedMinReceiveAmount;
|
|
28009
28031
|
return acc.plus(estimatedMinReceiveAmount);
|
|
28010
28032
|
}, new BigNumber__default(0));
|
|
28011
|
-
_context5.next =
|
|
28033
|
+
_context5.next = 30;
|
|
28012
28034
|
return easySwapper.withdrawalContracts(pool.address);
|
|
28013
28035
|
|
|
28014
|
-
case
|
|
28036
|
+
case 30:
|
|
28015
28037
|
withdrawalVaultAddress = _context5.sent;
|
|
28016
|
-
_context5.next =
|
|
28038
|
+
_context5.next = 33;
|
|
28017
28039
|
return receiveTokenErc20.balanceOf(withdrawalVaultAddress);
|
|
28018
28040
|
|
|
28019
|
-
case
|
|
28041
|
+
case 33:
|
|
28020
28042
|
balanceOfReceiveToken = _context5.sent;
|
|
28021
|
-
|
|
28043
|
+
|
|
28044
|
+
if (trackedAssets.length !== 0) {
|
|
28045
|
+
// finds the receiveTokenErc20's balance inside trackedAssets
|
|
28046
|
+
trackedAsset = trackedAssets.find(function (_ref7) {
|
|
28047
|
+
var token = _ref7.token;
|
|
28048
|
+
return token.toLowerCase() === receiveToken.toLowerCase();
|
|
28049
|
+
});
|
|
28050
|
+
|
|
28051
|
+
if (trackedAsset) {
|
|
28052
|
+
balanceOfReceiveToken = balanceOfReceiveToken.add(trackedAsset.balance);
|
|
28053
|
+
}
|
|
28054
|
+
} // complete withdraw _expectedDestTokenAmount
|
|
28055
|
+
|
|
28056
|
+
|
|
28022
28057
|
estimatedMinReceiveAmount = swapDestMinDestAmount.plus(balanceOfReceiveToken.toString());
|
|
28023
|
-
_context5.next =
|
|
28024
|
-
return getSwapWithdrawData(pool, tAssetInfos.map(function (
|
|
28025
|
-
var token =
|
|
28026
|
-
balance =
|
|
28027
|
-
slippage =
|
|
28058
|
+
_context5.next = 38;
|
|
28059
|
+
return getSwapWithdrawData(pool, tAssetInfos.map(function (_ref8) {
|
|
28060
|
+
var token = _ref8.token,
|
|
28061
|
+
balance = _ref8.balance,
|
|
28062
|
+
slippage = _ref8.slippage;
|
|
28028
28063
|
return {
|
|
28029
28064
|
token: token,
|
|
28030
28065
|
balance: balance,
|
|
@@ -28032,7 +28067,7 @@ var createCompleteWithdrawalTxArguments = /*#__PURE__*/function () {
|
|
|
28032
28067
|
};
|
|
28033
28068
|
}), receiveToken, swapDestMinDestAmount);
|
|
28034
28069
|
|
|
28035
|
-
case
|
|
28070
|
+
case 38:
|
|
28036
28071
|
swapData = _context5.sent;
|
|
28037
28072
|
return _context5.abrupt("return", {
|
|
28038
28073
|
isSwapNeeded: true,
|
|
@@ -28040,7 +28075,7 @@ var createCompleteWithdrawalTxArguments = /*#__PURE__*/function () {
|
|
|
28040
28075
|
estimatedMinReceiveAmount: estimatedMinReceiveAmount.toFixed(0)
|
|
28041
28076
|
});
|
|
28042
28077
|
|
|
28043
|
-
case
|
|
28078
|
+
case 40:
|
|
28044
28079
|
case "end":
|
|
28045
28080
|
return _context5.stop();
|
|
28046
28081
|
}
|
|
@@ -28048,19 +28083,19 @@ var createCompleteWithdrawalTxArguments = /*#__PURE__*/function () {
|
|
|
28048
28083
|
}, _callee3);
|
|
28049
28084
|
}));
|
|
28050
28085
|
|
|
28051
|
-
return function createCompleteWithdrawalTxArguments(_x5, _x6, _x7) {
|
|
28086
|
+
return function createCompleteWithdrawalTxArguments(_x5, _x6, _x7, _x8) {
|
|
28052
28087
|
return _ref2.apply(this, arguments);
|
|
28053
28088
|
};
|
|
28054
28089
|
}();
|
|
28055
28090
|
var getCompleteWithdrawalTxData = /*#__PURE__*/function () {
|
|
28056
|
-
var
|
|
28091
|
+
var _ref9 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(pool, receiveToken, slippage, useOnChainSwap, trackedAssets) {
|
|
28057
28092
|
var completeWithdrawTxArguments, isSwapNeeded, isOffchainSwap, iEasySwapperV2;
|
|
28058
28093
|
return runtime_1.wrap(function _callee4$(_context6) {
|
|
28059
28094
|
while (1) {
|
|
28060
28095
|
switch (_context6.prev = _context6.next) {
|
|
28061
28096
|
case 0:
|
|
28062
28097
|
_context6.next = 2;
|
|
28063
|
-
return createCompleteWithdrawalTxArguments(pool, receiveToken, slippage);
|
|
28098
|
+
return createCompleteWithdrawalTxArguments(pool, receiveToken, slippage, trackedAssets);
|
|
28064
28099
|
|
|
28065
28100
|
case 2:
|
|
28066
28101
|
completeWithdrawTxArguments = _context6.sent;
|
|
@@ -28086,8 +28121,275 @@ var getCompleteWithdrawalTxData = /*#__PURE__*/function () {
|
|
|
28086
28121
|
}, _callee4);
|
|
28087
28122
|
}));
|
|
28088
28123
|
|
|
28089
|
-
return function getCompleteWithdrawalTxData(
|
|
28090
|
-
return
|
|
28124
|
+
return function getCompleteWithdrawalTxData(_x10, _x11, _x12, _x13, _x14) {
|
|
28125
|
+
return _ref9.apply(this, arguments);
|
|
28126
|
+
};
|
|
28127
|
+
}();
|
|
28128
|
+
|
|
28129
|
+
var IOffice = [
|
|
28130
|
+
{
|
|
28131
|
+
inputs: [
|
|
28132
|
+
{
|
|
28133
|
+
components: [
|
|
28134
|
+
{
|
|
28135
|
+
internalType: "AccountId",
|
|
28136
|
+
name: "account",
|
|
28137
|
+
type: "uint256"
|
|
28138
|
+
},
|
|
28139
|
+
{
|
|
28140
|
+
internalType: "ReserveKey",
|
|
28141
|
+
name: "key",
|
|
28142
|
+
type: "uint248"
|
|
28143
|
+
},
|
|
28144
|
+
{
|
|
28145
|
+
internalType: "address",
|
|
28146
|
+
name: "receiver",
|
|
28147
|
+
type: "address"
|
|
28148
|
+
},
|
|
28149
|
+
{
|
|
28150
|
+
internalType: "uint256",
|
|
28151
|
+
name: "assets",
|
|
28152
|
+
type: "uint256"
|
|
28153
|
+
},
|
|
28154
|
+
{
|
|
28155
|
+
internalType: "bytes",
|
|
28156
|
+
name: "extraData",
|
|
28157
|
+
type: "bytes"
|
|
28158
|
+
}
|
|
28159
|
+
],
|
|
28160
|
+
internalType: "struct BorrowParams",
|
|
28161
|
+
name: "params",
|
|
28162
|
+
type: "tuple"
|
|
28163
|
+
}
|
|
28164
|
+
],
|
|
28165
|
+
name: "borrow",
|
|
28166
|
+
outputs: [
|
|
28167
|
+
{
|
|
28168
|
+
internalType: "uint256",
|
|
28169
|
+
name: "debtShares",
|
|
28170
|
+
type: "uint256"
|
|
28171
|
+
}
|
|
28172
|
+
],
|
|
28173
|
+
stateMutability: "nonpayable",
|
|
28174
|
+
type: "function"
|
|
28175
|
+
},
|
|
28176
|
+
{
|
|
28177
|
+
inputs: [
|
|
28178
|
+
{
|
|
28179
|
+
components: [
|
|
28180
|
+
{
|
|
28181
|
+
internalType: "AccountId",
|
|
28182
|
+
name: "account",
|
|
28183
|
+
type: "uint256"
|
|
28184
|
+
},
|
|
28185
|
+
{
|
|
28186
|
+
internalType: "ReserveKey",
|
|
28187
|
+
name: "key",
|
|
28188
|
+
type: "uint248"
|
|
28189
|
+
},
|
|
28190
|
+
{
|
|
28191
|
+
internalType: "enum TokenType",
|
|
28192
|
+
name: "withCollateralType",
|
|
28193
|
+
type: "uint8"
|
|
28194
|
+
},
|
|
28195
|
+
{
|
|
28196
|
+
internalType: "uint256",
|
|
28197
|
+
name: "assets",
|
|
28198
|
+
type: "uint256"
|
|
28199
|
+
},
|
|
28200
|
+
{
|
|
28201
|
+
internalType: "uint256",
|
|
28202
|
+
name: "shares",
|
|
28203
|
+
type: "uint256"
|
|
28204
|
+
},
|
|
28205
|
+
{
|
|
28206
|
+
internalType: "bytes",
|
|
28207
|
+
name: "extraData",
|
|
28208
|
+
type: "bytes"
|
|
28209
|
+
}
|
|
28210
|
+
],
|
|
28211
|
+
internalType: "struct RepayParams",
|
|
28212
|
+
name: "params",
|
|
28213
|
+
type: "tuple"
|
|
28214
|
+
}
|
|
28215
|
+
],
|
|
28216
|
+
name: "repay",
|
|
28217
|
+
outputs: [
|
|
28218
|
+
{
|
|
28219
|
+
internalType: "uint256",
|
|
28220
|
+
name: "assetsRepaid",
|
|
28221
|
+
type: "uint256"
|
|
28222
|
+
}
|
|
28223
|
+
],
|
|
28224
|
+
stateMutability: "nonpayable",
|
|
28225
|
+
type: "function"
|
|
28226
|
+
},
|
|
28227
|
+
{
|
|
28228
|
+
inputs: [
|
|
28229
|
+
{
|
|
28230
|
+
components: [
|
|
28231
|
+
{
|
|
28232
|
+
internalType: "AccountId",
|
|
28233
|
+
name: "account",
|
|
28234
|
+
type: "uint256"
|
|
28235
|
+
},
|
|
28236
|
+
{
|
|
28237
|
+
internalType: "uint256",
|
|
28238
|
+
name: "tokenId",
|
|
28239
|
+
type: "uint256"
|
|
28240
|
+
},
|
|
28241
|
+
{
|
|
28242
|
+
internalType: "uint256",
|
|
28243
|
+
name: "assets",
|
|
28244
|
+
type: "uint256"
|
|
28245
|
+
},
|
|
28246
|
+
{
|
|
28247
|
+
internalType: "bytes",
|
|
28248
|
+
name: "extraData",
|
|
28249
|
+
type: "bytes"
|
|
28250
|
+
}
|
|
28251
|
+
],
|
|
28252
|
+
internalType: "struct SupplyParams",
|
|
28253
|
+
name: "params",
|
|
28254
|
+
type: "tuple"
|
|
28255
|
+
}
|
|
28256
|
+
],
|
|
28257
|
+
name: "supply",
|
|
28258
|
+
outputs: [
|
|
28259
|
+
{
|
|
28260
|
+
internalType: "uint256",
|
|
28261
|
+
name: "shares",
|
|
28262
|
+
type: "uint256"
|
|
28263
|
+
}
|
|
28264
|
+
],
|
|
28265
|
+
stateMutability: "nonpayable",
|
|
28266
|
+
type: "function"
|
|
28267
|
+
},
|
|
28268
|
+
{
|
|
28269
|
+
inputs: [
|
|
28270
|
+
{
|
|
28271
|
+
components: [
|
|
28272
|
+
{
|
|
28273
|
+
internalType: "AccountId",
|
|
28274
|
+
name: "account",
|
|
28275
|
+
type: "uint256"
|
|
28276
|
+
},
|
|
28277
|
+
{
|
|
28278
|
+
internalType: "uint256",
|
|
28279
|
+
name: "tokenId",
|
|
28280
|
+
type: "uint256"
|
|
28281
|
+
},
|
|
28282
|
+
{
|
|
28283
|
+
internalType: "address",
|
|
28284
|
+
name: "receiver",
|
|
28285
|
+
type: "address"
|
|
28286
|
+
},
|
|
28287
|
+
{
|
|
28288
|
+
internalType: "uint256",
|
|
28289
|
+
name: "assets",
|
|
28290
|
+
type: "uint256"
|
|
28291
|
+
},
|
|
28292
|
+
{
|
|
28293
|
+
internalType: "uint256",
|
|
28294
|
+
name: "shares",
|
|
28295
|
+
type: "uint256"
|
|
28296
|
+
},
|
|
28297
|
+
{
|
|
28298
|
+
internalType: "bytes",
|
|
28299
|
+
name: "extraData",
|
|
28300
|
+
type: "bytes"
|
|
28301
|
+
}
|
|
28302
|
+
],
|
|
28303
|
+
internalType: "struct WithdrawParams",
|
|
28304
|
+
name: "params",
|
|
28305
|
+
type: "tuple"
|
|
28306
|
+
}
|
|
28307
|
+
],
|
|
28308
|
+
name: "withdraw",
|
|
28309
|
+
outputs: [
|
|
28310
|
+
{
|
|
28311
|
+
internalType: "uint256",
|
|
28312
|
+
name: "assets",
|
|
28313
|
+
type: "uint256"
|
|
28314
|
+
}
|
|
28315
|
+
],
|
|
28316
|
+
stateMutability: "nonpayable",
|
|
28317
|
+
type: "function"
|
|
28318
|
+
}
|
|
28319
|
+
];
|
|
28320
|
+
|
|
28321
|
+
var iOffice = /*#__PURE__*/new ethers.ethers.utils.Interface(IOffice);
|
|
28322
|
+
var getDytmDepositTxData = function getDytmDepositTxData(pool, asset, amount) {
|
|
28323
|
+
return iOffice.encodeFunctionData("supply", [{
|
|
28324
|
+
account: ethers.ethers.BigNumber.from(pool.address),
|
|
28325
|
+
tokenId: asset,
|
|
28326
|
+
assets: amount,
|
|
28327
|
+
extraData: "0x"
|
|
28328
|
+
}]);
|
|
28329
|
+
};
|
|
28330
|
+
var getDytmBorrowTxData = function getDytmBorrowTxData(pool, asset, amount) {
|
|
28331
|
+
return iOffice.encodeFunctionData("borrow", [{
|
|
28332
|
+
account: ethers.ethers.BigNumber.from(pool.address),
|
|
28333
|
+
key: asset,
|
|
28334
|
+
receiver: pool.address,
|
|
28335
|
+
assets: amount,
|
|
28336
|
+
extraData: "0x"
|
|
28337
|
+
}]);
|
|
28338
|
+
};
|
|
28339
|
+
var getDytmRepayTxData = /*#__PURE__*/function () {
|
|
28340
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, asset, amount) {
|
|
28341
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
28342
|
+
while (1) {
|
|
28343
|
+
switch (_context.prev = _context.next) {
|
|
28344
|
+
case 0:
|
|
28345
|
+
return _context.abrupt("return", iOffice.encodeFunctionData("repay", [{
|
|
28346
|
+
account: ethers.ethers.BigNumber.from(pool.address),
|
|
28347
|
+
key: asset,
|
|
28348
|
+
withCollateralType: "0",
|
|
28349
|
+
assets: amount,
|
|
28350
|
+
shares: "0",
|
|
28351
|
+
extraData: "0x"
|
|
28352
|
+
}]));
|
|
28353
|
+
|
|
28354
|
+
case 1:
|
|
28355
|
+
case "end":
|
|
28356
|
+
return _context.stop();
|
|
28357
|
+
}
|
|
28358
|
+
}
|
|
28359
|
+
}, _callee);
|
|
28360
|
+
}));
|
|
28361
|
+
|
|
28362
|
+
return function getDytmRepayTxData(_x, _x2, _x3) {
|
|
28363
|
+
return _ref.apply(this, arguments);
|
|
28364
|
+
};
|
|
28365
|
+
}();
|
|
28366
|
+
var getDytmWithdrawTxData = /*#__PURE__*/function () {
|
|
28367
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, asset, amount) {
|
|
28368
|
+
var isMaxAmount;
|
|
28369
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
28370
|
+
while (1) {
|
|
28371
|
+
switch (_context2.prev = _context2.next) {
|
|
28372
|
+
case 0:
|
|
28373
|
+
isMaxAmount = ethers.ethers.BigNumber.from(amount).eq(ethers.ethers.constants.MaxUint256);
|
|
28374
|
+
return _context2.abrupt("return", iOffice.encodeFunctionData("withdraw", [{
|
|
28375
|
+
account: ethers.ethers.BigNumber.from(pool.address),
|
|
28376
|
+
tokenId: asset,
|
|
28377
|
+
assets: isMaxAmount ? 0 : amount,
|
|
28378
|
+
shares: isMaxAmount ? amount : 0,
|
|
28379
|
+
receiver: pool.address,
|
|
28380
|
+
extraData: "0x"
|
|
28381
|
+
}]));
|
|
28382
|
+
|
|
28383
|
+
case 2:
|
|
28384
|
+
case "end":
|
|
28385
|
+
return _context2.stop();
|
|
28386
|
+
}
|
|
28387
|
+
}
|
|
28388
|
+
}, _callee2);
|
|
28389
|
+
}));
|
|
28390
|
+
|
|
28391
|
+
return function getDytmWithdrawTxData(_x4, _x5, _x6) {
|
|
28392
|
+
return _ref2.apply(this, arguments);
|
|
28091
28393
|
};
|
|
28092
28394
|
}();
|
|
28093
28395
|
|
|
@@ -29888,7 +30190,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
29888
30190
|
/*#__PURE__*/
|
|
29889
30191
|
function () {
|
|
29890
30192
|
var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(dapp, assetFrom, assetTo, amountIn, slippage, options, sdkOptions) {
|
|
29891
|
-
var swapTxData, minAmountOut, _yield$getOneInchSwap, _yield$getOdosSwapTxD, _yield$getPendleSwapT, _yield$getKyberSwapTx, _yield$getOndoSwapTxD, cowSwapEstimateGas, _yield$getCowSwapTxDa, encodedTypedData, preSignTxData, cowMinOut, validatorContract, submitTx, submitReceipt, iUniswapV2Router, calculatedMinAmountOut, tx;
|
|
30193
|
+
var swapTxData, minAmountOut, _yield$getOneInchSwap, _yield$getEasySwapper, _yield$getOdosSwapTxD, _yield$getPendleSwapT, _yield$getKyberSwapTx, _yield$getOndoSwapTxD, cowSwapEstimateGas, _yield$getCowSwapTxDa, encodedTypedData, preSignTxData, cowMinOut, validatorContract, submitTx, submitReceipt, iUniswapV2Router, calculatedMinAmountOut, tx;
|
|
29892
30194
|
|
|
29893
30195
|
return runtime_1.wrap(function _callee10$(_context10) {
|
|
29894
30196
|
while (1) {
|
|
@@ -29910,7 +30212,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
29910
30212
|
|
|
29911
30213
|
minAmountOut = null;
|
|
29912
30214
|
_context10.t0 = dapp;
|
|
29913
|
-
_context10.next = _context10.t0 === exports.Dapp.ONEINCH ? 7 : _context10.t0 === exports.Dapp.BALANCER ? 13 : _context10.t0 === exports.Dapp.TOROS ? 17 : _context10.t0 === exports.Dapp.ODOS ?
|
|
30215
|
+
_context10.next = _context10.t0 === exports.Dapp.ONEINCH ? 7 : _context10.t0 === exports.Dapp.BALANCER ? 13 : _context10.t0 === exports.Dapp.TOROS ? 17 : _context10.t0 === exports.Dapp.ODOS ? 23 : _context10.t0 === exports.Dapp.PENDLE ? 29 : _context10.t0 === exports.Dapp.KYBERSWAP ? 35 : _context10.t0 === exports.Dapp.ONDO ? 41 : _context10.t0 === exports.Dapp.COWSWAP ? 47 : 66;
|
|
29914
30216
|
break;
|
|
29915
30217
|
|
|
29916
30218
|
case 7:
|
|
@@ -29921,7 +30223,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
29921
30223
|
_yield$getOneInchSwap = _context10.sent;
|
|
29922
30224
|
swapTxData = _yield$getOneInchSwap.swapTxData;
|
|
29923
30225
|
minAmountOut = _yield$getOneInchSwap.dstAmount;
|
|
29924
|
-
return _context10.abrupt("break",
|
|
30226
|
+
return _context10.abrupt("break", 81);
|
|
29925
30227
|
|
|
29926
30228
|
case 13:
|
|
29927
30229
|
_context10.next = 15;
|
|
@@ -29929,106 +30231,108 @@ var Pool = /*#__PURE__*/function () {
|
|
|
29929
30231
|
|
|
29930
30232
|
case 15:
|
|
29931
30233
|
swapTxData = _context10.sent;
|
|
29932
|
-
return _context10.abrupt("break",
|
|
30234
|
+
return _context10.abrupt("break", 81);
|
|
29933
30235
|
|
|
29934
30236
|
case 17:
|
|
29935
30237
|
_context10.next = 19;
|
|
29936
30238
|
return getEasySwapperTxData(this, assetFrom, assetTo, ethers.ethers.BigNumber.from(amountIn), slippage);
|
|
29937
30239
|
|
|
29938
30240
|
case 19:
|
|
29939
|
-
|
|
29940
|
-
|
|
30241
|
+
_yield$getEasySwapper = _context10.sent;
|
|
30242
|
+
swapTxData = _yield$getEasySwapper.swapTxData;
|
|
30243
|
+
minAmountOut = _yield$getEasySwapper.minAmountOut;
|
|
30244
|
+
return _context10.abrupt("break", 81);
|
|
29941
30245
|
|
|
29942
|
-
case
|
|
29943
|
-
_context10.next =
|
|
30246
|
+
case 23:
|
|
30247
|
+
_context10.next = 25;
|
|
29944
30248
|
return getOdosSwapTxData(this, assetFrom, assetTo, amountIn, slippage);
|
|
29945
30249
|
|
|
29946
|
-
case
|
|
30250
|
+
case 25:
|
|
29947
30251
|
_yield$getOdosSwapTxD = _context10.sent;
|
|
29948
30252
|
swapTxData = _yield$getOdosSwapTxD.swapTxData;
|
|
29949
30253
|
minAmountOut = _yield$getOdosSwapTxD.minAmountOut;
|
|
29950
|
-
return _context10.abrupt("break",
|
|
30254
|
+
return _context10.abrupt("break", 81);
|
|
29951
30255
|
|
|
29952
|
-
case
|
|
29953
|
-
_context10.next =
|
|
30256
|
+
case 29:
|
|
30257
|
+
_context10.next = 31;
|
|
29954
30258
|
return getPendleSwapTxData(this, assetFrom, assetTo, amountIn, slippage);
|
|
29955
30259
|
|
|
29956
|
-
case
|
|
30260
|
+
case 31:
|
|
29957
30261
|
_yield$getPendleSwapT = _context10.sent;
|
|
29958
30262
|
swapTxData = _yield$getPendleSwapT.swapTxData;
|
|
29959
30263
|
minAmountOut = _yield$getPendleSwapT.minAmountOut;
|
|
29960
|
-
return _context10.abrupt("break",
|
|
30264
|
+
return _context10.abrupt("break", 81);
|
|
29961
30265
|
|
|
29962
|
-
case
|
|
29963
|
-
_context10.next =
|
|
30266
|
+
case 35:
|
|
30267
|
+
_context10.next = 37;
|
|
29964
30268
|
return getKyberSwapTxData(this, assetFrom, assetTo, amountIn, slippage);
|
|
29965
30269
|
|
|
29966
|
-
case
|
|
30270
|
+
case 37:
|
|
29967
30271
|
_yield$getKyberSwapTx = _context10.sent;
|
|
29968
30272
|
swapTxData = _yield$getKyberSwapTx.swapTxData;
|
|
29969
30273
|
minAmountOut = _yield$getKyberSwapTx.minAmountOut;
|
|
29970
|
-
return _context10.abrupt("break",
|
|
30274
|
+
return _context10.abrupt("break", 81);
|
|
29971
30275
|
|
|
29972
|
-
case
|
|
29973
|
-
_context10.next =
|
|
30276
|
+
case 41:
|
|
30277
|
+
_context10.next = 43;
|
|
29974
30278
|
return getOndoSwapTxData(this, assetFrom, assetTo, amountIn.toString(), slippage);
|
|
29975
30279
|
|
|
29976
|
-
case
|
|
30280
|
+
case 43:
|
|
29977
30281
|
_yield$getOndoSwapTxD = _context10.sent;
|
|
29978
30282
|
swapTxData = _yield$getOndoSwapTxD.swapTxData;
|
|
29979
30283
|
minAmountOut = _yield$getOndoSwapTxD.minAmountOut;
|
|
29980
|
-
return _context10.abrupt("break",
|
|
30284
|
+
return _context10.abrupt("break", 81);
|
|
29981
30285
|
|
|
29982
|
-
case
|
|
30286
|
+
case 47:
|
|
29983
30287
|
cowSwapEstimateGas = isSdkOptionsBoolean(sdkOptions) ? sdkOptions : sdkOptions.estimateGas;
|
|
29984
30288
|
|
|
29985
30289
|
if (!(cowSwapEstimateGas || !isSdkOptionsBoolean(sdkOptions) && sdkOptions.onlyGetTxData)) {
|
|
29986
|
-
_context10.next =
|
|
30290
|
+
_context10.next = 50;
|
|
29987
30291
|
break;
|
|
29988
30292
|
}
|
|
29989
30293
|
|
|
29990
30294
|
throw new Error("CowSwap requires two sequential transactions (submit + preSign) and does not support estimateGas or onlyGetTxData");
|
|
29991
30295
|
|
|
29992
|
-
case
|
|
29993
|
-
_context10.next =
|
|
30296
|
+
case 50:
|
|
30297
|
+
_context10.next = 52;
|
|
29994
30298
|
return getCowSwapTxData(this, assetFrom, assetTo, amountIn, slippage);
|
|
29995
30299
|
|
|
29996
|
-
case
|
|
30300
|
+
case 52:
|
|
29997
30301
|
_yield$getCowSwapTxDa = _context10.sent;
|
|
29998
30302
|
encodedTypedData = _yield$getCowSwapTxDa.encodedTypedData;
|
|
29999
30303
|
preSignTxData = _yield$getCowSwapTxDa.preSignTxData;
|
|
30000
30304
|
cowMinOut = _yield$getCowSwapTxDa.minAmountOut;
|
|
30001
30305
|
// Tx 1: manager calls submit() directly on TypedStructuredDataValidator (not via pool.execTransaction)
|
|
30002
30306
|
validatorContract = new ethers.Contract(routerAddress[this.network][dapp], ["function submit(address _poolLogic, uint8 _dataType, bytes memory _structuredData) external"], this.signer);
|
|
30003
|
-
_context10.next =
|
|
30307
|
+
_context10.next = 59;
|
|
30004
30308
|
return validatorContract.submit.apply(validatorContract, [this.address, 1
|
|
30005
30309
|
/* COWSWAP_ORDER */
|
|
30006
30310
|
, encodedTypedData].concat(options ? [options] : []));
|
|
30007
30311
|
|
|
30008
|
-
case
|
|
30312
|
+
case 59:
|
|
30009
30313
|
submitTx = _context10.sent;
|
|
30010
|
-
_context10.next =
|
|
30314
|
+
_context10.next = 62;
|
|
30011
30315
|
return submitTx.wait(3);
|
|
30012
30316
|
|
|
30013
|
-
case
|
|
30317
|
+
case 62:
|
|
30014
30318
|
submitReceipt = _context10.sent;
|
|
30015
30319
|
|
|
30016
30320
|
if (!(submitReceipt.status === 0)) {
|
|
30017
|
-
_context10.next =
|
|
30321
|
+
_context10.next = 65;
|
|
30018
30322
|
break;
|
|
30019
30323
|
}
|
|
30020
30324
|
|
|
30021
30325
|
return _context10.abrupt("return", submitReceipt);
|
|
30022
30326
|
|
|
30023
|
-
case
|
|
30327
|
+
case 65:
|
|
30024
30328
|
return _context10.abrupt("return", getPoolTxOrGasEstimate(this, [gpv2SettlementAddress[this.network], preSignTxData, options, cowMinOut], sdkOptions));
|
|
30025
30329
|
|
|
30026
|
-
case
|
|
30330
|
+
case 66:
|
|
30027
30331
|
iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
|
|
30028
|
-
_context10.next =
|
|
30332
|
+
_context10.next = 69;
|
|
30029
30333
|
return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
|
|
30030
30334
|
|
|
30031
|
-
case
|
|
30335
|
+
case 69:
|
|
30032
30336
|
calculatedMinAmountOut = _context10.sent;
|
|
30033
30337
|
_context10.t1 = iUniswapV2Router;
|
|
30034
30338
|
_context10.t2 = exports.Transaction.SWAP;
|
|
@@ -30036,23 +30340,23 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30036
30340
|
_context10.t4 = calculatedMinAmountOut;
|
|
30037
30341
|
_context10.t5 = [assetFrom, assetTo];
|
|
30038
30342
|
_context10.t6 = this.address;
|
|
30039
|
-
_context10.next =
|
|
30343
|
+
_context10.next = 78;
|
|
30040
30344
|
return getDeadline(this);
|
|
30041
30345
|
|
|
30042
|
-
case
|
|
30346
|
+
case 78:
|
|
30043
30347
|
_context10.t7 = _context10.sent;
|
|
30044
30348
|
_context10.t8 = [_context10.t3, _context10.t4, _context10.t5, _context10.t6, _context10.t7];
|
|
30045
30349
|
swapTxData = _context10.t1.encodeFunctionData.call(_context10.t1, _context10.t2, _context10.t8);
|
|
30046
30350
|
|
|
30047
|
-
case
|
|
30048
|
-
_context10.next =
|
|
30351
|
+
case 81:
|
|
30352
|
+
_context10.next = 83;
|
|
30049
30353
|
return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], swapTxData, options, minAmountOut], sdkOptions);
|
|
30050
30354
|
|
|
30051
|
-
case
|
|
30355
|
+
case 83:
|
|
30052
30356
|
tx = _context10.sent;
|
|
30053
30357
|
return _context10.abrupt("return", tx);
|
|
30054
30358
|
|
|
30055
|
-
case
|
|
30359
|
+
case 85:
|
|
30056
30360
|
case "end":
|
|
30057
30361
|
return _context10.stop();
|
|
30058
30362
|
}
|
|
@@ -30469,7 +30773,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30469
30773
|
/*#__PURE__*/
|
|
30470
30774
|
function () {
|
|
30471
30775
|
var _lend = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(dapp, asset, amount, referralCode, options, sdkOptions) {
|
|
30472
|
-
var
|
|
30776
|
+
var depositTxData, iLendingPool, tx;
|
|
30473
30777
|
return runtime_1.wrap(function _callee17$(_context17) {
|
|
30474
30778
|
while (1) {
|
|
30475
30779
|
switch (_context17.prev = _context17.next) {
|
|
@@ -30488,16 +30792,21 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30488
30792
|
};
|
|
30489
30793
|
}
|
|
30490
30794
|
|
|
30491
|
-
|
|
30492
|
-
|
|
30493
|
-
|
|
30795
|
+
if (dapp === exports.Dapp.DYTM) {
|
|
30796
|
+
depositTxData = getDytmDepositTxData(this, asset, amount);
|
|
30797
|
+
} else {
|
|
30798
|
+
iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
|
|
30799
|
+
depositTxData = iLendingPool.encodeFunctionData(exports.Transaction.DEPOSIT, [asset, amount, this.address, referralCode]);
|
|
30800
|
+
}
|
|
30801
|
+
|
|
30802
|
+
_context17.next = 6;
|
|
30494
30803
|
return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], depositTxData, options], sdkOptions);
|
|
30495
30804
|
|
|
30496
|
-
case
|
|
30805
|
+
case 6:
|
|
30497
30806
|
tx = _context17.sent;
|
|
30498
30807
|
return _context17.abrupt("return", tx);
|
|
30499
30808
|
|
|
30500
|
-
case
|
|
30809
|
+
case 8:
|
|
30501
30810
|
case "end":
|
|
30502
30811
|
return _context17.stop();
|
|
30503
30812
|
}
|
|
@@ -30582,7 +30891,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30582
30891
|
/*#__PURE__*/
|
|
30583
30892
|
function () {
|
|
30584
30893
|
var _withdrawDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19(dapp, asset, amount, options, sdkOptions) {
|
|
30585
|
-
var
|
|
30894
|
+
var withdrawTxData, iLendingPool, tx;
|
|
30586
30895
|
return runtime_1.wrap(function _callee19$(_context19) {
|
|
30587
30896
|
while (1) {
|
|
30588
30897
|
switch (_context19.prev = _context19.next) {
|
|
@@ -30597,16 +30906,32 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30597
30906
|
};
|
|
30598
30907
|
}
|
|
30599
30908
|
|
|
30909
|
+
if (!(dapp === exports.Dapp.DYTM)) {
|
|
30910
|
+
_context19.next = 8;
|
|
30911
|
+
break;
|
|
30912
|
+
}
|
|
30913
|
+
|
|
30914
|
+
_context19.next = 5;
|
|
30915
|
+
return getDytmWithdrawTxData(this, asset, amount);
|
|
30916
|
+
|
|
30917
|
+
case 5:
|
|
30918
|
+
withdrawTxData = _context19.sent;
|
|
30919
|
+
_context19.next = 10;
|
|
30920
|
+
break;
|
|
30921
|
+
|
|
30922
|
+
case 8:
|
|
30600
30923
|
iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
|
|
30601
30924
|
withdrawTxData = iLendingPool.encodeFunctionData(exports.Transaction.WITHDRAW, [asset, amount, this.address]);
|
|
30602
|
-
|
|
30925
|
+
|
|
30926
|
+
case 10:
|
|
30927
|
+
_context19.next = 12;
|
|
30603
30928
|
return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], withdrawTxData, options], sdkOptions);
|
|
30604
30929
|
|
|
30605
|
-
case
|
|
30930
|
+
case 12:
|
|
30606
30931
|
tx = _context19.sent;
|
|
30607
30932
|
return _context19.abrupt("return", tx);
|
|
30608
30933
|
|
|
30609
|
-
case
|
|
30934
|
+
case 14:
|
|
30610
30935
|
case "end":
|
|
30611
30936
|
return _context19.stop();
|
|
30612
30937
|
}
|
|
@@ -30692,7 +31017,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30692
31017
|
/*#__PURE__*/
|
|
30693
31018
|
function () {
|
|
30694
31019
|
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee21(dapp, asset, amount, referralCode, options, sdkOptions) {
|
|
30695
|
-
var
|
|
31020
|
+
var borrowTxData, iLendingPool, tx;
|
|
30696
31021
|
return runtime_1.wrap(function _callee21$(_context21) {
|
|
30697
31022
|
while (1) {
|
|
30698
31023
|
switch (_context21.prev = _context21.next) {
|
|
@@ -30711,16 +31036,21 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30711
31036
|
};
|
|
30712
31037
|
}
|
|
30713
31038
|
|
|
30714
|
-
|
|
30715
|
-
|
|
30716
|
-
|
|
31039
|
+
if (dapp === exports.Dapp.DYTM) {
|
|
31040
|
+
borrowTxData = getDytmBorrowTxData(this, asset, amount);
|
|
31041
|
+
} else {
|
|
31042
|
+
iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
|
|
31043
|
+
borrowTxData = iLendingPool.encodeFunctionData(exports.Transaction.BORROW, [asset, amount, 2, referralCode, this.address]);
|
|
31044
|
+
}
|
|
31045
|
+
|
|
31046
|
+
_context21.next = 6;
|
|
30717
31047
|
return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], borrowTxData, options], sdkOptions);
|
|
30718
31048
|
|
|
30719
|
-
case
|
|
31049
|
+
case 6:
|
|
30720
31050
|
tx = _context21.sent;
|
|
30721
31051
|
return _context21.abrupt("return", tx);
|
|
30722
31052
|
|
|
30723
|
-
case
|
|
31053
|
+
case 8:
|
|
30724
31054
|
case "end":
|
|
30725
31055
|
return _context21.stop();
|
|
30726
31056
|
}
|
|
@@ -30749,7 +31079,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30749
31079
|
/*#__PURE__*/
|
|
30750
31080
|
function () {
|
|
30751
31081
|
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee22(dapp, asset, amount, options, sdkOptions) {
|
|
30752
|
-
var
|
|
31082
|
+
var repayTxData, iLendingPool, tx;
|
|
30753
31083
|
return runtime_1.wrap(function _callee22$(_context22) {
|
|
30754
31084
|
while (1) {
|
|
30755
31085
|
switch (_context22.prev = _context22.next) {
|
|
@@ -30764,16 +31094,32 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30764
31094
|
};
|
|
30765
31095
|
}
|
|
30766
31096
|
|
|
31097
|
+
if (!(dapp === exports.Dapp.DYTM)) {
|
|
31098
|
+
_context22.next = 8;
|
|
31099
|
+
break;
|
|
31100
|
+
}
|
|
31101
|
+
|
|
31102
|
+
_context22.next = 5;
|
|
31103
|
+
return getDytmRepayTxData(this, asset, amount);
|
|
31104
|
+
|
|
31105
|
+
case 5:
|
|
31106
|
+
repayTxData = _context22.sent;
|
|
31107
|
+
_context22.next = 10;
|
|
31108
|
+
break;
|
|
31109
|
+
|
|
31110
|
+
case 8:
|
|
30767
31111
|
iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
|
|
30768
31112
|
repayTxData = iLendingPool.encodeFunctionData(exports.Transaction.REPAY, [asset, amount, 2, this.address]);
|
|
30769
|
-
|
|
31113
|
+
|
|
31114
|
+
case 10:
|
|
31115
|
+
_context22.next = 12;
|
|
30770
31116
|
return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], repayTxData, options], sdkOptions);
|
|
30771
31117
|
|
|
30772
|
-
case
|
|
31118
|
+
case 12:
|
|
30773
31119
|
tx = _context22.sent;
|
|
30774
31120
|
return _context22.abrupt("return", tx);
|
|
30775
31121
|
|
|
30776
|
-
case
|
|
31122
|
+
case 14:
|
|
30777
31123
|
case "end":
|
|
30778
31124
|
return _context22.stop();
|
|
30779
31125
|
}
|
|
@@ -32544,6 +32890,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
32544
32890
|
* @param {number} slippage Slippage tolerance in %
|
|
32545
32891
|
* @param {any} options Transaction options
|
|
32546
32892
|
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
32893
|
+
* @param {any} trackedAssets Tracked assets information (only for tx data generation)
|
|
32547
32894
|
* @returns {Promise<any>} Transaction
|
|
32548
32895
|
*/
|
|
32549
32896
|
;
|
|
@@ -32551,7 +32898,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
32551
32898
|
_proto.completeTorosWithdrawal =
|
|
32552
32899
|
/*#__PURE__*/
|
|
32553
32900
|
function () {
|
|
32554
|
-
var _completeTorosWithdrawal = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee50(destinationToken, slippage, options, sdkOptions) {
|
|
32901
|
+
var _completeTorosWithdrawal = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee50(destinationToken, slippage, options, sdkOptions, trackedAssets) {
|
|
32555
32902
|
var txData, tx;
|
|
32556
32903
|
return runtime_1.wrap(function _callee50$(_context50) {
|
|
32557
32904
|
while (1) {
|
|
@@ -32571,19 +32918,23 @@ var Pool = /*#__PURE__*/function () {
|
|
|
32571
32918
|
};
|
|
32572
32919
|
}
|
|
32573
32920
|
|
|
32574
|
-
|
|
32575
|
-
|
|
32921
|
+
if (trackedAssets === void 0) {
|
|
32922
|
+
trackedAssets = [];
|
|
32923
|
+
}
|
|
32576
32924
|
|
|
32577
|
-
|
|
32925
|
+
_context50.next = 6;
|
|
32926
|
+
return getCompleteWithdrawalTxData(this, destinationToken, slippage * 100, false, trackedAssets);
|
|
32927
|
+
|
|
32928
|
+
case 6:
|
|
32578
32929
|
txData = _context50.sent;
|
|
32579
|
-
_context50.next =
|
|
32930
|
+
_context50.next = 9;
|
|
32580
32931
|
return getPoolTxOrGasEstimate(this, [routerAddress[this.network].toros, txData, options], sdkOptions);
|
|
32581
32932
|
|
|
32582
|
-
case
|
|
32933
|
+
case 9:
|
|
32583
32934
|
tx = _context50.sent;
|
|
32584
32935
|
return _context50.abrupt("return", tx);
|
|
32585
32936
|
|
|
32586
|
-
case
|
|
32937
|
+
case 11:
|
|
32587
32938
|
case "end":
|
|
32588
32939
|
return _context50.stop();
|
|
32589
32940
|
}
|
|
@@ -32591,7 +32942,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
32591
32942
|
}, _callee50, this);
|
|
32592
32943
|
}));
|
|
32593
32944
|
|
|
32594
|
-
function completeTorosWithdrawal(_x238, _x239, _x240, _x241) {
|
|
32945
|
+
function completeTorosWithdrawal(_x238, _x239, _x240, _x241, _x242) {
|
|
32595
32946
|
return _completeTorosWithdrawal.apply(this, arguments);
|
|
32596
32947
|
}
|
|
32597
32948
|
|
|
@@ -32655,7 +33006,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
32655
33006
|
}, _callee51, this);
|
|
32656
33007
|
}));
|
|
32657
33008
|
|
|
32658
|
-
function mintPendle(
|
|
33009
|
+
function mintPendle(_x243, _x244, _x245, _x246, _x247, _x248) {
|
|
32659
33010
|
return _mintPendle.apply(this, arguments);
|
|
32660
33011
|
}
|
|
32661
33012
|
|
|
@@ -32712,7 +33063,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
32712
33063
|
}, _callee52, this);
|
|
32713
33064
|
}));
|
|
32714
33065
|
|
|
32715
|
-
function depositHyperliquid(
|
|
33066
|
+
function depositHyperliquid(_x249, _x250, _x251, _x252) {
|
|
32716
33067
|
return _depositHyperliquid.apply(this, arguments);
|
|
32717
33068
|
}
|
|
32718
33069
|
|
|
@@ -32765,7 +33116,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
32765
33116
|
}, _callee53, this);
|
|
32766
33117
|
}));
|
|
32767
33118
|
|
|
32768
|
-
function perpToSpotHyperliquid(
|
|
33119
|
+
function perpToSpotHyperliquid(_x253, _x254, _x255, _x256) {
|
|
32769
33120
|
return _perpToSpotHyperliquid.apply(this, arguments);
|
|
32770
33121
|
}
|
|
32771
33122
|
|
|
@@ -32817,7 +33168,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
32817
33168
|
}, _callee54, this);
|
|
32818
33169
|
}));
|
|
32819
33170
|
|
|
32820
|
-
function spotToPerpHyperliquid(
|
|
33171
|
+
function spotToPerpHyperliquid(_x257, _x258, _x259, _x260) {
|
|
32821
33172
|
return _spotToPerpHyperliquid.apply(this, arguments);
|
|
32822
33173
|
}
|
|
32823
33174
|
|
|
@@ -32867,7 +33218,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
32867
33218
|
}, _callee55, this);
|
|
32868
33219
|
}));
|
|
32869
33220
|
|
|
32870
|
-
function withdrawHyperliquid(
|
|
33221
|
+
function withdrawHyperliquid(_x261, _x262, _x263) {
|
|
32871
33222
|
return _withdrawHyperliquid.apply(this, arguments);
|
|
32872
33223
|
}
|
|
32873
33224
|
|
|
@@ -32934,7 +33285,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
32934
33285
|
}, _callee56, this);
|
|
32935
33286
|
}));
|
|
32936
33287
|
|
|
32937
|
-
function openMarketOrderHyperliquid(
|
|
33288
|
+
function openMarketOrderHyperliquid(_x264, _x265, _x266, _x267, _x268, _x269) {
|
|
32938
33289
|
return _openMarketOrderHyperliquid.apply(this, arguments);
|
|
32939
33290
|
}
|
|
32940
33291
|
|
|
@@ -33003,7 +33354,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
33003
33354
|
}, _callee57, this);
|
|
33004
33355
|
}));
|
|
33005
33356
|
|
|
33006
|
-
function closePositionHyperliquid(
|
|
33357
|
+
function closePositionHyperliquid(_x270, _x271, _x272, _x273, _x274) {
|
|
33007
33358
|
return _closePositionHyperliquid.apply(this, arguments);
|
|
33008
33359
|
}
|
|
33009
33360
|
|
|
@@ -33052,7 +33403,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
33052
33403
|
}, _callee58, this);
|
|
33053
33404
|
}));
|
|
33054
33405
|
|
|
33055
|
-
function approveTorosLimitOrder(
|
|
33406
|
+
function approveTorosLimitOrder(_x275, _x276, _x277, _x278) {
|
|
33056
33407
|
return _approveTorosLimitOrder.apply(this, arguments);
|
|
33057
33408
|
}
|
|
33058
33409
|
|
|
@@ -33121,7 +33472,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
33121
33472
|
}, _callee59, this);
|
|
33122
33473
|
}));
|
|
33123
33474
|
|
|
33124
|
-
function createTorosLimitOrder(
|
|
33475
|
+
function createTorosLimitOrder(_x279, _x280, _x281, _x282, _x283, _x284, _x285) {
|
|
33125
33476
|
return _createTorosLimitOrder.apply(this, arguments);
|
|
33126
33477
|
}
|
|
33127
33478
|
|
|
@@ -33190,7 +33541,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
33190
33541
|
}, _callee60, this);
|
|
33191
33542
|
}));
|
|
33192
33543
|
|
|
33193
|
-
function modifyTorosLimitOrder(
|
|
33544
|
+
function modifyTorosLimitOrder(_x286, _x287, _x288, _x289, _x290, _x291, _x292) {
|
|
33194
33545
|
return _modifyTorosLimitOrder.apply(this, arguments);
|
|
33195
33546
|
}
|
|
33196
33547
|
|
|
@@ -33245,7 +33596,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
33245
33596
|
}, _callee61, this);
|
|
33246
33597
|
}));
|
|
33247
33598
|
|
|
33248
|
-
function deleteTorosLimitOrder(
|
|
33599
|
+
function deleteTorosLimitOrder(_x293, _x294, _x295) {
|
|
33249
33600
|
return _deleteTorosLimitOrder.apply(this, arguments);
|
|
33250
33601
|
}
|
|
33251
33602
|
|
|
@@ -33277,7 +33628,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
33277
33628
|
}, _callee62, this);
|
|
33278
33629
|
}));
|
|
33279
33630
|
|
|
33280
|
-
function getTorosLimitOrder$1(
|
|
33631
|
+
function getTorosLimitOrder$1(_x296, _x297) {
|
|
33281
33632
|
return _getTorosLimitOrder2.apply(this, arguments);
|
|
33282
33633
|
}
|
|
33283
33634
|
|
|
@@ -33309,7 +33660,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
33309
33660
|
}, _callee63, this);
|
|
33310
33661
|
}));
|
|
33311
33662
|
|
|
33312
|
-
function hasActiveTorosLimitOrder$1(
|
|
33663
|
+
function hasActiveTorosLimitOrder$1(_x298, _x299) {
|
|
33313
33664
|
return _hasActiveTorosLimitOrder2.apply(this, arguments);
|
|
33314
33665
|
}
|
|
33315
33666
|
|