@gmx-io/sdk 1.5.0-alpha-12 → 1.5.0-alpha-13

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 (28) hide show
  1. package/build/cjs/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +24 -0
  2. package/build/cjs/src/codegen/prebuilt/hashedMarketConfigKeys.json +183 -0
  3. package/build/cjs/src/codegen/prebuilt/hashedMarketValuesKeys.json +45 -0
  4. package/build/cjs/src/configs/marketHours.js +27 -0
  5. package/build/cjs/src/configs/markets.js +21 -0
  6. package/build/cjs/src/configs/tokens.js +32 -0
  7. package/build/cjs/src/utils/__tests__/markets.spec.js +44 -9
  8. package/build/cjs/src/utils/markets/utils.js +19 -12
  9. package/build/cjs/src/utils/positions/utils.js +1 -1
  10. package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +1 -1
  11. package/build/cjs/src/utils/swap/swapRouting.js +1 -1
  12. package/build/esm/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +24 -0
  13. package/build/esm/src/codegen/prebuilt/hashedMarketConfigKeys.json +183 -0
  14. package/build/esm/src/codegen/prebuilt/hashedMarketValuesKeys.json +45 -0
  15. package/build/esm/src/configs/marketHours.js +24 -0
  16. package/build/esm/src/configs/markets.js +21 -0
  17. package/build/esm/src/configs/tokens.js +32 -0
  18. package/build/esm/src/utils/__tests__/markets.spec.js +45 -10
  19. package/build/esm/src/utils/markets/utils.js +19 -12
  20. package/build/esm/src/utils/positions/utils.js +1 -1
  21. package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +1 -1
  22. package/build/esm/src/utils/swap/swapRouting.js +1 -1
  23. package/build/types/src/codegen/prebuilt/index.d.ts +252 -0
  24. package/build/types/src/configs/marketHours.d.ts +7 -0
  25. package/build/types/src/configs/tokens.d.ts +1 -39
  26. package/build/types/src/utils/markets/utils.d.ts +1 -1
  27. package/build/types/src/utils/tokens/types.d.ts +2 -0
  28. package/package.json +1 -1
@@ -1091,6 +1091,30 @@
1091
1091
  "baseBorrowingFactorShort": "0x05640382d9ac2b646b854e08d798e98f04cd0723d0898053d14d73aa8ad67aa1",
1092
1092
  "aboveOptimalUsageBorrowingFactorLong": "0xe1de87148bd67bda9217fbb7a4605e13a6819cf6b02f99ed4c0df17281800ee6",
1093
1093
  "aboveOptimalUsageBorrowingFactorShort": "0xf4d2054fd2e503b3e5535b68952c816ff1e6c76ed5a6db2b0a7071d88d1834c7"
1094
+ },
1095
+ "0xda81cdd397210C08cFc567f93982E148A3aac8a6": {
1096
+ "optimalUsageFactorLong": "0x986daec772e7197f321cf18ae605db6da936f87bcb03cff3d4303cd21e88fa51",
1097
+ "optimalUsageFactorShort": "0x41638decee9a2957f1416690587fb5f120bcb5a8636713df019f82f98eb9b4d7",
1098
+ "baseBorrowingFactorLong": "0x776135184fcbae1f6122486c6d370bbbc629d19b20298f5556291b8d8218ef42",
1099
+ "baseBorrowingFactorShort": "0x6e65b5a36df631c8e2251438f025977d1acffe836288cf5b3cb7b0b8812a8be0",
1100
+ "aboveOptimalUsageBorrowingFactorLong": "0x98e679255838f4a852cfe1711d2490d29a4f22d0becbe8464894f95c15c21372",
1101
+ "aboveOptimalUsageBorrowingFactorShort": "0x0945c48086a7b3eca228da45ae3e5811634c1d985fba1ef05591c2557769ccd5"
1102
+ },
1103
+ "0x6F287D071800BfA847B4a7a7104BE33F87Ce9E74": {
1104
+ "optimalUsageFactorLong": "0x90bbb46df9295b17c763bce05f9ac5d856a64dfd24e3298c6b242adedfbe7510",
1105
+ "optimalUsageFactorShort": "0x2e1131e3a19d1a6ba5dfe35f8f7b671fb05e46e448d6a4edb08575654e568070",
1106
+ "baseBorrowingFactorLong": "0x7f6e709e6b17fac1405b0a8cea7b76adeefd421663d8d84965caed5647597285",
1107
+ "baseBorrowingFactorShort": "0x6f4862a2271d2e3ebdd3280a1754297681dcb6d8c204fd6b44751178ce50a3d9",
1108
+ "aboveOptimalUsageBorrowingFactorLong": "0x19fd2a53a0b6aaf23cda804c4e832456f338926fa1e5427ac30936a881413d9a",
1109
+ "aboveOptimalUsageBorrowingFactorShort": "0x94b097a23f795ddb86ecc36fc491bf94fc246623aeb400f320091bc3520d37b1"
1110
+ },
1111
+ "0x2Ce2bc8B0f9d000f359d756a5816C125474Bb39b": {
1112
+ "optimalUsageFactorLong": "0xf925bb5c2878443d47d98b6e9f0d39dd21212f50b015a0c01fcd43adbf0c55a0",
1113
+ "optimalUsageFactorShort": "0x02f76508457d07fb8a2d7c475498c1d182054a87eca61b1c947521cfac21bbaa",
1114
+ "baseBorrowingFactorLong": "0x41c82ada55554195955056b52630f479dc5acad3eaa96970fd93735a72f50ca7",
1115
+ "baseBorrowingFactorShort": "0x85a4a75fcc2ced632df6a9dadbc46b5d4171f166572e298ac8e0f5dc0a713818",
1116
+ "aboveOptimalUsageBorrowingFactorLong": "0xfdc145dc5c86925a834513f0c78ef57f8da0f095253e561506b6367106d5caac",
1117
+ "aboveOptimalUsageBorrowingFactorShort": "0xc961a42b4a07b7f63f14fbd2a3c14c41643eb80dd5a8fdcde32ad1365bcb51a7"
1094
1118
  }
1095
1119
  },
