@gmx-io/sdk 1.1.2 → 1.2.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 (84) hide show
  1. package/build/cjs/src/abis/StBTC.json +1225 -0
  2. package/build/cjs/src/abis/SyntheticsReader.json +480 -19
  3. package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -0
  4. package/build/cjs/src/configs/chains.js +57 -6
  5. package/build/cjs/src/configs/contracts.js +64 -68
  6. package/build/cjs/src/configs/dataStore.js +4 -3
  7. package/build/cjs/src/configs/express.js +2 -1
  8. package/build/cjs/src/configs/markets.js +37 -0
  9. package/build/cjs/src/configs/oracleKeeper.js +1 -0
  10. package/build/cjs/src/configs/tokens.js +130 -1
  11. package/build/cjs/src/modules/orders/helpers.js +12 -13
  12. package/build/cjs/src/modules/positions/positions.js +9 -0
  13. package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +42 -0
  14. package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +257 -0
  15. package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +77 -0
  16. package/build/cjs/src/types/subsquid.js +103 -1
  17. package/build/cjs/src/utils/__tests__/numbers.spec.js +17 -9
  18. package/build/cjs/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +2 -0
  19. package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
  20. package/build/cjs/src/utils/__tests__/orderTransactions/swapOrders.spec.js +1 -0
  21. package/build/cjs/src/utils/__tests__/prices.spec.js +3 -2
  22. package/build/cjs/src/utils/__tests__/uiFeeReceiver.spec.js +9 -0
  23. package/build/cjs/src/utils/errors/transactionsErrors.js +2 -1
  24. package/build/cjs/src/utils/fees/executionFee.js +9 -1
  25. package/build/cjs/src/utils/numbers.js +52 -34
  26. package/build/cjs/src/utils/orderTransactions.js +3 -0
  27. package/build/cjs/src/utils/orders.js +8 -2
  28. package/build/cjs/src/utils/prices.js +1 -1
  29. package/build/cjs/src/utils/swap/swapValues.js +40 -0
  30. package/build/cjs/src/utils/tokens.js +10 -1
  31. package/build/cjs/src/utils/twap/uiFeeReceiver.js +26 -6
  32. package/build/esm/src/abis/StBTC.json +1225 -0
  33. package/build/esm/src/abis/SyntheticsReader.json +480 -19
  34. package/build/esm/src/configs/__tests__/tokens.spec.js +2 -1
  35. package/build/esm/src/configs/chains.js +56 -5
  36. package/build/esm/src/configs/contracts.js +65 -69
  37. package/build/esm/src/configs/dataStore.js +1 -0
  38. package/build/esm/src/configs/express.js +4 -3
  39. package/build/esm/src/configs/markets.js +38 -1
  40. package/build/esm/src/configs/oracleKeeper.js +2 -1
  41. package/build/esm/src/configs/tokens.js +131 -2
  42. package/build/esm/src/modules/orders/helpers.js +12 -13
  43. package/build/esm/src/modules/positions/positions.js +9 -0
  44. package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +42 -0
  45. package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +257 -0
  46. package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +77 -0
  47. package/build/esm/src/types/subsquid.js +102 -0
  48. package/build/esm/src/utils/__tests__/numbers.spec.js +18 -10
  49. package/build/esm/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +2 -0
  50. package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
  51. package/build/esm/src/utils/__tests__/orderTransactions/swapOrders.spec.js +1 -0
  52. package/build/esm/src/utils/__tests__/prices.spec.js +3 -2
  53. package/build/esm/src/utils/__tests__/uiFeeReceiver.spec.js +9 -0
  54. package/build/esm/src/utils/errors/transactionsErrors.js +2 -1
  55. package/build/esm/src/utils/fees/executionFee.js +11 -3
  56. package/build/esm/src/utils/numbers.js +50 -31
  57. package/build/esm/src/utils/orderTransactions.js +3 -0
  58. package/build/esm/src/utils/orders.js +8 -2
  59. package/build/esm/src/utils/prices.js +1 -1
  60. package/build/esm/src/utils/swap/swapValues.js +41 -1
  61. package/build/esm/src/utils/tokens.js +7 -0
  62. package/build/esm/src/utils/twap/uiFeeReceiver.js +24 -5
  63. package/build/types/src/configs/chains.d.ts +20 -37
  64. package/build/types/src/configs/contracts.d.ts +60 -63
  65. package/build/types/src/configs/dataStore.d.ts +1 -0
  66. package/build/types/src/configs/markets.d.ts +2 -1
  67. package/build/types/src/configs/oracleKeeper.d.ts +1 -1
  68. package/build/types/src/configs/tokens.d.ts +1 -0
  69. package/build/types/src/index.d.ts +1 -1
  70. package/build/types/src/modules/base.d.ts +1 -1
  71. package/build/types/src/modules/orders/helpers.d.ts +10 -2
  72. package/build/types/src/modules/orders/orders.d.ts +10 -1
  73. package/build/types/src/types/orders.d.ts +1 -1
  74. package/build/types/src/types/sdk.d.ts +2 -1
  75. package/build/types/src/types/subsquid.d.ts +388 -0
  76. package/build/types/src/types/tokens.d.ts +1 -0
  77. package/build/types/src/types/trade.d.ts +1 -0
  78. package/build/types/src/utils/multicall.d.ts +1 -1
  79. package/build/types/src/utils/numbers.d.ts +8 -3
  80. package/build/types/src/utils/orderTransactions.d.ts +2 -3
  81. package/build/types/src/utils/prices.d.ts +1 -1
  82. package/build/types/src/utils/tokens.d.ts +2 -0
  83. package/build/types/src/utils/twap/uiFeeReceiver.d.ts +13 -0
  84. package/package.json +1 -1
