Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 4 additions & 37 deletions config/buyback.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BigNumberish } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { expandDecimals, percentageToFloat } from "../utils/math";
import { percentageToFloat } from "../utils/math";

export type BuybackBatchAmount = {
token: string;
Expand Down Expand Up @@ -39,43 +39,10 @@ export default async function (hre: HardhatRuntimeEnvironment): Promise<BuybackC
const defaultMaxPriceAge = 30;

const config: { [network: string]: BuybackConfig } = {
localhost: defaultEmptyConfig,
base: defaultEmptyConfig,
baseSepolia: defaultEmptyConfig,
hardhat: defaultEmptyConfig,

arbitrum: {
batchAmounts: [
{
token: "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a", // GMX
amount: expandDecimals(200, 18),
},
{
token: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", // WETH
amount: expandDecimals(15, 17),
},
],
gmxFactors: defaultBuybackGmxFactor,
maxPriceAge: defaultMaxPriceAge,
},

avalanche: {
batchAmounts: [
{
token: "0x62edc0692BD897D2295872a9FFCac5425011c661", // GMX
amount: expandDecimals(150, 18),
},
{
token: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", // WAVAX
amount: expandDecimals(150, 18),
},
],
gmxFactors: defaultBuybackGmxFactor,
maxPriceAge: defaultMaxPriceAge,
},

arbitrumSepolia: defaultEmptyConfig,
arbitrumGoerli: defaultEmptyConfig,

avalancheFuji: defaultEmptyConfig,
localhost: defaultEmptyConfig,
};

const networkConfig: BuybackConfig = config[hre.network.name];
Expand Down
42 changes: 19 additions & 23 deletions config/general.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ethers } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { decimalToFloat, percentageToFloat, expandDecimals } from "../utils/math";
import { decimalToFloat, expandDecimals, percentageToFloat } from "../utils/math";