1096
1120
  "43113": {
@@ -8299,6 +8299,189 @@
8299
8299
  "virtualMarketId": "0xdb27e89e0fe0c0ac059ed01e11b1ae3ad6f789f32e1fdddd40ca472a8daa3a03",
8300
8300
  "virtualLongTokenId": "0xaab37f889b9680dda34f58a689de3023cb22f7ae14d32a3c1d45798a973db1f5",
8301
8301
  "virtualShortTokenId": "0xd5258cb84f0039be58306488e8df941c05f3cf4f219e92aacb6561c736bbb960"
8302
+ },
8303
+ "0xda81cdd397210C08cFc567f93982E148A3aac8a6": {
8304
+ "isDisabled": "0xe798deebb3666821348826b2af3b45c3aba00c56517b23821f4af5dfab8aa11e",
8305
+ "maxLongPoolAmount": "0xb1a99060f6c5c2dcd4806c4214b2cb0fb479770f5c6a775c4771456198a9827d",
8306
+ "maxShortPoolAmount": "0x74ae039799b602712e8e9387ee55321dcf46af6308102961121e61350cc7a946",
8307
+ "maxLongPoolUsdForDeposit": "0xaf94714e067e07f29bcee3c1e19283a84dd0c28f6f741e54d7ee156af1046636",
8308
+ "maxShortPoolUsdForDeposit": "0xfe8be1d1fbe6f0a57d25280acf521af3e5ea6192d662b7fec68b54d8e7dddd9d",
8309
+ "reserveFactorLong": "0x7d54ebbbe3847402ec04b169bccffc92be5d7b9fff5f537eca12aefcba46a131",
8310
+ "reserveFactorShort": "0x2637dcca314ffb96177da3c97215619d83407190a7a39312cfb24857aebbdb27",
8311
+ "openInterestReserveFactorLong": "0x4735a6d1bf55542b5eea33471c5650e44b5368a6226753dc305f19839d695b54",
8312
+ "openInterestReserveFactorShort": "0x9f617438e493df62798b2da7faf7b10bc4dc32a44015e1646d0881641eb5335b",
8313
+ "maxOpenInterestLong": "0x18258eb3a5ef0f4af2692e54e73852f11c5d71bf9101402b1027c3f7bd42f5e6",
8314
+ "maxOpenInterestShort": "0x11b9445d0dbb2baea5e9b53d1d13b8a2ca5add077b565325cf799a8753f1516b",
8315
+ "minPositionImpactPoolAmount": "0x13dd0ee6946f347eb56eda1157ba1ccbf2c9f8d4e92a7d6ea71583a4e554aa2b",
8316
+ "positionImpactPoolDistributionRate": "0xf238e5219be8e487741119eaa0ab5e64a182c79d21de9f8678cab2cfd9b3e5cc",
8317
+ "borrowingFactorLong": "0x957b0087e3b03cea73c5ba6b57b1f30a1330c6a4bca39e7b819e58c83f8f67fc",
8318
+ "borrowingFactorShort": "0xb12503b76155999da1e14fa9526edd9719f417cdcdc22bb4055320aeae300375",
8319
+ "borrowingExponentFactorLong": "0x83249f197ab1734c434465b7106d14e41fe2d9fe60aa663d162ceafa89620334",
8320
+ "borrowingExponentFactorShort": "0x86d3bec5dc227d5520a4c763fe0cda6ace0985f339b7141322cdf923a0075556",
8321
+ "fundingFactor": "0x8dcd9f0dabcf58f16e52b0cf18f66621594ac31a24590cf357487193ba424093",
8322
+ "fundingExponentFactor": "0x408114a2ca96746ca24d6c1e5459dc5bd3a765c6c8811edddde3fedbc143e43f",
8323
+ "fundingIncreaseFactorPerSecond": "0x07d1caa4651893876001990da7804c2f9d64312226fc412e7789ecb972ca9df3",
8324
+ "fundingDecreaseFactorPerSecond": "0x857f645e7ce34f8ffbc2a03b896fabe20d4b48955525ca814d4b7de3199c28e7",
8325
+ "thresholdForStableFunding": "0x43de3d000c1aafacd690d771996e47acc4b344d64ebf249fb097d7b3d647f6f2",
8326
+ "thresholdForDecreaseFunding": "0x87a51eff585283a7eaa772bd09150a1dcc8676e8cb98523cf299624e16fbaaea",
8327
+ "minFundingFactorPerSecond": "0x444848606120f6d820fa0b60dbc2501c59fd3a5f659a3fd028197b6411128798",
8328
+ "maxFundingFactorPerSecond": "0xe8d62364922a1d3291298c4ea63dadcb79b020f179d988bec10c7a167fa1d2bd",
8329
+ "maxPnlFactorForTradersLong": "0x2f22d65f79095b523b664119dcc890070453d61aed5b80d2ca8f6fea7b6a551c",
8330
+ "maxPnlFactorForTradersShort": "0x93f26b6eb52f955b82d92c8804c81f16cb7c66bd3afa68efedfc742e3b3c9ea4",
8331
+ "maxPnlFactorForDepositsLong": "0x11e12df2d75ae15e9b29e7b33eecefd5fc0c58208ce6b60e220d5d19ffa309c7",
8332
+ "maxPnlFactorForDepositsShort": "0xf0e44ae7ce08170972c7995ec13fb3415ab6a019eaef3e570b601aee789a9d84",
8333
+ "maxPnlFactorForWithdrawalsLong": "0xaf1a8ae5756ce8c5fc7a7588131e3d88a2894eee762c38e61f3993422a7ae737",
8334
+ "maxPnlFactorForWithdrawalsShort": "0x90b8c856cf9d274ef2e846bf92a0ce64aa2283bf40bb48fe4dae7685f1f1b7b0",
8335
+ "positionFeeFactorForBalanceWasImproved": "0xba915215e928cb2779337f8637d905e5ec8a0ad83f4596b73bd64f007b790c9f",
8336
+ "positionFeeFactorForBalanceWasNotImproved": "0x55230277bc176eff9c44885ebc66dab28d941ce4d4f88e71dd58e64146baa07d",
8337
+ "positionImpactFactorPositive": "0x867a00d6a61dcf3085bbb2186e45c80444f2dce96bbef393ce414da79997d3c2",
8338
+ "positionImpactFactorNegative": "0x5406d146d3c06f1d1b9ae51cd0a7e165e8c1518217db4543a2736a172f49422e",
8339
+ "maxPositionImpactFactorPositive": "0x2e8b015e4e614ebfb4d32fa6976f492f24127d25a6e3eeecd8fcb29ef3c35dc9",
8340
+ "maxPositionImpactFactorNegative": "0x9617076426b2cec08e39083bb9606ac85548265bedc02d3a61f62695e3926568",
8341
+ "maxPositionImpactFactorForLiquidations": "0xfbbfa727781e378f0d40d201e66566d114aba7c173f5ffac491b99e400466725",
8342
+ "maxLendableImpactFactor": "0x5cd916471a01acc881c0cabfb307977ba940d061bacdb50cd9d7156c1b999276",
8343
+ "maxLendableImpactFactorForWithdrawals": "0xda57395a621749794f443344f9d6b5aef8736d2e01a6efedab344c04203a2f0d",
8344
+ "maxLendableImpactUsd": "0x5ee60c82481e2a8741b0150b8a7fa6f0ae549cf88a64378b2fedbdf93a8b36d3",
8345
+ "lentPositionImpactPoolAmount": "0xb3f8c8cc4a9359661d10d3e512600f95b40bf4ee3d33b156698afb3ca7361923",
8346
+ "minCollateralFactor": "0x4e00da12671ef829ce8cf8b7390ba3da17c423ce0e19475568da0ec7975faf20",
8347
+ "minCollateralFactorForLiquidation": "0xbce9a55ce62860cc37b9915bd323075009f2b23338d0e82eaf1c6f5b10c0aff9",
8348
+ "minCollateralFactorForOpenInterestLong": "0xd13f88bf2f1d6c70f32bf978e3b37e8fc5ec016a91dad528afcfc4e0e655fb8d",
8349
+ "minCollateralFactorForOpenInterestShort": "0x09b021a7935a0c4969c61293c429a01cc2cafca5767a20509a33c105a49bb617",
8350
+ "positionImpactExponentFactorPositive": "0xd3ef0c8f6679790b704791499750c15a22834dc0cfa3d19a4f1a90b7b00fd1c2",
8351
+ "positionImpactExponentFactorNegative": "0xb96e68d542fdb7cada82d122adf4c7d46f7a3770af4e08c9d9a94f1875c337fd",
8352
+ "swapFeeFactorForBalanceWasImproved": "0x89301313d2beea021375987560e2d9aa93afa076644810bfedef50599e638b76",
8353
+ "swapFeeFactorForBalanceWasNotImproved": "0x820248d94a9c178e4da16c36fff111208f2e107e0f33b871f7efa853d2fbcc3f",
8354
+ "atomicSwapFeeFactor": "0x49527108bf6bf70f1d9d154eaeac90c11fbacbd2c9362dffb445a4415d3eb71c",
8355
+ "swapImpactFactorPositive": "0x4c1a9d1b88a985a01f4e604c42402e6555a2ea04c5a105e90e1092e123edd6be",
8356
+ "swapImpactFactorNegative": "0x815011a5c896323d894dbc2ec642f6e909606f21d0d74db76b07d05c84c76ca5",
8357
+ "swapImpactExponentFactor": "0xffdee75ee6f2bc66ef32b600e7e4449b54c0dea0d3ba43b50b856ebcf44daaad",
8358
+ "withdrawalFeeFactorBalanceWasImproved": "0x7d579491fb4d00b7373302a7cd03684009a7849a4a83dc81efc52bd296074565",
8359
+ "withdrawalFeeFactorBalanceWasNotImproved": "0xa45673dcc2b760c245930db891fba2d55cd47370cf702ad65ba41c0a7a900767",
8360
+ "virtualMarketId": "0x329c35204ff9930d2d5d56c2c2c0064a58daa81971851c6461c5780284620b4e",
8361
+ "virtualLongTokenId": "0xaab37f889b9680dda34f58a689de3023cb22f7ae14d32a3c1d45798a973db1f5",
8362
+ "virtualShortTokenId": "0xd5258cb84f0039be58306488e8df941c05f3cf4f219e92aacb6561c736bbb960"
8363
+ },
8364
+ "0x6F287D071800BfA847B4a7a7104BE33F87Ce9E74": {
8365
+ "isDisabled": "0x4f13c7f629d71f415fd0e268d3fa7aa0821cbbf18d400d4671e4f066026e8f15",
8366
+ "maxLongPoolAmount": "0x26bc27f885de37125f9742eb5ef347fff231ca0ce25229fb33d31c0d6ab409cd",
8367
+ "maxShortPoolAmount": "0x4d03da5dc3a18d4d646bbb720e3fa691eb437b98be0abf0646b2498fb7de2fe0",
8368
+ "maxLongPoolUsdForDeposit": "0x6b50c0a5dbc4c8ad71c1d51d8fba2d3c4f16688cc67f1b9a9a6c2d977db03346",
8369
+ "maxShortPoolUsdForDeposit": "0x7d68dcc7e580506ceb9655b75b2211c80fffe32d76cc906deec049331651df46",
8370
+ "reserveFactorLong": "0x7d7530a29a7dcf3087c9851effb477b8a673f3781abf5314137b44e2104fedb2",
8371
+ "reserveFactorShort": "0x15c9a045dbff43677c233fbad341b9542f2c1d9934df556e50447086a140b534",
8372
+ "openInterestReserveFactorLong": "0xb54a8ad19e5a64c6c8d9688f69e4a6b593ad3148c6757a7b306b07cf773c5a25",
8373
+ "openInterestReserveFactorShort": "0x2c79a553886e164daf5a1f161d40cc1e8d693a32acaca6787a578e1fb27ea5ca",
8374
+ "maxOpenInterestLong": "0xba62bcb8aef98f08d5f6d06ede1cefcbd01af63068848a98736cd4f208157403",
8375
+ "maxOpenInterestShort": "0x986ae13b63b099d94fdbd31d9a2fc36f526287e4a3e4dcfd577815b573d5e938",
8376
+ "minPositionImpactPoolAmount": "0x131c61098ef437b2973963433b3ab63f4d30a9d0c74bdc13ec97a7cb149ae22d",
8377
+ "positionImpactPoolDistributionRate": "0xeff40cc96028f89608bec5825e1c84fb389a5b5c03dc7bc9665bffd05d4dd093",
8378
+ "borrowingFactorLong": "0xa1576373793c7a1b2638e57f5eb562100385757266dbece31a3a8958859d8ae2",
8379
+ "borrowingFactorShort": "0xf25e147655a8b11199f94e1392b2a004e7247815cb15fa4318d2ecb4d4ce213c",
8380
+ "borrowingExponentFactorLong": "0x7c6d1db4ccea5097306ee7ba009dc5838ac1e67717d0244cc83843d68b7dfadd",
8381
+ "borrowingExponentFactorShort": "0xc6cb77fb3436129fc3aa49866b48d9b01df60e188db96cffd6d53dcdf72629d2",
8382
+ "fundingFactor": "0xfe28e059cc7d76efe3017515c6e0509ccf9b2a13dc129a60ed8c6fc011ab9696",
8383
+ "fundingExponentFactor": "0xfdf13cc1ad47ac8bc41c0533835708fb55911fcc69ff9603347970be75f5a76d",
8384
+ "fundingIncreaseFactorPerSecond": "0x421f8e406d9f5365eb8a224fa877226b62c623c7cc39ab3e26772341fcacad5f",
8385
+ "fundingDecreaseFactorPerSecond": "0x5a0a2d2238f6c39d2af42ed2eaf6a43decb1c6f4fc01818d4f63b2d2ba8b3051",
8386
+ "thresholdForStableFunding": "0xc5e922a1a2796ebd1c66a91296c4150fe426209ee8780b14b2b2ad7d2062b401",
8387
+ "thresholdForDecreaseFunding": "0x2eadfb10dca84fbeb81999e0bb789c0c89f9e7778b746078eae432be23412c48",
8388
+ "minFundingFactorPerSecond": "0xc773b0cfb9135dffa368b4763191ae8e8705fd4ca46a49cf04584454ba3c3d73",
8389
+ "maxFundingFactorPerSecond": "0x76378bb541ec4afbd3597e04950d15d9e244cec4de41fda70e5012729846c326",
8390
+ "maxPnlFactorForTradersLong": "0x376e3fbe4769340314efe3b69c6fdc538cb1d297765a3d1e04e5b0165c76da6b",
8391
+ "maxPnlFactorForTradersShort": "0xcf8b2ebfb4bc6a253e9b3de1217a3a865d39c21352e8201e78751c236519ab1f",
8392
+ "maxPnlFactorForDepositsLong": "0x637d977450a1cddd2b1de54e01592c31c22eeeda6739960d0b6007e73735aca0",
8393
+ "maxPnlFactorForDepositsShort": "0x7d5ab6a0fb9f8a8fb4a018502b2de29ad8e85a57a8528aad9066e5ba357eee06",
8394
+ "maxPnlFactorForWithdrawalsLong": "0x3923f4c6756e92608700c7f7f6b086794778d272c6c9f5191d7ad494d938cf33",
8395
+ "maxPnlFactorForWithdrawalsShort": "0x85293e35c7c15da7f563894fe8834d149c6728da69499a841039d48d9a5c4a18",
8396
+ "positionFeeFactorForBalanceWasImproved": "0xeb81589a8c8624bf482c02f94fac8334e97b4351cd5a5b04609011d91a3b3c0a",
8397
+ "positionFeeFactorForBalanceWasNotImproved": "0x132be1ae0857c2a15f0da6e619b2ea5c1958b23278c0292c034c9e0e4ceccdcb",
8398
+ "positionImpactFactorPositive": "0xabd9b86a23832b0a19ddd8f660848ef9927bede61e554d9b299c4b66bbd85bb7",
8399
+ "positionImpactFactorNegative": "0xac7db8d42c178869db007f8570d3cdf9387c483fcaec82f6892548cf0d9e6dc4",
8400
+ "maxPositionImpactFactorPositive": "0xf82e4bbb3d3d9c1daf7937d075ba403f297b56e83cbe24ad4163a5ab900183cd",
8401
+ "maxPositionImpactFactorNegative": "0x42d2a397742d2a75d112154e28fa1a0bbaba63e789060631622602406d537464",
8402
+ "maxPositionImpactFactorForLiquidations": "0xac2cb9d8936c25c17255669c002366b81fe86d20c1c7001fe8c8d37441aca90e",
8403
+ "maxLendableImpactFactor": "0x42bcb88e17e0ece60f6e7d9948f1a5d91eccd59a8a624a480dbacfa9abeaa389",
8404
+ "maxLendableImpactFactorForWithdrawals": "0x61941d08148cf98cd380941d67f1f45aab8b0a9f2c8bef5235df3eb6b2a5f9f9",
8405
+ "maxLendableImpactUsd": "0x47c3b0a10e60584303316243bdd8b07fa3ccd7d4de80948c97cb3ac06c35d7ec",
8406
+ "lentPositionImpactPoolAmount": "0xa0632ca21f4ea0ed563b8339044a159188be593b9a593f65cb1c154907373d85",
8407
+ "minCollateralFactor": "0x9cde5d93322db493ef263f8bd399f248fe89099810f13f02f06fa86e9f377d19",
8408
+ "minCollateralFactorForLiquidation": "0x7bb90537dabeca1ca14fa83049875ac6926139a25f44f9f0dea58b18e1305e5e",
8409
+ "minCollateralFactorForOpenInterestLong": "0xb61c11377472662826f7f90695cd4ebdc628be9fd6e942b0904392528c03cce7",
8410
+ "minCollateralFactorForOpenInterestShort": "0x3e5978566bf744db5c5bd35dc76165e4f0500245e858f0ff295d412ac38f362b",
8411
+ "positionImpactExponentFactorPositive": "0x6156c558c8363d6ff33aa90d358dadcf450358b77a279dc7190b021511eed0a9",
8412
+ "positionImpactExponentFactorNegative": "0xde109854d5fef7d24d1537f8f0a337108ca59784e8dd4971bce70f80d95e9d65",
8413
+ "swapFeeFactorForBalanceWasImproved": "0x7cdb0b716119c759c979d1b3e75e56fe6001926ccdcbbf705061b5faeed028f0",
8414
+ "swapFeeFactorForBalanceWasNotImproved": "0xc07c5b27ae9a8f7d0a8484c95a711fd382ac82a83e6948f1edbafbeed84a5270",
8415
+ "atomicSwapFeeFactor": "0xa1f57325d92544e6e25d59bfeaeda8b6fa690f2e5ba489eec0368345eb8f1452",
8416
+ "swapImpactFactorPositive": "0x168eab258ed6a8d2f7eb7c2911a35d892d89f6a32eb875ce473cbf3f76550511",
8417
+ "swapImpactFactorNegative": "0xa789fa6d1249aefae8cace99c412f3a464565d4c80c08a97a3ac3596a65e7517",
8418
+ "swapImpactExponentFactor": "0xb5eb55d45c7bee8cc24ef3fa14c0cb32e2c86c03c170bc2c20b4142e4e0a0ffa",
8419
+ "withdrawalFeeFactorBalanceWasImproved": "0xcc0c34150dc81fbcc42474011e25bf0471f2e5a68681144efad94eeba383b4bd",
8420
+ "withdrawalFeeFactorBalanceWasNotImproved": "0x25cb20d2cd5d943f471b50fd7dbd474066f42b377223720864c58d691fce976f",
8421
+ "virtualMarketId": "0xc4a14ec11c733ffa3d39e35634c62d3f9cb8547c22964a19c1460a2e383f48e5",
8422
+ "virtualLongTokenId": "0xaab37f889b9680dda34f58a689de3023cb22f7ae14d32a3c1d45798a973db1f5",
8423
+ "virtualShortTokenId": "0xd5258cb84f0039be58306488e8df941c05f3cf4f219e92aacb6561c736bbb960"
8424
+ },
8425
+ "0x2Ce2bc8B0f9d000f359d756a5816C125474Bb39b": {
8426
+ "isDisabled": "0xec2662d8624d9017e4c7ef29ca3596dc2725c5757b5989bd3b6e9b95d085431e",
8427
+ "maxLongPoolAmount": "0xbdd8f22d7c1bf9256ec571069d72cee4fa40be4b84a4377ceee6704a0943cf0a",
8428
+ "maxShortPoolAmount": "0x102f924ca8fb05e6d27e7d88b32028a8e8d15732c184945fa01d4c623c7e9baa",
8429
+ "maxLongPoolUsdForDeposit": "0xefe8e929051651e2dcd934b433539db59c8cc786ac278cba0a68ee0d5bbd5cc8",
8430
+ "maxShortPoolUsdForDeposit": "0xc521f6543060123178a72d5f34661bc2e6ccea3f2f4d2818023fc7eb145cd22e",
8431
+ "reserveFactorLong": "0x6eb134304523f09609f9d16bcbe59e36e3ece777f47c151b05eed37229c4e290",
8432
+ "reserveFactorShort": "0x00bdda31bfa2ec3d8c66a35d0cbf95664b2f99470e4e0585a97df3e9257e306a",
8433
+ "openInterestReserveFactorLong": "0x0602776f7d4dd869b8477501997cfbc54a97f08c280f37dec0aded36d72157b0",
8434
+ "openInterestReserveFactorShort": "0x90b4a9e4dc997bd6d99fe2c04acfc485c83225becaafcc0089cbc6afde029f1a",
8435
+ "maxOpenInterestLong": "0xedce1daeab7e885f7bda76e0b53dbbfe819b700a10781743e4f48d7bd20f4714",
8436
+ "maxOpenInterestShort": "0x62e9fe81c847d3fa0e2895ce360389500d49fdc8e21ac7091e5fcb6b09ca71a2",
8437
+ "minPositionImpactPoolAmount": "0xc9337bbbe968145ffc392fe3626344a6ed594e7c3abf6382e1aae33564b4c6ba",
8438
+ "positionImpactPoolDistributionRate": "0x6459f1c29a5564c14fbff5315dff86519b0366ac3f9180c0664a961fb5e83aeb",
8439
+ "borrowingFactorLong": "0x93a6552da0e264ff93533f3b9bae663bfc9d6aeaef8e74d19d1c5ccd96f51e1d",
8440
+ "borrowingFactorShort": "0x178bca08e5808d56b703ad716c9f9bf20a50f8a141b11b280056f11a6d478a9a",
8441
+ "borrowingExponentFactorLong": "0xe5e6bcda69cf34fb086b2d7aa9bade8d731f688e911d2733fcf3d4fc9ab36323",
8442
+ "borrowingExponentFactorShort": "0x8fa4487e23a179f99c4bd6ab5f2bb395252b8b80c7c91a86c271f5b929f90f7c",
8443
+ "fundingFactor": "0xb7ce4b2d44d137089993d195cb8be39a130977f35636b5dd4136307045a7cd52",
8444
+ "fundingExponentFactor": "0x89127c89a2a2380dcc614f9ffc04e78358bbc9246498ed088347bdced5fa239a",
8445
+ "fundingIncreaseFactorPerSecond": "0xf0966e63e7d66f3335ffd5aa81d0c9e4ec46a558b4ce69f6526c0e7ae99d5d14",
8446
+ "fundingDecreaseFactorPerSecond": "0x2ba9b4642277e845fa404febbc37b005a6196e2bd50de3fdc365ac35a782f657",
8447
+ "thresholdForStableFunding": "0xc8a3d5c130d1d7ba6c53f0719254b8639410da99a3917395b87c55ac282af9db",
8448
+ "thresholdForDecreaseFunding": "0x04d9d778eed9f9ddf5820cea4dba04c498b0b9e8a6a614a98d4d1bb770be96a9",
8449
+ "minFundingFactorPerSecond": "0x8a5f4cdd4ed32d3114db052d84519dcf0fa4274dee454c055998dae99553c694",
8450
+ "maxFundingFactorPerSecond": "0x59f1c2804e9955c0360f7f0e068c97eccb884c8312a4f4bd4c8aeb6b119e99e1",
8451
+ "maxPnlFactorForTradersLong": "0x086d8ce5f1423fc95ee4ea53efe2a3ac83b87dd837f039de885b1adca6e6cccc",
8452
+ "maxPnlFactorForTradersShort": "0x45f5f94404614f10bc3b7565793373529f81fd3bc90c8ccc49cc35a0ff9e270a",
8453
+ "maxPnlFactorForDepositsLong": "0x60913b250886d680e07f746fb40e3e557184fbe01753db4f9795ff1e7fa3d844",
8454
+ "maxPnlFactorForDepositsShort": "0xe19b9811e4cb0b425425e0f6f2890db93d73c49c4f06b97a2da36c72495945bd",
8455
+ "maxPnlFactorForWithdrawalsLong": "0x4a56d7204f625d1f9893f722b94a1e8a0ce490db00bd84a3b8883f3fab7ace12",
8456
+ "maxPnlFactorForWithdrawalsShort": "0x34d861d615f3a3e0a5b45aaabdcb2a30019accfdc402606c8502cb30521d3635",
8457
+ "positionFeeFactorForBalanceWasImproved": "0x2c9bfebd3e92f8831ff776bdd4e73b40346f6b6043976e82b55df8344b120b96",
8458
+ "positionFeeFactorForBalanceWasNotImproved": "0xf825cee8fd63315d42691ee6c7a0e45691719c62597a24d64fc7c7a23548b3e5",
8459
+ "positionImpactFactorPositive": "0xd8efd50b22772f984d3ea02411069d2527eacdb4fe6ad9c90b7aa75d8cdbe8f4",
8460
+ "positionImpactFactorNegative": "0x1e5dd8416943c20c933a02bcd6a7c94e187075ecfdb1876b4a0bb0b459237a48",
8461
+ "maxPositionImpactFactorPositive": "0x8d5eed6fc142b0416cc65d9c235d20093ed74a85b07ed8d1214c0ccd29f3ac03",
8462
+ "maxPositionImpactFactorNegative": "0xc207410c990b614f65d7d7b3b6f55ab95a08dde9c89d1cd5555f43420330ec14",
8463
+ "maxPositionImpactFactorForLiquidations": "0xeaee00d92f88588cc313ba2778cc19d2cc1648dbd5d81af5aeb51c231e76c015",
8464
+ "maxLendableImpactFactor": "0x512ffc938f8382bd160a8f196611f217e78740c804340f33a4d2b67bb3ddecaa",
8465
+ "maxLendableImpactFactorForWithdrawals": "0x0dfff59d7523bb19ce0029abbc51b6357135ebcf30ad1db239e1fb1d3b4b96fc",
8466
+ "maxLendableImpactUsd": "0x66c2587602f1eec693a603de3f3a1249db182655530afc875e98ea70ae170650",
8467
+ "lentPositionImpactPoolAmount": "0x87ddc606285cfbb10f151228ce9dee3b090c4533f431bff5c5d5d45650ed0130",
8468
+ "minCollateralFactor": "0xbdeca4dee3eec5a49b56ba4ff34b17aeca6e127bac50e9d85af9f8157b112fc2",
8469
+ "minCollateralFactorForLiquidation": "0x1fa9f68211e7f99ba4000bcc27b5a1241ba5d12fd66df00640c8db4f3946f8e7",
8470
+ "minCollateralFactorForOpenInterestLong": "0x88db5d4b6a5cb99258a2f5e904b2ca51365b3daff2af614f39c1beb053832fe3",
8471
+ "minCollateralFactorForOpenInterestShort": "0x0b9dd69fb66011cf8f3eaca204ab88060c411f1c6f26f06c43965359f561336a",
8472
+ "positionImpactExponentFactorPositive": "0x4b91cd585b4858ddf191eb66ca3dfb85003965756ef0441269e6ef3c454cc51d",
8473
+ "positionImpactExponentFactorNegative": "0xee9dfb93b5eadbc66490e2080d25bfe72bb6c3e67d3dc8da93177c4736d91866",
8474
+ "swapFeeFactorForBalanceWasImproved": "0xc1b64cb2fb0c45784ae7b724b0d1d89bb8e43f35a468784d81e4012dd21d577b",
8475
+ "swapFeeFactorForBalanceWasNotImproved": "0x3316517a6d4f0f5b644e7512c676a3d941e478454c19b9517b598d57aa2ea59d",
8476
+ "atomicSwapFeeFactor": "0x256a1048e15d93572ed3e9d89fc231b5c12de136980dbec6d7116bee2c10b2de",
8477
+ "swapImpactFactorPositive": "0xa990468db719d1383930c87be2a7faecbb7ee2b003bbacdbe4de09798013236c",
8478
+ "swapImpactFactorNegative": "0x97a9f0342ed5d714ee6e7987e31d999539693401f977114bc1837c3397c74bd1",
8479
+ "swapImpactExponentFactor": "0x65d3ce5e275335e8ce478e4ef702c77ce8c037016f40267109b172ba095a2716",
8480
+ "withdrawalFeeFactorBalanceWasImproved": "0x91c8b6da83d9c06664c83f4a1c441fba4b17eedcddcce6c3bc82bd10669b7ca0",
8481
+ "withdrawalFeeFactorBalanceWasNotImproved": "0xac2842afeb305b2498606a5ca72bad928d011d9aea31d76dce9b57665dd09aab",
8482
+ "virtualMarketId": "0x0972819d24db7fb85b0d03ee48c64ce38c97f76b27b8c12da91c070c8604b4ef",
8483
+ "virtualLongTokenId": "0xaab37f889b9680dda34f58a689de3023cb22f7ae14d32a3c1d45798a973db1f5",
8484
+ "virtualShortTokenId": "0xd5258cb84f0039be58306488e8df941c05f3cf4f219e92aacb6561c736bbb960"
8302
8485
  }