@@ -1,5 +1,7 @@
1
1
  {
2
- "address": "0x23D4Da5C7C6902D4C86d551CaE60d5755820df9E",
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "Reader",
4
+ "sourceName": "contracts/reader/Reader.sol",
3
5
  "abi": [
4
6
  {
5
7
  "inputs": [
@@ -273,6 +275,11 @@
273
275
  "outputs": [
274
276
  {
275
277
  "components": [
278
+ {
279
+ "internalType": "bytes32",
280
+ "name": "positionKey",
281
+ "type": "bytes32"
282
+ },
276
283
  {
277
284
  "components": [
278
285
  {
@@ -800,6 +807,108 @@
800
807
  "stateMutability": "view",
801
808
  "type": "function"
802
809
  },
810
+ {
811
+ "inputs": [
812
+ {
813
+ "internalType": "contract DataStore",
814
+ "name": "dataStore",
815
+ "type": "address"
816
+ },
817
+ {
818
+ "internalType": "address",
819
+ "name": "market",
820
+ "type": "address"
821
+ },
822
+ {
823
+ "internalType": "bool",
824
+ "name": "isLong",
825
+ "type": "bool"
826
+ },
827
+ {
828
+ "components": [
829
+ {
830
+ "components": [
831
+ {
832
+ "internalType": "uint256",
833
+ "name": "min",
834
+ "type": "uint256"
835
+ },
836
+ {
837
+ "internalType": "uint256",
838
+ "name": "max",
839
+ "type": "uint256"
840
+ }
841
+ ],
842
+ "internalType": "struct Price.Props",
843
+ "name": "indexTokenPrice",
844
+ "type": "tuple"
845
+ },
846
+ {
847
+ "components": [
848
+ {
849
+ "internalType": "uint256",
850
+ "name": "min",
851
+ "type": "uint256"
852
+ },
853
+ {
854
+ "internalType": "uint256",
855
+ "name": "max",
856
+ "type": "uint256"
857
+ }
858
+ ],
859
+ "internalType": "struct Price.Props",
860
+ "name": "longTokenPrice",
861
+ "type": "tuple"
862
+ },
863
+ {
864
+ "components": [
865
+ {
866
+ "internalType": "uint256",
867
+ "name": "min",
868
+ "type": "uint256"
869
+ },
870
+ {
871
+ "internalType": "uint256",
872
+ "name": "max",
873
+ "type": "uint256"
874
+ }
875
+ ],
876
+ "internalType": "struct Price.Props",
877
+ "name": "shortTokenPrice",
878
+ "type": "tuple"
879
+ }
880
+ ],
881
+ "internalType": "struct MarketUtils.MarketPrices",
882
+ "name": "prices",
883
+ "type": "tuple"
884
+ }
885
+ ],
886
+ "name": "getAdlState",
887
+ "outputs": [
888
+ {
889
+ "internalType": "uint256",
890
+ "name": "",
891
+ "type": "uint256"
892
+ },
893
+ {
894
+ "internalType": "bool",
895
+ "name": "",
896
+ "type": "bool"
897
+ },
898
+ {
899
+ "internalType": "int256",
900
+ "name": "",
901
+ "type": "int256"
902
+ },
903
+ {
904
+ "internalType": "uint256",
905
+ "name": "",
906
+ "type": "uint256"
907
+ }
908
+ ],
909
+ "stateMutability": "view",
910
+ "type": "function"
911
+ },
803
912
  {
804
913
  "inputs": [
805
914
  {
@@ -2436,6 +2545,35 @@
2436
2545
  "stateMutability": "view",
2437
2546
  "type": "function"
2438
2547
  },
2548
+ {
2549
+ "inputs": [
2550
+ {
2551
+ "internalType": "contract DataStore",
2552
+ "name": "dataStore",
2553
+ "type": "address"
2554
+ },
2555
+ {
2556
+ "internalType": "address",
2557
+ "name": "market",
2558
+ "type": "address"
2559
+ }
2560
+ ],
2561
+ "name": "getPendingPositionImpactPoolDistributionAmount",
2562
+ "outputs": [
2563
+ {
2564
+ "internalType": "uint256",
2565
+ "name": "",
2566
+ "type": "uint256"
2567
+ },
2568
+ {
2569
+ "internalType": "uint256",
2570
+ "name": "",
2571
+ "type": "uint256"
2572
+ }
2573
+ ],
2574
+ "stateMutability": "view",
2575
+ "type": "function"
2576
+ },
2439
2577
  {
2440
2578
  "inputs": [
2441
2579
  {
@@ -2808,6 +2946,11 @@
2808
2946
  "outputs": [
2809
2947
  {
2810
2948
  "components": [
2949
+ {
2950
+ "internalType": "bytes32",
2951
+ "name": "positionKey",
2952
+ "type": "bytes32"
2953
+ },
2811
2954
  {
2812
2955
  "components": [
2813
2956
  {
@@ -3298,6 +3441,11 @@
3298
3441
  "outputs": [
3299
3442
  {
3300
3443
  "components": [
3444
+ {
3445
+ "internalType": "bytes32",
3446
+ "name": "positionKey",
3447
+ "type": "bytes32"
3448
+ },
3301
3449
  {
3302
3450
  "components": [
3303
3451
  {
@@ -4554,23 +4702,336 @@
4554
4702
  "type": "function"
4555
4703
  }
4556
4704
  ],
4557
- "transactionHash": "0xb058c26493408e1ec30b17ac5872c1c322a9d4243e75d434099d15a9e4ccea76",
4558
- "receipt": {
4559
- "to": null,
4560
- "from": "0xE7BfFf2aB721264887230037940490351700a068",
4561
- "contractAddress": "0x23D4Da5C7C6902D4C86d551CaE60d5755820df9E",
4562
- "transactionIndex": 5,
4563
- "gasUsed": "5375288",
4564
- "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
4565
- "blockHash": "0xec6a71487f45632fdf9f6c8e7c2f3efe0c7d4093f90f28a8468bd2b7b23c3395",
4566
- "transactionHash": "0xb058c26493408e1ec30b17ac5872c1c322a9d4243e75d434099d15a9e4ccea76",
4567
- "logs": [],
4568
- "blockNumber": 252698175,
4569
- "cumulativeGasUsed": "5964774",
4570
- "status": 1,
4571
- "byzantium": true
4705
+ "linkReferences": {
4706
+ "contracts/deposit/DepositStoreUtils.sol": {
4707
+ "DepositStoreUtils": [
4708
+ {
4709
+ "length": 20,
4710
+ "start": 2495
4711
+ }
4712
+ ]
4713
+ },
4714
+ "contracts/market/MarketStoreUtils.sol": {
4715
+ "MarketStoreUtils": [
4716
+ {
4717
+ "length": 20,
4718
+ "start": 3440
4719
+ },
4720
+ {
4721
+ "length": 20,
4722
+ "start": 3703
4723
+ },
4724
+ {
4725
+ "length": 20,
4726
+ "start": 4153
4727
+ },
4728
+ {
4729
+ "length": 20,
4730
+ "start": 4566
4731
+ },
4732
+ {
4733
+ "length": 20,
4734
+ "start": 4739
4735
+ }
4736
+ ]
4737
+ },
4738
+ "contracts/market/MarketUtils.sol": {
4739
+ "MarketUtils": [
4740
+ {
4741
+ "length": 20,
4742
+ "start": 2198
4743
+ }
4744
+ ]
4745
+ },
4746
+ "contracts/position/PositionStoreUtils.sol": {
4747
+ "PositionStoreUtils": [
4748
+ {
4749
+ "length": 20,
4750
+ "start": 1669
4751
+ },
4752
+ {
4753
+ "length": 20,
4754
+ "start": 2355
4755
+ },
4756
+ {
4757
+ "length": 20,
4758
+ "start": 5061
4759
+ }
4760
+ ]
4761
+ },
4762
+ "contracts/position/PositionUtils.sol": {
4763
+ "PositionUtils": [
4764
+ {
4765
+ "length": 20,
4766
+ "start": 1795
4767
+ },
4768
+ {
4769
+ "length": 20,
4770
+ "start": 5200
4771
+ }
4772
+ ]
4773
+ },
4774
+ "contracts/reader/ReaderDepositUtils.sol": {
4775
+ "ReaderDepositUtils": [
4776
+ {
4777
+ "length": 20,
4778
+ "start": 3996
4779
+ }
4780
+ ]
4781
+ },
4782
+ "contracts/reader/ReaderPositionUtils.sol": {
4783
+ "ReaderPositionUtils": [
4784
+ {
4785
+ "length": 20,
4786
+ "start": 1956
4787
+ },
4788
+ {
4789
+ "length": 20,
4790
+ "start": 4278
4791
+ },
4792
+ {
4793
+ "length": 20,
4794
+ "start": 4930
4795
+ },
4796
+ {
4797
+ "length": 20,
4798
+ "start": 5482
4799
+ }
4800
+ ]
4801
+ },
4802
+ "contracts/reader/ReaderPricingUtils.sol": {
4803
+ "ReaderPricingUtils": [
4804
+ {
4805
+ "length": 20,
4806
+ "start": 3014
4807
+ },
4808
+ {
4809
+ "length": 20,
4810
+ "start": 3565
4811
+ },
4812
+ {
4813
+ "length": 20,
4814
+ "start": 3841
4815
+ }
4816
+ ]
4817
+ },
4818
+ "contracts/reader/ReaderUtils.sol": {
4819
+ "ReaderUtils": [
4820
+ {
4821
+ "length": 20,
4822
+ "start": 2788
4823
+ },
4824
+ {
4825
+ "length": 20,
4826
+ "start": 3166
4827
+ },
4828
+ {
4829
+ "length": 20,
4830
+ "start": 3303
4831
+ },
4832
+ {
4833
+ "length": 20,
4834
+ "start": 4416
4835
+ },
4836
+ {
4837
+ "length": 20,
4838
+ "start": 5349
4839
+ },
4840
+ {
4841
+ "length": 20,
4842
+ "start": 5646
4843
+ }
4844
+ ]
4845
+ },
4846
+ "contracts/reader/ReaderWithdrawalUtils.sol": {
4847
+ "ReaderWithdrawalUtils": [
4848
+ {
4849
+ "length": 20,
4850
+ "start": 2638
4851
+ }
4852
+ ]
4853
+ },
4854
+ "contracts/shift/ShiftStoreUtils.sol": {
4855
+ "ShiftStoreUtils": [
4856
+ {
4857
+ "length": 20,
4858
+ "start": 4804
4859
+ }
4860
+ ]
4861
+ },
4862
+ "contracts/withdrawal/WithdrawalStoreUtils.sol": {
4863
+ "WithdrawalStoreUtils": [
4864
+ {
4865
+ "length": 20,
4866
+ "start": 5767
4867
+ }
4868
+ ]
4869
+ }
4572
4870
  },
4573
- "args": [],
4574
- "numDeployments": 10,
4575
- "solcInputHash": "be316035eac2019d87590bce566bb2c5"
4871
+ "deployedLinkReferences": {
4872
+ "contracts/deposit/DepositStoreUtils.sol": {
4873
+ "DepositStoreUtils": [
4874
+ {
4875
+ "length": 20,
4876
+ "start": 2462
4877
+ }
4878
+ ]
4879
+ },
4880
+ "contracts/market/MarketStoreUtils.sol": {
4881
+ "MarketStoreUtils": [
4882
+ {
4883
+ "length": 20,
4884
+ "start": 3407
4885
+ },
4886
+ {
4887
+ "length": 20,
4888
+ "start": 3670
4889
+ },
4890
+ {
4891
+ "length": 20,
4892
+ "start": 4120
4893
+ },
4894
+ {
4895
+ "length": 20,
4896
+ "start": 4533
4897
+ },
4898
+ {
4899
+ "length": 20,
4900
+ "start": 4706
4901
+ }
4902
+ ]
4903
+ },
4904
+ "contracts/market/MarketUtils.sol": {
4905
+ "MarketUtils": [
4906
+ {
4907
+ "length": 20,
4908
+ "start": 2165
4909
+ }
4910
+ ]
4911
+ },
4912
+ "contracts/position/PositionStoreUtils.sol": {
4913
+ "PositionStoreUtils": [
4914
+ {
4915
+ "length": 20,
4916
+ "start": 1636
4917
+ },
4918
+ {
4919
+ "length": 20,
4920
+ "start": 2322
4921
+ },
4922
+ {
4923
+ "length": 20,
4924
+ "start": 5028
4925
+ }
4926
+ ]
4927
+ },
4928
+ "contracts/position/PositionUtils.sol": {
4929
+ "PositionUtils": [
4930
+ {
4931
+ "length": 20,
4932
+ "start": 1762
4933
+ },
4934
+ {
4935
+ "length": 20,
4936
+ "start": 5167
4937
+ }
4938
+ ]
4939
+ },
4940
+ "contracts/reader/ReaderDepositUtils.sol": {
4941
+ "ReaderDepositUtils": [
4942
+ {
4943
+ "length": 20,
4944
+ "start": 3963
4945
+ }
4946
+ ]
4947
+ },
4948
+ "contracts/reader/ReaderPositionUtils.sol": {
4949
+ "ReaderPositionUtils": [
4950
+ {
4951
+ "length": 20,
4952
+ "start": 1923
4953
+ },
4954
+ {
4955
+ "length": 20,
4956
+ "start": 4245
4957
+ },
4958
+ {
4959
+ "length": 20,
4960
+ "start": 4897
4961
+ },
4962
+ {
4963
+ "length": 20,
4964
+ "start": 5449
4965
+ }
4966
+ ]
4967
+ },
4968
+ "contracts/reader/ReaderPricingUtils.sol": {
4969
+ "ReaderPricingUtils": [
4970
+ {
4971
+ "length": 20,
4972
+ "start": 2981
4973
+ },
4974
+ {
4975
+ "length": 20,
4976
+ "start": 3532
4977
+ },
4978
+ {
4979
+ "length": 20,
4980
+ "start": 3808
4981
+ }
4982
+ ]
4983
+ },
4984
+ "contracts/reader/ReaderUtils.sol": {
4985
+ "ReaderUtils": [
4986
+ {
4987
+ "length": 20,
4988
+ "start": 2755
4989
+ },
4990
+ {
4991
+ "length": 20,
4992
+ "start": 3133
4993
+ },
4994
+ {
4995
+ "length": 20,
4996
+ "start": 3270
4997
+ },
4998
+ {
4999
+ "length": 20,
5000
+ "start": 4383
5001
+ },
5002
+ {
5003
+ "length": 20,
5004
+ "start": 5316
5005
+ },
5006
+ {
5007
+ "length": 20,
5008
+ "start": 5613
5009
+ }
5010
+ ]
5011
+ },
5012
+ "contracts/reader/ReaderWithdrawalUtils.sol": {
5013
+ "ReaderWithdrawalUtils": [
5014
+ {
5015
+ "length": 20,
5016
+ "start": 2605
5017
+ }
5018
+ ]
5019
+ },
5020
+ "contracts/shift/ShiftStoreUtils.sol": {
5021
+ "ShiftStoreUtils": [
5022
+ {
5023
+ "length": 20,
5024
+ "start": 4771
5025
+ }
5026
+ ]
5027
+ },
5028
+ "contracts/withdrawal/WithdrawalStoreUtils.sol": {
5029
+ "WithdrawalStoreUtils": [
5030
+ {
5031
+ "length": 20,
5032
+ "start": 5734
5033
+ }
5034
+ ]
5035
+ }
5036
+ }
4576
5037
  }
@@ -1,6 +1,6 @@
1
1
  import { withRetry, zeroAddress } from "viem";
2
2
  import { describe, expect, it } from "vitest";
3
- import { ARBITRUM, AVALANCHE, getChainName, SUPPORTED_CHAIN_IDS } from "../chains";
3
+ import { ARBITRUM, AVALANCHE, BOTANIX, getChainName, SUPPORTED_CHAIN_IDS } from "../chains";
4
4
  import { getOracleKeeperUrl } from "../oracleKeeper";
5
5
  import { TOKENS } from "../tokens";
6
6
  const getKeeperTokens = async (chainId) => {
@@ -15,6 +15,7 @@ const getIgnoredTokensByChain = (chainId) => {
15
15
  return IGNORED_TOKENS.concat({
16
16
  [ARBITRUM]: ["FRAX", "MIM"],
17
17
  [AVALANCHE]: ["MIM", "WBTC"],
18
+ [BOTANIX]: ["GMX"],
18
19
  }[chainId] ?? []);
19
20
  };
20
21
  describe("tokens config", () => {
@@ -1,29 +1,30 @@
1
+ import { defineChain } from "viem";
1
2
  import { arbitrum, avalanche, avalancheFuji } from "viem/chains";
2
3
  export const AVALANCHE = 43114;
3
4
  export const AVALANCHE_FUJI = 43113;
4
5
  export const ARBITRUM = 42161;
5
- export const BSС_MAINNET = 56;
6
- export const BSС_TESTNET = 97;
7
6
  export const ETH_MAINNET = 1;
8
- export const SUPPORTED_CHAIN_IDS = [ARBITRUM, AVALANCHE];
7
+ export const BOTANIX = 3637;
8
+ export const SUPPORTED_CHAIN_IDS = [ARBITRUM, AVALANCHE, BOTANIX];
9
9
  export const SUPPORTED_CHAIN_IDS_DEV = [...SUPPORTED_CHAIN_IDS, AVALANCHE_FUJI];
10
10
  export const CHAIN_NAMES_MAP = {
11
- [BSС_MAINNET]: "BSC",
12
- [BSС_TESTNET]: "BSC Testnet",
13
11
  [ARBITRUM]: "Arbitrum",
14
12
  [AVALANCHE]: "Avalanche",
15
13
  [AVALANCHE_FUJI]: "Avalanche Fuji",
14
+ [BOTANIX]: "Botanix",
16
15
  };
17
16
  export const HIGH_EXECUTION_FEES_MAP = {
18
17
  [ARBITRUM]: 5, // 5 USD
19
18
  [AVALANCHE]: 5, // 5 USD
20
19
  [AVALANCHE_FUJI]: 5, // 5 USD
20
+ [BOTANIX]: 5, // 5 USD
21
21
  };
22
22
  // added to maxPriorityFeePerGas
23
23
  // applied to EIP-1559 transactions only
24
24
  // is not applied to execution fee calculation
25
25
  export const MAX_FEE_PER_GAS_MAP = {
26
26
  [AVALANCHE]: 200000000000n, // 200 gwei
27
+ [BOTANIX]: 20n,
27
28
  };
28
29
  // added to maxPriorityFeePerGas
29
30
  // applied to EIP-1559 transactions only
@@ -39,11 +40,21 @@ export const MAX_PRIORITY_FEE_PER_GAS_MAP = {
39
40
  [ARBITRUM]: 1500000000n,
40
41
  [AVALANCHE]: 1500000000n,
41
42
  [AVALANCHE_FUJI]: 1500000000n,
43
+ [BOTANIX]: 7n,
42
44
  };
43
45
  export const EXCESSIVE_EXECUTION_FEES_MAP = {
44
46
  [ARBITRUM]: 10, // 10 USD
45
47
  [AVALANCHE]: 10, // 10 USD
46
48
  [AVALANCHE_FUJI]: 10, // 10 USD
49
+ [BOTANIX]: 10, // 10 USD
50
+ };
51
+ // avoid botanix gas spikes when chain is not actively used
52
+ // if set, execution fee value should not be less than this in USD equivalent
53
+ export const MIN_EXECUTION_FEE_USD = {
54
+ [ARBITRUM]: undefined,
55
+ [AVALANCHE]: undefined,
56
+ [AVALANCHE_FUJI]: undefined,
57
+ [BOTANIX]: 1000000000000000000000000000n, // 1e27 $0.001
47
58
  };
48
59
  // added to gasPrice
49
60
  // applied to *non* EIP-1559 transactions only
@@ -65,10 +76,40 @@ export const EXCESSIVE_EXECUTION_FEES_MAP = {
65
76
  export const GAS_PRICE_BUFFER_MAP = {
66
77
  [ARBITRUM]: 2000n, // 20%
67
78
  };
79
+ export const botanix = defineChain({
80
+ id: BOTANIX,
81
+ name: "Botanix",
82
+ nativeCurrency: {
83
+ name: "Bitcoin",
84
+ symbol: "BTC",
85
+ decimals: 18,
86
+ },
87
+ rpcUrls: {
88
+ default: {
89
+ http: [
90
+ // this rpc returns incorrect gas price
91
+ // "https://rpc.botanixlabs.com",
92
+ "https://rpc.ankr.com/botanix_mainnet",
93
+ ],
94
+ },
95
+ },
96
+ blockExplorers: {
97
+ default: {
98
+ name: "BotanixScan",
99
+ url: "https://botanixscan.io",
100
+ },
101
+ },
102
+ contracts: {
103
+ multicall3: {
104
+ address: "0x4BaA24f93a657f0c1b4A0Ffc72B91011E35cA46b",
105
+ },
106
+ },
107
+ });
68
108
  const VIEM_CHAIN_BY_CHAIN_ID = {
69
109
  [AVALANCHE_FUJI]: avalancheFuji,
70
110
  [ARBITRUM]: arbitrum,
71
111
  [AVALANCHE]: avalanche,
112
+ [BOTANIX]: botanix,
72
113
  };
73
114
  export function getChainName(chainId) {
74
115
  return CHAIN_NAMES_MAP[chainId];
@@ -98,6 +139,10 @@ export const EXECUTION_FEE_CONFIG_V2 = {
98
139
  shouldUseMaxPriorityFeePerGas: false,
99
140
  defaultBufferBps: 3000, // 30%
100
141
  },
142
+ [BOTANIX]: {
143
+ shouldUseMaxPriorityFeePerGas: true,
144
+ defaultBufferBps: 3000, // 30%
145
+ },
101
146
  };
102
147
  export const GAS_LIMITS_STATIC_CONFIG = {
103
148
  [ARBITRUM]: {
@@ -118,4 +163,10 @@ export const GAS_LIMITS_STATIC_CONFIG = {
118
163
  cancelOrderGasLimit: 700000n,
119
164
  tokenPermitGasLimit: 90000n,
120
165
  },
166
+ [BOTANIX]: {
167
+ createOrderGasLimit: 1000000n,
168
+ updateOrderGasLimit: 800000n,
169
+ cancelOrderGasLimit: 700000n,
170
+ tokenPermitGasLimit: 90000n,
171
+ },
121
172
  };