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

Add tomls for SIP-363 base-sepolia #171

Merged
merged 7 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion e2e/parseError.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function parseError(error) {
data?.args?.oracleContract &&
data?.args?.oracleQuery
) {
const oracleAddress = data?.args?.oracleAddress;
const oracleAddress = data?.args?.oracleContract;
const oracleQueryRaw = data?.args?.oracleQuery;
const decoded = ethers.utils.defaultAbiCoder.decode(
['uint8', 'uint64', 'bytes32'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { wrapCollateral } = require('../../tasks/wrapCollateral');
const { unwrapCollateral } = require('../../tasks/unwrapCollateral');
const { syncTime } = require('../../tasks/syncTime');

const SYNTH_USDC_MAX_MARKET_COLLATERAL = 10_000_000;
const SYNTH_USDC_MAX_MARKET_COLLATERAL = 20_000_000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When people managed to fill up 10mil wrapper? I thought we did not have free mint to avoid this...


describe(require('path').basename(__filename, '.e2e.js'), function () {
const provider = new ethers.providers.JsonRpcProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const {
} = require('../../tasks/configureMaximumMarketCollateral');
const { syncTime } = require('../../tasks/syncTime');

const SYNTH_USDC_MAX_MARKET_COLLATERAL = 10_000_000;
const SYNTH_USDC_MAX_MARKET_COLLATERAL = 20_000_000;

describe(require('path').basename(__filename, '.e2e.js'), function () {
const accountId = parseInt(`1337${crypto.randomInt(1000)}`);
Expand Down Expand Up @@ -209,6 +209,21 @@ describe(require('path').basename(__filename, '.e2e.js'), function () {
marketId: 200,
settlementStrategyId: require('../../deployments/extras.json').btc_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 300,
settlementStrategyId: require('../../deployments/extras.json').snx_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 400,
settlementStrategyId: require('../../deployments/extras.json').sol_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 500,
settlementStrategyId: require('../../deployments/extras.json').wif_pyth_settlement_strategy,
});
});

it(`should delegate ${SYNTH_USDC_MAX_MARKET_COLLATERAL - 200_000} sUSDC into the Spartan Council pool`, async () => {
Expand Down
20 changes: 20 additions & 0 deletions e2e/tests/omnibus-base-sepolia-andromeda.toml/Perps_Trading.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,21 @@ describe(require('path').basename(__filename, '.e2e.js'), function () {
marketId: 200,
settlementStrategyId: require('../../deployments/extras.json').btc_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 300,
settlementStrategyId: require('../../deployments/extras.json').snx_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 400,
settlementStrategyId: require('../../deployments/extras.json').sol_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 500,
settlementStrategyId: require('../../deployments/extras.json').wif_pyth_settlement_strategy,
});
});

it('should increase max collateral for the test to 1_000_000_000_000', async () => {
Expand Down Expand Up @@ -230,6 +245,11 @@ describe(require('path').basename(__filename, '.e2e.js'), function () {
settlementStrategyId,
});

const PerpsMarketProxy = new ethers.Contract(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused?

require('../../deployments/PerpsMarketProxy.json').address,
require('../../deployments/PerpsMarketProxy.json').abi,
provider
);
// Wait for commitment price/settlement delay
await wait(2000);

Expand Down
15 changes: 15 additions & 0 deletions e2e/tests/omnibus-base-sepolia-andromeda.toml/Rewards_SNX.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,21 @@ describe(require('path').basename(__filename, '.e2e.js'), function () {
marketId: 200,
settlementStrategyId: require('../../deployments/extras.json').btc_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 300,
settlementStrategyId: require('../../deployments/extras.json').snx_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 400,
settlementStrategyId: require('../../deployments/extras.json').sol_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 500,
settlementStrategyId: require('../../deployments/extras.json').wif_pyth_settlement_strategy,
});
});

it(`should delegate 1_000 sUSDC into the Spartan Council pool`, async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const {
},
} = require('../../deployments/meta.json');

describe(require('path').basename(__filename, '.e2e.js'), function () {
describe.only(require('path').basename(__filename, '.e2e.js'), function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
describe.only(require('path').basename(__filename, '.e2e.js'), function () {
describe(require('path').basename(__filename, '.e2e.js'), function () {

const accountId = parseInt(`1337${crypto.randomInt(1000)}`);
const provider = new ethers.providers.JsonRpcProvider(
process.env.RPC_URL || 'http://127.0.0.1:8545'
Expand Down Expand Up @@ -222,6 +222,21 @@ describe(require('path').basename(__filename, '.e2e.js'), function () {
marketId: 200,
settlementStrategyId: require('../../deployments/extras.json').btc_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 300,
settlementStrategyId: require('../../deployments/extras.json').snx_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 400,
settlementStrategyId: require('../../deployments/extras.json').sol_pyth_settlement_strategy,
});
await doPriceUpdate({
wallet,
marketId: 500,
settlementStrategyId: require('../../deployments/extras.json').wif_pyth_settlement_strategy,
});
});

it(`should delegate 1_000 sUSDC into the Spartan Council pool`, async () => {
Expand Down
14 changes: 13 additions & 1 deletion omnibus-base-sepolia-andromeda.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "synthetix-omnibus"
version = "11"
version = "12"
description = "Andromeda dev deployment"
preset = "andromeda"
include = [
Expand Down Expand Up @@ -27,6 +27,18 @@ include = [
"tomls/omnibus-base-sepolia-andromeda/perps/eth-invokes.toml",
"tomls/oracles/pyth-eth.toml",
"tomls/omnibus-base-sepolia-andromeda/perps/eth.toml",
# SNX
"tomls/omnibus-base-sepolia-andromeda/perps/snx-invokes.toml",
"tomls/oracles/pyth-snx.toml",
"tomls/omnibus-base-sepolia-andromeda/perps/snx.toml",
# SOL
"tomls/omnibus-base-sepolia-andromeda/perps/sol-invokes.toml",
"tomls/oracles/pyth-sol.toml",
"tomls/omnibus-base-sepolia-andromeda/perps/sol.toml",
# WIF
"tomls/omnibus-base-sepolia-andromeda/perps/wif-invokes.toml",
"tomls/oracles/pyth-wif.toml",
"tomls/omnibus-base-sepolia-andromeda/perps/wif.toml",
]

[setting.commitmentPriceDelay]
Expand Down
34 changes: 16 additions & 18 deletions tomls/markets/perps/snx.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include = [
"../common/bigcap-settings.toml",
]

[setting.snxPerpsMarketId]
[setting.perpsSnxMarketId]

[setting.perpsSnxSkewScale]

Expand All @@ -27,28 +27,26 @@ include = [

[setting.perpsSnxMaxSecondsInLiquidationWindow]

[setting.perpsSnxMinimumPositionMargin]
[setting.perpsSnxMaxLiquidationPd]

[setting.perpsSnxLockedOiRatio]
[setting.perpsSnxEndorsedLiquidator]

[setting.pythSnxFeedId]
[setting.perpsSnxMinimumPositionMargin]

# strategy type for Perps markets is 0, for spot markets is 1
[setting.strategyType]
defaultValue = "0"
[setting.perpsSnxLockedOiRatio]

[invoke.createSnxPerpsMarket]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "createMarket"
args = ["<%= settings.snxPerpsMarketId %>", "Synthetix Network Token", "SNX"]
args = ["<%= settings.perpsSnxMarketId %>", "Synthetix Network Token", "SNX"]

[invoke.setPerpsPriceSnx]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "updatePriceData"
args = [
"<%= settings.snxPerpsMarketId %>",
"<%= settings.perpsSnxMarketId %>",
"<%= extras.snx_oracle_id %>",
"<%= settings.bigCapStrictStalenessTolerance %>",
]
Expand All @@ -58,17 +56,17 @@ target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setSettlementStrategy"
args = [
"<%= settings.snxPerpsMarketId %>",
"0", # Settlement Strategy ID
{ strategyType = "<%= settings.strategyType %>", settlementDelay = "<%= settings.bigCapSettlementDelay %>", settlementWindowDuration = "<%= settings.bigCapSettlementWindowDuration %>", priceVerificationContract = "<%= imports.pyth_erc7412_wrapper.contracts.PythERC7412Wrapper.address %>", feedId = "<%= settings.pythSnxFeedId %>", settlementReward = "<%= parseEther(settings.settlementReward) %>", disabled = false, commitmentPriceDelay = "<%= settings.commitmentPriceDelay %>" },
"<%= settings.perpsSnxMarketId %>",
"0", # Settlement Strategy ID
{ strategyType = "0", settlementDelay = "<%= settings.bigCapSettlementDelay %>", settlementWindowDuration = "<%= settings.bigCapSettlementWindowDuration %>", priceVerificationContract = "<%= imports.pyth_erc7412_wrapper.contracts.PythERC7412Wrapper.address %>", feedId = "<%= settings.pythSnxFeedId %>", settlementReward = "<%= parseEther(settings.settlementReward) %>", disabled = false, commitmentPriceDelay = "<%= settings.commitmentPriceDelay %>" },
]

[invoke.setPerpsSnxFundingParameters]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setFundingParameters"
args = [
"<%= settings.snxPerpsMarketId %>",
"<%= settings.perpsSnxMarketId %>",
"<%= parseEther(settings.perpsSnxSkewScale) %>",
"<%= parseEther(settings.perpsSnxMaxFundingVelocity) %>",
]
Expand All @@ -78,7 +76,7 @@ target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setOrderFees"
args = [
"<%= settings.snxPerpsMarketId %>",
"<%= settings.perpsSnxMarketId %>",
"<%= parseEther(settings.perpsSnxMakerFeeRatio) %>",
"<%= parseEther(settings.perpsSnxTakerFeeRatio) %>",
]
Expand All @@ -87,14 +85,14 @@ args = [
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setMaxMarketSize"
args = ["<%= settings.snxPerpsMarketId %>", "<%= parseEther(settings.perpsSnxMaxMarketSize) %>"]
args = ["<%= settings.perpsSnxMarketId %>", "<%= parseEther(settings.perpsSnxMaxMarketSize) %>"]

[invoke.setPerpsSnxMaxLiquidationParameters]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setMaxLiquidationParameters"
args = [
"<%= settings.snxPerpsMarketId %>",
"<%= settings.perpsSnxMarketId %>",
"<%= parseEther(settings.perpsSnxMaxLiquidationLimitAccumulationMultiplier) %>",
"<%= settings.perpsSnxMaxSecondsInLiquidationWindow %>",
"<%= parseEther(settings.perpsSnxMaxLiquidationPd) %>",
Expand All @@ -106,7 +104,7 @@ target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setLiquidationParameters"
args = [
"<%= settings.snxPerpsMarketId %>",
"<%= settings.perpsSnxMarketId %>",
"<%= parseEther(settings.perpsSnxInitialMarginRatio) %>",
"<%= parseEther(settings.perpsSnxMinimumInitialMarginRatio) %>",
"<%= parseEther(settings.perpsSnxMaintenanceMarginScalar) %>",
Expand All @@ -118,4 +116,4 @@ args = [
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setLockedOiRatio"
args = ["<%= settings.snxPerpsMarketId %>", "<%= parseEther(settings.perpsSnxLockedOiRatio) %>"]
args = ["<%= settings.perpsSnxMarketId %>", "<%= parseEther(settings.perpsSnxLockedOiRatio) %>"]
119 changes: 119 additions & 0 deletions tomls/markets/perps/sol.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
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/pyth-sol.toml",
"../common/bigcap-settings.toml",
]

[setting.perpsSolMarketId]

[setting.perpsSolSkewScale]

[setting.perpsSolMaxFundingVelocity]

[setting.perpsSolMakerFeeRatio]

[setting.perpsSolTakerFeeRatio]

[setting.perpsSolMaxMarketSize]

[setting.perpsSolInitialMarginRatio]

[setting.perpsSolMaintenanceMarginFraction]

[setting.perpsSolFlagRewardRatioD18]

[setting.perpsSolMaxLiquidationLimitAccumulationMultiplier]

[setting.perpsSolMaxSecondsInLiquidationWindow]

[setting.perpsSolMaxLiquidationPd]

[setting.perpsSolEndorsedLiquidator]

[setting.perpsSolMinimumPositionMargin]

[setting.perpsSolLockedOiRatio]

[invoke.createSolPerpsMarket]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "createMarket"
args = ["<%= settings.perpsSolMarketId %>", "Solana", "SOL"]

[invoke.setPerpsPriceSol]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "updatePriceData"
args = [
"<%= settings.perpsSolMarketId %>",
"<%= extras.sol_oracle_id %>",
"<%= settings.bigCapStrictStalenessTolerance %>",
]

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

[invoke.setPerpsSolFundingParameters]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setFundingParameters"
args = [
"<%= settings.perpsSolMarketId %>",
"<%= parseEther(settings.perpsSolSkewScale) %>",
"<%= parseEther(settings.perpsSolMaxFundingVelocity) %>",
]

[invoke.setPerpsSolOrderFees]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setOrderFees"
args = [
"<%= settings.perpsSolMarketId %>",
"<%= parseEther(settings.perpsSolMakerFeeRatio) %>",
"<%= parseEther(settings.perpsSolTakerFeeRatio) %>",
]

[invoke.setPerpsSolMaxMarketSize]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setMaxMarketSize"
args = ["<%= settings.perpsSolMarketId %>", "<%= parseEther(settings.perpsSolMaxMarketSize) %>"]

[invoke.setPerpsSolMaxLiquidationParameters]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setMaxLiquidationParameters"
args = [
"<%= settings.perpsSolMarketId %>",
"<%= parseEther(settings.perpsSolMaxLiquidationLimitAccumulationMultiplier) %>",
"<%= settings.perpsSolMaxSecondsInLiquidationWindow %>",
"<%= parseEther(settings.perpsSolMaxLiquidationPd) %>",
"<%= settings.perpsSolEndorsedLiquidator %>",
]

[invoke.setPerpsSolLiquidationParameters]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setLiquidationParameters"
args = [
"<%= settings.perpsSolMarketId %>",
"<%= parseEther(settings.perpsSolInitialMarginRatio) %>",
"<%= parseEther(settings.perpsSolMinimumInitialMarginRatio) %>",
"<%= parseEther(settings.perpsSolMaintenanceMarginScalar) %>",
"<%= parseEther(settings.perpsSolFlagRewardRatioD18) %>",
"<%= parseEther(settings.perpsSolMinimumPositionMargin) %>",
]

[invoke.setPerpsSolLockedOiRatio]
target = ["perpsFactory.PerpsMarketProxy"]
fromCall.func = "owner"
func = "setLockedOiRatio"
args = ["<%= settings.perpsSolMarketId %>", "<%= parseEther(settings.perpsSolLockedOiRatio) %>"]
Loading