8303
8486
  },
8304
8487
  "43113": {
@@ -2043,6 +2043,51 @@
2043
2043
  "longInterestInTokensUsingShortToken": "0xd893c4fcc594e9a0ce0ab93d266e4e70414b4cd26b53cb0163e7062a5eb685f9",
2044
2044
  "shortInterestInTokensUsingLongToken": "0x44b4ead85e88e64c9d33a4d1536e7a88dbdd358c34493b750b307e71bd30c389",
2045
2045
  "shortInterestInTokensUsingShortToken": "0x2b0d7675116aaba49bd90b5bab02e516d56e17c58bc9094856584ef539cbaeab"
2046
+ },
2047
+ "0xda81cdd397210C08cFc567f93982E148A3aac8a6": {
2048
+ "longPoolAmount": "0xa623b2ef3b0cbe188cd0a6a7f66ab11ff4097d13d5c91d5bc890a14ef7014fb2",
2049
+ "shortPoolAmount": "0xfbf08274e17ac1ac55834da4dc313d4719268cb10576e2f55816326a0abccd18",
2050
+ "positionImpactPoolAmount": "0x6196f1f685c07c510baaf44af1778099371cd0b09e7775654bf6e4a6fc7fd574",
2051
+ "swapImpactPoolAmountLong": "0x619360f4a669b67b737be8ed17e588ce75df8ebc74784241104c52bbd26a1b4e",
2052
+ "swapImpactPoolAmountShort": "0xc6d1d060ece19603561b09c3f499db24a460eb7439020b9ecc0dce5d1db4007e",
2053
+ "longInterestUsingLongToken": "0x62f5cd8ce2d4c0fa7a7feb9561c85a031b663deceaf3cd14d390a84a0f102702",
2054
+ "longInterestUsingShortToken": "0xd118e405922d9f76977b26d001d9e0d017f1664c2c2501947733e436221eaff3",
2055
+ "shortInterestUsingLongToken": "0xbeb8ea99ac439f5cf0c09b33f460800abfdb2e5a304160defbc3d7b0bba807ad",
2056
+ "shortInterestUsingShortToken": "0x8baabff8869decb43b5438a4531a433c0964f0d72111460628ad4df61ee4e251",
2057
+ "longInterestInTokensUsingLongToken": "0xea6a68fda1c1e0643dedbeffabd16c14c096231f14d7a1b7b26cab333c29f5ca",
2058
+ "longInterestInTokensUsingShortToken": "0x36288838d6485d0e6ab9fe998405ad3b5a614bed06207face6cc08e3a910358b",
2059
+ "shortInterestInTokensUsingLongToken": "0x585315fb32db672be38177229edfeeee2435eac1ba61724a000eca920da364c5",
2060
+ "shortInterestInTokensUsingShortToken": "0x2594d3cdf50fa51cdfc4d521017759e70695d4a4c3d02607c3396ef00456f87a"
2061
+ },
2062
+ "0x6F287D071800BfA847B4a7a7104BE33F87Ce9E74": {
2063
+ "longPoolAmount": "0xffe4f5141fa56213c7a4503e906e8b78d14c8f45d554b239ec665a4dc59da992",
2064
+ "shortPoolAmount": "0x84dfdde24a9488ad7a160b52eae17c165d9e65704ec2fd51cc1cd31722317cb0",
2065
+ "positionImpactPoolAmount": "0xe4d42e78bd6cc4fbe977ff9582bb3d30a63c3e8e1c91058a5cee5809a83a8063",
2066
+ "swapImpactPoolAmountLong": "0x631ae2ecd66309a4f22523c4174101b5fd24373ee65bdfe5e92958c1c6d4af81",
2067
+ "swapImpactPoolAmountShort": "0x3cfdcff765e146b85cd62580516e6106f754a32f8c1b959dabf339d4b772266e",
2068
+ "longInterestUsingLongToken": "0x0a9ac749f1651357200b4524b525a7920e1294dfa3f4c132e1ffffa89c11c71e",
2069
+ "longInterestUsingShortToken": "0x2b4ab8502b07948a316c2d2fb0281900156815e09e56af0c6db1f6c04dd92053",
2070
+ "shortInterestUsingLongToken": "0x2bbb0f05a9a9dcdbe868292fd4cf60b5492e82152a03d50e603e3ece144ceb9a",
2071
+ "shortInterestUsingShortToken": "0xcb8451da9c5259dbe0be3a67aabbc798caa8590ee95195f628c95021fa448175",
2072
+ "longInterestInTokensUsingLongToken": "0x3ba80188520b08938ec084c527df3573fd612a30e15509ac8528d106fc0c5b2f",
2073
+ "longInterestInTokensUsingShortToken": "0x6b077b72d8987e5e1e91701460f816550467f3509961418cea5ff582a6f1de14",
2074
+ "shortInterestInTokensUsingLongToken": "0x5b3c85e631d365e17e9a26781b391f96c805603bc9980fcffd6fbc16f9e63d68",
2075
+ "shortInterestInTokensUsingShortToken": "0xb28e17120d8673905d243b23f0fbd4af7eccbe2462c26091faed611cd4c3fcfd"
2076
+ },
2077
+ "0x2Ce2bc8B0f9d000f359d756a5816C125474Bb39b": {
2078
+ "longPoolAmount": "0x0aa370bd4f4cb71230e4dfedd31a584f0cf5b74534a540655da5ae43508d0194",
2079
+ "shortPoolAmount": "0x0594ea921b3a3c25474baad01a129c89b1b4bce5e97cb77f114dac27e9d98ba7",
2080
+ "positionImpactPoolAmount": "0xd48f22400dc15fffe3d57af129244c75a05bd6c316f752647480fa40302ba44e",
2081
+ "swapImpactPoolAmountLong": "0x0766f80043596ab996995415283da0071d8daa85f33db0eed147e7f211fedc10",
2082
+ "swapImpactPoolAmountShort": "0xd61775b7c0987cd87fd06904569a03ea2d28cc1ca52180146dd88ff2306bb63d",
2083
+ "longInterestUsingLongToken": "0xefab48a072d02232e61d878dcc7dc31b0897511be212ea86b7e8504a97d08be0",
2084
+ "longInterestUsingShortToken": "0xa7ce1cd08babdcd3cbba098eaaea1f0bb62d60eec4ff42c6108cefe17d5eab75",
2085
+ "shortInterestUsingLongToken": "0x3358ebdffc9da33dfe5811ea2a24e9e8cd46c78b7d4d6bbe89b80a1f2ce5ebac",
2086
+ "shortInterestUsingShortToken": "0x764a71125a505ed36dd3e449394fb0dc3bcd52fd39ea77804c7f43fe6084f641",
2087
+ "longInterestInTokensUsingLongToken": "0x660deee197e25d7ec0983a4228890535c632bbb8b9e4cb9c3131fb84caa2a932",
2088
+ "longInterestInTokensUsingShortToken": "0x5cabb84debcb7263087ca7ef71e167a8048527739991483f2793bb6079554a50",
2089
+ "shortInterestInTokensUsingLongToken": "0xccb072d4c5cf74a4a1d0e6f80b7628dba861d6c95037409fc42800e72a935d7c",
2090
+ "shortInterestInTokensUsingShortToken": "0x3e1a9a944352a0080a281988fbf04a6b9c44a82767c10d16eb11ad80b1fb5d65"
2046
2091
  }
