@dhedge/v2-sdk 1.5.4 → 1.7.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.
Files changed (38) hide show
  1. package/dist/config.d.ts +2 -1
  2. package/dist/entities/pool.d.ts +21 -1
  3. package/dist/entities/utils.d.ts +7 -2
  4. package/dist/services/lyra/markets.d.ts +6 -0
  5. package/dist/services/lyra/positions.d.ts +2 -0
  6. package/dist/services/lyra/quote.d.ts +4 -0
  7. package/dist/services/lyra/trade.d.ts +4 -0
  8. package/dist/services/lyra/tradeOptionType.d.ts +3 -0
  9. package/dist/test/constants.d.ts +1 -0
  10. package/dist/types.d.ts +20 -1
  11. package/dist/v2-sdk.cjs.development.js +4202 -12
  12. package/dist/v2-sdk.cjs.development.js.map +1 -1
  13. package/dist/v2-sdk.cjs.production.min.js +1 -1
  14. package/dist/v2-sdk.cjs.production.min.js.map +1 -1
  15. package/dist/v2-sdk.esm.js +4200 -11
  16. package/dist/v2-sdk.esm.js.map +1 -1
  17. package/package.json +6 -2
  18. package/src/abi/IOptionMArketWrapper.json +1038 -0
  19. package/src/abi/IOptionMarket.json +1473 -0
  20. package/src/abi/IOptionToken.json +1671 -0
  21. package/src/config.ts +10 -5
  22. package/src/entities/pool.ts +61 -1
  23. package/src/entities/utils.ts +45 -2
  24. package/src/services/lyra/markets.ts +52 -0
  25. package/src/services/lyra/positions.ts +19 -0
  26. package/src/services/lyra/quote.ts +12 -0
  27. package/src/services/lyra/trade.ts +101 -0
  28. package/src/services/lyra/tradeOptionType.ts +19 -0
  29. package/src/test/constants.ts +1 -0
  30. package/src/test/lyra.test.ts +163 -0
  31. package/src/test/pool.test.ts +1 -1
  32. package/src/test/toros.test.ts +1 -1
  33. package/src/test/txOptions.ts +1 -1
  34. package/src/test/uniswap.test.ts +1 -1
  35. package/src/test/velodrome.test.ts +1 -1
  36. package/src/test/wallet.ts +8 -0
  37. package/src/types.ts +20 -1
  38. package/src/test/sushi.test.ts +0 -173
@@ -5,11 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
6
 
7
7
  var ethers = require('ethers');
8
+ var Lyra = require('@lyrafinance/lyra-js');
9
+ var Lyra__default = _interopDefault(Lyra);
8
10
  var axios = _interopDefault(require('axios'));
9
11
  var lodash = require('lodash');
10
12
  var address = require('@ethersproject/address');
11
13
  require('lodash/set');
12
- var abi$q = require('@ethersproject/abi');
14
+ var abi$s = require('@ethersproject/abi');
13
15
  var BigNumber = _interopDefault(require('bignumber.js'));
14
16
  var web3Utils = require('web3-utils');
15
17
  var ethereumjsUtil = require('ethereumjs-util');
@@ -3842,6 +3844,7 @@ var ManagerLogic = {
3842
3844
  Dapp["ARRAKIS"] = "arrakis";
3843
3845
  Dapp["TOROS"] = "toros";
3844
3846
  Dapp["VELODROME"] = "velodrome";
3847
+ Dapp["LYRA"] = "lyra";
3845
3848
  })(exports.Dapp || (exports.Dapp = {}));
3846
3849
 
