Skip to content

Commit

Permalink
Merge branch 'master' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
leomassazza committed Aug 9, 2023
2 parents b073201 + 1030a0b commit 70906a3
Show file tree
Hide file tree
Showing 7 changed files with 311 additions and 6 deletions.
137 changes: 137 additions & 0 deletions contracts/migrations/Migration_ScheatOptimismStep1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
pragma solidity ^0.5.16;

import "../BaseMigration.sol";
import "../PerpsV2MarketState.sol";
import "../PerpsV2ExchangeRate.sol";
import "../FuturesMarketManager.sol";
import "../PerpsV2MarketSettings.sol";
import "../SystemStatus.sol";
import "../ExchangeRates.sol";

interface ISynthetixNamedContract {
// solhint-disable func-name-mixedcase
function CONTRACT_NAME() external view returns (bytes32);
}

// solhint-disable contract-name-camelcase
contract Migration_ScheatOptimismStep1 is BaseMigration {
// https://explorer.optimism.io/address/0x6d4a64C57612841c2C6745dB2a4E4db34F002D20;
address public constant OWNER = 0x6d4a64C57612841c2C6745dB2a4E4db34F002D20;

// ----------------------------
// EXISTING SYNTHETIX CONTRACTS
// ----------------------------

// https://explorer.optimism.io/address/0xC2231D2cAdDBee015AeDddd3F0EE3874E3bd1d59
PerpsV2MarketState public constant perpsv2marketstateusdtperp_i =
PerpsV2MarketState(0xC2231D2cAdDBee015AeDddd3F0EE3874E3bd1d59);
// https://explorer.optimism.io/address/0x2C15259D4886e2C0946f9aB7a5E389c86b3c3b04
PerpsV2ExchangeRate public constant perpsv2exchangerate_i =
PerpsV2ExchangeRate(0x2C15259D4886e2C0946f9aB7a5E389c86b3c3b04);
// https://explorer.optimism.io/address/0xd30bdFd7e7a65fE109D5dE1D4e95F3B800FB7463
FuturesMarketManager public constant futuresmarketmanager_i =
FuturesMarketManager(0xd30bdFd7e7a65fE109D5dE1D4e95F3B800FB7463);
// https://explorer.optimism.io/address/0x649F44CAC3276557D03223Dbf6395Af65b11c11c
PerpsV2MarketSettings public constant perpsv2marketsettings_i =
PerpsV2MarketSettings(0x649F44CAC3276557D03223Dbf6395Af65b11c11c);
// https://explorer.optimism.io/address/0xE8c41bE1A167314ABAF2423b72Bf8da826943FFD
SystemStatus public constant systemstatus_i = SystemStatus(0xE8c41bE1A167314ABAF2423b72Bf8da826943FFD);
// https://explorer.optimism.io/address/0x913bd76F7E1572CC8278CeF2D6b06e2140ca9Ce2
ExchangeRates public constant exchangerates_i = ExchangeRates(0x913bd76F7E1572CC8278CeF2D6b06e2140ca9Ce2);

// ----------------------------------
// NEW CONTRACTS DEPLOYED TO BE ADDED
// ----------------------------------

constructor() public BaseMigration(OWNER) {}

function contractsRequiringOwnership() public pure returns (address[] memory contracts) {
contracts = new address[](6);
contracts[0] = address(perpsv2marketstateusdtperp_i);
contracts[1] = address(perpsv2exchangerate_i);
contracts[2] = address(futuresmarketmanager_i);
contracts[3] = address(perpsv2marketsettings_i);
contracts[4] = address(systemstatus_i);
contracts[5] = address(exchangerates_i);
}

function migrate() external onlyOwner {
// ACCEPT OWNERSHIP for all contracts that require ownership to make changes
acceptAll();

// MIGRATION
// Add migration contract permission to pause
systemstatus_i.updateAccessControl("Futures", address(this), true, false);
perpsv2marketstateusdtperp_i.linkOrInitializeState();
perpsv2exchangerate_addAssociatedContracts_1();
futuresmarketmanager_addProxiedMarkets_2();
perpsv2marketsettings_i.setTakerFee("sUSDTPERP", 300000000000000000);
perpsv2marketsettings_i.setMakerFee("sUSDTPERP", 300000000000000000);
perpsv2marketsettings_i.setTakerFeeDelayedOrder("sUSDTPERP", 300000000000000000);
perpsv2marketsettings_i.setMakerFeeDelayedOrder("sUSDTPERP", 300000000000000000);
perpsv2marketsettings_i.setTakerFeeOffchainDelayedOrder("sUSDTPERP", 150000000000000);
perpsv2marketsettings_i.setNextPriceConfirmWindow("sUSDTPERP", 2);
perpsv2marketsettings_i.setDelayedOrderConfirmWindow("sUSDTPERP", 120);
perpsv2marketsettings_i.setMinDelayTimeDelta("sUSDTPERP", 60);
perpsv2marketsettings_i.setMaxDelayTimeDelta("sUSDTPERP", 6000);
perpsv2marketsettings_i.setOffchainDelayedOrderMinAge("sUSDTPERP", 2);
perpsv2marketsettings_i.setOffchainDelayedOrderMaxAge("sUSDTPERP", 60);
perpsv2marketsettings_i.setMaxLeverage("sUSDTPERP", 55000000000000000000);
perpsv2marketsettings_i.setMaxMarketValue("sUSDTPERP", 5000000000000000000000000);
perpsv2marketsettings_i.setMaxFundingVelocity("sUSDTPERP", 3000000000000000000);
perpsv2marketsettings_i.setSkewScale("sUSDTPERP", 10000000000000000000000000000);
perpsv2marketsettings_i.setOffchainMarketKey("sUSDTPERP", "ocUSDTPERP");
perpsv2marketsettings_i.setOffchainPriceDivergence("sUSDTPERP", 25000000000000000);
perpsv2marketsettings_i.setLiquidationPremiumMultiplier("sUSDTPERP", 1000000000000000000);
perpsv2marketsettings_i.setMaxLiquidationDelta("sUSDTPERP", 300000000000000);
perpsv2marketsettings_i.setLiquidationBufferRatio("sUSDTPERP", 7500000000000000);
perpsv2marketsettings_i.setMaxPD("sUSDTPERP", 150000000000000);
// Ensure perpsV2 market is paused according to config;
systemstatus_i.suspendFuturesMarket("sUSDTPERP", 80);
// Ensure perpsV2 market is paused according to config;
systemstatus_i.suspendFuturesMarket("ocUSDTPERP", 80);
// Remove permission to migration contract
systemstatus_i.updateAccessControl("Futures", address(this), false, false);
// Ensure the ExchangeRates contract has the standalone feed for USDT;
exchangerates_i.addAggregator("USDT", 0xECef79E109e997bCA29c1c0897ec9d7b03647F5E);
// Ensure the PerpsV2ExchangeRate contract has the off-chain feed Id for USDT;
perpsv2exchangerate_i.setOffchainPriceFeedId(
"USDT",
0x2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b
);

// NOMINATE OWNERSHIP back to owner for aforementioned contracts
nominateAll();
}

function acceptAll() internal {
address[] memory contracts = contractsRequiringOwnership();
for (uint i = 0; i < contracts.length; i++) {
Owned(contracts[i]).acceptOwnership();
}
}

function nominateAll() internal {
address[] memory contracts = contractsRequiringOwnership();
for (uint i = 0; i < contracts.length; i++) {
returnOwnership(contracts[i]);
}
}

function perpsv2exchangerate_addAssociatedContracts_1() internal {
address[] memory perpsv2exchangerate_addAssociatedContracts_associatedContracts_1_0 = new address[](2);
perpsv2exchangerate_addAssociatedContracts_associatedContracts_1_0[0] = address(
0xD53C50B644aa4E29fe2B633E97187e2Aa3cBd6fc
);
perpsv2exchangerate_addAssociatedContracts_associatedContracts_1_0[1] = address(
0x244c689BFa19F046124e75339887f9918317b919
);
perpsv2exchangerate_i.addAssociatedContracts(perpsv2exchangerate_addAssociatedContracts_associatedContracts_1_0);
}

function futuresmarketmanager_addProxiedMarkets_2() internal {
address[] memory futuresmarketmanager_addProxiedMarkets_marketsToAdd_2_0 = new address[](1);
futuresmarketmanager_addProxiedMarkets_marketsToAdd_2_0[0] = address(0x1681212A0Edaf314496B489AB57cB3a5aD7a833f);
futuresmarketmanager_i.addProxiedMarkets(futuresmarketmanager_addProxiedMarkets_marketsToAdd_2_0);
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "synthetix",
"version": "2.93.0-alpha",
"version": "2.93.1",
"license": "MIT",
"author": "Synthetix",
"description": "The smart contracts which make up the Synthetix system. (synthetix.io)",
Expand Down
21 changes: 21 additions & 0 deletions publish/deployed/mainnet-ovm/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1348,5 +1348,26 @@
},
"PerpsV2MarketViewsWLDPERP": {
"deploy": false
},
"PerpsV2ProxyUSDTPERP": {
"deploy": false
},
"PerpsV2MarketStateUSDTPERP": {
"deploy": false
},
"PerpsV2MarketUSDTPERP": {
"deploy": false
},
"PerpsV2MarketLiquidateUSDTPERP": {
"deploy": false
},
"PerpsV2DelayedIntentUSDTPERP": {
"deploy": false
},
"PerpsV2DelayedExecutionUSDTPERP": {
"deploy": false
},
"PerpsV2MarketViewsUSDTPERP": {
"deploy": false
}
}
102 changes: 101 additions & 1 deletion publish/deployed/mainnet-ovm/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
"0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4",
"0xB9c6CA25452E7f6D0D3340CE1e9B573421afc2eE",
"0x6d4a64C57612841c2C6745dB2a4E4db34F002D20",
"104340246073023887803116546",
"104665146496802550602329734",
"0x1Cb059b7e74fD21665968C908806143E744D5F30"
]
},
Expand Down Expand Up @@ -6580,6 +6580,106 @@
"0x6d4a64C57612841c2C6745dB2a4E4db34F002D20",
"0x1Cb059b7e74fD21665968C908806143E744D5F30"
]
},
"PerpsV2ProxyUSDTPERP": {
"name": "PerpsV2ProxyUSDTPERP",
"address": "0x1681212A0Edaf314496B489AB57cB3a5aD7a833f",
"source": "ProxyPerpsV2",
"link": "https://explorer.optimism.io/address/0x1681212A0Edaf314496B489AB57cB3a5aD7a833f",
"timestamp": "2023-08-09T17:25:56.540Z",
"txn": "",
"network": "mainnet",
"constructorArgs": ["0x6d4a64C57612841c2C6745dB2a4E4db34F002D20"]
},
"PerpsV2MarketStateUSDTPERP": {
"name": "PerpsV2MarketStateUSDTPERP",
"address": "0xC2231D2cAdDBee015AeDddd3F0EE3874E3bd1d59",
"source": "PerpsV2MarketState",
"link": "https://explorer.optimism.io/address/0xC2231D2cAdDBee015AeDddd3F0EE3874E3bd1d59",
"timestamp": "2023-08-09T17:26:05.486Z",
"txn": "",
"network": "mainnet",
"constructorArgs": [
"0x6d4a64C57612841c2C6745dB2a4E4db34F002D20",
["0x6d4a64C57612841c2C6745dB2a4E4db34F002D20"],
"0x5553445400000000000000000000000000000000000000000000000000000000",
"0x7355534454504552500000000000000000000000000000000000000000000000",
"0xC2231D2cAdDBee015AeDddd3F0EE3874E3bd1d59"
]
},
"PerpsV2MarketUSDTPERP": {
"name": "PerpsV2MarketUSDTPERP",
"address": "0xB7d7605f814Da681cC299A9Ac9ABBfc1ea65E40A",
"source": "PerpsV2Market",
"link": "https://explorer.optimism.io/address/0xB7d7605f814Da681cC299A9Ac9ABBfc1ea65E40A",
"timestamp": "2023-08-09T17:26:15.001Z",
"txn": "",
"network": "mainnet",
"constructorArgs": [
"0x1681212A0Edaf314496B489AB57cB3a5aD7a833f",
"0xC2231D2cAdDBee015AeDddd3F0EE3874E3bd1d59",
"0x6d4a64C57612841c2C6745dB2a4E4db34F002D20",
"0x1Cb059b7e74fD21665968C908806143E744D5F30"
]
},
"PerpsV2MarketLiquidateUSDTPERP": {
"name": "PerpsV2MarketLiquidateUSDTPERP",
"address": "0xA552049A9f320B6a8622A003FE1108595061e223",
"source": "PerpsV2MarketLiquidate",
"link": "https://explorer.optimism.io/address/0xA552049A9f320B6a8622A003FE1108595061e223",
"timestamp": "2023-08-09T17:26:25.124Z",
"txn": "",
"network": "mainnet",
"constructorArgs": [
"0x1681212A0Edaf314496B489AB57cB3a5aD7a833f",
"0xC2231D2cAdDBee015AeDddd3F0EE3874E3bd1d59",
"0x6d4a64C57612841c2C6745dB2a4E4db34F002D20",
"0x1Cb059b7e74fD21665968C908806143E744D5F30"
]
},
"PerpsV2DelayedIntentUSDTPERP": {
"name": "PerpsV2DelayedIntentUSDTPERP",
"address": "0xD53C50B644aa4E29fe2B633E97187e2Aa3cBd6fc",
"source": "PerpsV2MarketDelayedIntent",
"link": "https://explorer.optimism.io/address/0xD53C50B644aa4E29fe2B633E97187e2Aa3cBd6fc",
"timestamp": "2023-08-09T17:26:35.824Z",
"txn": "",
"network": "mainnet",
"constructorArgs": [
"0x1681212A0Edaf314496B489AB57cB3a5aD7a833f",
"0xC2231D2cAdDBee015AeDddd3F0EE3874E3bd1d59",
"0x6d4a64C57612841c2C6745dB2a4E4db34F002D20",
"0x1Cb059b7e74fD21665968C908806143E744D5F30"
]
},
"PerpsV2DelayedExecutionUSDTPERP": {
"name": "PerpsV2DelayedExecutionUSDTPERP",
"address": "0x244c689BFa19F046124e75339887f9918317b919",
"source": "PerpsV2MarketDelayedExecution",
"link": "https://explorer.optimism.io/address/0x244c689BFa19F046124e75339887f9918317b919",
"timestamp": "2023-08-09T17:26:44.963Z",
"txn": "",
"network": "mainnet",
"constructorArgs": [
"0x1681212A0Edaf314496B489AB57cB3a5aD7a833f",
"0xC2231D2cAdDBee015AeDddd3F0EE3874E3bd1d59",
"0x6d4a64C57612841c2C6745dB2a4E4db34F002D20",
"0x1Cb059b7e74fD21665968C908806143E744D5F30"
]
},
"PerpsV2MarketViewsUSDTPERP": {
"name": "PerpsV2MarketViewsUSDTPERP",
"address": "0xCee08cC3BB744dEC69f6eECf5B7B62CCD9143E99",
"source": "PerpsV2MarketViews",
"link": "https://explorer.optimism.io/address/0xCee08cC3BB744dEC69f6eECf5B7B62CCD9143E99",
"timestamp": "2023-08-09T17:26:55.178Z",
"txn": "",
"network": "mainnet",
"constructorArgs": [
"0xC2231D2cAdDBee015AeDddd3F0EE3874E3bd1d59",
"0x6d4a64C57612841c2C6745dB2a4E4db34F002D20",
"0x1Cb059b7e74fD21665968C908806143E744D5F30"
]
}
},
"sources": {
Expand Down
45 changes: 45 additions & 0 deletions publish/deployed/mainnet-ovm/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4521,5 +4521,50 @@
"keccak256": "0xf5ac63ad2b3ca0cda1f69256b9a2c31b527742934bc43491c2b22c6429823ddb"
}
}
},
"v2.93.1": {
"tag": "v2.93.1",
"fulltag": "v2.93.1",
"release": "Scheat",
"network": "mainnet",
"date": "2023-08-10T00:36:54+01:00",
"commit": "56019d700d7fd12b59024447961d3204157fcec5",
"contracts": {
"PerpsV2ProxyUSDTPERP": {
"address": "0x1681212A0Edaf314496B489AB57cB3a5aD7a833f",
"status": "current",
"keccak256": "0xf2b764f8f435fc338d04c110dd021bb0bd438d20c3c5c2ab6671727de614fe1b"
},
"PerpsV2MarketStateUSDTPERP": {
"address": "0xC2231D2cAdDBee015AeDddd3F0EE3874E3bd1d59",
"status": "current",
"keccak256": "0xc98cdb2faf2a5a405aa1b8af9a56218fdfd234bdde37772375c6e23f65bd58cf"
},
"PerpsV2MarketUSDTPERP": {
"address": "0xB7d7605f814Da681cC299A9Ac9ABBfc1ea65E40A",
"status": "current",
"keccak256": "0xc42eea66d1f1bf2db628906a3bb66cce4cdb8fc86d23e7ef51b37158e4a7a212"
},
"PerpsV2MarketLiquidateUSDTPERP": {
"address": "0xA552049A9f320B6a8622A003FE1108595061e223",
"status": "current",
"keccak256": "0x05843128c0faaf6d66a51deba285a340767f40bb9561e0d5396d71260acaaca6"
},
"PerpsV2DelayedIntentUSDTPERP": {
"address": "0xD53C50B644aa4E29fe2B633E97187e2Aa3cBd6fc",
"status": "current",
"keccak256": "0xc30e0d0475536d8f41b69adf66f26ef168785950166436fd629ff4a4b2d1b287"
},
"PerpsV2DelayedExecutionUSDTPERP": {
"address": "0x244c689BFa19F046124e75339887f9918317b919",
"status": "current",
"keccak256": "0x63d10a8673881405a22f477b1fd5f092116c8b1156bff2bf3af6dcfb0a2048c8"
},
"PerpsV2MarketViewsUSDTPERP": {
"address": "0xCee08cC3BB744dEC69f6eECf5B7B62CCD9143E99",
"status": "current",
"keccak256": "0xf5ac63ad2b3ca0cda1f69256b9a2c31b527742934bc43491c2b22c6429823ddb"
}
}
}
}
6 changes: 4 additions & 2 deletions publish/releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,8 @@
{
"sip": 2030,
"layer": "ovm",
"sources": []
"sources": [],
"released": "ovm"
}
],
"releases": [
Expand Down Expand Up @@ -1824,7 +1825,8 @@
"major": 2,
"minor": 93
},
"sips": [2030]
"sips": [2030],
"released": true
}
]
}

0 comments on commit 70906a3

Please sign in to comment.