Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base mainnet perps v3.1 #170

Merged
merged 2 commits into from
Mar 28, 2024
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
14 changes: 7 additions & 7 deletions omnibus-base-mainnet-andromeda.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "synthetix-omnibus"
version = "7"
version = "8"
description = "Andromeda deployment"
preset = "andromeda"
include = [
Expand All @@ -20,11 +20,11 @@ include = [
"tomls/omnibus-base-mainnet-andromeda/collaterals/susdc.toml",
"tomls/collaterals/susdc.toml",
# BTC
"tomls/markets/perps/btc.toml",
"tomls/omnibus-base-mainnet-andromeda/perps/btc-invokes.toml",
"tomls/oracles/pyth-btc.toml",
"tomls/omnibus-base-mainnet-andromeda/perps/btc.toml",
# ETH
"tomls/markets/perps/eth.toml",
"tomls/omnibus-base-mainnet-andromeda/perps/eth-invokes.toml",
"tomls/oracles/pyth-eth.toml",
"tomls/omnibus-base-mainnet-andromeda/perps/eth.toml",
]
Expand All @@ -36,16 +36,16 @@ defaultValue = "2"
defaultValue = "2"

[setting.snx_package]
defaultValue = "synthetix:3.3.5"
defaultValue = "synthetix:3.3.15"

[setting.perps_keeper_cost_package]
defaultValue = "op-gas-price-oracle:3.3.15"

[setting.spot_market_package]
defaultValue = "synthetix-spot-market:3.3.5"
defaultValue = "synthetix-spot-market:3.3.15"

[setting.perps_market_package]
defaultValue = "synthetix-perps-market:3.3.5"
defaultValue = "synthetix-perps-market:3.3.17"

[setting.buyback_snx_package]
defaultValue = "buyback-snx:3.3.5" # Do not update! This package isn't upgradeable. A version change will deploy a new contract.
Expand All @@ -60,7 +60,7 @@ defaultValue = "andromeda" # Preset assigned to provisioned packages
defaultValue = "0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a"

[provision.pyth_erc7412_wrapper]
source = "pyth-erc7412-wrapper:3.3.5"
source = "pyth-erc7412-wrapper:3.3.15"
targetPreset = "<%= settings.target_preset %>"
options.salt = "<%= settings.salt %>"
options.pythAddress = "<%= settings.pyth_price_verification_address %>"
Expand Down
139 changes: 139 additions & 0 deletions tomls/omnibus-base-mainnet-andromeda/perps/btc-invokes.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
include = ["../../oracles/btc.toml", "../../markets/common/bigcap-settings.toml"]
sunnyvempati marked this conversation as resolved.
Show resolved Hide resolved
# NOTE: This toml will live until the setMaxMarketValue is on mainnet
[setting.pythBtcFeedId]

[setting.btcPerpsMarketId]

[setting.perpsBtcSkewScale]

[setting.perpsBtcMaxFundingVelocity]

[setting.perpsBtcMakerFeeRatio]

[setting.perpsBtcTakerFeeRatio]

[setting.perpsBtcMaxMarketSize]

[setting.perpsBtcInitialMarginRatio]

[setting.perpsBtcMaintenanceMarginFraction]

[setting.perpsBtcFlagRewardRatioD18]

[setting.perpsBtcMaxLiquidationLimitAccumulationMultiplier]

[setting.perpsBtcMaxSecondsInLiquidationWindow]

[setting.perpsBtcMinimumPositionMargin]

[setting.perpsBtcLockedOiRatio]

[invoke.createBtcPerpsMarket]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "createMarket"
args = ["<%= settings.btcPerpsMarketId %>", "Bitcoin", "BTC"]

[invoke.setPerpsPriceBtc]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "updatePriceData"
args = [
"<%= settings.btcPerpsMarketId %>",
"<%= extras.btc_oracle_id %>",
"<%= settings.bigCapStrictStalenessTolerance %>",
]
depends = ["invoke.createBtcPerpsMarket"]

# DO NOT MODIFY THIS STEP!. Edit [invoke.setPerpsBtcSettlementStrategy] instead.
[invoke.addPerpsBtcSettlementStrategy]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "addSettlementStrategy"
args = [
"<%= settings.btcPerpsMarketId %>",
{ strategyType = "0", settlementDelay = "0", settlementWindowDuration = "1", priceVerificationContract = "0x0000000000000000000000000000000000000000", feedId = "0x0000000000000000000000000000000000000000000000000000000000000000", settlementReward = "0", disabled = false, commitmentPriceDelay = "0" },
]
extra.btc_pyth_settlement_strategy.event = "SettlementStrategyAdded"
extra.btc_pyth_settlement_strategy.arg = 2
depends = ["invoke.createBtcPerpsMarket"]

[invoke.setPerpsBtcSettlementStrategy]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setSettlementStrategy"
args = [
"<%= settings.btcPerpsMarketId %>",
"<%= extras.btc_pyth_settlement_strategy %>", # Settlement Strategy ID
{ strategyType = "0", settlementDelay = "<%= settings.bigCapSettlementDelay %>", settlementWindowDuration = "<%= settings.bigCapSettlementWindowDuration %>", priceVerificationContract = "<%= imports.pyth_erc7412_wrapper.contracts.PythERC7412Wrapper.address %>", feedId = "<%= settings.pythBtcFeedId %>", settlementReward = "<%= parseEther(settings.settlementReward) %>", disabled = false, commitmentPriceDelay = "<%= settings.commitmentPriceDelay %>" },
]

[invoke.setPerpsBtcFundingParameters]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setFundingParameters"
args = [
"<%= settings.btcPerpsMarketId %>",
"<%= parseEther(settings.perpsBtcSkewScale) %>",
"<%= parseEther(settings.perpsBtcMaxFundingVelocity) %>",
]
depends = ["invoke.createBtcPerpsMarket"]

[invoke.setPerpsBtcOrderFees]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setOrderFees"
args = [
"<%= settings.btcPerpsMarketId %>",
"<%= parseEther(settings.perpsBtcMakerFeeRatio) %>",
"<%= parseEther(settings.perpsBtcTakerFeeRatio) %>",
]
depends = ["invoke.createBtcPerpsMarket"]

[invoke.setPerpsBtcMaxMarketSize]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setMaxMarketSize"
args = ["<%= settings.btcPerpsMarketId %>", "<%= parseEther(settings.perpsBtcMaxMarketSize) %>"]
depends = ["invoke.createBtcPerpsMarket"]

[invoke.setPerpsBtcMaxMarketValue]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setMaxMarketValue"
args = ["<%= settings.btcPerpsMarketId %>", "<%= parseEther(settings.perpsBtcMaxMarketValue) %>"]
depends = ["invoke.createBtcPerpsMarket"]

[invoke.setPerpsBtcMaxLiquidationParameters]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setMaxLiquidationParameters"
args = [
"<%= settings.btcPerpsMarketId %>",
"<%= parseEther(settings.perpsBtcMaxLiquidationLimitAccumulationMultiplier) %>",
"<%= settings.perpsBtcMaxSecondsInLiquidationWindow %>",
"<%= parseEther(settings.perpsBtcMaxLiquidationPd) %>",
"<%= settings.perpsBtcEndorsedLiquidator %>",
]
depends = ["invoke.createBtcPerpsMarket"]

[invoke.setPerpsBtcLiquidationParameters]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setLiquidationParameters"
args = [
"<%= settings.btcPerpsMarketId %>",
"<%= parseEther(settings.perpsBtcInitialMarginRatio) %>",
"<%= parseEther(settings.perpsBtcMinimumInitialMarginRatio) %>",
"<%= parseEther(settings.perpsBtcMaintenanceMarginScalar) %>",
"<%= parseEther(settings.perpsBtcFlagRewardRatioD18) %>",
"<%= parseEther(settings.perpsBtcMinimumPositionMargin) %>",
]
depends = ["invoke.createBtcPerpsMarket"]

[invoke.setPerpsBtcLockedOiRatio]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setLockedOiRatio"
args = ["<%= settings.btcPerpsMarketId %>", "<%= parseEther(settings.perpsBtcLockedOiRatio) %>"]
depends = ["invoke.createBtcPerpsMarket"]
3 changes: 3 additions & 0 deletions tomls/omnibus-base-mainnet-andromeda/perps/btc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ defaultValue = "0.0005"
[setting.perpsBtcMaxMarketSize]
defaultValue = "22" #approx $1m

[setting.perpsBtcMaxMarketValue]
defaultValue = "0" # not enabled

[setting.perpsBtcInitialMarginRatio]
defaultValue = "13.35"

Expand Down
149 changes: 149 additions & 0 deletions tomls/omnibus-base-mainnet-andromeda/perps/eth-invokes.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
include = [
# TODO: this is a funny necessary dependency because the oracle manager is registering the same node twice
# however, it will not emit "NodeRegistered" the second time because its an unnecessary call
"../../oracles/eth.toml",
"../../markets/common/bigcap-settings.toml",
]
# NOTE: This toml will live until the setMaxMarketValue is on mainnet

[setting.ethPerpsMarketId]

[setting.perpsEthSkewScale]

[setting.perpsEthMaxFundingVelocity]

[setting.perpsEthMakerFeeRatio]

[setting.perpsEthTakerFeeRatio]

[setting.perpsEthMaxMarketSize]

[setting.perpsEthMaxMarketValue]

[setting.perpsEthInitialMarginRatio]

[setting.perpsEthMaintenanceMarginFraction]

[setting.perpsEthFlagRewardRatioD18]

[setting.perpsEthMaxLiquidationLimitAccumulationMultiplier]

[setting.perpsEthMaxSecondsInLiquidationWindow]

[setting.perpsEthMaxLiquidationPd]

[setting.perpsEthEndorsedLiquidator]

[setting.perpsEthMinimumPositionMargin]

[setting.perpsEthLockedOiRatio]

[invoke.createEthPerpsMarket]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "createMarket"
args = ["<%= settings.ethPerpsMarketId %>", "Ethereum", "ETH"]

[invoke.setPerpsPriceEth]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "updatePriceData"
args = [
"<%= settings.ethPerpsMarketId %>",
"<%= extras.eth_oracle_id %>",
"<%= settings.bigCapStrictStalenessTolerance %>",
]
depends = ["invoke.createEthPerpsMarket"]

# Do not modify this step. Edit [invoke.setPerpsEthSettlementStrategy] instead.
[invoke.addPerpsEthSettlementStrategy]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "addSettlementStrategy"
args = [
"<%= settings.ethPerpsMarketId %>",
{ strategyType = "0", settlementDelay = "0", settlementWindowDuration = "1", priceVerificationContract = "0x0000000000000000000000000000000000000000", feedId = "0x0000000000000000000000000000000000000000000000000000000000000000", settlementReward = "0", disabled = false, commitmentPriceDelay = "0" },
]
extra.eth_pyth_settlement_strategy.event = "SettlementStrategyAdded"
extra.eth_pyth_settlement_strategy.arg = 2
depends = ["invoke.createEthPerpsMarket"]

[invoke.setPerpsEthSettlementStrategy]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setSettlementStrategy"
args = [
"<%= settings.ethPerpsMarketId %>",
"<%= extras.eth_pyth_settlement_strategy %>", # Settlement Strategy ID
{ strategyType = "0", settlementDelay = "<%= settings.bigCapSettlementDelay %>", settlementWindowDuration = "<%= settings.bigCapSettlementWindowDuration %>", priceVerificationContract = "<%= imports.pyth_erc7412_wrapper.contracts.PythERC7412Wrapper.address %>", feedId = "<%= settings.pythEthFeedId %>", settlementReward = "<%= parseEther(settings.settlementReward) %>", disabled = false, commitmentPriceDelay = "<%= settings.commitmentPriceDelay %>" },
]

[invoke.setPerpsEthFundingParameters]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setFundingParameters"
args = [
"<%= settings.ethPerpsMarketId %>",
"<%= parseEther(settings.perpsEthSkewScale) %>",
"<%= parseEther(settings.perpsEthMaxFundingVelocity) %>",
]
depends = ["invoke.createEthPerpsMarket"]

[invoke.setPerpsEthOrderFees]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setOrderFees"
args = [
"<%= settings.ethPerpsMarketId %>",
"<%= parseEther(settings.perpsEthMakerFeeRatio) %>",
"<%= parseEther(settings.perpsEthTakerFeeRatio) %>",
]
depends = ["invoke.createEthPerpsMarket"]

[invoke.setPerpsEthMaxMarketSize]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setMaxMarketSize"
args = ["<%= settings.ethPerpsMarketId %>", "<%= parseEther(settings.perpsEthMaxMarketSize) %>"]
depends = ["invoke.createEthPerpsMarket"]

[invoke.setPerpsEthMaxMarketValue]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setMaxMarketValue"
args = ["<%= settings.ethPerpsMarketId %>", "<%= parseEther(settings.perpsEthMaxMarketValue) %>"]
depends = ["invoke.createEthPerpsMarket"]

[invoke.setPerpsEthMaxLiquidationParameters]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setMaxLiquidationParameters"
args = [
"<%= settings.ethPerpsMarketId %>",
"<%= parseEther(settings.perpsEthMaxLiquidationLimitAccumulationMultiplier) %>",
"<%= settings.perpsEthMaxSecondsInLiquidationWindow %>",
"<%= parseEther(settings.perpsEthMaxLiquidationPd) %>",
"<%= settings.perpsEthEndorsedLiquidator %>",
]
depends = ["invoke.createEthPerpsMarket"]

[invoke.setPerpsEthLiquidationParameters]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setLiquidationParameters"
args = [
"<%= settings.ethPerpsMarketId %>",
"<%= parseEther(settings.perpsEthInitialMarginRatio) %>",
"<%= parseEther(settings.perpsEthMinimumInitialMarginRatio) %>",
"<%= parseEther(settings.perpsEthMaintenanceMarginScalar) %>",
"<%= parseEther(settings.perpsEthFlagRewardRatioD18) %>",
"<%= parseEther(settings.perpsEthMinimumPositionMargin) %>",
]
depends = ["invoke.createEthPerpsMarket"]

[invoke.setPerpsEthLockedOiRatio]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setLockedOiRatio"
args = ["<%= settings.ethPerpsMarketId %>", "<%= parseEther(settings.perpsEthLockedOiRatio) %>"]
depends = ["invoke.createEthPerpsMarket"]
3 changes: 3 additions & 0 deletions tomls/omnibus-base-mainnet-andromeda/perps/eth.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ defaultValue = "0.0005"
[setting.perpsEthMaxMarketSize]
defaultValue = "385" # approx $1m

[setting.perpsEthMaxMarketValue]
defaultValue = "0" # not enabled

[setting.perpsEthInitialMarginRatio]
defaultValue = "8.92"

Expand Down
19 changes: 19 additions & 0 deletions tomls/omnibus-base-mainnet-andromeda/perps/global.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ defaultValue = "100"
[setting.perps_liquidation_max_keeper_scaling_ratio_d18]
defaultValue = "0.3"

[setting.perps_low_util_gradient]
defaultValue = "0" # not enabled

[setting.perps_gradient_breakpoint]
defaultValue = "0" # not enabled

[setting.perps_high_util_gradient]
defaultValue = "0" # not enabled

[invoke.setPerpsLiquidationRewardGuards]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
Expand Down Expand Up @@ -65,3 +74,13 @@ target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "updateKeeperCostNodeId"
args = ["<%= extras.perps_keeper_cost_usd_oracle_id %>"]

[invoke.setInterestRateParams]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setInterestRateParameters"
args = [
"<%= parseEther(settings.perps_low_util_gradient) %>",
"<%= parseEther(settings.perps_gradient_breakpoint) %>",
"<%= parseEther(settings.perps_high_util_gradient) %>",
]