3847
3850
  (function (Transaction) {
@@ -3866,19 +3869,20 @@ var ManagerLogic = {
3866
3869
  Transaction["REMOVE_LIQUIDITY_UNSTAKE"] = "removeLiquidityAndUnstake";
3867
3870
  })(exports.Transaction || (exports.Transaction = {}));
3868
3871
 
3869
- var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _Network$OPTIMISM2, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM3, _aaveAddressProvider, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress;
3872
+ var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM2, _aaveAddressProvider, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress, _lyraNetworkMap;
3870
3873
 
3871
3874
  require("dotenv").config();
3872
3875
 
3873
3876
  var factoryAddress = (_factoryAddress = {}, _factoryAddress[exports.Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[exports.Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress);
3874
- var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x1111111254fb6c44bac0bed2854e76f90643097d", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xbc91a120cCD8F80b819EAF32F0996daC3Fa76a6C", _Network$POLYGON[exports.Dapp.TOROS] = "0x42B1DDcFa1c43E06F483BA0Dd1b9cC923043677f", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x1111111254760F7ab3F16433eea9304126DCd199", _Network$OPTIMISM[exports.Dapp.TOROS] = "0xf8C62BD5f2fEf9E1a329c197F32E77AD6866B022", _Network$OPTIMISM[exports.Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM), _routerAddress);
3877
+ var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x1111111254fb6c44bac0bed2854e76f90643097d", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xbc91a120cCD8F80b819EAF32F0996daC3Fa76a6C", _Network$POLYGON[exports.Dapp.TOROS] = "0x42B1DDcFa1c43E06F483BA0Dd1b9cC923043677f", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x1111111254760F7ab3F16433eea9304126DCd199", _Network$OPTIMISM[exports.Dapp.TOROS] = "0xf8C62BD5f2fEf9E1a329c197F32E77AD6866B022", _Network$OPTIMISM[exports.Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[exports.Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM), _routerAddress);
3875
3878
  var dappFactoryAddress = (_dappFactoryAddress = {}, _dappFactoryAddress[exports.Network.POLYGON] = (_Network$POLYGON2 = {}, _Network$POLYGON2[exports.Dapp.SUSHISWAP] = "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", _Network$POLYGON2[exports.Dapp.QUICKSWAP] = "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32", _Network$POLYGON2), _dappFactoryAddress[exports.Network.OPTIMISM] = {}, _dappFactoryAddress);
3876
- var stakingAddress = (_stakingAddress = {}, _stakingAddress[exports.Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[exports.Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[exports.Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[exports.Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3[exports.Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$POLYGON3), _stakingAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM2 = {}, _Network$OPTIMISM2[exports.Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$OPTIMISM2), _stakingAddress);
3877
- var aaveAddressProvider = (_aaveAddressProvider = {}, _aaveAddressProvider[exports.Network.POLYGON] = (_Network$POLYGON4 = {}, _Network$POLYGON4[exports.Dapp.AAVE] = "0xd05e3E715d945B59290df0ae8eF85c1BdB684744", _Network$POLYGON4[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$POLYGON4), _aaveAddressProvider[exports.Network.OPTIMISM] = (_Network$OPTIMISM3 = {}, _Network$OPTIMISM3[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$OPTIMISM3), _aaveAddressProvider);
3879
+ var stakingAddress = (_stakingAddress = {}, _stakingAddress[exports.Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[exports.Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[exports.Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[exports.Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3[exports.Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$POLYGON3), _stakingAddress[exports.Network.OPTIMISM] = {}, _stakingAddress);
3880
+ var aaveAddressProvider = (_aaveAddressProvider = {}, _aaveAddressProvider[exports.Network.POLYGON] = (_Network$POLYGON4 = {}, _Network$POLYGON4[exports.Dapp.AAVE] = "0xd05e3E715d945B59290df0ae8eF85c1BdB684744", _Network$POLYGON4[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$POLYGON4), _aaveAddressProvider[exports.Network.OPTIMISM] = (_Network$OPTIMISM2 = {}, _Network$OPTIMISM2[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$OPTIMISM2), _aaveAddressProvider);
3878
3881
  var nonfungiblePositionManagerAddress = (_nonfungiblePositionM = {}, _nonfungiblePositionM[exports.Network.POLYGON] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[exports.Network.OPTIMISM] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM);
3879
3882
  var networkChainIdMap = (_networkChainIdMap = {}, _networkChainIdMap[exports.Network.POLYGON] = 137, _networkChainIdMap[exports.Network.OPTIMISM] = 10, _networkChainIdMap);
3880
3883
  var balancerSubgraph = (_balancerSubgraph = {}, _balancerSubgraph[exports.Network.POLYGON] = "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2", _balancerSubgraph[exports.Network.OPTIMISM] = "", _balancerSubgraph);
3881
3884
  var multiCallAddress = (_multiCallAddress = {}, _multiCallAddress[exports.Network.POLYGON] = "0x275617327c958bD06b5D6b871E7f491D76113dd8", _multiCallAddress[exports.Network.OPTIMISM] = "", _multiCallAddress);
3885
+ var lyraNetworkMap = (_lyraNetworkMap = {}, _lyraNetworkMap[exports.Network.OPTIMISM] = Lyra.Deployment.Mainnet, _lyraNetworkMap);
3882
3886
  var deadline = /*#__PURE__*/Math.floor( /*#__PURE__*/Date.now() / 1000) + 60 * 20;
3883
3887
  var MaxUint128 = "0xffffffffffffffffffffffffffffffff";
3884
3888
  var UNISWAPV3_QUOTER_ADDRESS = "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";
@@ -8121,7 +8125,7 @@ function _multicall() {
8121
8125
  }
8122
8126
 
8123
8127
  multi = new ethers.ethers.Contract(multiCallAddress[network], ["function tryAggregate(bool requireSuccess, tuple(address, bytes)[] memory calls) public view returns (tuple(bool, bytes)[] memory returnData)"], provider);
8124
- itf = new abi$q.Interface(abi);
8128
+ itf = new abi$s.Interface(abi);
8125
8129
  _context3.prev = 4;
8126
8130
  _context3.next = 7;
8127
8131
  return multi.tryAggregate( // if false, allows individual calls to fail without causing entire multicall to fail
@@ -15834,6 +15838,3987 @@ function _getVelodromeClaimTxData() {
15834
15838
  return _getVelodromeClaimTxData.apply(this, arguments);
15835
15839
  }
15836
15840
 
15841
+ function getBoard(_x, _x2, _x3) {
15842
+ return _getBoard.apply(this, arguments);
15843
+ }
15844
+
15845
+ function _getBoard() {
15846
+ _getBoard = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(network, market, expiry) {
15847
+ var lyra, optionMarket, filteredBoards;
15848
+ return runtime_1.wrap(function _callee$(_context) {
15849
+ while (1) {
15850
+ switch (_context.prev = _context.next) {
15851
+ case 0:
15852
+ lyra = new Lyra__default(lyraNetworkMap[network]);
15853
+ _context.next = 3;
15854
+ return lyra.market(market);
15855
+
15856
+ case 3:
15857
+ optionMarket = _context.sent;
15858
+ filteredBoards = optionMarket.liveBoards().filter(function (e) {
15859
+ return e.expiryTimestamp === expiry;
15860
+ });
15861
+
15862
+ if (!(filteredBoards.length === 0)) {
15863
+ _context.next = 7;
15864
+ break;
15865
+ }
15866
+
15867
+ throw new Error("no lyra board for expiry");
15868
+
15869
+ case 7:
15870
+ return _context.abrupt("return", filteredBoards[0]);
15871
+
15872
+ case 8:
15873
+ case "end":
15874
+ return _context.stop();
15875
+ }
15876
+ }
15877
+ }, _callee);
15878
+ }));
15879
+ return _getBoard.apply(this, arguments);
15880
+ }
15881
+
15882
+ function getExpiries(_x4, _x5) {
15883
+ return _getExpiries.apply(this, arguments);
15884
+ }
15885
+
15886
+ function _getExpiries() {
15887
+ _getExpiries = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(network, market) {
15888
+ var lyra, optionMarket;
15889
+ return runtime_1.wrap(function _callee2$(_context2) {
15890
+ while (1) {
15891
+ switch (_context2.prev = _context2.next) {
15892
+ case 0:
15893
+ lyra = new Lyra__default(lyraNetworkMap[network]);
15894
+ _context2.next = 3;
15895
+ return lyra.market(market);
15896
+
15897
+ case 3:
15898
+ optionMarket = _context2.sent;
15899
+ return _context2.abrupt("return", optionMarket.liveBoards().map(function (e) {
15900
+ return e.expiryTimestamp;
15901
+ }));
15902
+
15903
+ case 5:
15904
+ case "end":
15905
+ return _context2.stop();
15906
+ }
15907
+ }
15908
+ }, _callee2);
15909
+ }));
15910
+ return _getExpiries.apply(this, arguments);
15911
+ }
15912
+
15913
+ function getStrikes(_x6, _x7, _x8) {
15914
+ return _getStrikes.apply(this, arguments);
15915
+ }
15916
+
15917
+ function _getStrikes() {
15918
+ _getStrikes = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(network, market, expiry) {
15919
+ return runtime_1.wrap(function _callee3$(_context3) {
15920
+ while (1) {
15921
+ switch (_context3.prev = _context3.next) {
15922
+ case 0:
15923
+ _context3.next = 2;
15924
+ return getBoard(network, market, expiry);
15925
+
15926
+ case 2:
15927
+ return _context3.abrupt("return", _context3.sent.strikes());
15928
+
15929
+ case 3:
15930
+ case "end":
15931
+ return _context3.stop();
15932
+ }
15933
+ }
15934
+ }, _callee3);
15935
+ }));
15936
+ return _getStrikes.apply(this, arguments);
15937
+ }
15938
+
15939
+ function getStrike(_x9, _x10, _x11, _x12) {
15940
+ return _getStrike.apply(this, arguments);
15941
+ }
15942
+
15943
+ function _getStrike() {
15944
+ _getStrike = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(network, market, expiry, strike) {
15945
+ var strikes, filteredStrike;
15946
+ return runtime_1.wrap(function _callee4$(_context4) {
15947
+ while (1) {
15948
+ switch (_context4.prev = _context4.next) {
15949
+ case 0:
15950
+ _context4.next = 2;
15951
+ return getStrikes(network, market, expiry);
15952
+
15953
+ case 2:
15954
+ strikes = _context4.sent;
15955
+ filteredStrike = strikes.filter(function (e) {
15956
+ return parseFloat(ethers.ethers.utils.formatEther(e.strikePrice)) === strike;
15957
+ });
15958
+
15959
+ if (!(filteredStrike.length === 0)) {
15960
+ _context4.next = 6;
15961
+ break;
15962
+ }
15963
+
15964
+ throw new Error("no option found for strike price");
15965
+
15966
+ case 6:
15967
+ return _context4.abrupt("return", filteredStrike[0]);
15968
+
15969
+ case 7:
15970
+ case "end":
15971
+ return _context4.stop();
15972
+ }
15973
+ }
15974
+ }, _callee4);
15975
+ }));
15976
+ return _getStrike.apply(this, arguments);
15977
+ }
15978
+
15979
+ var abi$n = [
15980
+ {
15981
+ inputs: [
15982
+ {
15983
+ internalType: "address",
15984
+ name: "thrower",
15985
+ type: "address"
15986
+ },
15987
+ {
15988
+ internalType: "contract ERC20",
15989
+ name: "asset",
15990
+ type: "address"
15991
+ },
15992
+ {
15993
+ internalType: "address",
15994
+ name: "approving",
15995
+ type: "address"
15996
+ },
15997
+ {
15998
+ internalType: "uint256",
15999
+ name: "approvalAmount",
16000
+ type: "uint256"
16001
+ }
16002
+ ],
16003
+ name: "ApprovalFailure",
16004
+ type: "error"
16005
+ },
16006
+ {
16007
+ inputs: [
16008
+ {
16009
+ internalType: "address",
16010
+ name: "thrower",
16011
+ type: "address"
16012
+ },
16013
+ {
16014
+ internalType: "contract ERC20",
16015
+ name: "asset",
16016
+ type: "address"
16017
+ },
16018
+ {
16019
+ internalType: "address",
16020
+ name: "sender",
16021
+ type: "address"
16022
+ },
16023
+ {
16024
+ internalType: "address",
16025
+ name: "receiver",
16026
+ type: "address"
16027
+ },
16028
+ {
16029
+ internalType: "uint256",
16030
+ name: "amount",
16031
+ type: "uint256"
16032
+ }
16033
+ ],
16034
+ name: "AssetTransferFailed",
16035
+ type: "error"
16036
+ },
16037
+ {
16038
+ inputs: [
16039
+ {
16040
+ internalType: "address",
16041
+ name: "thrower",
16042
+ type: "address"
16043
+ },
16044
+ {
16045
+ internalType: "uint8",
16046
+ name: "id",
16047
+ type: "uint8"
16048
+ },
16049
+ {
16050
+ internalType: "address",
16051
+ name: "addr",
16052
+ type: "address"
16053
+ }
16054
+ ],
16055
+ name: "DuplicateEntry",
16056
+ type: "error"
16057
+ },
16058
+ {
16059
+ inputs: [
16060
+ {
16061
+ internalType: "address",
16062
+ name: "thrower",
16063
+ type: "address"
16064
+ },
16065
+ {
16066
+ internalType: "address",
16067
+ name: "caller",
16068
+ type: "address"
16069
+ },
16070
+ {
16071
+ internalType: "address",
16072
+ name: "nominatedOwner",
16073
+ type: "address"
16074
+ }
16075
+ ],
16076
+ name: "OnlyNominatedOwner",
16077
+ type: "error"
16078
+ },
16079
+ {
16080
+ inputs: [
16081
+ {
16082
+ internalType: "address",
16083
+ name: "thrower",
16084
+ type: "address"
16085
+ },
16086
+ {
16087
+ internalType: "address",
16088
+ name: "caller",
16089
+ type: "address"
16090
+ },
16091
+ {
16092
+ internalType: "address",
16093
+ name: "owner",
16094
+ type: "address"
16095
+ }
16096
+ ],
16097
+ name: "OnlyOwner",
16098
+ type: "error"
16099
+ },
16100
+ {
16101
+ inputs: [
16102
+ {
16103
+ internalType: "address",
16104
+ name: "thrower",
16105
+ type: "address"
16106
+ },
16107
+ {
16108
+ internalType: "enum OptionMarket.OptionType",
16109
+ name: "optionType",
16110
+ type: "uint8"
16111
+ }
16112
+ ],
16113
+ name: "OnlyShorts",
16114
+ type: "error"
16115
+ },
16116
+ {
16117
+ inputs: [
16118
+ {
16119
+ internalType: "address",
16120
+ name: "thrower",
16121
+ type: "address"
16122
+ },
16123
+ {
16124
+ internalType: "uint8",
16125
+ name: "id",
16126
+ type: "uint8"
16127
+ }
16128
+ ],
16129
+ name: "RemovingInvalidId",
16130
+ type: "error"
16131
+ },
16132
+ {
16133
+ inputs: [
16134
+ {
16135
+ internalType: "address",
16136
+ name: "asset",
16137
+ type: "address"
16138
+ }
16139
+ ],
16140
+ name: "UnsupportedToken",
16141
+ type: "error"
16142
+ },
16143
+ {
16144
+ anonymous: false,
16145
+ inputs: [
16146
+ {
16147
+ indexed: false,
16148
+ internalType: "address",
16149
+ name: "oldOwner",
16150
+ type: "address"
16151
+ },
16152
+ {
16153
+ indexed: false,
16154
+ internalType: "address",
16155
+ name: "newOwner",
16156
+ type: "address"
16157
+ }
16158
+ ],
16159
+ name: "OwnerChanged",
16160
+ type: "event"
16161
+ },
16162
+ {
16163
+ anonymous: false,
16164
+ inputs: [
16165
+ {
16166
+ indexed: false,
16167
+ internalType: "address",
16168
+ name: "newOwner",
16169
+ type: "address"
16170
+ }
16171
+ ],
16172
+ name: "OwnerNominated",
16173
+ type: "event"
16174
+ },
16175
+ {
16176
+ anonymous: false,
16177
+ inputs: [
16178
+ {
16179
+ indexed: false,
16180
+ internalType: "bool",
16181
+ name: "isOpen",
16182
+ type: "bool"
16183
+ },
16184
+ {
16185
+ indexed: false,
16186
+ internalType: "bool",
16187
+ name: "isLong",
16188
+ type: "bool"
16189
+ },
16190
+ {
16191
+ indexed: true,
16192
+ internalType: "address",
16193
+ name: "market",
16194
+ type: "address"
16195
+ },
16196
+ {
16197
+ indexed: true,
16198
+ internalType: "uint256",
16199
+ name: "positionId",
16200
+ type: "uint256"
16201
+ },
16202
+ {
16203
+ indexed: true,
16204
+ internalType: "address",
16205
+ name: "owner",
16206
+ type: "address"
16207
+ },
16208
+ {
16209
+ indexed: false,
16210
+ internalType: "uint256",
16211
+ name: "amount",
16212
+ type: "uint256"
16213
+ },
16214
+ {
16215
+ indexed: false,
16216
+ internalType: "uint256",
16217
+ name: "totalCost",
16218
+ type: "uint256"
16219
+ },
16220
+ {
16221
+ indexed: false,
16222
+ internalType: "uint256",
16223
+ name: "totalFee",
16224
+ type: "uint256"
16225
+ },
16226
+ {
16227
+ indexed: false,
16228
+ internalType: "int256",
16229
+ name: "swapFee",
16230
+ type: "int256"
16231
+ },
16232
+ {
16233
+ indexed: false,
16234
+ internalType: "address",
16235
+ name: "token",
16236
+ type: "address"
16237
+ }
16238
+ ],
16239
+ name: "PositionTraded",
16240
+ type: "event"
16241
+ },
16242
+ {
16243
+ anonymous: false,
16244
+ inputs: [
16245
+ {
16246
+ indexed: false,
16247
+ internalType: "uint256",
16248
+ name: "newCollateral",
16249
+ type: "uint256"
16250
+ }
16251
+ ],
16252
+ name: "SetCollateralTo",
16253
+ type: "event"
16254
+ },
16255
+ {
16256
+ anonymous: false,
16257
+ inputs: [
16258
+ {
16259
+ indexed: false,
16260
+ internalType: "contract ICurve",
16261
+ name: "curveSwap",
16262
+ type: "address"
16263
+ },
16264
+ {
16265
+ indexed: false,
16266
+ internalType: "contract SynthetixAdapter",
16267
+ name: "synthetixAdapter",
16268
+ type: "address"
16269
+ },
16270
+ {
16271
+ indexed: false,
16272
+ internalType: "contract IFeeCounter",
16273
+ name: "tradingRewards",
16274
+ type: "address"
16275
+ },
16276
+ {
16277
+ indexed: false,
16278
+ internalType: "uint256",
16279
+ name: "minReturnPercent",
16280
+ type: "uint256"
16281
+ }
16282
+ ],
16283
+ name: "WrapperParamsUpdated",
16284
+ type: "event"
16285
+ },
16286
+ {
16287
+ inputs: [
16288
+ ],
16289
+ name: "acceptOwnership",
16290
+ outputs: [
16291
+ ],
16292
+ stateMutability: "nonpayable",
16293
+ type: "function"
16294
+ },
16295
+ {
16296
+ inputs: [
16297
+ {
16298
+ internalType: "contract ERC20",
16299
+ name: "token",
16300
+ type: "address"
16301
+ },
16302
+ {
16303
+ internalType: "uint8",
16304
+ name: "id",
16305
+ type: "uint8"
16306
+ }
16307
+ ],
16308
+ name: "addCurveStable",
16309
+ outputs: [
16310
+ ],
16311
+ stateMutability: "nonpayable",
16312
+ type: "function"
16313
+ },
16314
+ {
16315
+ inputs: [
16316
+ {
16317
+ internalType: "uint256",
16318
+ name: "params",
16319
+ type: "uint256"
16320
+ }
16321
+ ],
16322
+ name: "addLong",
16323
+ outputs: [
16324
+ {
16325
+ internalType: "uint256",
16326
+ name: "totalCost",
16327
+ type: "uint256"
16328
+ }
16329
+ ],
16330
+ stateMutability: "nonpayable",
16331
+ type: "function"
16332
+ },
16333
+ {
16334
+ inputs: [
16335
+ {
16336
+ internalType: "contract OptionMarket",
16337
+ name: "optionMarket",
16338
+ type: "address"
16339
+ },
16340
+ {
16341
+ internalType: "uint8",
16342
+ name: "id",
16343
+ type: "uint8"
16344
+ },
16345
+ {
16346
+ components: [
16347
+ {
16348
+ internalType: "contract ERC20",
16349
+ name: "quoteAsset",
16350
+ type: "address"
16351
+ },
16352
+ {
16353
+ internalType: "contract ERC20",
16354
+ name: "baseAsset",
16355
+ type: "address"
16356
+ },
16357
+ {
16358
+ internalType: "contract OptionToken",
16359
+ name: "optionToken",
16360
+ type: "address"
16361
+ },
16362
+ {
16363
+ internalType: "contract LiquidityPool",
16364
+ name: "liquidityPool",
16365
+ type: "address"
16366
+ },
16367
+ {
16368
+ internalType: "contract LiquidityToken",
16369
+ name: "liquidityToken",
16370
+ type: "address"
16371
+ }
16372
+ ],
16373
+ internalType: "struct OptionMarketWrapperWithSwaps.OptionMarketContracts",
16374
+ name: "_marketContracts",
16375
+ type: "tuple"
16376
+ }
16377
+ ],
16378
+ name: "addMarket",
16379
+ outputs: [
16380
+ ],
16381
+ stateMutability: "nonpayable",
16382
+ type: "function"
16383
+ },
16384
+ {
16385
+ inputs: [
16386
+ {
16387
+ internalType: "uint256",
16388
+ name: "params",
16389
+ type: "uint256"
16390
+ }
16391
+ ],
16392
+ name: "addShort",
16393
+ outputs: [
16394
+ {
16395
+ internalType: "uint256",
16396
+ name: "totalReceived",
16397
+ type: "uint256"
16398
+ }
16399
+ ],
16400
+ stateMutability: "nonpayable",
16401
+ type: "function"
16402
+ },
16403
+ {
16404
+ inputs: [
16405
+ {
16406
+ internalType: "uint256",
16407
+ name: "params",
16408
+ type: "uint256"
16409
+ }
16410
+ ],
16411
+ name: "closeLong",
16412
+ outputs: [
16413
+ {
16414
+ internalType: "uint256",
16415
+ name: "totalReceived",
16416
+ type: "uint256"
16417
+ }
16418
+ ],
16419
+ stateMutability: "nonpayable",
16420
+ type: "function"
16421
+ },
16422
+ {
16423
+ inputs: [
16424
+ {
16425
+ components: [
16426
+ {
16427
+ internalType: "contract OptionMarket",
16428
+ name: "optionMarket",
16429
+ type: "address"
16430
+ },
16431
+ {
16432
+ internalType: "uint256",
16433
+ name: "strikeId",
16434
+ type: "uint256"
16435
+ },
16436
+ {
16437
+ internalType: "uint256",
16438
+ name: "positionId",
16439
+ type: "uint256"
16440
+ },
16441
+ {
16442
+ internalType: "uint256",
16443
+ name: "iterations",
16444
+ type: "uint256"
16445
+ },
16446
+ {
16447
+ internalType: "uint256",
16448
+ name: "setCollateralTo",
16449
+ type: "uint256"
16450
+ },
16451
+ {
16452
+ internalType: "uint256",
16453
+ name: "currentCollateral",
16454
+ type: "uint256"
16455
+ },
16456
+ {
16457
+ internalType: "enum OptionMarket.OptionType",
16458
+ name: "optionType",
16459
+ type: "uint8"
16460
+ },
16461
+ {
16462
+ internalType: "uint256",
16463
+ name: "amount",
16464
+ type: "uint256"
16465
+ },
16466
+ {
16467
+ internalType: "uint256",
16468
+ name: "minCost",
16469
+ type: "uint256"
16470
+ },
16471
+ {
16472
+ internalType: "uint256",
16473
+ name: "maxCost",
16474
+ type: "uint256"
16475
+ },
16476
+ {
16477
+ internalType: "uint256",
16478
+ name: "inputAmount",
16479
+ type: "uint256"
16480
+ },
16481
+ {
16482
+ internalType: "contract ERC20",
16483
+ name: "inputAsset",
16484
+ type: "address"
16485
+ }
16486
+ ],
16487
+ internalType: "struct OptionMarketWrapperWithSwaps.OptionPositionParams",
16488
+ name: "params",
16489
+ type: "tuple"
16490
+ }
16491
+ ],
16492
+ name: "closePosition",
16493
+ outputs: [
16494
+ {
16495
+ components: [
16496
+ {
16497
+ internalType: "address",
16498
+ name: "market",
16499
+ type: "address"
16500
+ },
16501
+ {
16502
+ internalType: "uint256",
16503
+ name: "positionId",
16504
+ type: "uint256"
16505
+ },
16506
+ {
16507
+ internalType: "address",
16508
+ name: "owner",
16509
+ type: "address"
16510
+ },
16511
+ {
16512
+ internalType: "uint256",
16513
+ name: "amount",
16514
+ type: "uint256"
16515
+ },
16516
+ {
16517
+ internalType: "uint256",
16518
+ name: "totalCost",
16519
+ type: "uint256"
16520
+ },
16521
+ {
16522
+ internalType: "uint256",
16523
+ name: "totalFee",
16524
+ type: "uint256"
16525
+ },
16526
+ {
16527
+ internalType: "int256",
16528
+ name: "swapFee",
16529
+ type: "int256"
16530
+ },
16531
+ {
16532
+ internalType: "address",
16533
+ name: "token",
16534
+ type: "address"
16535
+ }
16536
+ ],
16537
+ internalType: "struct OptionMarketWrapperWithSwaps.ReturnDetails",
16538
+ name: "returnDetails",
16539
+ type: "tuple"
16540
+ }
16541
+ ],
16542
+ stateMutability: "nonpayable",
16543
+ type: "function"
16544
+ },
16545
+ {
16546
+ inputs: [
16547
+ {
16548
+ internalType: "uint256",
16549
+ name: "params",
16550
+ type: "uint256"
16551
+ }
16552
+ ],
16553
+ name: "closeShort",
16554
+ outputs: [
16555
+ {
16556
+ internalType: "uint256",
16557
+ name: "totalCost",
16558
+ type: "uint256"
16559
+ }
16560
+ ],
16561
+ stateMutability: "nonpayable",
16562
+ type: "function"
16563
+ },
16564
+ {
16565
+ inputs: [
16566
+ ],
16567
+ name: "curveSwap",
16568
+ outputs: [
16569
+ {
16570
+ internalType: "contract ICurve",
16571
+ name: "",
16572
+ type: "address"
16573
+ }
16574
+ ],
16575
+ stateMutability: "view",
16576
+ type: "function"
16577
+ },
16578
+ {
16579
+ inputs: [
16580
+ {
16581
+ internalType: "uint256",
16582
+ name: "",
16583
+ type: "uint256"
16584
+ }
16585
+ ],
16586
+ name: "ercIds",
16587
+ outputs: [
16588
+ {
16589
+ internalType: "uint8",
16590
+ name: "",
16591
+ type: "uint8"
16592
+ }
16593
+ ],
16594
+ stateMutability: "view",
16595
+ type: "function"
16596
+ },
16597
+ {
16598
+ inputs: [
16599
+ {
16600
+ components: [
16601
+ {
16602
+ internalType: "contract OptionMarket",
16603
+ name: "optionMarket",
16604
+ type: "address"
16605
+ },
16606
+ {
16607
+ internalType: "uint256",
16608
+ name: "strikeId",
16609
+ type: "uint256"
16610
+ },
16611
+ {
16612
+ internalType: "uint256",
16613
+ name: "positionId",
16614
+ type: "uint256"
16615
+ },
16616
+ {
16617
+ internalType: "uint256",
16618
+ name: "iterations",
16619
+ type: "uint256"
16620
+ },
16621
+ {
16622
+ internalType: "uint256",
16623
+ name: "setCollateralTo",
16624
+ type: "uint256"
16625
+ },
16626
+ {
16627
+ internalType: "uint256",
16628
+ name: "currentCollateral",
16629
+ type: "uint256"
16630
+ },
16631
+ {
16632
+ internalType: "enum OptionMarket.OptionType",
16633
+ name: "optionType",
16634
+ type: "uint8"
16635
+ },
16636
+ {
16637
+ internalType: "uint256",
16638
+ name: "amount",
16639
+ type: "uint256"
16640
+ },
16641
+ {
16642
+ internalType: "uint256",
16643
+ name: "minCost",
16644
+ type: "uint256"
16645
+ },
16646
+ {
16647
+ internalType: "uint256",
16648
+ name: "maxCost",
16649
+ type: "uint256"
16650
+ },
16651
+ {
16652
+ internalType: "uint256",
16653
+ name: "inputAmount",
16654
+ type: "uint256"
16655
+ },
16656
+ {
16657
+ internalType: "contract ERC20",
16658
+ name: "inputAsset",
16659
+ type: "address"
16660
+ }
16661
+ ],
16662
+ internalType: "struct OptionMarketWrapperWithSwaps.OptionPositionParams",
16663
+ name: "params",
16664
+ type: "tuple"
16665
+ }
16666
+ ],
16667
+ name: "forceClosePosition",
16668
+ outputs: [
16669
+ {
16670
+ components: [
16671
+ {
16672
+ internalType: "address",
16673
+ name: "market",
16674
+ type: "address"
16675
+ },
16676
+ {
16677
+ internalType: "uint256",
16678
+ name: "positionId",
16679
+ type: "uint256"
16680
+ },
16681
+ {
16682
+ internalType: "address",
16683
+ name: "owner",
16684
+ type: "address"
16685
+ },
16686
+ {
16687
+ internalType: "uint256",
16688
+ name: "amount",
16689
+ type: "uint256"
16690
+ },
16691
+ {
16692
+ internalType: "uint256",
16693
+ name: "totalCost",
16694
+ type: "uint256"
16695
+ },
16696
+ {
16697
+ internalType: "uint256",
16698
+ name: "totalFee",
16699
+ type: "uint256"
16700
+ },
16701
+ {
16702
+ internalType: "int256",
16703
+ name: "swapFee",
16704
+ type: "int256"
16705
+ },
16706
+ {
16707
+ internalType: "address",
16708
+ name: "token",
16709
+ type: "address"
16710
+ }
16711
+ ],
16712
+ internalType: "struct OptionMarketWrapperWithSwaps.ReturnDetails",
16713
+ name: "returnDetails",
16714
+ type: "tuple"
16715
+ }
16716
+ ],
16717
+ stateMutability: "nonpayable",
16718
+ type: "function"
16719
+ },
16720
+ {
16721
+ inputs: [
16722
+ {
16723
+ internalType: "address",
16724
+ name: "owner",
16725
+ type: "address"
16726
+ }
16727
+ ],
16728
+ name: "getBalancesAndAllowances",
16729
+ outputs: [
16730
+ {
16731
+ components: [
16732
+ {
16733
+ internalType: "uint8",
16734
+ name: "id",
16735
+ type: "uint8"
16736
+ },
16737
+ {
16738
+ internalType: "address",
16739
+ name: "token",
16740
+ type: "address"
16741
+ },
16742
+ {
16743
+ internalType: "uint8",
16744
+ name: "decimals",
16745
+ type: "uint8"
16746
+ },
16747
+ {
16748
+ internalType: "string",
16749
+ name: "symbol",
16750
+ type: "string"
16751
+ },
16752
+ {
16753
+ internalType: "uint256",
16754
+ name: "balance",
16755
+ type: "uint256"
16756
+ },
16757
+ {
16758
+ internalType: "uint256",
16759
+ name: "allowance",
16760
+ type: "uint256"
16761
+ }
16762
+ ],
16763
+ internalType: "struct OptionMarketWrapperWithSwaps.StableAssetView[]",
16764
+ name: "",
16765
+ type: "tuple[]"
16766
+ },
16767
+ {
16768
+ components: [
16769
+ {
16770
+ internalType: "uint8",
16771
+ name: "id",
16772
+ type: "uint8"
16773
+ },
16774
+ {
16775
+ internalType: "contract OptionMarket",
16776
+ name: "market",
16777
+ type: "address"
16778
+ },
16779
+ {
16780
+ internalType: "address",
16781
+ name: "token",
16782
+ type: "address"
16783
+ },
16784
+ {
16785
+ internalType: "uint8",
16786
+ name: "decimals",
16787
+ type: "uint8"
16788
+ },
16789
+ {
16790
+ internalType: "string",
16791
+ name: "symbol",
16792
+ type: "string"
16793
+ },
16794
+ {
16795
+ internalType: "uint256",
16796
+ name: "balance",
16797
+ type: "uint256"
16798
+ },
16799
+ {
16800
+ internalType: "uint256",
16801
+ name: "allowance",
16802
+ type: "uint256"
16803
+ },
16804
+ {
16805
+ internalType: "bool",
16806
+ name: "isApprovedForAll",
16807
+ type: "bool"
16808
+ }
16809
+ ],
16810
+ internalType: "struct OptionMarketWrapperWithSwaps.MarketAssetView[]",
16811
+ name: "",
16812
+ type: "tuple[]"
16813
+ },
16814
+ {
16815
+ components: [
16816
+ {
16817
+ internalType: "address",
16818
+ name: "token",
16819
+ type: "address"
16820
+ },
16821
+ {
16822
+ internalType: "uint256",
16823
+ name: "balance",
16824
+ type: "uint256"
16825
+ },
16826
+ {
16827
+ internalType: "uint256",
16828
+ name: "allowance",
16829
+ type: "uint256"
16830
+ }
16831
+ ],
16832
+ internalType: "struct OptionMarketWrapperWithSwaps.LiquidityBalanceAndAllowance[]",
16833
+ name: "",
16834
+ type: "tuple[]"
16835
+ }
16836
+ ],
16837
+ stateMutability: "view",
16838
+ type: "function"
16839
+ },
16840
+ {
16841
+ inputs: [
16842
+ ],
16843
+ name: "getMarketAndErcIds",
16844
+ outputs: [
16845
+ {
16846
+ internalType: "uint8[]",
16847
+ name: "",
16848
+ type: "uint8[]"
16849
+ },
16850
+ {
16851
+ internalType: "uint8[]",
16852
+ name: "",
16853
+ type: "uint8[]"
16854
+ }
16855
+ ],
16856
+ stateMutability: "view",
16857
+ type: "function"
16858
+ },
16859
+ {
16860
+ inputs: [
16861
+ {
16862
+ internalType: "uint8",
16863
+ name: "",
16864
+ type: "uint8"
16865
+ }
16866
+ ],
16867
+ name: "idToERC",
16868
+ outputs: [
16869
+ {
16870
+ internalType: "contract ERC20",
16871
+ name: "",
16872
+ type: "address"
16873
+ }
16874
+ ],
16875
+ stateMutability: "view",
16876
+ type: "function"
16877
+ },
16878
+ {
16879
+ inputs: [
16880
+ {
16881
+ internalType: "uint8",
16882
+ name: "",
16883
+ type: "uint8"
16884
+ }
16885
+ ],
16886
+ name: "idToMarket",
16887
+ outputs: [
16888
+ {
16889
+ internalType: "contract OptionMarket",
16890
+ name: "",
16891
+ type: "address"
16892
+ }
16893
+ ],
16894
+ stateMutability: "view",
16895
+ type: "function"
16896
+ },
16897
+ {
16898
+ inputs: [
16899
+ {
16900
+ internalType: "contract OptionMarket",
16901
+ name: "",
16902
+ type: "address"
16903
+ }
16904
+ ],
16905
+ name: "marketContracts",
16906
+ outputs: [
16907
+ {
16908
+ internalType: "contract ERC20",
16909
+ name: "quoteAsset",
16910
+ type: "address"
16911
+ },
16912
+ {
16913
+ internalType: "contract ERC20",
16914
+ name: "baseAsset",
16915
+ type: "address"
16916
+ },
16917
+ {
16918
+ internalType: "contract OptionToken",
16919
+ name: "optionToken",
16920
+ type: "address"
16921
+ },
16922
+ {
16923
+ internalType: "contract LiquidityPool",
16924
+ name: "liquidityPool",
16925
+ type: "address"
16926
+ },
16927
+ {
16928
+ internalType: "contract LiquidityToken",
16929
+ name: "liquidityToken",
16930
+ type: "address"
16931
+ }
16932
+ ],
16933
+ stateMutability: "view",
16934
+ type: "function"
16935
+ },
16936
+ {
16937
+ inputs: [
16938
+ {
16939
+ internalType: "uint256",
16940
+ name: "",
16941
+ type: "uint256"
16942
+ }
16943
+ ],
16944
+ name: "marketIds",
16945
+ outputs: [
16946
+ {
16947
+ internalType: "uint8",
16948
+ name: "",
16949
+ type: "uint8"
16950
+ }
16951
+ ],
16952
+ stateMutability: "view",
16953
+ type: "function"
16954
+ },
16955
+ {
16956
+ inputs: [
16957
+ ],
16958
+ name: "minReturnPercent",
16959
+ outputs: [
16960
+ {
16961
+ internalType: "uint256",
16962
+ name: "",
16963
+ type: "uint256"
16964
+ }
16965
+ ],
16966
+ stateMutability: "view",
16967
+ type: "function"
16968
+ },
16969
+ {
16970
+ inputs: [
16971
+ {
16972
+ internalType: "address",
16973
+ name: "_owner",
16974
+ type: "address"
16975
+ }
16976
+ ],
16977
+ name: "nominateNewOwner",
16978
+ outputs: [
16979
+ ],
16980
+ stateMutability: "nonpayable",
16981
+ type: "function"
16982
+ },
16983
+ {
16984
+ inputs: [
16985
+ ],
16986
+ name: "nominatedOwner",
16987
+ outputs: [
16988
+ {
16989
+ internalType: "address",
16990
+ name: "",
16991
+ type: "address"
16992
+ }
16993
+ ],
16994
+ stateMutability: "view",
16995
+ type: "function"
16996
+ },
16997
+ {
16998
+ inputs: [
16999
+ {
17000
+ internalType: "uint256",
17001
+ name: "params",
17002
+ type: "uint256"
17003
+ }
17004
+ ],
17005
+ name: "openLong",
17006
+ outputs: [
17007
+ {
17008
+ internalType: "uint256",
17009
+ name: "totalCost",
17010
+ type: "uint256"
17011
+ }
17012
+ ],
17013
+ stateMutability: "nonpayable",
17014
+ type: "function"
17015
+ },
17016
+ {
17017
+ inputs: [
17018
+ {
17019
+ components: [
17020
+ {
17021
+ internalType: "contract OptionMarket",
17022
+ name: "optionMarket",
17023
+ type: "address"
17024
+ },
17025
+ {
17026
+ internalType: "uint256",
17027
+ name: "strikeId",
17028
+ type: "uint256"
17029
+ },
17030
+ {
17031
+ internalType: "uint256",
17032
+ name: "positionId",
17033
+ type: "uint256"
17034
+ },
17035
+ {
17036
+ internalType: "uint256",
17037
+ name: "iterations",
17038
+ type: "uint256"
17039
+ },
17040
+ {
17041
+ internalType: "uint256",
17042
+ name: "setCollateralTo",
17043
+ type: "uint256"
17044
+ },
17045
+ {
17046
+ internalType: "uint256",
17047
+ name: "currentCollateral",
17048
+ type: "uint256"
17049
+ },
17050
+ {
17051
+ internalType: "enum OptionMarket.OptionType",
17052
+ name: "optionType",
17053
+ type: "uint8"
17054
+ },
17055
+ {
17056
+ internalType: "uint256",
17057
+ name: "amount",
17058
+ type: "uint256"
17059
+ },
17060
+ {
17061
+ internalType: "uint256",
17062
+ name: "minCost",
17063
+ type: "uint256"
17064
+ },
17065
+ {
17066
+ internalType: "uint256",
17067
+ name: "maxCost",
17068
+ type: "uint256"
17069
+ },
17070
+ {
17071
+ internalType: "uint256",
17072
+ name: "inputAmount",
17073
+ type: "uint256"
17074
+ },
17075
+ {
17076
+ internalType: "contract ERC20",
17077
+ name: "inputAsset",
17078
+ type: "address"
17079
+ }
17080
+ ],
17081
+ internalType: "struct OptionMarketWrapperWithSwaps.OptionPositionParams",
17082
+ name: "params",
17083
+ type: "tuple"
17084
+ }
17085
+ ],
17086
+ name: "openPosition",
17087
+ outputs: [
17088
+ {
17089
+ components: [
17090
+ {
17091
+ internalType: "address",
17092
+ name: "market",
17093
+ type: "address"
17094
+ },
17095
+ {
17096
+ internalType: "uint256",
17097
+ name: "positionId",
17098
+ type: "uint256"
17099
+ },
17100
+ {
17101
+ internalType: "address",
17102
+ name: "owner",
17103
+ type: "address"
17104
+ },
17105
+ {
17106
+ internalType: "uint256",
17107
+ name: "amount",
17108
+ type: "uint256"
17109
+ },
17110
+ {
17111
+ internalType: "uint256",
17112
+ name: "totalCost",
17113
+ type: "uint256"
17114
+ },
17115
+ {
17116
+ internalType: "uint256",
17117
+ name: "totalFee",
17118
+ type: "uint256"
17119
+ },
17120
+ {
17121
+ internalType: "int256",
17122
+ name: "swapFee",
17123
+ type: "int256"
17124
+ },
17125
+ {
17126
+ internalType: "address",
17127
+ name: "token",
17128
+ type: "address"
17129
+ }
17130
+ ],
17131
+ internalType: "struct OptionMarketWrapperWithSwaps.ReturnDetails",
17132
+ name: "returnDetails",
17133
+ type: "tuple"
17134
+ }
17135
+ ],
17136
+ stateMutability: "nonpayable",
17137
+ type: "function"
17138
+ },
17139
+ {
17140
+ inputs: [
17141
+ {
17142
+ internalType: "uint256",
17143
+ name: "params",
17144
+ type: "uint256"
17145
+ }
17146
+ ],
17147
+ name: "openShort",
17148
+ outputs: [
17149
+ {
17150
+ internalType: "uint256",
17151
+ name: "totalReceived",
17152
+ type: "uint256"
17153
+ }
17154
+ ],
17155
+ stateMutability: "nonpayable",
17156
+ type: "function"
17157
+ },
17158
+ {
17159
+ inputs: [
17160
+ ],
17161
+ name: "owner",
17162
+ outputs: [
17163
+ {
17164
+ internalType: "address",
17165
+ name: "",
17166
+ type: "address"
17167
+ }
17168
+ ],
17169
+ stateMutability: "view",
17170
+ type: "function"
17171
+ },
17172
+ {
17173
+ inputs: [
17174
+ {
17175
+ internalType: "address",
17176
+ name: "fromToken",
17177
+ type: "address"
17178
+ },
17179
+ {
17180
+ internalType: "address",
17181
+ name: "toToken",
17182
+ type: "address"
17183
+ },
17184
+ {
17185
+ internalType: "uint256",
17186
+ name: "amountIn",
17187
+ type: "uint256"
17188
+ }
17189
+ ],
17190
+ name: "quoteCurveSwap",
17191
+ outputs: [
17192
+ {
17193
+ internalType: "address",
17194
+ name: "pool",
17195
+ type: "address"
17196
+ },
17197
+ {
17198
+ internalType: "uint256",
17199
+ name: "amountOut",
17200
+ type: "uint256"
17201
+ }
17202
+ ],
17203
+ stateMutability: "view",
17204
+ type: "function"
17205
+ },
17206
+ {
17207
+ inputs: [
17208
+ {
17209
+ internalType: "uint256",
17210
+ name: "params",
17211
+ type: "uint256"
17212
+ }
17213
+ ],
17214
+ name: "reduceLong",
17215
+ outputs: [
17216
+ {
17217
+ internalType: "uint256",
17218
+ name: "totalReceived",
17219
+ type: "uint256"
17220
+ }
17221
+ ],
17222
+ stateMutability: "nonpayable",
17223
+ type: "function"
17224
+ },
17225
+ {
17226
+ inputs: [
17227
+ {
17228
+ internalType: "uint256",
17229
+ name: "params",
17230
+ type: "uint256"
17231
+ }
17232
+ ],
17233
+ name: "reduceShort",
17234
+ outputs: [
17235
+ {
17236
+ internalType: "uint256",
17237
+ name: "totalCost",
17238
+ type: "uint256"
17239
+ }
17240
+ ],
17241
+ stateMutability: "nonpayable",
17242
+ type: "function"
17243
+ },
17244
+ {
17245
+ inputs: [
17246
+ {
17247
+ internalType: "uint8",
17248
+ name: "id",
17249
+ type: "uint8"
17250
+ }
17251
+ ],
17252
+ name: "removeCurveStable",
17253
+ outputs: [
17254
+ ],
17255
+ stateMutability: "nonpayable",
17256
+ type: "function"
17257
+ },
17258
+ {
17259
+ inputs: [
17260
+ {
17261
+ internalType: "uint8",
17262
+ name: "id",
17263
+ type: "uint8"
17264
+ }
17265
+ ],
17266
+ name: "removeMarket",
17267
+ outputs: [
17268
+ ],
17269
+ stateMutability: "nonpayable",
17270
+ type: "function"
17271
+ },
17272
+ {
17273
+ inputs: [
17274
+ ],
17275
+ name: "synthetixAdapter",
17276
+ outputs: [
17277
+ {
17278
+ internalType: "contract SynthetixAdapter",
17279
+ name: "",
17280
+ type: "address"
17281
+ }
17282
+ ],
17283
+ stateMutability: "view",
17284
+ type: "function"
17285
+ },
17286
+ {
17287
+ inputs: [
17288
+ ],
17289
+ name: "tradingRewards",
17290
+ outputs: [
17291
+ {
17292
+ internalType: "contract IFeeCounter",
17293
+ name: "",
17294
+ type: "address"
17295
+ }
17296
+ ],
17297
+ stateMutability: "view",
17298
+ type: "function"
17299
+ },
17300
+ {
17301
+ inputs: [
17302
+ {
17303
+ internalType: "contract ICurve",
17304
+ name: "_curveSwap",
17305
+ type: "address"
17306
+ },
17307
+ {
17308
+ internalType: "contract SynthetixAdapter",
17309
+ name: "_synthetixAdapter",
17310
+ type: "address"
17311
+ },
17312
+ {
17313
+ internalType: "contract IFeeCounter",
17314
+ name: "_tradingRewards",
17315
+ type: "address"
17316
+ },
17317
+ {
17318
+ internalType: "uint256",
17319
+ name: "_minReturnPercent",
17320
+ type: "uint256"
17321
+ }
17322
+ ],
17323
+ name: "updateContractParams",
17324
+ outputs: [
17325
+ ],
17326
+ stateMutability: "nonpayable",
17327
+ type: "function"
17328
+ }
17329
+ ];
17330
+ var IOptionMarketWrapper = {
17331
+ abi: abi$n
17332
+ };
17333
+
17334
+ function getLyraTradeOptionType(isCall, isLong, isCoveredCall) {
17335
+ if (isCall) {
17336
+ return isLong ? 0 : isCoveredCall ? 2 : 3;
17337
+ } else {
17338
+ return isLong ? 1 : 4;
17339
+ }
17340
+ }
17341
+ function isCall(optionType) {
17342
+ return [0, 2, 3].includes(optionType);
17343
+ }
17344
+ function isLong(optionType) {
17345
+ return optionType === 0 || optionType === 1;
17346
+ }
17347
+
17348
+ var abi$o = [
17349
+ {
17350
+ inputs: [
17351
+ {
17352
+ internalType: "string",
17353
+ name: "name_",
17354
+ type: "string"
17355
+ },
17356
+ {
17357
+ internalType: "string",
17358
+ name: "symbol_",
17359
+ type: "string"
17360
+ }
17361
+ ],
17362
+ stateMutability: "nonpayable",
17363
+ type: "constructor"
17364
+ },
17365
+ {
17366
+ inputs: [
17367
+ {
17368
+ internalType: "address",
17369
+ name: "thrower",
17370
+ type: "address"
17371
+ },
17372
+ {
17373
+ internalType: "uint256",
17374
+ name: "positionId",
17375
+ type: "uint256"
17376
+ },
17377
+ {
17378
+ internalType: "bool",
17379
+ name: "invalidPositionId",
17380
+ type: "bool"
17381
+ },
17382
+ {
17383
+ internalType: "bool",
17384
+ name: "positionInactive",
17385
+ type: "bool"
17386
+ },
17387
+ {
17388
+ internalType: "bool",
17389
+ name: "isShort",
17390
+ type: "bool"
17391
+ }
17392
+ ],
17393
+ name: "AddingCollateralToInvalidPosition",
17394
+ type: "error"
17395
+ },
17396
+ {
17397
+ inputs: [
17398
+ {
17399
+ internalType: "address",
17400
+ name: "thrower",
17401
+ type: "address"
17402
+ },
17403
+ {
17404
+ components: [
17405
+ {
17406
+ internalType: "uint256",
17407
+ name: "positionId",
17408
+ type: "uint256"
17409
+ },
17410
+ {
17411
+ internalType: "uint256",
17412
+ name: "strikeId",
17413
+ type: "uint256"
17414
+ },
17415
+ {
17416
+ internalType: "enum OptionMarket.OptionType",
17417
+ name: "optionType",
17418
+ type: "uint8"
17419
+ },
17420
+ {
17421
+ internalType: "uint256",
17422
+ name: "amount",
17423
+ type: "uint256"
17424
+ },
17425
+ {
17426
+ internalType: "uint256",
17427
+ name: "collateral",
17428
+ type: "uint256"
17429
+ },
17430
+ {
17431
+ internalType: "enum OptionToken.PositionState",
17432
+ name: "state",
17433
+ type: "uint8"
17434
+ }
17435
+ ],
17436
+ internalType: "struct OptionToken.OptionPosition",
17437
+ name: "position",
17438
+ type: "tuple"
17439
+ },
17440
+ {
17441
+ internalType: "uint256",
17442
+ name: "spotPrice",
17443
+ type: "uint256"
17444
+ }
17445
+ ],
17446
+ name: "AdjustmentResultsInMinimumCollateralNotBeingMet",
17447
+ type: "error"
17448
+ },
17449
+ {
17450
+ inputs: [
17451
+ {
17452
+ internalType: "address",
17453
+ name: "thrower",
17454
+ type: "address"
17455
+ }
17456
+ ],
17457
+ name: "AlreadyInitialised",
17458
+ type: "error"
17459
+ },
17460
+ {
17461
+ inputs: [
17462
+ {
17463
+ internalType: "address",
17464
+ name: "thrower",
17465
+ type: "address"
17466
+ },
17467
+ {
17468
+ internalType: "uint256",
17469
+ name: "positionId",
17470
+ type: "uint256"
17471
+ },
17472
+ {
17473
+ internalType: "bool",
17474
+ name: "invalidPositionId",
17475
+ type: "bool"
17476
+ },
17477
+ {
17478
+ internalType: "bool",
17479
+ name: "positionInactive",
17480
+ type: "bool"
17481
+ },
17482
+ {
17483
+ internalType: "bool",
17484
+ name: "strikeMismatch",
17485
+ type: "bool"
17486
+ },
17487
+ {
17488
+ internalType: "bool",
17489
+ name: "optionTypeMismatch",
17490
+ type: "bool"
17491
+ }
17492
+ ],
17493
+ name: "CannotAdjustInvalidPosition",
17494
+ type: "error"
17495
+ },
17496
+ {
17497
+ inputs: [
17498
+ {
17499
+ internalType: "address",
17500
+ name: "thrower",
17501
+ type: "address"
17502
+ }
17503
+ ],
17504
+ name: "CannotClosePositionZero",
17505
+ type: "error"
17506
+ },
17507
+ {
17508
+ inputs: [
17509
+ {
17510
+ internalType: "address",
17511
+ name: "thrower",
17512
+ type: "address"
17513
+ }
17514
+ ],
17515
+ name: "CannotOpenZeroAmount",
17516
+ type: "error"
17517
+ },
17518
+ {
17519
+ inputs: [
17520
+ {
17521
+ internalType: "address",
17522
+ name: "thrower",
17523
+ type: "address"
17524
+ },
17525
+ {
17526
+ internalType: "uint256",
17527
+ name: "positionId",
17528
+ type: "uint256"
17529
+ },
17530
+ {
17531
+ internalType: "uint256",
17532
+ name: "setCollateralTo",
17533
+ type: "uint256"
17534
+ }
17535
+ ],
17536
+ name: "FullyClosingWithNonZeroSetCollateral",
17537
+ type: "error"
17538
+ },
17539
+ {
17540
+ inputs: [
17541
+ {
17542
+ internalType: "address",
17543
+ name: "thrower",
17544
+ type: "address"
17545
+ },
17546
+ {
17547
+ components: [
17548
+ {
17549
+ internalType: "uint256",
17550
+ name: "penaltyRatio",
17551
+ type: "uint256"
17552
+ },
17553
+ {
17554
+ internalType: "uint256",
17555
+ name: "liquidatorFeeRatio",
17556
+ type: "uint256"
17557
+ },
17558
+ {
17559
+ internalType: "uint256",
17560
+ name: "smFeeRatio",
17561
+ type: "uint256"
17562
+ },
17563
+ {
17564
+ internalType: "uint256",
17565
+ name: "minLiquidationFee",
17566
+ type: "uint256"
17567
+ }
17568
+ ],
17569
+ internalType: "struct OptionToken.PartialCollateralParameters",
17570
+ name: "partialCollatParams",
17571
+ type: "tuple"
17572
+ }
17573
+ ],
17574
+ name: "InvalidPartialCollateralParameters",
17575
+ type: "error"
17576
+ },
17577
+ {
17578
+ inputs: [
17579
+ {
17580
+ internalType: "address",
17581
+ name: "thrower",
17582
+ type: "address"
17583
+ },
17584
+ {
17585
+ internalType: "uint256",
17586
+ name: "originalPositionAmount",
17587
+ type: "uint256"
17588
+ },
17589
+ {
17590
+ internalType: "uint256",
17591
+ name: "splitAmount",
17592
+ type: "uint256"
17593
+ }
17594
+ ],
17595
+ name: "InvalidSplitAmount",
17596
+ type: "error"
17597
+ },
17598
+ {
17599
+ inputs: [
17600
+ {
17601
+ internalType: "address",
17602
+ name: "thrower",
17603
+ type: "address"
17604
+ },
17605
+ {
17606
+ internalType: "address",
17607
+ name: "caller",
17608
+ type: "address"
17609
+ },
17610
+ {
17611
+ internalType: "uint256",
17612
+ name: "positionId",
17613
+ type: "uint256"
17614
+ }
17615
+ ],
17616
+ name: "MergingUnapprovedPosition",
17617
+ type: "error"
17618
+ },
17619
+ {
17620
+ inputs: [
17621
+ {
17622
+ internalType: "address",
17623
+ name: "thrower",
17624
+ type: "address"
17625
+ }
17626
+ ],
17627
+ name: "MustMergeTwoOrMorePositions",
17628
+ type: "error"
17629
+ },
17630
+ {
17631
+ inputs: [
17632
+ {
17633
+ internalType: "address",
17634
+ name: "thrower",
17635
+ type: "address"
17636
+ },
17637
+ {
17638
+ internalType: "address",
17639
+ name: "caller",
17640
+ type: "address"
17641
+ },
17642
+ {
17643
+ internalType: "address",
17644
+ name: "nominatedOwner",
17645
+ type: "address"
17646
+ }
17647
+ ],
17648
+ name: "OnlyNominatedOwner",
17649
+ type: "error"
17650
+ },
17651
+ {
17652
+ inputs: [
17653
+ {
17654
+ internalType: "address",
17655
+ name: "thrower",
17656
+ type: "address"
17657
+ },
17658
+ {
17659
+ internalType: "address",
17660
+ name: "caller",
17661
+ type: "address"
17662
+ },
17663
+ {
17664
+ internalType: "address",
17665
+ name: "optionMarket",
17666
+ type: "address"
17667
+ }
17668
+ ],
17669
+ name: "OnlyOptionMarket",
17670
+ type: "error"
17671
+ },
17672
+ {
17673
+ inputs: [
17674
+ {
17675
+ internalType: "address",
17676
+ name: "thrower",
17677
+ type: "address"
17678
+ },
17679
+ {
17680
+ internalType: "address",
17681
+ name: "caller",
17682
+ type: "address"
17683
+ },
17684
+ {
17685
+ internalType: "address",
17686
+ name: "owner",
17687
+ type: "address"
17688
+ }
17689
+ ],
17690
+ name: "OnlyOwner",
17691
+ type: "error"
17692
+ },
17693
+ {
17694
+ inputs: [
17695
+ {
17696
+ internalType: "address",
17697
+ name: "thrower",
17698
+ type: "address"
17699
+ },
17700
+ {
17701
+ internalType: "uint256",
17702
+ name: "positionId",
17703
+ type: "uint256"
17704
+ },
17705
+ {
17706
+ internalType: "address",
17707
+ name: "trader",
17708
+ type: "address"
17709
+ },
17710
+ {
17711
+ internalType: "address",
17712
+ name: "owner",
17713
+ type: "address"
17714
+ }
17715
+ ],
17716
+ name: "OnlyOwnerCanAdjustPosition",
17717
+ type: "error"
17718
+ },
17719
+ {
17720
+ inputs: [
17721
+ {
17722
+ internalType: "address",
17723
+ name: "thrower",
17724
+ type: "address"
17725
+ },
17726
+ {
17727
+ internalType: "address",
17728
+ name: "caller",
17729
+ type: "address"
17730
+ },
17731
+ {
17732
+ internalType: "address",
17733
+ name: "shortCollateral",
17734
+ type: "address"
17735
+ }
17736
+ ],
17737
+ name: "OnlyShortCollateral",
17738
+ type: "error"
17739
+ },
17740
+ {
17741
+ inputs: [
17742
+ {
17743
+ internalType: "address",
17744
+ name: "thrower",
17745
+ type: "address"
17746
+ },
17747
+ {
17748
+ components: [
17749
+ {
17750
+ internalType: "uint256",
17751
+ name: "positionId",
17752
+ type: "uint256"
17753
+ },
17754
+ {
17755
+ internalType: "uint256",
17756
+ name: "strikeId",
17757
+ type: "uint256"
17758
+ },
17759
+ {
17760
+ internalType: "enum OptionMarket.OptionType",
17761
+ name: "optionType",
17762
+ type: "uint8"
17763
+ },
17764
+ {
17765
+ internalType: "uint256",
17766
+ name: "amount",
17767
+ type: "uint256"
17768
+ },
17769
+ {
17770
+ internalType: "uint256",
17771
+ name: "collateral",
17772
+ type: "uint256"
17773
+ },
17774
+ {
17775
+ internalType: "enum OptionToken.PositionState",
17776
+ name: "state",
17777
+ type: "uint8"
17778
+ }
17779
+ ],
17780
+ internalType: "struct OptionToken.OptionPosition",
17781
+ name: "firstPosition",
17782
+ type: "tuple"
17783
+ },
17784
+ {
17785
+ components: [
17786
+ {
17787
+ internalType: "uint256",
17788
+ name: "positionId",
17789
+ type: "uint256"
17790
+ },
17791
+ {
17792
+ internalType: "uint256",
17793
+ name: "strikeId",
17794
+ type: "uint256"
17795
+ },
17796
+ {
17797
+ internalType: "enum OptionMarket.OptionType",
17798
+ name: "optionType",
17799
+ type: "uint8"
17800
+ },
17801
+ {
17802
+ internalType: "uint256",
17803
+ name: "amount",
17804
+ type: "uint256"
17805
+ },
17806
+ {
17807
+ internalType: "uint256",
17808
+ name: "collateral",
17809
+ type: "uint256"
17810
+ },
17811
+ {
17812
+ internalType: "enum OptionToken.PositionState",
17813
+ name: "state",
17814
+ type: "uint8"
17815
+ }
17816
+ ],
17817
+ internalType: "struct OptionToken.OptionPosition",
17818
+ name: "nextPosition",
17819
+ type: "tuple"
17820
+ },
17821
+ {
17822
+ internalType: "bool",
17823
+ name: "ownerMismatch",
17824
+ type: "bool"
17825
+ },
17826
+ {
17827
+ internalType: "bool",
17828
+ name: "strikeMismatch",
17829
+ type: "bool"
17830
+ },
17831
+ {
17832
+ internalType: "bool",
17833
+ name: "optionTypeMismatch",
17834
+ type: "bool"
17835
+ },
17836
+ {
17837
+ internalType: "bool",
17838
+ name: "duplicatePositionId",
17839
+ type: "bool"
17840
+ }
17841
+ ],
17842
+ name: "PositionMismatchWhenMerging",
17843
+ type: "error"
17844
+ },
17845
+ {
17846
+ inputs: [
17847
+ {
17848
+ internalType: "address",
17849
+ name: "thrower",
17850
+ type: "address"
17851
+ },
17852
+ {
17853
+ components: [
17854
+ {
17855
+ internalType: "uint256",
17856
+ name: "positionId",
17857
+ type: "uint256"
17858
+ },
17859
+ {
17860
+ internalType: "uint256",
17861
+ name: "strikeId",
17862
+ type: "uint256"
17863
+ },
17864
+ {
17865
+ internalType: "enum OptionMarket.OptionType",
17866
+ name: "optionType",
17867
+ type: "uint8"
17868
+ },
17869
+ {
17870
+ internalType: "uint256",
17871
+ name: "amount",
17872
+ type: "uint256"
17873
+ },
17874
+ {
17875
+ internalType: "uint256",
17876
+ name: "collateral",
17877
+ type: "uint256"
17878
+ },
17879
+ {
17880
+ internalType: "enum OptionToken.PositionState",
17881
+ name: "state",
17882
+ type: "uint8"
17883
+ }
17884
+ ],
17885
+ internalType: "struct OptionToken.OptionPosition",
17886
+ name: "position",
17887
+ type: "tuple"
17888
+ },
17889
+ {
17890
+ internalType: "uint256",
17891
+ name: "spotPrice",
17892
+ type: "uint256"
17893
+ }
17894
+ ],
17895
+ name: "PositionNotLiquidatable",
17896
+ type: "error"
17897
+ },
17898
+ {
17899
+ inputs: [
17900
+ {
17901
+ internalType: "address",
17902
+ name: "thrower",
17903
+ type: "address"
17904
+ },
17905
+ {
17906
+ components: [
17907
+ {
17908
+ internalType: "uint256",
17909
+ name: "positionId",
17910
+ type: "uint256"
17911
+ },
17912
+ {
17913
+ internalType: "uint256",
17914
+ name: "strikeId",
17915
+ type: "uint256"
17916
+ },
17917
+ {
17918
+ internalType: "enum OptionMarket.OptionType",
17919
+ name: "optionType",
17920
+ type: "uint8"
17921
+ },
17922
+ {
17923
+ internalType: "uint256",
17924
+ name: "amount",
17925
+ type: "uint256"
17926
+ },
17927
+ {
17928
+ internalType: "uint256",
17929
+ name: "collateral",
17930
+ type: "uint256"
17931
+ },
17932
+ {
17933
+ internalType: "enum OptionToken.PositionState",
17934
+ name: "state",
17935
+ type: "uint8"
17936
+ }
17937
+ ],
17938
+ internalType: "struct OptionToken.OptionPosition",
17939
+ name: "position",
17940
+ type: "tuple"
17941
+ },
17942
+ {
17943
+ internalType: "uint256",
17944
+ name: "spotPrice",
17945
+ type: "uint256"
17946
+ }
17947
+ ],
17948
+ name: "ResultingNewPositionLiquidatable",
17949
+ type: "error"
17950
+ },
17951
+ {
17952
+ inputs: [
17953
+ {
17954
+ internalType: "address",
17955
+ name: "thrower",
17956
+ type: "address"
17957
+ },
17958
+ {
17959
+ components: [
17960
+ {
17961
+ internalType: "uint256",
17962
+ name: "positionId",
17963
+ type: "uint256"
17964
+ },
17965
+ {
17966
+ internalType: "uint256",
17967
+ name: "strikeId",
17968
+ type: "uint256"
17969
+ },
17970
+ {
17971
+ internalType: "enum OptionMarket.OptionType",
17972
+ name: "optionType",
17973
+ type: "uint8"
17974
+ },
17975
+ {
17976
+ internalType: "uint256",
17977
+ name: "amount",
17978
+ type: "uint256"
17979
+ },
17980
+ {
17981
+ internalType: "uint256",
17982
+ name: "collateral",
17983
+ type: "uint256"
17984
+ },
17985
+ {
17986
+ internalType: "enum OptionToken.PositionState",
17987
+ name: "state",
17988
+ type: "uint8"
17989
+ }
17990
+ ],
17991
+ internalType: "struct OptionToken.OptionPosition",
17992
+ name: "position",
17993
+ type: "tuple"
17994
+ },
17995
+ {
17996
+ internalType: "uint256",
17997
+ name: "spotPrice",
17998
+ type: "uint256"
17999
+ }
18000
+ ],
18001
+ name: "ResultingOriginalPositionLiquidatable",
18002
+ type: "error"
18003
+ },
18004
+ {
18005
+ inputs: [
18006
+ {
18007
+ internalType: "address",
18008
+ name: "thrower",
18009
+ type: "address"
18010
+ },
18011
+ {
18012
+ internalType: "address",
18013
+ name: "caller",
18014
+ type: "address"
18015
+ },
18016
+ {
18017
+ internalType: "uint256",
18018
+ name: "positionId",
18019
+ type: "uint256"
18020
+ }
18021
+ ],
18022
+ name: "SplittingUnapprovedPosition",
18023
+ type: "error"
18024
+ },
18025
+ {
18026
+ inputs: [
18027
+ {
18028
+ internalType: "address",
18029
+ name: "thrower",
18030
+ type: "address"
18031
+ },
18032
+ {
18033
+ internalType: "uint256",
18034
+ name: "strikeId",
18035
+ type: "uint256"
18036
+ }
18037
+ ],
18038
+ name: "StrikeIsSettled",
18039
+ type: "error"
18040
+ },
18041
+ {
18042
+ anonymous: false,
18043
+ inputs: [
18044
+ {
18045
+ indexed: true,
18046
+ internalType: "address",
18047
+ name: "owner",
18048
+ type: "address"
18049
+ },
18050
+ {
18051
+ indexed: true,
18052
+ internalType: "address",
18053
+ name: "approved",
18054
+ type: "address"
18055
+ },
18056
+ {
18057
+ indexed: true,
18058
+ internalType: "uint256",
18059
+ name: "tokenId",
18060
+ type: "uint256"
18061
+ }
18062
+ ],
18063
+ name: "Approval",
18064
+ type: "event"
18065
+ },
18066
+ {
18067
+ anonymous: false,
18068
+ inputs: [
18069
+ {
18070
+ indexed: true,
18071
+ internalType: "address",
18072
+ name: "owner",
18073
+ type: "address"
18074
+ },
18075
+ {
18076
+ indexed: true,
18077
+ internalType: "address",
18078
+ name: "operator",
18079
+ type: "address"
18080
+ },
18081
+ {
18082
+ indexed: false,
18083
+ internalType: "bool",
18084
+ name: "approved",
18085
+ type: "bool"
18086
+ }
18087
+ ],
18088
+ name: "ApprovalForAll",
18089
+ type: "event"
18090
+ },
18091
+ {
18092
+ anonymous: false,
18093
+ inputs: [
18094
+ {
18095
+ indexed: false,
18096
+ internalType: "address",
18097
+ name: "oldOwner",
18098
+ type: "address"
18099
+ },
18100
+ {
18101
+ indexed: false,
18102
+ internalType: "address",
18103
+ name: "newOwner",
18104
+ type: "address"
18105
+ }
18106
+ ],
18107
+ name: "OwnerChanged",
18108
+ type: "event"
18109
+ },
18110
+ {
18111
+ anonymous: false,
18112
+ inputs: [
18113
+ {
18114
+ indexed: false,
18115
+ internalType: "address",
18116
+ name: "newOwner",
18117
+ type: "address"
18118
+ }
18119
+ ],
18120
+ name: "OwnerNominated",
18121
+ type: "event"
18122
+ },
18123
+ {
18124
+ anonymous: false,
18125
+ inputs: [
18126
+ {
18127
+ components: [
18128
+ {
18129
+ internalType: "uint256",
18130
+ name: "penaltyRatio",
18131
+ type: "uint256"
18132
+ },
18133
+ {
18134
+ internalType: "uint256",
18135
+ name: "liquidatorFeeRatio",
18136
+ type: "uint256"
18137
+ },
18138
+ {
18139
+ internalType: "uint256",
18140
+ name: "smFeeRatio",
18141
+ type: "uint256"
18142
+ },
18143
+ {
18144
+ internalType: "uint256",
18145
+ name: "minLiquidationFee",
18146
+ type: "uint256"
18147
+ }
18148
+ ],
18149
+ indexed: false,
18150
+ internalType: "struct OptionToken.PartialCollateralParameters",
18151
+ name: "partialCollateralParams",
18152
+ type: "tuple"
18153
+ }
18154
+ ],
18155
+ name: "PartialCollateralParamsSet",
18156
+ type: "event"
18157
+ },
18158
+ {
18159
+ anonymous: false,
18160
+ inputs: [
18161
+ {
18162
+ indexed: true,
18163
+ internalType: "uint256",
18164
+ name: "positionId",
18165
+ type: "uint256"
18166
+ },
18167
+ {
18168
+ indexed: true,
18169
+ internalType: "address",
18170
+ name: "owner",
18171
+ type: "address"
18172
+ },
18173
+ {
18174
+ indexed: true,
18175
+ internalType: "enum OptionToken.PositionUpdatedType",
18176
+ name: "updatedType",
18177
+ type: "uint8"
18178
+ },
18179
+ {
18180
+ components: [
18181
+ {
18182
+ internalType: "uint256",
18183
+ name: "positionId",
18184
+ type: "uint256"
18185
+ },
18186
+ {
18187
+ internalType: "uint256",
18188
+ name: "strikeId",
18189
+ type: "uint256"
18190
+ },
18191
+ {
18192
+ internalType: "enum OptionMarket.OptionType",
18193
+ name: "optionType",
18194
+ type: "uint8"
18195
+ },
18196
+ {
18197
+ internalType: "uint256",
18198
+ name: "amount",
18199
+ type: "uint256"
18200
+ },
18201
+ {
18202
+ internalType: "uint256",
18203
+ name: "collateral",
18204
+ type: "uint256"
18205
+ },
18206
+ {
18207
+ internalType: "enum OptionToken.PositionState",
18208
+ name: "state",
18209
+ type: "uint8"
18210
+ }
18211
+ ],
18212
+ indexed: false,
18213
+ internalType: "struct OptionToken.OptionPosition",
18214
+ name: "position",
18215
+ type: "tuple"
18216
+ },
18217
+ {
18218
+ indexed: false,
18219
+ internalType: "uint256",
18220
+ name: "timestamp",
18221
+ type: "uint256"
18222
+ }
18223
+ ],
18224
+ name: "PositionUpdated",
18225
+ type: "event"
18226
+ },
18227
+ {
18228
+ anonymous: false,
18229
+ inputs: [
18230
+ {
18231
+ indexed: true,
18232
+ internalType: "address",
18233
+ name: "from",
18234
+ type: "address"
18235
+ },
18236
+ {
18237
+ indexed: true,
18238
+ internalType: "address",
18239
+ name: "to",
18240
+ type: "address"
18241
+ },
18242
+ {
18243
+ indexed: true,
18244
+ internalType: "uint256",
18245
+ name: "tokenId",
18246
+ type: "uint256"
18247
+ }
18248
+ ],
18249
+ name: "Transfer",
18250
+ type: "event"
18251
+ },
18252
+ {
18253
+ anonymous: false,
18254
+ inputs: [
18255
+ {
18256
+ indexed: false,
18257
+ internalType: "string",
18258
+ name: "URI",
18259
+ type: "string"
18260
+ }
18261
+ ],
18262
+ name: "URISet",
18263
+ type: "event"
18264
+ },
18265
+ {
18266
+ inputs: [
18267
+ ],
18268
+ name: "acceptOwnership",
18269
+ outputs: [
18270
+ ],
18271
+ stateMutability: "nonpayable",
18272
+ type: "function"
18273
+ },
18274
+ {
18275
+ inputs: [
18276
+ {
18277
+ internalType: "uint256",
18278
+ name: "positionId",
18279
+ type: "uint256"
18280
+ },
18281
+ {
18282
+ internalType: "uint256",
18283
+ name: "amountCollateral",
18284
+ type: "uint256"
18285
+ }
18286
+ ],
18287
+ name: "addCollateral",
18288
+ outputs: [
18289
+ {
18290
+ internalType: "enum OptionMarket.OptionType",
18291
+ name: "optionType",
18292
+ type: "uint8"
18293
+ }
18294
+ ],
18295
+ stateMutability: "nonpayable",
18296
+ type: "function"
18297
+ },
18298
+ {
18299
+ inputs: [
18300
+ {
18301
+ components: [
18302
+ {
18303
+ internalType: "bool",
18304
+ name: "isBuy",
18305
+ type: "bool"
18306
+ },
18307
+ {
18308
+ internalType: "bool",
18309
+ name: "isForceClose",
18310
+ type: "bool"
18311
+ },
18312
+ {
18313
+ internalType: "enum OptionMarket.TradeDirection",
18314
+ name: "tradeDirection",
18315
+ type: "uint8"
18316
+ },
18317
+ {
18318
+ internalType: "enum OptionMarket.OptionType",
18319
+ name: "optionType",
18320
+ type: "uint8"
18321
+ },
18322
+ {
18323
+ internalType: "uint256",
18324
+ name: "amount",
18325
+ type: "uint256"
18326
+ },
18327
+ {
18328
+ internalType: "uint256",
18329
+ name: "expiry",
18330
+ type: "uint256"
18331
+ },
18332
+ {
18333
+ internalType: "uint256",
18334
+ name: "strikePrice",
18335
+ type: "uint256"
18336
+ },
18337
+ {
18338
+ components: [
18339
+ {
18340
+ internalType: "uint256",
18341
+ name: "freeLiquidity",
18342
+ type: "uint256"
18343
+ },
18344
+ {
18345
+ internalType: "uint256",
18346
+ name: "burnableLiquidity",
18347
+ type: "uint256"
18348
+ },
18349
+ {
18350
+ internalType: "uint256",
18351
+ name: "usedCollatLiquidity",
18352
+ type: "uint256"
18353
+ },
18354
+ {
18355
+ internalType: "uint256",
18356
+ name: "pendingDeltaLiquidity",
18357
+ type: "uint256"
18358
+ },
18359
+ {
18360
+ internalType: "uint256",
18361
+ name: "usedDeltaLiquidity",
18362
+ type: "uint256"
18363
+ },
18364
+ {
18365
+ internalType: "uint256",
18366
+ name: "NAV",
18367
+ type: "uint256"
18368
+ }
18369
+ ],
18370
+ internalType: "struct LiquidityPool.Liquidity",
18371
+ name: "liquidity",
18372
+ type: "tuple"
18373
+ },
18374
+ {
18375
+ components: [
18376
+ {
18377
+ internalType: "uint256",
18378
+ name: "spotPrice",
18379
+ type: "uint256"
18380
+ },
18381
+ {
18382
+ internalType: "bytes32",
18383
+ name: "quoteKey",
18384
+ type: "bytes32"
18385
+ },
18386
+ {
18387
+ internalType: "bytes32",
18388
+ name: "baseKey",
18389
+ type: "bytes32"
18390
+ },
18391
+ {
18392
+ internalType: "uint256",
18393
+ name: "quoteBaseFeeRate",
18394
+ type: "uint256"
18395
+ },
18396
+ {
18397
+ internalType: "uint256",
18398
+ name: "baseQuoteFeeRate",
18399
+ type: "uint256"
18400
+ }
18401
+ ],
18402
+ internalType: "struct SynthetixAdapter.ExchangeParams",
18403
+ name: "exchangeParams",
18404
+ type: "tuple"
18405
+ }
18406
+ ],
18407
+ internalType: "struct OptionMarket.TradeParameters",
18408
+ name: "trade",
18409
+ type: "tuple"
18410
+ },
18411
+ {
18412
+ internalType: "uint256",
18413
+ name: "strikeId",
18414
+ type: "uint256"
18415
+ },
18416
+ {
18417
+ internalType: "address",
18418
+ name: "trader",
18419
+ type: "address"
18420
+ },
18421
+ {
18422
+ internalType: "uint256",
18423
+ name: "positionId",
18424
+ type: "uint256"
18425
+ },
18426
+ {
18427
+ internalType: "uint256",
18428
+ name: "optionCost",
18429
+ type: "uint256"
18430
+ },
18431
+ {
18432
+ internalType: "uint256",
18433
+ name: "setCollateralTo",
18434
+ type: "uint256"
18435
+ },
18436
+ {
18437
+ internalType: "bool",
18438
+ name: "isOpen",
18439
+ type: "bool"
18440
+ }
18441
+ ],
18442
+ name: "adjustPosition",
18443
+ outputs: [
18444
+ {
18445
+ internalType: "uint256",
18446
+ name: "",
18447
+ type: "uint256"
18448
+ },
18449
+ {
18450
+ internalType: "int256",
18451
+ name: "pendingCollateral",
18452
+ type: "int256"
18453
+ }
18454
+ ],
18455
+ stateMutability: "nonpayable",
18456
+ type: "function"
18457
+ },
18458
+ {
18459
+ inputs: [
18460
+ {
18461
+ internalType: "address",
18462
+ name: "to",
18463
+ type: "address"
18464
+ },
18465
+ {
18466
+ internalType: "uint256",
18467
+ name: "tokenId",
18468
+ type: "uint256"
18469
+ }
18470
+ ],
18471
+ name: "approve",
18472
+ outputs: [
18473
+ ],
18474
+ stateMutability: "nonpayable",
18475
+ type: "function"
18476
+ },
18477
+ {
18478
+ inputs: [
18479
+ {
18480
+ internalType: "address",
18481
+ name: "owner",
18482
+ type: "address"
18483
+ }
18484
+ ],
18485
+ name: "balanceOf",
18486
+ outputs: [
18487
+ {
18488
+ internalType: "uint256",
18489
+ name: "",
18490
+ type: "uint256"
18491
+ }
18492
+ ],
18493
+ stateMutability: "view",
18494
+ type: "function"
18495
+ },
18496
+ {
18497
+ inputs: [
18498
+ ],
18499
+ name: "baseURI",
18500
+ outputs: [
18501
+ {
18502
+ internalType: "string",
18503
+ name: "",
18504
+ type: "string"
18505
+ }
18506
+ ],
18507
+ stateMutability: "view",
18508
+ type: "function"
18509
+ },
18510
+ {
18511
+ inputs: [
18512
+ {
18513
+ components: [
18514
+ {
18515
+ internalType: "uint256",
18516
+ name: "positionId",
18517
+ type: "uint256"
18518
+ },
18519
+ {
18520
+ internalType: "uint256",
18521
+ name: "strikeId",
18522
+ type: "uint256"
18523
+ },
18524
+ {
18525
+ internalType: "enum OptionMarket.OptionType",
18526
+ name: "optionType",
18527
+ type: "uint8"
18528
+ },
18529
+ {
18530
+ internalType: "uint256",
18531
+ name: "amount",
18532
+ type: "uint256"
18533
+ },
18534
+ {
18535
+ internalType: "uint256",
18536
+ name: "collateral",
18537
+ type: "uint256"
18538
+ },
18539
+ {
18540
+ internalType: "enum OptionToken.PositionState",
18541
+ name: "state",
18542
+ type: "uint8"
18543
+ }
18544
+ ],
18545
+ internalType: "struct OptionToken.OptionPosition",
18546
+ name: "position",
18547
+ type: "tuple"
18548
+ },
18549
+ {
18550
+ internalType: "uint256",
18551
+ name: "expiry",
18552
+ type: "uint256"
18553
+ },
18554
+ {
18555
+ internalType: "uint256",
18556
+ name: "strikePrice",
18557
+ type: "uint256"
18558
+ },
18559
+ {
18560
+ internalType: "uint256",
18561
+ name: "spotPrice",
18562
+ type: "uint256"
18563
+ }
18564
+ ],
18565
+ name: "canLiquidate",
18566
+ outputs: [
18567
+ {
18568
+ internalType: "bool",
18569
+ name: "",
18570
+ type: "bool"
18571
+ }
18572
+ ],
18573
+ stateMutability: "view",
18574
+ type: "function"
18575
+ },
18576
+ {
18577
+ inputs: [
18578
+ {
18579
+ internalType: "uint256",
18580
+ name: "tokenId",
18581
+ type: "uint256"
18582
+ }
18583
+ ],
18584
+ name: "getApproved",
18585
+ outputs: [
18586
+ {
18587
+ internalType: "address",
18588
+ name: "",
18589
+ type: "address"
18590
+ }
18591
+ ],
18592
+ stateMutability: "view",
18593
+ type: "function"
18594
+ },
18595
+ {
18596
+ inputs: [
18597
+ {
18598
+ internalType: "uint256",
18599
+ name: "gwavPremium",
18600
+ type: "uint256"
18601
+ },
18602
+ {
18603
+ internalType: "uint256",
18604
+ name: "userPositionCollateral",
18605
+ type: "uint256"
18606
+ },
18607
+ {
18608
+ internalType: "uint256",
18609
+ name: "convertedMinLiquidationFee",
18610
+ type: "uint256"
18611
+ },
18612
+ {
18613
+ internalType: "uint256",
18614
+ name: "insolvencyMultiplier",
18615
+ type: "uint256"
18616
+ }
18617
+ ],
18618
+ name: "getLiquidationFees",
18619
+ outputs: [
18620
+ {
18621
+ components: [
18622
+ {
18623
+ internalType: "uint256",
18624
+ name: "returnCollateral",
18625
+ type: "uint256"
18626
+ },
18627
+ {
18628
+ internalType: "uint256",
18629
+ name: "lpPremiums",
18630
+ type: "uint256"
18631
+ },
18632
+ {
18633
+ internalType: "uint256",
18634
+ name: "lpFee",
18635
+ type: "uint256"
18636
+ },
18637
+ {
18638
+ internalType: "uint256",
18639
+ name: "liquidatorFee",
18640
+ type: "uint256"
18641
+ },
18642
+ {
18643
+ internalType: "uint256",
18644
+ name: "smFee",
18645
+ type: "uint256"
18646
+ },
18647
+ {
18648
+ internalType: "uint256",
18649
+ name: "insolventAmount",
18650
+ type: "uint256"
18651
+ }
18652
+ ],
18653
+ internalType: "struct OptionToken.LiquidationFees",
18654
+ name: "liquidationFees",
18655
+ type: "tuple"
18656
+ }
18657
+ ],
18658
+ stateMutability: "view",
18659
+ type: "function"
18660
+ },
18661
+ {
18662
+ inputs: [
18663
+ {
18664
+ internalType: "uint256",
18665
+ name: "positionId",
18666
+ type: "uint256"
18667
+ }
18668
+ ],
18669
+ name: "getOptionPosition",
18670
+ outputs: [
18671
+ {
18672
+ components: [
18673
+ {
18674
+ internalType: "uint256",
18675
+ name: "positionId",
18676
+ type: "uint256"
18677
+ },
18678
+ {
18679
+ internalType: "uint256",
18680
+ name: "strikeId",
18681
+ type: "uint256"
18682
+ },
18683
+ {
18684
+ internalType: "enum OptionMarket.OptionType",
18685
+ name: "optionType",
18686
+ type: "uint8"
18687
+ },
18688
+ {
18689
+ internalType: "uint256",
18690
+ name: "amount",
18691
+ type: "uint256"
18692
+ },
18693
+ {
18694
+ internalType: "uint256",
18695
+ name: "collateral",
18696
+ type: "uint256"
18697
+ },
18698
+ {
18699
+ internalType: "enum OptionToken.PositionState",
18700
+ name: "state",
18701
+ type: "uint8"
18702
+ }
18703
+ ],
18704
+ internalType: "struct OptionToken.OptionPosition",
18705
+ name: "",
18706
+ type: "tuple"
18707
+ }
18708
+ ],
18709
+ stateMutability: "view",
18710
+ type: "function"
18711
+ },
18712
+ {
18713
+ inputs: [
18714
+ {
18715
+ internalType: "uint256[]",
18716
+ name: "positionIds",
18717
+ type: "uint256[]"
18718
+ }
18719
+ ],
18720
+ name: "getOptionPositions",
18721
+ outputs: [
18722
+ {
18723
+ components: [
18724
+ {
18725
+ internalType: "uint256",
18726
+ name: "positionId",
18727
+ type: "uint256"
18728
+ },
18729
+ {
18730
+ internalType: "uint256",
18731
+ name: "strikeId",
18732
+ type: "uint256"
18733
+ },
18734
+ {
18735
+ internalType: "enum OptionMarket.OptionType",
18736
+ name: "optionType",
18737
+ type: "uint8"
18738
+ },
18739
+ {
18740
+ internalType: "uint256",
18741
+ name: "amount",
18742
+ type: "uint256"
18743
+ },
18744
+ {
18745
+ internalType: "uint256",
18746
+ name: "collateral",
18747
+ type: "uint256"
18748
+ },
18749
+ {
18750
+ internalType: "enum OptionToken.PositionState",
18751
+ name: "state",
18752
+ type: "uint8"
18753
+ }
18754
+ ],
18755
+ internalType: "struct OptionToken.OptionPosition[]",
18756
+ name: "",
18757
+ type: "tuple[]"
18758
+ }
18759
+ ],
18760
+ stateMutability: "view",
18761
+ type: "function"
18762
+ },
18763
+ {
18764
+ inputs: [
18765
+ {
18766
+ internalType: "address",
18767
+ name: "target",
18768
+ type: "address"
18769
+ }
18770
+ ],
18771
+ name: "getOwnerPositions",
18772
+ outputs: [
18773
+ {
18774
+ components: [
18775
+ {
18776
+ internalType: "uint256",
18777
+ name: "positionId",
18778
+ type: "uint256"
18779
+ },
18780
+ {
18781
+ internalType: "uint256",
18782
+ name: "strikeId",
18783
+ type: "uint256"
18784
+ },
18785
+ {
18786
+ internalType: "enum OptionMarket.OptionType",
18787
+ name: "optionType",
18788
+ type: "uint8"
18789
+ },
18790
+ {
18791
+ internalType: "uint256",
18792
+ name: "amount",
18793
+ type: "uint256"
18794
+ },
18795
+ {
18796
+ internalType: "uint256",
18797
+ name: "collateral",
18798
+ type: "uint256"
18799
+ },
18800
+ {
18801
+ internalType: "enum OptionToken.PositionState",
18802
+ name: "state",
18803
+ type: "uint8"
18804
+ }
18805
+ ],
18806
+ internalType: "struct OptionToken.OptionPosition[]",
18807
+ name: "",
18808
+ type: "tuple[]"
18809
+ }
18810
+ ],
18811
+ stateMutability: "view",
18812
+ type: "function"
18813
+ },
18814
+ {
18815
+ inputs: [
18816
+ ],
18817
+ name: "getPartialCollatParams",
18818
+ outputs: [
18819
+ {
18820
+ components: [
18821
+ {
18822
+ internalType: "uint256",
18823
+ name: "penaltyRatio",
18824
+ type: "uint256"
18825
+ },
18826
+ {
18827
+ internalType: "uint256",
18828
+ name: "liquidatorFeeRatio",
18829
+ type: "uint256"
18830
+ },
18831
+ {
18832
+ internalType: "uint256",
18833
+ name: "smFeeRatio",
18834
+ type: "uint256"
18835
+ },
18836
+ {
18837
+ internalType: "uint256",
18838
+ name: "minLiquidationFee",
18839
+ type: "uint256"
18840
+ }
18841
+ ],
18842
+ internalType: "struct OptionToken.PartialCollateralParameters",
18843
+ name: "",
18844
+ type: "tuple"
18845
+ }
18846
+ ],
18847
+ stateMutability: "view",
18848
+ type: "function"
18849
+ },
18850
+ {
18851
+ inputs: [
18852
+ {
18853
+ internalType: "uint256",
18854
+ name: "positionId",
18855
+ type: "uint256"
18856
+ }
18857
+ ],
18858
+ name: "getPositionState",
18859
+ outputs: [
18860
+ {
18861
+ internalType: "enum OptionToken.PositionState",
18862
+ name: "",
18863
+ type: "uint8"
18864
+ }
18865
+ ],
18866
+ stateMutability: "view",
18867
+ type: "function"
18868
+ },
18869
+ {
18870
+ inputs: [
18871
+ {
18872
+ internalType: "uint256",
18873
+ name: "positionId",
18874
+ type: "uint256"
18875
+ }
18876
+ ],
18877
+ name: "getPositionWithOwner",
18878
+ outputs: [
18879
+ {
18880
+ components: [
18881
+ {
18882
+ internalType: "uint256",
18883
+ name: "positionId",
18884
+ type: "uint256"
18885
+ },
18886
+ {
18887
+ internalType: "uint256",
18888
+ name: "strikeId",
18889
+ type: "uint256"
18890
+ },
18891
+ {
18892
+ internalType: "enum OptionMarket.OptionType",
18893
+ name: "optionType",
18894
+ type: "uint8"
18895
+ },
18896
+ {
18897
+ internalType: "uint256",
18898
+ name: "amount",
18899
+ type: "uint256"
18900
+ },
18901
+ {
18902
+ internalType: "uint256",
18903
+ name: "collateral",
18904
+ type: "uint256"
18905
+ },
18906
+ {
18907
+ internalType: "enum OptionToken.PositionState",
18908
+ name: "state",
18909
+ type: "uint8"
18910
+ },
18911
+ {
18912
+ internalType: "address",
18913
+ name: "owner",
18914
+ type: "address"
18915
+ }
18916
+ ],
18917
+ internalType: "struct OptionToken.PositionWithOwner",
18918
+ name: "",
18919
+ type: "tuple"
18920
+ }
18921
+ ],
18922
+ stateMutability: "view",
18923
+ type: "function"
18924
+ },
18925
+ {
18926
+ inputs: [
18927
+ {
18928
+ internalType: "uint256[]",
18929
+ name: "positionIds",
18930
+ type: "uint256[]"
18931
+ }
18932
+ ],
18933
+ name: "getPositionsWithOwner",
18934
+ outputs: [
18935
+ {
18936
+ components: [
18937
+ {
18938
+ internalType: "uint256",
18939
+ name: "positionId",
18940
+ type: "uint256"
18941
+ },
18942
+ {
18943
+ internalType: "uint256",
18944
+ name: "strikeId",
18945
+ type: "uint256"
18946
+ },
18947
+ {
18948
+ internalType: "enum OptionMarket.OptionType",
18949
+ name: "optionType",
18950
+ type: "uint8"
18951
+ },
18952
+ {
18953
+ internalType: "uint256",
18954
+ name: "amount",
18955
+ type: "uint256"
18956
+ },
18957
+ {
18958
+ internalType: "uint256",
18959
+ name: "collateral",
18960
+ type: "uint256"
18961
+ },
18962
+ {
18963
+ internalType: "enum OptionToken.PositionState",
18964
+ name: "state",
18965
+ type: "uint8"
18966
+ },
18967
+ {
18968
+ internalType: "address",
18969
+ name: "owner",
18970
+ type: "address"
18971
+ }
18972
+ ],
18973
+ internalType: "struct OptionToken.PositionWithOwner[]",
18974
+ name: "",
18975
+ type: "tuple[]"
18976
+ }
18977
+ ],
18978
+ stateMutability: "view",
18979
+ type: "function"
18980
+ },
18981
+ {
18982
+ inputs: [
18983
+ {
18984
+ internalType: "contract OptionMarket",
18985
+ name: "_optionMarket",
18986
+ type: "address"
18987
+ },
18988
+ {
18989
+ internalType: "contract OptionGreekCache",
18990
+ name: "_greekCache",
18991
+ type: "address"
18992
+ },
18993
+ {
18994
+ internalType: "address",
18995
+ name: "_shortCollateral",
18996
+ type: "address"
18997
+ },
18998
+ {
18999
+ internalType: "contract SynthetixAdapter",
19000
+ name: "_synthetixAdapter",
19001
+ type: "address"
19002
+ }
19003
+ ],
19004
+ name: "init",
19005
+ outputs: [
19006
+ ],
19007
+ stateMutability: "nonpayable",
19008
+ type: "function"
19009
+ },
19010
+ {
19011
+ inputs: [
19012
+ {
19013
+ internalType: "address",
19014
+ name: "owner",
19015
+ type: "address"
19016
+ },
19017
+ {
19018
+ internalType: "address",
19019
+ name: "operator",
19020
+ type: "address"
19021
+ }
19022
+ ],
19023
+ name: "isApprovedForAll",
19024
+ outputs: [
19025
+ {
19026
+ internalType: "bool",
19027
+ name: "",
19028
+ type: "bool"
19029
+ }
19030
+ ],
19031
+ stateMutability: "view",
19032
+ type: "function"
19033
+ },
19034
+ {
19035
+ inputs: [
19036
+ {
19037
+ internalType: "uint256",
19038
+ name: "positionId",
19039
+ type: "uint256"
19040
+ },
19041
+ {
19042
+ components: [
19043
+ {
19044
+ internalType: "bool",
19045
+ name: "isBuy",
19046
+ type: "bool"
19047
+ },
19048
+ {
19049
+ internalType: "bool",
19050
+ name: "isForceClose",
19051
+ type: "bool"
19052
+ },
19053
+ {
19054
+ internalType: "enum OptionMarket.TradeDirection",
19055
+ name: "tradeDirection",
19056
+ type: "uint8"
19057
+ },
19058
+ {
19059
+ internalType: "enum OptionMarket.OptionType",
19060
+ name: "optionType",
19061
+ type: "uint8"
19062
+ },
19063
+ {
19064
+ internalType: "uint256",
19065
+ name: "amount",
19066
+ type: "uint256"
19067
+ },
19068
+ {
19069
+ internalType: "uint256",
19070
+ name: "expiry",
19071
+ type: "uint256"
19072
+ },
19073
+ {
19074
+ internalType: "uint256",
19075
+ name: "strikePrice",
19076
+ type: "uint256"
19077
+ },
19078
+ {
19079
+ components: [
19080
+ {
19081
+ internalType: "uint256",
19082
+ name: "freeLiquidity",
19083
+ type: "uint256"
19084
+ },
19085
+ {
19086
+ internalType: "uint256",
19087
+ name: "burnableLiquidity",
19088
+ type: "uint256"
19089
+ },
19090
+ {
19091
+ internalType: "uint256",
19092
+ name: "usedCollatLiquidity",
19093
+ type: "uint256"
19094
+ },
19095
+ {
19096
+ internalType: "uint256",
19097
+ name: "pendingDeltaLiquidity",
19098
+ type: "uint256"
19099
+ },
19100
+ {
19101
+ internalType: "uint256",
19102
+ name: "usedDeltaLiquidity",
19103
+ type: "uint256"
19104
+ },
19105
+ {
19106
+ internalType: "uint256",
19107
+ name: "NAV",
19108
+ type: "uint256"
19109
+ }
19110
+ ],
19111
+ internalType: "struct LiquidityPool.Liquidity",
19112
+ name: "liquidity",
19113
+ type: "tuple"
19114
+ },
19115
+ {
19116
+ components: [
19117
+ {
19118
+ internalType: "uint256",
19119
+ name: "spotPrice",
19120
+ type: "uint256"
19121
+ },
19122
+ {
19123
+ internalType: "bytes32",
19124
+ name: "quoteKey",
19125
+ type: "bytes32"
19126
+ },
19127
+ {
19128
+ internalType: "bytes32",
19129
+ name: "baseKey",
19130
+ type: "bytes32"
19131
+ },
19132
+ {
19133
+ internalType: "uint256",
19134
+ name: "quoteBaseFeeRate",
19135
+ type: "uint256"
19136
+ },
19137
+ {
19138
+ internalType: "uint256",
19139
+ name: "baseQuoteFeeRate",
19140
+ type: "uint256"
19141
+ }
19142
+ ],
19143
+ internalType: "struct SynthetixAdapter.ExchangeParams",
19144
+ name: "exchangeParams",
19145
+ type: "tuple"
19146
+ }
19147
+ ],
19148
+ internalType: "struct OptionMarket.TradeParameters",
19149
+ name: "trade",
19150
+ type: "tuple"
19151
+ },
19152
+ {
19153
+ internalType: "uint256",
19154
+ name: "totalCost",
19155
+ type: "uint256"
19156
+ }
19157
+ ],
19158
+ name: "liquidate",
19159
+ outputs: [
19160
+ {
19161
+ components: [
19162
+ {
19163
+ internalType: "uint256",
19164
+ name: "returnCollateral",
19165
+ type: "uint256"
19166
+ },
19167
+ {
19168
+ internalType: "uint256",
19169
+ name: "lpPremiums",
19170
+ type: "uint256"
19171
+ },
19172
+ {
19173
+ internalType: "uint256",
19174
+ name: "lpFee",
19175
+ type: "uint256"
19176
+ },
19177
+ {
19178
+ internalType: "uint256",
19179
+ name: "liquidatorFee",
19180
+ type: "uint256"
19181
+ },
19182
+ {
19183
+ internalType: "uint256",
19184
+ name: "smFee",
19185
+ type: "uint256"
19186
+ },
19187
+ {
19188
+ internalType: "uint256",
19189
+ name: "insolventAmount",
19190
+ type: "uint256"
19191
+ }
19192
+ ],
19193
+ internalType: "struct OptionToken.LiquidationFees",
19194
+ name: "liquidationFees",
19195
+ type: "tuple"
19196
+ }
19197
+ ],
19198
+ stateMutability: "nonpayable",
19199
+ type: "function"
19200
+ },
19201
+ {
19202
+ inputs: [
19203
+ {
19204
+ internalType: "uint256[]",
19205
+ name: "positionIds",
19206
+ type: "uint256[]"
19207
+ }
19208
+ ],
19209
+ name: "merge",
19210
+ outputs: [
19211
+ ],
19212
+ stateMutability: "nonpayable",
19213
+ type: "function"
19214
+ },
19215
+ {
19216
+ inputs: [
19217
+ ],
19218
+ name: "name",
19219
+ outputs: [
19220
+ {
19221
+ internalType: "string",
19222
+ name: "",
19223
+ type: "string"
19224
+ }
19225
+ ],
19226
+ stateMutability: "view",
19227
+ type: "function"
19228
+ },
19229
+ {
19230
+ inputs: [
19231
+ ],
19232
+ name: "nextId",
19233
+ outputs: [
19234
+ {
19235
+ internalType: "uint256",
19236
+ name: "",
19237
+ type: "uint256"
19238
+ }
19239
+ ],
19240
+ stateMutability: "view",
19241
+ type: "function"
19242
+ },
19243
+ {
19244
+ inputs: [
19245
+ {
19246
+ internalType: "address",
19247
+ name: "_owner",
19248
+ type: "address"
19249
+ }
19250
+ ],
19251
+ name: "nominateNewOwner",
19252
+ outputs: [
19253
+ ],
19254
+ stateMutability: "nonpayable",
19255
+ type: "function"
19256
+ },
19257
+ {
19258
+ inputs: [
19259
+ ],
19260
+ name: "nominatedOwner",
19261
+ outputs: [
19262
+ {
19263
+ internalType: "address",
19264
+ name: "",
19265
+ type: "address"
19266
+ }
19267
+ ],
19268
+ stateMutability: "view",
19269
+ type: "function"
19270
+ },
19271
+ {
19272
+ inputs: [
19273
+ ],
19274
+ name: "owner",
19275
+ outputs: [
19276
+ {
19277
+ internalType: "address",
19278
+ name: "",
19279
+ type: "address"
19280
+ }
19281
+ ],
19282
+ stateMutability: "view",
19283
+ type: "function"
19284
+ },
19285
+ {
19286
+ inputs: [
19287
+ {
19288
+ internalType: "uint256",
19289
+ name: "tokenId",
19290
+ type: "uint256"
19291
+ }
19292
+ ],
19293
+ name: "ownerOf",
19294
+ outputs: [
19295
+ {
19296
+ internalType: "address",
19297
+ name: "",
19298
+ type: "address"
19299
+ }
19300
+ ],
19301
+ stateMutability: "view",
19302
+ type: "function"
19303
+ },
19304
+ {
19305
+ inputs: [
19306
+ ],
19307
+ name: "partialCollatParams",
19308
+ outputs: [
19309
+ {
19310
+ internalType: "uint256",
19311
+ name: "penaltyRatio",
19312
+ type: "uint256"
19313
+ },
19314
+ {
19315
+ internalType: "uint256",
19316
+ name: "liquidatorFeeRatio",
19317
+ type: "uint256"
19318
+ },
19319
+ {
19320
+ internalType: "uint256",
19321
+ name: "smFeeRatio",
19322
+ type: "uint256"
19323
+ },
19324
+ {
19325
+ internalType: "uint256",
19326
+ name: "minLiquidationFee",
19327
+ type: "uint256"
19328
+ }
19329
+ ],
19330
+ stateMutability: "view",
19331
+ type: "function"
19332
+ },
19333
+ {
19334
+ inputs: [
19335
+ {
19336
+ internalType: "uint256",
19337
+ name: "",
19338
+ type: "uint256"
19339
+ }
19340
+ ],
19341
+ name: "positions",
19342
+ outputs: [
19343
+ {
19344
+ internalType: "uint256",
19345
+ name: "positionId",
19346
+ type: "uint256"
19347
+ },
19348
+ {
19349
+ internalType: "uint256",
19350
+ name: "strikeId",
19351
+ type: "uint256"
19352
+ },
19353
+ {
19354
+ internalType: "enum OptionMarket.OptionType",
19355
+ name: "optionType",
19356
+ type: "uint8"
19357
+ },
19358
+ {
19359
+ internalType: "uint256",
19360
+ name: "amount",
19361
+ type: "uint256"
19362
+ },
19363
+ {
19364
+ internalType: "uint256",
19365
+ name: "collateral",
19366
+ type: "uint256"
19367
+ },
19368
+ {
19369
+ internalType: "enum OptionToken.PositionState",
19370
+ name: "state",
19371
+ type: "uint8"
19372
+ }
19373
+ ],
19374
+ stateMutability: "view",
19375
+ type: "function"
19376
+ },
19377
+ {
19378
+ inputs: [
19379
+ {
19380
+ internalType: "address",
19381
+ name: "from",
19382
+ type: "address"
19383
+ },
19384
+ {
19385
+ internalType: "address",
19386
+ name: "to",
19387
+ type: "address"
19388
+ },
19389
+ {
19390
+ internalType: "uint256",
19391
+ name: "tokenId",
19392
+ type: "uint256"
19393
+ }
19394
+ ],
19395
+ name: "safeTransferFrom",
19396
+ outputs: [
19397
+ ],
19398
+ stateMutability: "nonpayable",
19399
+ type: "function"
19400
+ },
19401
+ {
19402
+ inputs: [
19403
+ {
19404
+ internalType: "address",
19405
+ name: "from",
19406
+ type: "address"
19407
+ },
19408
+ {
19409
+ internalType: "address",
19410
+ name: "to",
19411
+ type: "address"
19412
+ },
19413
+ {
19414
+ internalType: "uint256",
19415
+ name: "tokenId",
19416
+ type: "uint256"
19417
+ },
19418
+ {
19419
+ internalType: "bytes",
19420
+ name: "_data",
19421
+ type: "bytes"
19422
+ }
19423
+ ],
19424
+ name: "safeTransferFrom",
19425
+ outputs: [
19426
+ ],
19427
+ stateMutability: "nonpayable",
19428
+ type: "function"
19429
+ },
19430
+ {
19431
+ inputs: [
19432
+ {
19433
+ internalType: "address",
19434
+ name: "operator",
19435
+ type: "address"
19436
+ },
19437
+ {
19438
+ internalType: "bool",
19439
+ name: "approved",
19440
+ type: "bool"
19441
+ }
19442
+ ],
19443
+ name: "setApprovalForAll",
19444
+ outputs: [
19445
+ ],
19446
+ stateMutability: "nonpayable",
19447
+ type: "function"
19448
+ },
19449
+ {
19450
+ inputs: [
19451
+ {
19452
+ components: [
19453
+ {
19454
+ internalType: "uint256",
19455
+ name: "penaltyRatio",
19456
+ type: "uint256"
19457
+ },
19458
+ {
19459
+ internalType: "uint256",
19460
+ name: "liquidatorFeeRatio",
19461
+ type: "uint256"
19462
+ },
19463
+ {
19464
+ internalType: "uint256",
19465
+ name: "smFeeRatio",
19466
+ type: "uint256"
19467
+ },
19468
+ {
19469
+ internalType: "uint256",
19470
+ name: "minLiquidationFee",
19471
+ type: "uint256"
19472
+ }
19473
+ ],
19474
+ internalType: "struct OptionToken.PartialCollateralParameters",
19475
+ name: "_partialCollatParams",
19476
+ type: "tuple"
19477
+ }
19478
+ ],
19479
+ name: "setPartialCollateralParams",
19480
+ outputs: [
19481
+ ],
19482
+ stateMutability: "nonpayable",
19483
+ type: "function"
19484
+ },
19485
+ {
19486
+ inputs: [
19487
+ {
19488
+ internalType: "string",
19489
+ name: "newURI",
19490
+ type: "string"
19491
+ }
19492
+ ],
19493
+ name: "setURI",
19494
+ outputs: [
19495
+ ],
19496
+ stateMutability: "nonpayable",
19497
+ type: "function"
19498
+ },
19499
+ {
19500
+ inputs: [
19501
+ {
19502
+ internalType: "uint256[]",
19503
+ name: "positionIds",
19504
+ type: "uint256[]"
19505
+ }
19506
+ ],
19507
+ name: "settlePositions",
19508
+ outputs: [
19509
+ ],
19510
+ stateMutability: "nonpayable",
19511
+ type: "function"
19512
+ },
19513
+ {
19514
+ inputs: [
19515
+ {
19516
+ internalType: "uint256",
19517
+ name: "positionId",
19518
+ type: "uint256"
19519
+ },
19520
+ {
19521
+ internalType: "uint256",
19522
+ name: "newAmount",
19523
+ type: "uint256"
19524
+ },
19525
+ {
19526
+ internalType: "uint256",
19527
+ name: "newCollateral",
19528
+ type: "uint256"
19529
+ },
19530
+ {
19531
+ internalType: "address",
19532
+ name: "recipient",
19533
+ type: "address"
19534
+ }
19535
+ ],
19536
+ name: "split",
19537
+ outputs: [
19538
+ {
19539
+ internalType: "uint256",
19540
+ name: "newPositionId",
19541
+ type: "uint256"
19542
+ }
19543
+ ],
19544
+ stateMutability: "nonpayable",
19545
+ type: "function"
19546
+ },
19547
+ {
19548
+ inputs: [
19549
+ {
19550
+ internalType: "bytes4",
19551
+ name: "interfaceId",
19552
+ type: "bytes4"
19553
+ }
19554
+ ],
19555
+ name: "supportsInterface",
19556
+ outputs: [
19557
+ {
19558
+ internalType: "bool",
19559
+ name: "",
19560
+ type: "bool"
19561
+ }
19562
+ ],
19563
+ stateMutability: "view",
19564
+ type: "function"
19565
+ },
19566
+ {
19567
+ inputs: [
19568
+ ],
19569
+ name: "symbol",
19570
+ outputs: [
19571
+ {
19572
+ internalType: "string",
19573
+ name: "",
19574
+ type: "string"
19575
+ }
19576
+ ],
19577
+ stateMutability: "view",
19578
+ type: "function"
19579
+ },
19580
+ {
19581
+ inputs: [
19582
+ {
19583
+ internalType: "uint256",
19584
+ name: "index",
19585
+ type: "uint256"
19586
+ }
19587
+ ],
19588
+ name: "tokenByIndex",
19589
+ outputs: [
19590
+ {
19591
+ internalType: "uint256",
19592
+ name: "",
19593
+ type: "uint256"
19594
+ }
19595
+ ],
19596
+ stateMutability: "view",
19597
+ type: "function"
19598
+ },
19599
+ {
19600
+ inputs: [
19601
+ {
19602
+ internalType: "address",
19603
+ name: "owner",
19604
+ type: "address"
19605
+ },
19606
+ {
19607
+ internalType: "uint256",
19608
+ name: "index",
19609
+ type: "uint256"
19610
+ }
19611
+ ],
19612
+ name: "tokenOfOwnerByIndex",
19613
+ outputs: [
19614
+ {
19615
+ internalType: "uint256",
19616
+ name: "",
19617
+ type: "uint256"
19618
+ }
19619
+ ],
19620
+ stateMutability: "view",
19621
+ type: "function"
19622
+ },
19623
+ {
19624
+ inputs: [
19625
+ {
19626
+ internalType: "uint256",
19627
+ name: "tokenId",
19628
+ type: "uint256"
19629
+ }
19630
+ ],
19631
+ name: "tokenURI",
19632
+ outputs: [
19633
+ {
19634
+ internalType: "string",
19635
+ name: "",
19636
+ type: "string"
19637
+ }
19638
+ ],
19639
+ stateMutability: "view",
19640
+ type: "function"
19641
+ },
19642
+ {
19643
+ inputs: [
19644
+ ],
19645
+ name: "totalSupply",
19646
+ outputs: [
19647
+ {
19648
+ internalType: "uint256",
19649
+ name: "",
19650
+ type: "uint256"
19651
+ }
19652
+ ],
19653
+ stateMutability: "view",
19654
+ type: "function"
19655
+ },
19656
+ {
19657
+ inputs: [
19658
+ {
19659
+ internalType: "address",
19660
+ name: "from",
19661
+ type: "address"
19662
+ },
19663
+ {
19664
+ internalType: "address",
19665
+ name: "to",
19666
+ type: "address"
19667
+ },
19668
+ {
19669
+ internalType: "uint256",
19670
+ name: "tokenId",
19671
+ type: "uint256"
19672
+ }
19673
+ ],
19674
+ name: "transferFrom",
19675
+ outputs: [
19676
+ ],
19677
+ stateMutability: "nonpayable",
19678
+ type: "function"
19679
+ }
19680
+ ];
19681
+ var IOptionToken = {
19682
+ abi: abi$o
19683
+ };
19684
+
19685
+ function getOptionPositions(_x, _x2) {
19686
+ return _getOptionPositions.apply(this, arguments);
19687
+ }
19688
+
19689
+ function _getOptionPositions() {
19690
+ _getOptionPositions = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, market // eslint-disable-next-line @typescript-eslint/no-explicit-any
19691
+ ) {
19692
+ var lyra, optionMarket, iOptionToken;
19693
+ return runtime_1.wrap(function _callee$(_context) {
19694
+ while (1) {
19695
+ switch (_context.prev = _context.next) {
19696
+ case 0:
19697
+ lyra = new Lyra__default();
19698
+ _context.next = 3;
19699
+ return lyra.market(market);
19700
+
19701
+ case 3:
19702
+ optionMarket = _context.sent;
19703
+ iOptionToken = new ethers.ethers.Contract(optionMarket.__marketData.marketAddresses.optionToken, IOptionToken.abi, pool.signer);
19704
+ _context.next = 7;
19705
+ return iOptionToken.getOwnerPositions(pool.address);
19706
+
19707
+ case 7:
19708
+ return _context.abrupt("return", _context.sent);
19709
+
19710
+ case 8:
19711
+ case "end":
19712
+ return _context.stop();
19713
+ }
19714
+ }
19715
+ }, _callee);
19716
+ }));
19717
+ return _getOptionPositions.apply(this, arguments);
19718
+ }
19719
+
19720
+ function getQuote(_x, _x2, _x3, _x4) {
19721
+ return _getQuote.apply(this, arguments);
19722
+ }
19723
+
19724
+ function _getQuote() {
19725
+ _getQuote = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(strike, type, tradeType, amount) {
19726
+ return runtime_1.wrap(function _callee$(_context) {
19727
+ while (1) {
19728
+ switch (_context.prev = _context.next) {
19729
+ case 0:
19730
+ _context.next = 2;
19731
+ return strike.quote(type === "call", tradeType === "buy", amount);
19732
+
19733
+ case 2:
19734
+ return _context.abrupt("return", _context.sent);
19735
+
19736
+ case 3:
19737
+ case "end":
19738
+ return _context.stop();
19739
+ }
19740
+ }
19741
+ }, _callee);
19742
+ }));
19743
+ return _getQuote.apply(this, arguments);
19744
+ }
19745
+
19746
+ function getLyraOptionTxData(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x10) {
19747
+ return _getLyraOptionTxData.apply(this, arguments);
19748
+ }
19749
+
19750
+ function _getLyraOptionTxData() {
19751
+ _getLyraOptionTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, market, optionType, expiry, strikePrice, tradeType, optionAmount, assetIn, collateralAmount, isCoveredCall) {
19752
+ var strike, strikeId, positions, filteredPosition, positionId, lyraOptionType, amountIn, quote, netPremiun, txFunction, inputAmount, currentCollateral, setCollateral, _filteredPosition$0$c, iOptionMarketWrapper, tradeTx;
19753
+
19754
+ return runtime_1.wrap(function _callee$(_context) {
19755
+ while (1) {
19756
+ switch (_context.prev = _context.next) {
19757
+ case 0:
19758
+ _context.next = 2;
19759
+ return getStrike(pool.network, market, expiry, strikePrice);
19760
+
19761
+ case 2:
19762
+ strike = _context.sent;
19763
+ strikeId = strike.id;
19764
+ _context.next = 6;
19765
+ return getOptionPositions(pool, market);
19766
+
19767
+ case 6:
19768
+ positions = _context.sent;
19769
+ filteredPosition = positions.filter(function (e) {
19770
+ return e.strikeId.toNumber() === strikeId && isCall(e.optionType) == (optionType === "call") && e.state === 1;
19771
+ });
19772
+ positionId = filteredPosition.length > 0 ? filteredPosition[0].positionId : 0;
19773
+ lyraOptionType = getLyraTradeOptionType(optionType === "call", tradeType === "buy", isCoveredCall);
19774
+ amountIn = ethers.BigNumber.from(optionAmount);
19775
+ _context.next = 13;
19776
+ return getQuote(strike, optionType, tradeType, amountIn);
19777
+
19778
+ case 13:
19779
+ quote = _context.sent;
19780
+ netPremiun = tradeType === "buy" ? quote.premium.add(quote.fee) : quote.premium.sub(quote.fee);
19781
+ txFunction = "openPosition";
19782
+ inputAmount = tradeType === "buy" ? netPremiun : collateralAmount;
19783
+ currentCollateral = ethers.BigNumber.from(0);
19784
+ setCollateral = collateralAmount;
19785
+
19786
+ if (filteredPosition.length > 0) {
19787
+ currentCollateral = (_filteredPosition$0$c = filteredPosition[0].collateral) != null ? _filteredPosition$0$c : ethers.BigNumber.from(0);
19788
+ setCollateral = currentCollateral.add(collateralAmount);
19789
+
19790
+ if ( //sell long positions
19791
+ tradeType === "sell" && isLong(filteredPosition[0].optionType) || //cover short positions
19792
+ tradeType === "buy" && !isLong(filteredPosition[0].optionType)) {
19793
+ lyraOptionType = filteredPosition[0].optionType;
19794
+ txFunction = "closePosition";
19795
+ setCollateral = currentCollateral.sub(collateralAmount); //cover short
19796
+
19797
+ if (!isLong(filteredPosition[0].optionType) && !isCoveredCall && collateralAmount.gt(netPremiun)) {
19798
+ inputAmount = netPremiun.sub(collateralAmount);
19799
+ } else if (!isLong(filteredPosition[0].optionType) && isCoveredCall) {
19800
+ inputAmount = netPremiun;
19801
+ } else {
19802
+ inputAmount = ethers.BigNumber.from(0);
19803
+ }
19804
+ }
19805
+ }
19806
+
19807
+ iOptionMarketWrapper = new ethers.ethers.utils.Interface(IOptionMarketWrapper.abi);
19808
+ tradeTx = iOptionMarketWrapper.encodeFunctionData(txFunction, [[strike.market().contractAddresses.optionMarket, strikeId, positionId, 1, setCollateral, currentCollateral, lyraOptionType, amountIn, tradeType === "sell" ? netPremiun : 0, tradeType === "buy" ? netPremiun : ethers.ethers.constants.MaxUint256, inputAmount, assetIn // input asset
19809
+ ]]);
19810
+ return _context.abrupt("return", tradeTx);
19811
+
19812
+ case 23:
19813
+ case "end":
19814
+ return _context.stop();
19815
+ }
19816
+ }
19817
+ }, _callee);
19818
+ }));
19819
+ return _getLyraOptionTxData.apply(this, arguments);
19820
+ }
19821
+
15837
19822
  var Pool = /*#__PURE__*/function () {
15838
19823
  function Pool(network, signer, poolLogic, mangerLogic, utils, factory) {
15839
19824
  this.network = network;
@@ -17663,12 +21648,109 @@ var Pool = /*#__PURE__*/function () {
17663
21648
  }
17664
21649
 
17665
21650
  return removeLiquidityVelodrome;
21651
+ }()
21652
+ /**
21653
+ * Trade options on lyra
21654
+ * @param {LyraOptionMarket} market Underlying market e.g. eth
21655
+ * @param {number} expiry Expiry timestamp
21656
+ * @param { number} strike Strike price
21657
+ * @param {LyraOptionType} optionType Call or put
21658
+ * @param { LyraTradeType} tradeType By or sell
21659
+ * @param {BigNumber | string } optionAmount Option amount
21660
+ * @param {string } assetIn Asset to invest
21661
+ * @param {BigNumber | string } collateralChangeAmount Collateral amount to add when shorting options and to remove when covering shorts
21662
+ * @param {boolean} isCoveredCall Selling covered call options
21663
+ * @param {any} options Transaction options
21664
+ * @returns {Promise<any>} Transaction
21665
+ */
21666
+ ;
21667
+
21668
+ _proto.tradeLyraOption =
21669
+ /*#__PURE__*/
21670
+ function () {
21671
+ var _tradeLyraOption = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee35(market, expiry, strike, optionType, tradeType, optionAmount, assetIn, collateralChangeAmount, isCoveredCall, options) {
21672
+ var swapxData, tx;
21673
+ return runtime_1.wrap(function _callee35$(_context35) {
21674
+ while (1) {
21675
+ switch (_context35.prev = _context35.next) {
21676
+ case 0:
21677
+ if (collateralChangeAmount === void 0) {
21678
+ collateralChangeAmount = "0";
21679
+ }
21680
+
21681
+ if (isCoveredCall === void 0) {
21682
+ isCoveredCall = false;
21683
+ }
21684
+
21685
+ if (options === void 0) {
21686
+ options = null;
21687
+ }
21688
+
21689
+ _context35.next = 5;
21690
+ return getLyraOptionTxData(this, market, optionType, expiry, strike, tradeType, optionAmount, assetIn, ethers.BigNumber.from(collateralChangeAmount), isCoveredCall);
21691
+
21692
+ case 5:
21693
+ swapxData = _context35.sent;
21694
+ _context35.next = 8;
21695
+ return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.LYRA], swapxData, options);
21696
+
21697
+ case 8:
21698
+ tx = _context35.sent;
21699
+ return _context35.abrupt("return", tx);
21700
+
21701
+ case 10:
21702
+ case "end":
21703
+ return _context35.stop();
21704
+ }
21705
+ }
21706
+ }, _callee35, this);
21707
+ }));
21708
+
21709
+ function tradeLyraOption(_x135, _x136, _x137, _x138, _x139, _x140, _x141, _x142, _x143, _x144) {
21710
+ return _tradeLyraOption.apply(this, arguments);
21711
+ }
21712
+
21713
+ return tradeLyraOption;
21714
+ }()
21715
+ /**
21716
+ * Gets Lyra option positions
21717
+ * @returns {Promise<Position>} Transaction
21718
+ */
21719
+ ;
21720
+
21721
+ _proto.getLyraPositions =
21722
+ /*#__PURE__*/
21723
+ function () {
21724
+ var _getLyraPositions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee36(market) {
21725
+ return runtime_1.wrap(function _callee36$(_context36) {
21726
+ while (1) {
21727
+ switch (_context36.prev = _context36.next) {
21728
+ case 0:
21729
+ _context36.next = 2;
21730
+ return getOptionPositions(this, market);
21731
+
21732
+ case 2:
21733
+ return _context36.abrupt("return", _context36.sent);
21734
+
21735
+ case 3:
21736
+ case "end":
21737
+ return _context36.stop();
21738
+ }
21739
+ }
21740
+ }, _callee36, this);
21741
+ }));
21742
+
21743
+ function getLyraPositions(_x145) {
21744
+ return _getLyraPositions.apply(this, arguments);
21745
+ }
21746
+
21747
+ return getLyraPositions;
17666
21748
  }();