export default async function ({ network }: HardhatRuntimeEnvironment) {
if (network.name === "hardhat") {
Expand Down Expand Up @@ -67,8 +67,6 @@ export default async function ({ network }: HardhatRuntimeEnvironment) {
}

const generalConfig = {
feeReceiver: "0x43ce1d475e06c65dd879f4ec644b8e0e10ff2b6d",
holdingAddress: "0x3f59203ea1c66527422998b54287e1efcacbe2c5",
sequencerUptimeFeed: ethers.constants.AddressZero,
sequencerGraceDuration: 300,
maxUiFeeFactor: percentageToFloat("0.05%"),
Expand Down Expand Up @@ -126,31 +124,29 @@ export default async function ({ network }: HardhatRuntimeEnvironment) {
};

const networkConfig = {
arbitrumGoerli: {},
arbitrumSepolia: {
maxAutoCancelOrders: 11,
maxTotalCallbackGasLimitForAutoCancelOrders: 10_000_000,
},
avalancheFuji: {},
arbitrum: {
maxAutoCancelOrders: 11,
maxTotalCallbackGasLimitForAutoCancelOrders: 10_000_000,
maxCallbackGasLimit: 4_000_000,
base: {
estimatedGasFeeBaseAmount: false,
estimatedGasPerOraclePrice: false,
executionGasFeeBaseAmount: false,
executionGasPerOraclePrice: false,
feeReceiver: "REPLACE_ME",
holdingAddress: "REPLACE_ME",
},
baseSepolia: {
estimatedGasFeeBaseAmount: false,
estimatedGasPerOraclePrice: false,
executionGasFeeBaseAmount: false,
sequencerUptimeFeed: "0xFdB631F5EE196F0ed6FAa767959853A9F217697D",

increaseOrderGasLimit: 3_000_000,
decreaseOrderGasLimit: 3_000_000,
swapOrderGasLimit: 2_500_000,
ignoreOpenInterestForUsageFactor: true,
executionGasPerOraclePrice: false,
feeReceiver: "REPLACE_ME",
holdingAddress: "REPLACE_ME",
},
avalanche: {
increaseOrderGasLimit: 3_500_000,
decreaseOrderGasLimit: 3_500_000,
ignoreOpenInterestForUsageFactor: true,
localhost: {
estimatedGasFeeBaseAmount: false,
estimatedGasPerOraclePrice: false,
executionGasFeeBaseAmount: false,
executionGasPerOraclePrice: false,
feeReceiver: "REPLACE_ME",
holdingAddress: "REPLACE_ME",
},
}[network.name];

Expand Down
8 changes: 6 additions & 2 deletions config/glvs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BigNumberish } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { percentageToFloat, expandDecimals, decimalToFloat } from "../utils/math";

type GlvConfig = {
name: string;
Expand All @@ -27,7 +26,12 @@ type GlvConfig = {
}[];

export default async function ({ network }: HardhatRuntimeEnvironment) {
const config: GlvConfig = {}[network.name]!;
const config: GlvConfig = {
base: [],
baseSepolia: [],
hardhat: [],
localhost: [],
}[network.name]!;

if (!config) {
throw new Error(`Network config not defined for ${network.name}`);
Expand Down
56 changes: 41 additions & 15 deletions config/markets.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { BigNumberish, ethers } from "ethers";
import { BigNumberish } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { expandDecimals, exponentToFloat, decimalToFloat, bigNumberify, percentageToFloat } from "../utils/math";
import { hashString } from "../utils/hash";
import { SECONDS_PER_HOUR, SECONDS_PER_YEAR } from "../utils/constants";
import { bigNumberify, decimalToFloat, expandDecimals, exponentToFloat, percentageToFloat } from "../utils/math";

export type BaseMarketConfig = {
reserveFactor: BigNumberish;
Expand Down Expand Up @@ -406,7 +405,8 @@ const hardhatBaseMarketConfig: Partial<BaseMarketConfig> = {
const config: {
[network: string]: MarketConfig[];
} = {
hardhat: [
base: [
// TODO: add more parameters for each mainnet market
{
tokens: { indexToken: "EUR", longToken: "USDC", shortToken: "USDC" },
reversed: false,
Expand All @@ -431,34 +431,34 @@ const config: {
tokens: { indexToken: "WETH", longToken: "USDC", shortToken: "USDC" },
reversed: false,
},

// For testing only
],
baseSepolia: [
{
tokens: { indexToken: "SOL", longToken: "WETH", shortToken: "USDC" },
tokens: { indexToken: "EUR", longToken: "USDC", shortToken: "USDC" },
reversed: false,
},
{
tokens: { longToken: "WETH", shortToken: "USDC" },
swapOnly: true,
tokens: { indexToken: "GBP", longToken: "USDC", shortToken: "USDC" },
reversed: false,
},
{
tokens: { indexToken: "WBTC", longToken: "WBTC", shortToken: "USDC" },
tokens: { indexToken: "GOLD", longToken: "USDC", shortToken: "USDC" },
reversed: false,
},
{
tokens: { indexToken: "WETH", longToken: "WETH", shortToken: "WETH" },
reversed: false,
tokens: { indexToken: "JPY", longToken: "USDC", shortToken: "USDC" },
reversed: true,
},
{
tokens: { indexToken: "WETH", longToken: "WETH", shortToken: "USDC" },
tokens: { indexToken: "WBTC", longToken: "USDC", shortToken: "USDC" },
reversed: false,
},
{
tokens: { indexToken: "WETH", longToken: "WETH", shortToken: "USDT" },
tokens: { indexToken: "WETH", longToken: "USDC", shortToken: "USDC" },
reversed: false,
},
],
localhost: [
hardhat: [
{
tokens: { indexToken: "EUR", longToken: "USDC", shortToken: "USDC" },
reversed: false,
Expand Down Expand Up @@ -510,6 +510,32 @@ const config: {
reversed: false,
},
],
localhost: [
{
tokens: { indexToken: "EUR", longToken: "USDC", shortToken: "USDC" },
reversed: false,
},
{
tokens: { indexToken: "GBP", longToken: "USDC", shortToken: "USDC" },
reversed: false,
},
{
tokens: { indexToken: "GOLD", longToken: "USDC", shortToken: "USDC" },
reversed: false,
},
{
tokens: { indexToken: "JPY", longToken: "USDC", shortToken: "USDC" },
reversed: true,
},
{
tokens: { indexToken: "WBTC", longToken: "USDC", shortToken: "USDC" },
reversed: false,
},
{
tokens: { indexToken: "WETH", longToken: "USDC", shortToken: "USDC" },
reversed: false,
},
],
};

function fillLongShortValues(market, key, longKey, shortKey) {
Expand Down
26 changes: 22 additions & 4 deletions config/oracle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BigNumberish } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { decimalToFloat } from "../utils/math";
import { BigNumberish } from "ethers";

export type OracleConfig = {
signers: string[];
Expand All @@ -23,13 +23,23 @@ export default async function (hre: HardhatRuntimeEnvironment): Promise<OracleCo
}

const config: { [network: string]: OracleConfig } = {
localhost: {
signers: testSigners,
base: {
signers: [],
minOracleSigners: 0,
minOracleBlockConfirmations: 255,
maxOraclePriceAge: 60 * 60,
maxOraclePriceAge: 5 * 60,
maxOracleTimestampRange: 60,
maxRefPriceDeviationFactor: decimalToFloat(5, 1), // 50%
pythLazerFeedVerifier: "0xacea761c27a909d4d3895128ebe6370fde2df481",
},
baseSepolia: {
signers: [],
minOracleSigners: 0,
minOracleBlockConfirmations: 255,
maxOraclePriceAge: 5 * 60,
maxOracleTimestampRange: 60,
maxRefPriceDeviationFactor: decimalToFloat(5, 1), // 50%
pythLazerFeedVerifier: "0xacea761c27a909d4d3895128ebe6370fde2df481",
},
hardhat: {
signers: testSigners,
Expand All @@ -40,6 +50,14 @@ export default async function (hre: HardhatRuntimeEnvironment): Promise<OracleCo
maxRefPriceDeviationFactor: decimalToFloat(5, 1), // 50%,
chainlinkPaymentToken: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf",
},
localhost: {
signers: testSigners,
minOracleSigners: 0,
minOracleBlockConfirmations: 255,
maxOraclePriceAge: 60 * 60,
maxOracleTimestampRange: 60,
maxRefPriceDeviationFactor: decimalToFloat(5, 1), // 50%
},
};

const oracleConfig: OracleConfig = config[hre.network.name];
Expand Down
102 changes: 0 additions & 102 deletions config/oracle.ts.bak

This file was deleted.

Loading