2047
2092
  },
2048
2093
  "43113": {
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ // Per-market UI leverage caps keyed off the contract's `minCollateralFactor`.
3
+ // The contracts team runs a cron (see Linear ENG-54) that toggles each market's
4
+ // MCF between its on-hours and off-hours value. Matching either sentinel here
5
+ // lets the UI apply the correct cap without knowing the session schedule.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.MARKET_HOURS_MARKETS = void 0;
8
+ const GOLD_SILVER_CFG = {
9
+ onHoursMcf: 9n * 10n ** 27n,
10
+ onHoursMaxLeverage: 100,
11
+ offHoursMcf: 35n * 10n ** 27n,
12
+ offHoursMaxLeverage: 25,
13
+ };
14
+ exports.MARKET_HOURS_MARKETS = {
15
+ // Arbitrum
16
+ "0x0Df2BE76F517BCF0000AbfFcB6344B3b2aC4Cc4f": GOLD_SILVER_CFG, // GOLD/USD
17
+ "0x448Fa722717df299ee197E2F6d8EB7911EFF6cEc": GOLD_SILVER_CFG, // SILVER/USD
18
+ "0xda81cdd397210C08cFc567f93982E148A3aac8a6": GOLD_SILVER_CFG, // WTIOIL/USD
19
+ "0x6F287D071800BfA847B4a7a7104BE33F87Ce9E74": GOLD_SILVER_CFG, // BRENTOIL/USD
20
+ "0x2Ce2bc8B0f9d000f359d756a5816C125474Bb39b": {
21
+ // NATGAS/USD
22
+ onHoursMcf: 22n * 10n ** 27n,
23
+ onHoursMaxLeverage: 40,
24
+ offHoursMcf: 40n * 10n ** 27n,
25
+ offHoursMaxLeverage: 20,
26
+ },
27
+ };
@@ -918,6 +918,27 @@ exports.MARKETS = {
918
918
  longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
919
919
  shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
920
920
  },
921
+ // WTIOIL/USD [WETH-USDC]
922
+ "0xda81cdd397210C08cFc567f93982E148A3aac8a6": {
923
+ marketTokenAddress: "0xda81cdd397210C08cFc567f93982E148A3aac8a6",
924
+ indexTokenAddress: "0xa8Ffb545d5cBF1F44E3eBA123D60372cD267D73c",
925
+ longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
926
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
927
+ },
928
+ // BRENTOIL/USD [WETH-USDC]
929
+ "0x6F287D071800BfA847B4a7a7104BE33F87Ce9E74": {
930
+ marketTokenAddress: "0x6F287D071800BfA847B4a7a7104BE33F87Ce9E74",
931
+ indexTokenAddress: "0x9C5C4b9BA1fEBA72186f50d8Ae7C58b1D7f0B12F",
932
+ longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
933
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
934
+ },
935
+ // NATGAS/USD [WETH-USDC]
936
+ "0x2Ce2bc8B0f9d000f359d756a5816C125474Bb39b": {
937
+ marketTokenAddress: "0x2Ce2bc8B0f9d000f359d756a5816C125474Bb39b",
938
+ indexTokenAddress: "0x620aC65BE29066Bb9D1E92C65b35B9fD321Fb963",
939
+ longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
940
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
941
+ },
921
942
  },
