From f0cfecb70b92361056dbee93d57e0a7800bbdc74 Mon Sep 17 00:00:00 2001 From: Daniel Beal Date: Sun, 17 Dec 2023 21:33:34 +0900 Subject: [PATCH 1/3] support for building andromeda testnet on local accomplishes this by detecting the chain id of the currently building network. if its local, it replaces problematic oracle nodes with constant nodes otherwise, the deployed network extremely closely resembles what is actually deployed to testnet, even after upgrades. this would be suitable for building a non-fork sandbox of any network (although right now its only tested with andromeda testnet) --- tomls/oracles/perps-keeper-cost.toml | 6 +++--- tomls/oracles/pyth-btc.toml | 4 ++-- tomls/oracles/pyth-eth.toml | 4 ++-- tomls/oracles/pyth-snx.toml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tomls/oracles/perps-keeper-cost.toml b/tomls/oracles/perps-keeper-cost.toml index 72ad932c3..33856bf8b 100644 --- a/tomls/oracles/perps-keeper-cost.toml +++ b/tomls/oracles/perps-keeper-cost.toml @@ -9,10 +9,10 @@ options.salt = "<%= settings.salt %>" target = ["system.oracle_manager.Proxy"] func = "registerNode" args = [ - # 2 = external node - 2, + # 2 = external node, 8 = constant node + "<%= chainId == 13370 ? 8 : 2 %>", # 7 parameters: 1 is the external node contract address, 2 to 7 gas units - "<%= defaultAbiCoder.encode(['address', 'uint256', 'uint256', 'uint256', 'uint256', 'uint256', 'uint256'], [imports.perps_gas_oracle_node.contracts.OpGasPriceOracle.address, settings.perps_keeper_l1_cost_settle_gas_units, settings.perps_keeper_l2_cost_settle_gas_units, settings.perps_keeper_l1_cost_flag_gas_units, settings.perps_keeper_l2_cost_flag_gas_units, settings.perps_keeper_l1_cost_liquidate_gas_units, settings.perps_keeper_l2_cost_liquidate_gas_units]) %>", + "<%= chainId == 13370 ? defaultAbiCoder.encode(['uint256'], [parseEther('0.001')]) : defaultAbiCoder.encode(['address', 'uint256', 'uint256', 'uint256', 'uint256', 'uint256', 'uint256'], [imports.perps_gas_oracle_node.contracts.OpGasPriceOracle.address, settings.perps_keeper_l1_cost_settle_gas_units, settings.perps_keeper_l2_cost_settle_gas_units, settings.perps_keeper_l1_cost_flag_gas_units, settings.perps_keeper_l2_cost_flag_gas_units, settings.perps_keeper_l1_cost_liquidate_gas_units, settings.perps_keeper_l2_cost_liquidate_gas_units]) %>", [ ], ] diff --git a/tomls/oracles/pyth-btc.toml b/tomls/oracles/pyth-btc.toml index d3e2bb229..a1ce7897a 100644 --- a/tomls/oracles/pyth-btc.toml +++ b/tomls/oracles/pyth-btc.toml @@ -6,8 +6,8 @@ include = ["../core.toml"] target = ["system.oracle_manager.Proxy"] func = "registerNode" args = [ - 5, # 5 = pyth aggregator type - "<%= defaultAbiCoder.encode(['address', 'bytes32', 'bool'], [settings.pyth_price_verification_address, settings.pythBtcFeedId, false]) %>", + "<%= chainId == 13370 ? 8 : 5 %>", # 5 = pyth aggregator type, 8 = constant node + "<%= chainId == 13370 ? defaultAbiCoder.encode(['uint256'], [parseEther('1')]) : defaultAbiCoder.encode(['address', 'bytes32', 'bool'], [settings.pyth_price_verification_address, settings.pythBtcFeedId, false]) %>", [ ], ] diff --git a/tomls/oracles/pyth-eth.toml b/tomls/oracles/pyth-eth.toml index ecd84e11c..8e4b961a3 100644 --- a/tomls/oracles/pyth-eth.toml +++ b/tomls/oracles/pyth-eth.toml @@ -6,8 +6,8 @@ include = ["../core.toml"] target = ["system.oracle_manager.Proxy"] func = "registerNode" args = [ - 5, # 5 = pyth aggregator type - "<%= defaultAbiCoder.encode(['address', 'bytes32', 'bool'], [settings.pyth_price_verification_address, settings.pythEthFeedId, false]) %>", + "<%= chainId == 13370 ? 8 : 5 %>", # 5 = pyth aggregator type, 8 = constant node + "<%= chainId == 13370 ? defaultAbiCoder.encode(['uint256'], [parseEther('1')]) : defaultAbiCoder.encode(['address', 'bytes32', 'bool'], [settings.pyth_price_verification_address, settings.pythEthFeedId, false]) %>", [ ], ] diff --git a/tomls/oracles/pyth-snx.toml b/tomls/oracles/pyth-snx.toml index 4b475c901..f6fe7becb 100644 --- a/tomls/oracles/pyth-snx.toml +++ b/tomls/oracles/pyth-snx.toml @@ -6,8 +6,8 @@ include = ["../core.toml"] target = ["system.oracle_manager.Proxy"] func = "registerNode" args = [ - 5, # 5 = pyth aggregator type - "<%= defaultAbiCoder.encode(['address', 'bytes32', 'bool'], [settings.pyth_price_verification_address, settings.pythSnxFeedId, false]) %>", + "<%= chainId == 13370 ? 8 : 5 %>", # 5 = pyth aggregator type, 8 = constant node + "<%= chainId == 13370 ? defaultAbiCoder.encode(['uint256'], [parseEther('1')]) : defaultAbiCoder.encode(['address', 'bytes32', 'bool'], [settings.pyth_price_verification_address, settings.pythSnxFeedId, false]) %>", [ ], ] From 6baaea0858dae5765b00afba31ef4e400bb4dc0d Mon Sep 17 00:00:00 2001 From: Daniel Beal Date: Tue, 19 Dec 2023 09:54:00 +0900 Subject: [PATCH 2/3] fix decimals --- tomls/omnibus-base-goerli-andromeda/spot/usdc.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tomls/omnibus-base-goerli-andromeda/spot/usdc.toml b/tomls/omnibus-base-goerli-andromeda/spot/usdc.toml index 7d991a2ef..fd0ab0a50 100644 --- a/tomls/omnibus-base-goerli-andromeda/spot/usdc.toml +++ b/tomls/omnibus-base-goerli-andromeda/spot/usdc.toml @@ -66,7 +66,8 @@ minDelegationD18 = "<%= parseEther('100') %>" depositingEnabled = false [provision.usdc_mock_collateral] -source = "mintable-token:1.3" +source = "mintable-token:1.7" options.name = "Fake USD Coin" options.symbol = "fUSDC" options.owner = "<%= settings.owner %>" +options.decimals = "6" From d51127c0ec0e8d6f355834567d1cdd5e0a3b623b Mon Sep 17 00:00:00 2001 From: Daniel Beal Date: Tue, 19 Dec 2023 10:01:36 +0900 Subject: [PATCH 3/3] it works --- tomls/omnibus-base-goerli-andromeda/perps/feeCollector.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tomls/omnibus-base-goerli-andromeda/perps/feeCollector.toml b/tomls/omnibus-base-goerli-andromeda/perps/feeCollector.toml index 941844469..b69390ff8 100644 --- a/tomls/omnibus-base-goerli-andromeda/perps/feeCollector.toml +++ b/tomls/omnibus-base-goerli-andromeda/perps/feeCollector.toml @@ -38,8 +38,8 @@ args = ["<%= imports.buyback_snx.contracts.buyback_snx.address %>"] target = ["system.oracle_manager.Proxy"] func = "registerNode" args = [ - 5, # 5 = pyth aggregator type - "<%= defaultAbiCoder.encode(['address', 'bytes32', 'bool'], [settings.pyth_price_verification_address, settings.pythSnxFeedId, false]) %>", + "<%= chainId == 13370 ? 8 : 5 %>", # 5 = pyth aggregator type, 8 = constant node + "<%= chainId == 13370 ? defaultAbiCoder.encode(['uint256'], [parseEther('1')]) : defaultAbiCoder.encode(['address', 'bytes32', 'bool'], [settings.pyth_price_verification_address, settings.pythSnxFeedId, false]) %>", [ ], ]