Skip to content

Commit 122e703

Browse files
committed
Merge branch 'v2.2-branch' into multichain
2 parents 31cdecd + 6f16e09 commit 122e703

File tree

12 files changed

+2859
-19
lines changed

12 files changed

+2859
-19
lines changed

config/general.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,12 @@ export default async function ({ network }: HardhatRuntimeEnvironment) {
141141
increaseOrderGasLimit: 3_000_000,
142142
decreaseOrderGasLimit: 3_000_000,
143143
swapOrderGasLimit: 2_500_000,
144+
ignoreOpenInterestForUsageFactor: true,
144145
},
145146
avalanche: {
146147
increaseOrderGasLimit: 3_500_000,
147148
decreaseOrderGasLimit: 3_500_000,
149+
ignoreOpenInterestForUsageFactor: true,
148150
},
149151
}[network.name];
150152

config/glvs.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,21 @@ export default async function ({ network }: HardhatRuntimeEnvironment) {
144144
glvMaxMarketTokenBalanceAmount: expandDecimals(1_182_951, 18),
145145
glvMaxMarketTokenBalanceUsd: decimalToFloat(1_224_000),
146146
},
147+
{
148+
indexToken: "TRUMP",
149+
glvMaxMarketTokenBalanceAmount: expandDecimals(3_500_000, 18),
150+
glvMaxMarketTokenBalanceUsd: decimalToFloat(3_500_000),
151+
},
152+
{
153+
indexToken: "MELANIA",
154+
glvMaxMarketTokenBalanceAmount: expandDecimals(500_000, 18),
155+
glvMaxMarketTokenBalanceUsd: decimalToFloat(500_000),
156+
},
157+
{
158+
indexToken: "ENA",
159+
glvMaxMarketTokenBalanceAmount: expandDecimals(500_000, 18),
160+
glvMaxMarketTokenBalanceUsd: decimalToFloat(500_000),
161+
},
147162
],
148163
},
149164
{

config/markets.ts

Lines changed: 97 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ const fundingRateConfig_Low: FundingRateConfig = {
163163

164164
maxFundingFactorPerSecond: percentageToFloat("75%").div(SECONDS_PER_YEAR),
165165

166-
thresholdForStableFunding: 0,
167-
thresholdForDecreaseFunding: percentageToFloat("2%"),
166+
thresholdForStableFunding: percentageToFloat("4%"),
167+
thresholdForDecreaseFunding: 0,
168168
};
169169

170170
const fundingRateConfig_Default: FundingRateConfig = {
@@ -181,8 +181,8 @@ const fundingRateConfig_Default: FundingRateConfig = {
181181

182182
maxFundingFactorPerSecond: percentageToFloat("90%").div(SECONDS_PER_YEAR),
183183

184-
thresholdForStableFunding: 0,
185-
thresholdForDecreaseFunding: percentageToFloat("2%"),
184+
thresholdForStableFunding: percentageToFloat("4%"),
185+
thresholdForDecreaseFunding: 0,
186186
};
187187

188188
const fundingRateConfig_High: FundingRateConfig = {
@@ -199,8 +199,8 @@ const fundingRateConfig_High: FundingRateConfig = {
199199

200200
maxFundingFactorPerSecond: percentageToFloat("100%").div(SECONDS_PER_YEAR),
201201

202-
thresholdForStableFunding: 0,
203-
thresholdForDecreaseFunding: percentageToFloat("2%"),
202+
thresholdForStableFunding: percentageToFloat("4%"),
203+
thresholdForDecreaseFunding: 0,
204204
};
205205

206206
const fundingRateConfig_SingleToken: FundingRateConfig = {
@@ -217,8 +217,8 @@ const fundingRateConfig_SingleToken: FundingRateConfig = {
217217

218218
maxFundingFactorPerSecond: percentageToFloat("90%").div(SECONDS_PER_YEAR),
219219

220-
thresholdForStableFunding: 0,
221-
thresholdForDecreaseFunding: percentageToFloat("2%"),
220+
thresholdForStableFunding: percentageToFloat("4%"),
221+
thresholdForDecreaseFunding: 0,
222222
};
223223

224224
type BorrowingRateConfig = Partial<{
@@ -922,8 +922,8 @@ const config: {
922922
// minCollateralFactor of 0.005 (0.5%) when open interest is 25,000,000 USD
923923
minCollateralFactorForOpenInterestMultiplier: exponentToFloat("2e-10"),
924924

925-
reserveFactor: percentageToFloat("265%"),
926-
openInterestReserveFactor: percentageToFloat("260%"),
925+
reserveFactor: percentageToFloat("275%"),
926+
openInterestReserveFactor: percentageToFloat("270%"),
927927

928928
positionImpactPoolDistributionRate: bigNumberify(0), // expandDecimals(230, 33), // 0.2300306+36, 20 SOL / day
929929
minPositionImpactPoolAmount: expandDecimals(219, 9), // 219 SOL
@@ -1366,9 +1366,6 @@ const config: {
13661366
negativeMaxPositionImpactFactor: percentageToFloat("0.5%"),
13671367
maxPositionImpactFactorForLiquidations: bigNumberify(0), // 0%
13681368

1369-
positionFeeFactorForPositiveImpact: percentageToFloat("0.05%"),
1370-
positionFeeFactorForNegativeImpact: percentageToFloat("0.07%"),
1371-
13721369
minCollateralFactor: percentageToFloat("1%"), // 100x leverage
13731370
minCollateralFactorForOpenInterestMultiplier: exponentToFloat("2.5e-9"),
13741371

@@ -2046,9 +2043,6 @@ const config: {
20462043
negativeMaxPositionImpactFactor: percentageToFloat("0.5%"),
20472044
maxPositionImpactFactorForLiquidations: bigNumberify(0), // 0%
20482045

2049-
positionFeeFactorForPositiveImpact: percentageToFloat("0.05%"),
2050-
positionFeeFactorForNegativeImpact: percentageToFloat("0.07%"),
2051-
20522046
fundingDecreaseFactorPerSecond: decimalToFloat(0), // not applicable if thresholdForDecreaseFunding = 0
20532047
thresholdForDecreaseFunding: decimalToFloat(0), // 0%
20542048

@@ -2332,6 +2326,93 @@ const config: {
23322326
maxOpenInterest: decimalToFloat(1_000_000),
23332327
maxPoolUsdForDeposit: decimalToFloat(1_500_000), // 1.5x the max open interest
23342328

2329+
maxLongTokenPoolAmount: expandDecimals(600, 18), // ~2M USD (2x the max open interest)
2330+
maxShortTokenPoolAmount: expandDecimals(2_000_000, 6), // ~2M USD (2x the max open interest)
2331+
},
2332+
{
2333+
tokens: { indexToken: "TRUMP", longToken: "WETH", shortToken: "USDC" },
2334+
virtualTokenIdForIndexToken: hashString("PERP:TRUMP/USD"),
2335+
virtualMarketId: hashString("SPOT:ETH/USD"),
2336+
2337+
...syntheticMarketConfig,
2338+
...fundingRateConfig_High,
2339+
...borrowingRateConfig_HighMax_WithHigherBase,
2340+
2341+
negativePositionImpactFactor: exponentToFloat("5e-7"),
2342+
positivePositionImpactFactor: exponentToFloat("2.5e-7"),
2343+
positionImpactExponentFactor: exponentToFloat("1.7e0"),
2344+
2345+
negativeSwapImpactFactor: exponentToFloat("3.5e-9"),
2346+
positiveSwapImpactFactor: exponentToFloat("1.75e-9"),
2347+
2348+
minCollateralFactorForOpenInterestMultiplier: exponentToFloat("2e-8"),
2349+
2350+
reserveFactor: percentageToFloat("40%"), // default is 95%
2351+
openInterestReserveFactor: percentageToFloat("35%"), // default is 90%
2352+
2353+
maxPnlFactorForTraders: percentageToFloat("50%"), // default is 60%
2354+
2355+
maxOpenInterest: decimalToFloat(750_000),
2356+
maxPoolUsdForDeposit: decimalToFloat(2_500_000),
2357+
2358+
maxLongTokenPoolAmount: expandDecimals(900, 18),
2359+
maxShortTokenPoolAmount: expandDecimals(3_000_000, 6),
2360+
},
2361+
{
2362+
tokens: { indexToken: "MELANIA", longToken: "WETH", shortToken: "USDC" },
2363+
virtualTokenIdForIndexToken: hashString("PERP:MELANIA/USD"),
2364+
virtualMarketId: hashString("SPOT:ETH/USD"),
2365+
2366+
...syntheticMarketConfig,
2367+
...fundingRateConfig_Default,
2368+
...borrowingRateConfig_HighMax_WithHigherBase,
2369+
2370+
negativePositionImpactFactor: exponentToFloat("5e-7"),
2371+
positivePositionImpactFactor: exponentToFloat("2.5e-7"),
2372+
positionImpactExponentFactor: exponentToFloat("1.7e0"),
2373+
2374+
negativeSwapImpactFactor: exponentToFloat("3.5e-9"),
2375+
positiveSwapImpactFactor: exponentToFloat("1.75e-9"),
2376+
2377+
minCollateralFactorForOpenInterestMultiplier: exponentToFloat("2e-8"),
2378+
2379+
reserveFactor: percentageToFloat("40%"), // default is 95%
2380+
openInterestReserveFactor: percentageToFloat("35%"), // default is 90%
2381+
2382+
maxPnlFactorForTraders: percentageToFloat("50%"), // default is 60%
2383+
2384+
maxOpenInterest: decimalToFloat(500_000),
2385+
maxPoolUsdForDeposit: decimalToFloat(750_000), // 1.5x the max open interest
2386+
2387+
maxLongTokenPoolAmount: expandDecimals(300, 18), // ~1M USD (2x the max open interest)
2388+
maxShortTokenPoolAmount: expandDecimals(1_000_000, 6), // ~1M USD (2x the max open interest)
2389+
},
2390+
{
2391+
tokens: { indexToken: "ENA", longToken: "WETH", shortToken: "USDC" },
2392+
virtualTokenIdForIndexToken: hashString("PERP:ENA/USD"),
2393+
virtualMarketId: hashString("SPOT:ETH/USD"),
2394+
2395+
...syntheticMarketConfig,
2396+
...fundingRateConfig_Default,
2397+
...borrowingRateConfig_HighMax_WithHigherBase,
2398+
2399+
negativePositionImpactFactor: exponentToFloat("8e-7"),
2400+
positivePositionImpactFactor: exponentToFloat("4e-7"),
2401+
positionImpactExponentFactor: exponentToFloat("1.6e0"),
2402+
2403+
negativeSwapImpactFactor: exponentToFloat("3.5e-9"),
2404+
positiveSwapImpactFactor: exponentToFloat("1.75e-9"),
2405+
2406+
minCollateralFactorForOpenInterestMultiplier: exponentToFloat("2e-10"),
2407+
2408+
reserveFactor: percentageToFloat("75%"), // default is 95%
2409+
openInterestReserveFactor: percentageToFloat("70%"), // default is 90%
2410+
2411+
maxPnlFactorForTraders: percentageToFloat("90%"), // default is 60%
2412+
2413+
maxOpenInterest: decimalToFloat(1_000_000),
2414+
maxPoolUsdForDeposit: decimalToFloat(1_500_000), // 1.5x the max open interest
2415+
23352416
maxLongTokenPoolAmount: expandDecimals(600, 18), // ~2M USD (2x the max open interest)
23362417
maxShortTokenPoolAmount: expandDecimals(2_000_000, 6), // ~2M USD (2x the max open interest)
23372418
},

config/tokens.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,45 @@ const config: {
526526
oracleTimestampAdjustment: 1,
527527
// Chainlink on-chain feed not available
528528
},
529+
TRUMP: {
530+
synthetic: true,
531+
decimals: 6, // https://solscan.io/token/6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
532+
transferGasLimit: 200 * 1000,
533+
dataStreamFeedId: "0x0003eae10f93ab9aeb6d1aa757b07938eed75a0d09cbe15df8521dc3d6bfb633",
534+
dataStreamFeedDecimals: 18,
535+
oracleTimestampAdjustment: 1,
536+
priceFeed: {
537+
address: "0x373510BDa1ab7e873c731968f4D81B685f520E4B", // indicated as New Token Feed
538+
decimals: 8,
539+
heartbeatDuration: (24 + 1) * 60 * 60,
540+
},
541+
},
542+
MELANIA: {
543+
synthetic: true,
544+
decimals: 6, // https://solscan.io/token/FUAfBo2jgks6gB4Z4LfZkqSZgzNucisEHqnNebaRxM1P
545+
transferGasLimit: 200 * 1000,
546+
dataStreamFeedId: "0x000334e8e9fd64bd9068f44e7779f9b6437c86b1c148549d026c00b3a642caeb",
547+
dataStreamFeedDecimals: 18,
548+
oracleTimestampAdjustment: 1,
549+
priceFeed: {
550+
address: "0xE2CB592D636c500a6e469628054F09d58e4d91BB", // no category ranking
551+
decimals: 8,
552+
heartbeatDuration: (24 + 1) * 60 * 60,
553+
},
554+
},
555+
ENA: {
556+
synthetic: true,
557+
decimals: 18, // https://etherscan.io/token/0x57e114b691db790c35207b2e685d4a43181e6061#readContract
558+
transferGasLimit: 200 * 1000,
559+
dataStreamFeedId: "0x00033e05a40dd8c25ffa1b88a35234845c067635f7ddf5edde701f859f8894c1",
560+
dataStreamFeedDecimals: 18,
561+
oracleTimestampAdjustment: 1,
562+
priceFeed: {
563+
address: "0x9eE96caa9972c801058CAA8E23419fc6516FbF7e", // no category ranking
564+
decimals: 8,
565+
heartbeatDuration: (24 + 1) * 60 * 60,
566+
},
567+
},
529568
AAVE: {
530569
address: "0xba5ddd1f9d7f570dc94a51479a000e3bce967196",
531570
decimals: 18,

contracts/router/ExchangeRouter.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ contract ExchangeRouter is IExchangeRouter, BaseRouter {
105105
bytes[] memory externalCallDataList,
106106
address[] memory refundTokens,
107107
address[] memory refundReceivers
108-
) external nonReentrant {
108+
) external payable nonReentrant {
109109
externalHandler.makeExternalCalls(
110110
externalCallTargets,
111111
externalCallDataList,

contracts/router/GlvRouter.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ contract GlvRouter is BaseRouter {
119119
bytes[] memory externalCallDataList,
120120
address[] memory refundTokens,
121121
address[] memory refundReceivers
122-
) external nonReentrant {
122+
) external payable nonReentrant {
123123
externalHandler.makeExternalCalls(
124124
externalCallTargets,
125125
externalCallDataList,

scripts/incentives/.migrations.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,9 @@
148148
"2024-12-25_avalanche_1100": 1735718489,
149149
"2024-12-25_avalanche_1101": 1735718859,
150150
"2025-01-01_avalanche_1101": 1736447252,
151-
"2025-01-01_avalanche_1100": 1736447589
151+
"2025-01-01_avalanche_1100": 1736447589,
152+
"2025-01-08_avalanche_1101": 1736947305,
153+
"2025-01-08_avalanche_1100": 1736947454,
154+
"2025-01-15_avalanche_1101": 1737578558,
155+
"2025-01-15_avalanche_1100": 1737578665
152156
}

0 commit comments

Comments
 (0)