922
943
  [chains_1.AVALANCHE]: {
923
944
  // BTC/USD [BTC-USDC]
@@ -1200,6 +1200,38 @@ exports.TOKENS = {
1200
1200
  imageUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/39343.png",
1201
1201
  explorerUrl: "https://arbiscan.io/token/0xE41902f9aD379A8CC34A34efa00F5c3EE5112bC8",
1202
1202
  },
1203
+ {
1204
+ name: "WTI Crude Oil",
1205
+ symbol: "WTIOIL",
1206
+ address: "0xa8Ffb545d5cBF1F44E3eBA123D60372cD267D73c",
1207
+ isSynthetic: true,
1208
+ decimals: 18,
1209
+ categories: ["rwa"],
1210
+ searchAliases: ["CL"],
1211
+ imageUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/39487.png",
1212
+ explorerUrl: "https://arbiscan.io/token/0xa8Ffb545d5cBF1F44E3eBA123D60372cD267D73c",
1213
+ },
1214
+ {
1215
+ name: "Brent Crude Oil",
1216
+ symbol: "BRENTOIL",
1217
+ address: "0x9C5C4b9BA1fEBA72186f50d8Ae7C58b1D7f0B12F",
1218
+ isSynthetic: true,
1219
+ decimals: 18,
1220
+ categories: ["rwa"],
1221
+ searchAliases: ["BZ"],
1222
+ imageUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/39804.png",
1223
+ explorerUrl: "https://arbiscan.io/token/0x9C5C4b9BA1fEBA72186f50d8Ae7C58b1D7f0B12F",
1224
+ },
1225
+ {
1226
+ name: "Natural Gas",
1227
+ symbol: "NATGAS",
1228
+ address: "0x620aC65BE29066Bb9D1E92C65b35B9fD321Fb963",
1229
+ isSynthetic: true,
1230
+ decimals: 18,
1231
+ categories: ["rwa"],
1232
+ imageUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/39464.png",
1233
+ explorerUrl: "https://arbiscan.io/token/0x620aC65BE29066Bb9D1E92C65b35B9fD321Fb963",
1234
+ },
1203
1235
  ],
