From 2323e5ab7181a9bffb038dd8d4bb9e4d429b9780 Mon Sep 17 00:00:00 2001 From: Sunny Vempati <5723490+sunnyvempati@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:16:53 -0500 Subject: [PATCH 1/2] add deployment --- omnibus-base-mainnet-andromeda.toml | 12 +- .../perps/btc-invokes.toml | 139 ++++++++++++++++ .../perps/btc.toml | 3 + .../perps/eth-invokes.toml | 149 ++++++++++++++++++ .../perps/eth.toml | 3 + .../perps/global.toml | 19 +++ 6 files changed, 319 insertions(+), 6 deletions(-) create mode 100644 tomls/omnibus-base-mainnet-andromeda/perps/btc-invokes.toml create mode 100644 tomls/omnibus-base-mainnet-andromeda/perps/eth-invokes.toml diff --git a/omnibus-base-mainnet-andromeda.toml b/omnibus-base-mainnet-andromeda.toml index d72f0e539..5f6216471 100644 --- a/omnibus-base-mainnet-andromeda.toml +++ b/omnibus-base-mainnet-andromeda.toml @@ -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", ] @@ -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. @@ -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 %>" diff --git a/tomls/omnibus-base-mainnet-andromeda/perps/btc-invokes.toml b/tomls/omnibus-base-mainnet-andromeda/perps/btc-invokes.toml new file mode 100644 index 000000000..1738783d1 --- /dev/null +++ b/tomls/omnibus-base-mainnet-andromeda/perps/btc-invokes.toml @@ -0,0 +1,139 @@ +include = ["../../oracles/btc.toml", "../../markets/common/bigcap-settings.toml"] +# 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.PerpsMarČketProxy"] +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"] diff --git a/tomls/omnibus-base-mainnet-andromeda/perps/btc.toml b/tomls/omnibus-base-mainnet-andromeda/perps/btc.toml index 0cc41eed6..e6512915f 100644 --- a/tomls/omnibus-base-mainnet-andromeda/perps/btc.toml +++ b/tomls/omnibus-base-mainnet-andromeda/perps/btc.toml @@ -19,6 +19,9 @@ defaultValue = "0.0005" [setting.perpsBtcMaxMarketSize] defaultValue = "22" #approx $1m +[setting.perpsBtcMaxMarketValue] +defaultValue = "0" # not enabled + [setting.perpsBtcInitialMarginRatio] defaultValue = "13.35" diff --git a/tomls/omnibus-base-mainnet-andromeda/perps/eth-invokes.toml b/tomls/omnibus-base-mainnet-andromeda/perps/eth-invokes.toml new file mode 100644 index 000000000..0d2e871ce --- /dev/null +++ b/tomls/omnibus-base-mainnet-andromeda/perps/eth-invokes.toml @@ -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"] diff --git a/tomls/omnibus-base-mainnet-andromeda/perps/eth.toml b/tomls/omnibus-base-mainnet-andromeda/perps/eth.toml index 134b022bb..b7804cb07 100644 --- a/tomls/omnibus-base-mainnet-andromeda/perps/eth.toml +++ b/tomls/omnibus-base-mainnet-andromeda/perps/eth.toml @@ -19,6 +19,9 @@ defaultValue = "0.0005" [setting.perpsEthMaxMarketSize] defaultValue = "385" # approx $1m +[setting.perpsEthMaxMarketValue] +defaultValue = "0" # not enabled + [setting.perpsEthInitialMarginRatio] defaultValue = "8.92" diff --git a/tomls/omnibus-base-mainnet-andromeda/perps/global.toml b/tomls/omnibus-base-mainnet-andromeda/perps/global.toml index f68f795bb..2d3721154 100644 --- a/tomls/omnibus-base-mainnet-andromeda/perps/global.toml +++ b/tomls/omnibus-base-mainnet-andromeda/perps/global.toml @@ -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" @@ -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) %>", +] From fef539686209d84bb457a1d3df3e3d09ef95eac9 Mon Sep 17 00:00:00 2001 From: Sunny Vempati <5723490+sunnyvempati@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:39:04 -0500 Subject: [PATCH 2/2] fix name --- omnibus-base-mainnet-andromeda.toml | 2 +- tomls/omnibus-base-mainnet-andromeda/perps/btc-invokes.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/omnibus-base-mainnet-andromeda.toml b/omnibus-base-mainnet-andromeda.toml index 5f6216471..bcc7c8bdb 100644 --- a/omnibus-base-mainnet-andromeda.toml +++ b/omnibus-base-mainnet-andromeda.toml @@ -1,5 +1,5 @@ name = "synthetix-omnibus" -version = "7" +version = "8" description = "Andromeda deployment" preset = "andromeda" include = [ diff --git a/tomls/omnibus-base-mainnet-andromeda/perps/btc-invokes.toml b/tomls/omnibus-base-mainnet-andromeda/perps/btc-invokes.toml index 1738783d1..e2e5866da 100644 --- a/tomls/omnibus-base-mainnet-andromeda/perps/btc-invokes.toml +++ b/tomls/omnibus-base-mainnet-andromeda/perps/btc-invokes.toml @@ -29,7 +29,7 @@ include = ["../../oracles/btc.toml", "../../markets/common/bigcap-settings.toml" [setting.perpsBtcLockedOiRatio] [invoke.createBtcPerpsMarket] -target = ["perpsFactory.PerpsMarČketProxy"] +target = ["perpsFactory.PerpsMarketProxy"] fromCall.func = "owner" func = "createMarket" args = ["<%= settings.btcPerpsMarketId %>", "Bitcoin", "BTC"]