17667
21749
 
17668
21750
  return Pool;
17669
21751
  }();
17670
21752
 
17671
- var abi$n = [
21753
+ var abi$p = [
17672
21754
  {
17673
21755
  inputs: [
17674
21756
  {
@@ -17892,10 +21974,10 @@ var abi$n = [
17892
21974
  }
17893
21975
  ];
17894
21976
  var UniswapV2Factory = {
17895
- abi: abi$n
21977
+ abi: abi$p
17896
21978
  };
17897
21979
 
17898
- var abi$o = [
21980
+ var abi$q = [
17899
21981
  {
17900
21982
  anonymous: false,
17901
21983
  inputs: [
@@ -18639,7 +22721,7 @@ var evm = {
18639
22721
  }
18640
22722
  };
18641
22723
  var UniswapV2Pair = {
18642
- abi: abi$o,
22724
+ abi: abi$q,
18643
22725
  evm: evm,
18644
22726
  "interface": [
18645
22727
  {
@@ -19370,7 +23452,7 @@ var UniswapV2Pair = {
19370
23452
  ]
19371
23453
  };
19372
23454
 
19373
- var abi$p = [
23455
+ var abi$r = [
19374
23456
  {
19375
23457
  inputs: [
19376
23458
  {
@@ -20565,7 +24647,7 @@ var abi$p = [
20565
24647
  }
20566
24648
  ];
20567
24649
  var IBalancerV2Vault = {
20568
- abi: abi$p
24650
+ abi: abi$r
20569
24651
  };
20570
24652
 
20571
24653
  var Utils = /*#__PURE__*/function () {
@@ -20983,6 +25065,114 @@ var Utils = /*#__PURE__*/function () {
20983
25065
  return getBalancerExitPoolTx;
20984
25066
  }();
20985
25067
 
25068
+ _proto.getLyraOptionExpiries = /*#__PURE__*/function () {
25069
+ var _getLyraOptionExpiries = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(market) {
25070
+ return runtime_1.wrap(function _callee9$(_context9) {
25071
+ while (1) {
25072
+ switch (_context9.prev = _context9.next) {
25073
+ case 0:
25074
+ _context9.next = 2;
25075
+ return getExpiries(this.network, market);
25076
+
25077
+ case 2:
25078
+ return _context9.abrupt("return", _context9.sent);
25079
+
25080
+ case 3:
25081
+ case "end":
25082
+ return _context9.stop();
25083
+ }
25084
+ }
25085
+ }, _callee9, this);
25086
+ }));
25087
+
25088
+ function getLyraOptionExpiries(_x28) {
25089
+ return _getLyraOptionExpiries.apply(this, arguments);
25090
+ }
25091
+
25092
+ return getLyraOptionExpiries;
25093
+ }();
25094
+
25095
+ _proto.getLyraOptionStrikes = /*#__PURE__*/function () {
25096
+ var _getLyraOptionStrikes = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(market, expiry) {
25097
+ return runtime_1.wrap(function _callee10$(_context10) {
25098
+ while (1) {
25099
+ switch (_context10.prev = _context10.next) {
25100
+ case 0:
25101
+ _context10.next = 2;
25102
+ return getStrikes(this.network, market, expiry);
25103
+
25104
+ case 2:
25105
+ return _context10.abrupt("return", _context10.sent);
25106
+
25107
+ case 3:
25108
+ case "end":
25109
+ return _context10.stop();
25110
+ }
25111
+ }
25112
+ }, _callee10, this);
25113
+ }));
25114
+
25115
+ function getLyraOptionStrikes(_x29, _x30) {
25116
+ return _getLyraOptionStrikes.apply(this, arguments);
25117
+ }
25118
+
25119
+ return getLyraOptionStrikes;
25120
+ }();
25121
+
25122
+ _proto.getLyraOptionStrike = /*#__PURE__*/function () {
25123
+ var _getLyraOptionStrike = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(market, expiry, strike) {
25124
+ return runtime_1.wrap(function _callee11$(_context11) {
25125
+ while (1) {
25126
+ switch (_context11.prev = _context11.next) {
25127
+ case 0:
25128
+ _context11.next = 2;
25129
+ return getStrike(this.network, market, expiry, strike);
25130
+
25131
+ case 2:
25132
+ return _context11.abrupt("return", _context11.sent);
25133
+
25134
+ case 3:
25135
+ case "end":
25136
+ return _context11.stop();
25137
+ }
25138
+ }
25139
+ }, _callee11, this);
25140
+ }));
25141
+
25142
+ function getLyraOptionStrike(_x31, _x32, _x33) {
25143
+ return _getLyraOptionStrike.apply(this, arguments);
25144
+ }
25145
+
25146
+ return getLyraOptionStrike;
25147
+ }();
25148
+
25149
+ _proto.getLyraOptionQuote = /*#__PURE__*/function () {
25150
+ var _getLyraOptionQuote = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(strike, type, tradeType, amount) {
25151
+ return runtime_1.wrap(function _callee12$(_context12) {
25152
+ while (1) {
25153
+ switch (_context12.prev = _context12.next) {
25154
+ case 0:
25155
+ _context12.next = 2;
25156
+ return getQuote(strike, type, tradeType, ethers.ethers.BigNumber.from(amount));
25157
+
25158
+ case 2:
25159
+ return _context12.abrupt("return", _context12.sent);
25160
+
25161
+ case 3:
25162
+ case "end":
25163
+ return _context12.stop();
25164
+ }
25165
+ }
25166
+ }, _callee12);
25167
+ }));
25168
+
25169
+ function getLyraOptionQuote(_x34, _x35, _x36, _x37) {
25170
+ return _getLyraOptionQuote.apply(this, arguments);
25171
+ }
25172
+
25173
+ return getLyraOptionQuote;
25174
+ }();
25175
+
20986
25176
  return Utils;
20987
25177
  }();
20988
25178