1204
1236
  [chains_1.AVALANCHE]: [
1205
1237
  {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const vitest_1 = require("vitest");
4
4
  const chains_1 = require("../../configs/chains");
5
+ const factors_1 = require("../../configs/factors");
5
6
  const tokens_1 = require("../../configs/tokens");
6
7
  const markets_1 = require("../markets");
7
8
  const numbers_1 = require("../numbers");
@@ -142,18 +143,52 @@ function getToken(symbol) {
142
143
  });
143
144
  });
144
145
  (0, vitest_1.describe)("getMaxAllowedLeverageByMinCollateralFactor", () => {
145
- (0, vitest_1.it)("returns half of max leverage", () => {
146
- (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(1000000000000000000n)).toBe(5000000000000000);
147
- });
148
- (0, vitest_1.it)("returns 100x for on-hours MCF (0.009 → 110x contract max)", () => {
149
- // MCF 0.009 = 9e27 → maxLeverage 110x → allowed 100x
146
+ const GOLD_MARKET = "0x0Df2BE76F517BCF0000AbfFcB6344B3b2aC4Cc4f";
147
+ const SILVER_MARKET = "0x448Fa722717df299ee197E2F6d8EB7911EFF6cEc";
148
+ const WTIOIL_MARKET = "0xda81cdd397210C08cFc567f93982E148A3aac8a6";
149
+ const BRENTOIL_MARKET = "0x6F287D071800BfA847B4a7a7104BE33F87Ce9E74";
150
+ const NATGAS_MARKET = "0x2Ce2bc8B0f9d000f359d756a5816C125474Bb39b";
151
+ const NON_MARKET_HOURS_MARKET = "0x1234567890abcdef1234567890abcdef12345678";
152
+ (0, vitest_1.it)("returns half of max leverage when no market address is provided", () => {
153
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(1000000000000000000n, undefined)).toBe(5000000000000000);
154
+ });
155
+ (0, vitest_1.it)("returns half of max leverage for a regular market", () => {
156
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(1000000000000000000n, NON_MARKET_HOURS_MARKET)).toBe(5000000000000000);
157
+ });
158
+ (0, vitest_1.it)("returns 100x for GOLD on on-hours MCF (0.009 → 110x contract max)", () => {
150
159
  const onHoursFactor = 9n * 10n ** 27n;
151
- (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(onHoursFactor)).toBe(100 * 10000);
160
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(onHoursFactor, GOLD_MARKET)).toBe(100 * factors_1.BASIS_POINTS_DIVISOR);
152
161
  });
153
- (0, vitest_1.it)("returns 25x for off-hours MCF (0.035 → 30x contract max)", () => {
154
- // MCF 0.035 = 35e27 → maxLeverage 30x → allowed 25x
162
+ (0, vitest_1.it)("returns 25x for GOLD on off-hours MCF (0.035 → 30x contract max)", () => {
155
163
  const offHoursFactor = 35n * 10n ** 27n;
156
- (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(offHoursFactor)).toBe(25 * 10000);
164
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(offHoursFactor, GOLD_MARKET)).toBe(25 * factors_1.BASIS_POINTS_DIVISOR);
165
+ });
166
+ (0, vitest_1.it)("returns 100x / 25x for SILVER with the same GOLD MCFs", () => {
167
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(9n * 10n ** 27n, SILVER_MARKET)).toBe(100 * factors_1.BASIS_POINTS_DIVISOR);
168
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(35n * 10n ** 27n, SILVER_MARKET)).toBe(25 * factors_1.BASIS_POINTS_DIVISOR);
169
+ });
170
+ (0, vitest_1.it)("returns 100x for WTIOIL on-hours MCF and 25x for off-hours MCF", () => {
171
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(9n * 10n ** 27n, WTIOIL_MARKET)).toBe(100 * factors_1.BASIS_POINTS_DIVISOR);
172
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(35n * 10n ** 27n, WTIOIL_MARKET)).toBe(25 * factors_1.BASIS_POINTS_DIVISOR);
173
+ });
174
+ (0, vitest_1.it)("returns 100x for BRENTOIL on-hours MCF and 25x for off-hours MCF", () => {
175
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(9n * 10n ** 27n, BRENTOIL_MARKET)).toBe(100 * factors_1.BASIS_POINTS_DIVISOR);
176
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(35n * 10n ** 27n, BRENTOIL_MARKET)).toBe(25 * factors_1.BASIS_POINTS_DIVISOR);
177
+ });
178
+ (0, vitest_1.it)("returns 40x for NATGAS on-hours MCF and 20x for off-hours MCF", () => {
179
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(22n * 10n ** 27n, NATGAS_MARKET)).toBe(40 * factors_1.BASIS_POINTS_DIVISOR);
180
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(40n * 10n ** 27n, NATGAS_MARKET)).toBe(20 * factors_1.BASIS_POINTS_DIVISOR);
181
+ });
182
+ (0, vitest_1.it)("does not apply market-hours overrides to other markets with same MCF", () => {
183
+ const onHoursFactor = 9n * 10n ** 27n;
184
+ const offHoursFactor = 35n * 10n ** 27n;
185
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(onHoursFactor, NON_MARKET_HOURS_MARKET)).toBe(55.5 * factors_1.BASIS_POINTS_DIVISOR);
186
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(offHoursFactor, NON_MARKET_HOURS_MARKET)).toBe(14.5 * factors_1.BASIS_POINTS_DIVISOR);
187
+ });
188
+ (0, vitest_1.it)("rounds allowed leverage to nearest .0 or .5", () => {
189
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)((0, numbers_1.numberToBigint)(1 / 24, numbers_1.PRECISION_DECIMALS), undefined)).toBe(12 * factors_1.BASIS_POINTS_DIVISOR);
190
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)((0, numbers_1.numberToBigint)(1 / 25, numbers_1.PRECISION_DECIMALS), undefined)).toBe(12.5 * factors_1.BASIS_POINTS_DIVISOR);
191
+ (0, vitest_1.expect)((0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)((0, numbers_1.numberToBigint)(1 / 50, numbers_1.PRECISION_DECIMALS), undefined)).toBe(25 * factors_1.BASIS_POINTS_DIVISOR);
157
192
  });
158
193
  });
159
194
  (0, vitest_1.describe)("getOppositeCollateral", () => {
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMarketAddressByName = exports.getMarketWithTiers = exports.composeFullMarketsInfoData = exports.hydrateMarketInfo = exports.composeRawMarketsInfoData = exports.composeRawMarketInfo = exports.getMarketTicker = exports.getMarket24Stats = exports.getIsMarketAvailableForExpressSwaps = exports.getPriceForPnl = exports.getOpenInterestForBalance = exports.getOpenInterestInTokens = exports.getOpenInterestUsd = exports.getMarketPnl = exports.getOiInTokensFromRawValues = exports.getOiUsdFromRawValues = exports.getMarketDivisor = exports.getReservedUsd = exports.getAvailableUsdLiquidityForCollateral = exports.getOppositeCollateralFromConfig = exports.getOppositeCollateral = exports.getMaxAllowedLeverageByMinCollateralFactor = exports.getMaxLeverageByMinCollateralFactor = exports.getCappedPoolPnl = exports.getPoolUsdWithoutPnl = exports.getTokenPoolType = exports.getContractMarketPrices = exports.getMarketPoolName = exports.getMarketBaseName = exports.getMarketIndexName = exports.getMarketFullName = void 0;
4
4
  const viem_1 = require("viem");
5
5
  const factors_1 = require("../../configs/factors");
6
+ const marketHours_1 = require("../../configs/marketHours");
6
7
  const tokens_1 = require("../../configs/tokens");
8
+ const bigmath_1 = require("../bigmath");
7
9
  const fees_1 = require("../fees");
8
10
  const numbers_1 = require("../numbers");
9
11
  const objects_1 = require("../objects");
@@ -93,25 +95,30 @@ function getCappedPoolPnl(p) {
93
95
  return poolPnl > maxPnl ? maxPnl : poolPnl;
94
96
  }
95
97
  exports.getCappedPoolPnl = getCappedPoolPnl;
98
+ /**
99
+ * Rounds to nearest .0 leverage, so that getMaxAllowedLeverageByMinCollateralFactor can get .0 or .5 leverage.
100
+ */
101
+ const ROUNDING_VALUE = 10000;
96
102
  function getMaxLeverageByMinCollateralFactor(minCollateralFactor) {
97
103
  if (minCollateralFactor === undefined)
98
104
  return 100 * factors_1.BASIS_POINTS_DIVISOR;
99
105
  if (minCollateralFactor === 0n)
100
106
  return 100 * factors_1.BASIS_POINTS_DIVISOR;
101
- const x = Number(numbers_1.PRECISION / minCollateralFactor);
102
- const rounded = Math.round(x / 10) * 10;
103
- return rounded * factors_1.BASIS_POINTS_DIVISOR;
107
+ const x = bigmath_1.bigMath.mulDiv(numbers_1.PRECISION, factors_1.BASIS_POINTS_DIVISOR_BIGINT, minCollateralFactor);
108
+ const rounded = Math.round(Number(x) / ROUNDING_VALUE) * ROUNDING_VALUE;
109
+ return rounded;
104
110
  }
105
111
  exports.getMaxLeverageByMinCollateralFactor = getMaxLeverageByMinCollateralFactor;
106
- // GOLD/SILVER on-hours: MCF 0.009 (9e27) → 100x UI
107
- const MCF_ON_HOURS = 9n * 10n ** 27n;
108
- // GOLD/SILVER off-hours: MCF 0.035 (35e27) → 25x UI
109
- const MCF_OFF_HOURS = 35n * 10n ** 27n;
110
- function getMaxAllowedLeverageByMinCollateralFactor(minCollateralFactor) {
111
- if (minCollateralFactor === MCF_ON_HOURS)
112
- return 100 * factors_1.BASIS_POINTS_DIVISOR;
113
- if (minCollateralFactor === MCF_OFF_HOURS)
114
- return 25 * factors_1.BASIS_POINTS_DIVISOR;
112
+ function getMaxAllowedLeverageByMinCollateralFactor(minCollateralFactor, marketAddress) {
113
+ if (marketAddress) {
114
+ const cfg = marketHours_1.MARKET_HOURS_MARKETS[marketAddress];
115
+ if (cfg) {
116
+ if (minCollateralFactor === cfg.onHoursMcf)
117
+ return cfg.onHoursMaxLeverage * factors_1.BASIS_POINTS_DIVISOR;
118
+ if (minCollateralFactor === cfg.offHoursMcf)
119
+ return cfg.offHoursMaxLeverage * factors_1.BASIS_POINTS_DIVISOR;
120
+ }
121
+ }
115
122
  return getMaxLeverageByMinCollateralFactor(minCollateralFactor) / 2;
116
123
  }
117
124
  exports.getMaxAllowedLeverageByMinCollateralFactor = getMaxAllowedLeverageByMinCollateralFactor;
@@ -346,7 +346,7 @@ function getPositionInfo(p) {
346
346
  pendingFundingFeesUsd,
347
347
  pnl: undefined,
348
348
  });
349
- const maxAllowedLeverage = (0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(marketInfo.minCollateralFactor);
349
+ const maxAllowedLeverage = (0, markets_1.getMaxAllowedLeverageByMinCollateralFactor)(marketInfo.minCollateralFactor, marketInfo.marketTokenAddress);
350
350
  const hasLowCollateral = (leverage !== undefined && leverage > maxAllowedLeverage) || false;
351
351
  const liquidationPrice = getLiquidationPrice({
352
352
  marketInfo,
@@ -295,7 +295,7 @@ const dollar = 10n ** BigInt(factors_1.USD_DECIMALS);
295
295
  (0, vitest_1.it)("should handle routes with zero output", () => {
296
296
  const routes = createTestRoutes();
297
297
  const result = (0, swapRouting_1.getBestSwapPath)({ routes, usdIn: 100n * dollar, estimator: () => ({ usdOut: 0n }) });
298
- (0, vitest_1.expect)(result).toEqual(routes[0]);
298
+ (0, vitest_1.expect)(result).toBeUndefined();
299
299
  });
300
300
  (0, vitest_1.it)("should skip routes that throw errors", () => {
301
301
  const routes = createTestRoutes();
@@ -103,7 +103,7 @@ function getBestSwapPath({ routes, usdIn, estimator, networkEstimator, }) {
103
103
  if (routes.length === 0) {
104
104
  return undefined;
105
105
  }
106
- let bestRoute = undefined;
106
+ let bestRoute = routes[0];
107
107
  let bestUsdOut = 0n;
108
108
  for (const route of routes) {
109
109
  try {
@@ -1091,6 +1091,30 @@
1091
1091
  "baseBorrowingFactorShort": "0x05640382d9ac2b646b854e08d798e98f04cd0723d0898053d14d73aa8ad67aa1",
1092
1092
  "aboveOptimalUsageBorrowingFactorLong": "0xe1de87148bd67bda9217fbb7a4605e13a6819cf6b02f99ed4c0df17281800ee6",
1093
1093
  "aboveOptimalUsageBorrowingFactorShort": "0xf4d2054fd2e503b3e5535b68952c816ff1e6c76ed5a6db2b0a7071d88d1834c7"
1094
+ },
1095
+ "0xda81cdd397210C08cFc567f93982E148A3aac8a6": {
1096
+ "optimalUsageFactorLong": "0x986daec772e7197f321cf18ae605db6da936f87bcb03cff3d4303cd21e88fa51",
1097
+ "optimalUsageFactorShort": "0x41638decee9a2957f1416690587fb5f120bcb5a8636713df019f82f98eb9b4d7",
1098
+ "baseBorrowingFactorLong": "0x776135184fcbae1f6122486c6d370bbbc629d19b20298f5556291b8d8218ef42",
1099
+ "baseBorrowingFactorShort": "0x6e65b5a36df631c8e2251438f025977d1acffe836288cf5b3cb7b0b8812a8be0",
1100
+ "aboveOptimalUsageBorrowingFactorLong": "0x98e679255838f4a852cfe1711d2490d29a4f22d0becbe8464894f95c15c21372",
1101
+ "aboveOptimalUsageBorrowingFactorShort": "0x0945c48086a7b3eca228da45ae3e5811634c1d985fba1ef05591c2557769ccd5"
1102
+ },
1103
+ "0x6F287D071800BfA847B4a7a7104BE33F87Ce9E74": {
1104
+ "optimalUsageFactorLong": "0x90bbb46df9295b17c763bce05f9ac5d856a64dfd24e3298c6b242adedfbe7510",
1105
+ "optimalUsageFactorShort": "0x2e1131e3a19d1a6ba5dfe35f8f7b671fb05e46e448d6a4edb08575654e568070",
1106
+ "baseBorrowingFactorLong": "0x7f6e709e6b17fac1405b0a8cea7b76adeefd421663d8d84965caed5647597285",
1107
+ "baseBorrowingFactorShort": "0x6f4862a2271d2e3ebdd3280a1754297681dcb6d8c204fd6b44751178ce50a3d9",
1108
+ "aboveOptimalUsageBorrowingFactorLong": "0x19fd2a53a0b6aaf23cda804c4e832456f338926fa1e5427ac30936a881413d9a",
1109
+ "aboveOptimalUsageBorrowingFactorShort": "0x94b097a23f795ddb86ecc36fc491bf94fc246623aeb400f320091bc3520d37b1"
1110
+ },
1111
+ "0x2Ce2bc8B0f9d000f359d756a5816C125474Bb39b": {
1112
+ "optimalUsageFactorLong": "0xf925bb5c2878443d47d98b6e9f0d39dd21212f50b015a0c01fcd43adbf0c55a0",
1113
+ "optimalUsageFactorShort": "0x02f76508457d07fb8a2d7c475498c1d182054a87eca61b1c947521cfac21bbaa",
1114
+ "baseBorrowingFactorLong": "0x41c82ada55554195955056b52630f479dc5acad3eaa96970fd93735a72f50ca7",
1115
+ "baseBorrowingFactorShort": "0x85a4a75fcc2ced632df6a9dadbc46b5d4171f166572e298ac8e0f5dc0a713818",
1116
+ "aboveOptimalUsageBorrowingFactorLong": "0xfdc145dc5c86925a834513f0c78ef57f8da0f095253e561506b6367106d5caac",
1117
+ "aboveOptimalUsageBorrowingFactorShort": "0xc961a42b4a07b7f63f14fbd2a3c14c41643eb80dd5a8fdcde32ad1365bcb51a7"
1094
1118
  }
1095
1119
  },
1096
1120
  "43113": {