-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95b778f
commit 2083ba6
Showing
5 changed files
with
132 additions
and
15 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
deploy/periphery/market-order-router/upgrade/upgrade-market-order-router.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { DeployFunction } from "hardhat-deploy/types"; | ||
import { ethers, upgrades } from "hardhat"; | ||
import { getConfig } from "../../../utils/config"; | ||
import { MaybeMultisigTimelock } from "../../../utils/maybe-multisig"; | ||
import { ProxyAdmin__factory } from "../../../../typechain"; | ||
import { compareAddress } from "../../../utils/address"; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const config = getConfig(); | ||
const networkInfo = await ethers.provider.getNetwork(); | ||
|
||
const TARGET_ADDRESS = config.MarketOrderRouter; | ||
|
||
const EXACT_ETA = 0; | ||
|
||
const deployer = (await ethers.getSigners())[0]; | ||
|
||
const marketOrderRouter = await ethers.getContractFactory( | ||
"MarketOrderRouter", | ||
deployer | ||
); | ||
|
||
console.log(`> Preparing to upgrade MarketOrderRouter`); | ||
const newMarketOrderRouter = await upgrades.prepareUpgrade( | ||
TARGET_ADDRESS, | ||
marketOrderRouter | ||
); | ||
|
||
console.log( | ||
`> New MarketOrderRouter Implementation address: ${newMarketOrderRouter}` | ||
); | ||
const proxyAdmin = ProxyAdmin__factory.connect(config.ProxyAdmin, deployer); | ||
|
||
if (!compareAddress(await proxyAdmin.owner(), config.Timelock)) { | ||
const upgradeTx = await upgrades.upgradeProxy( | ||
TARGET_ADDRESS, | ||
marketOrderRouter | ||
); | ||
console.log(`> ⛓ Tx is submitted: ${upgradeTx.deployTransaction.hash}`); | ||
console.log(`> Waiting for tx to be mined...`); | ||
await upgradeTx.deployTransaction.wait(); | ||
|
||
console.log(`> Tx is mined!`); | ||
} else { | ||
const timelock = new MaybeMultisigTimelock(networkInfo.chainId, deployer); | ||
|
||
console.log(`> Queue tx on Timelock to upgrade the implementation`); | ||
await timelock.queueTransaction( | ||
`Upgrade MarketOrderRouter`, | ||
config.ProxyAdmin, | ||
"0", | ||
"upgrade(address,address)", | ||
["address", "address"], | ||
[TARGET_ADDRESS, newMarketOrderRouter], | ||
EXACT_ETA | ||
); | ||
} | ||
|
||
console.log("> ✅ Done"); | ||
}; | ||
|
||
export default func; | ||
func.tags = ["UpgradeMarketOrderRouter"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
deploy/trade-mining/upgrade/upgrade-trade-mining-manager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { DeployFunction } from "hardhat-deploy/types"; | ||
import { ethers, upgrades, tenderly } from "hardhat"; | ||
import { getConfig } from "../../utils/config"; | ||
import { ProxyAdmin__factory } from "../../../typechain"; | ||
import { compareAddress } from "../../utils/address"; | ||
import { MaybeMultisigTimelock } from "../../utils/maybe-multisig"; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const config = getConfig(); | ||
const networkInfo = await ethers.provider.getNetwork(); | ||
|
||
const TARGET_ADDRESS = config.TradeMining.tradeMiningManager; | ||
|
||
const EXACT_ETA = 0; | ||
|
||
const deployer = (await ethers.getSigners())[0]; | ||
|
||
const tradeMiningManager = await ethers.getContractFactory( | ||
"TradeMiningManager", | ||
deployer | ||
); | ||
|
||
console.log(`> Preparing to upgrade TradeMiningManager`); | ||
const newTradeMiningManager = await upgrades.prepareUpgrade( | ||
TARGET_ADDRESS, | ||
tradeMiningManager | ||
); | ||
|
||
console.log( | ||
`> New TradeMiningManager Implementation address: ${newTradeMiningManager}` | ||
); | ||
const proxyAdmin = ProxyAdmin__factory.connect(config.ProxyAdmin, deployer); | ||
|
||
if (!compareAddress(await proxyAdmin.owner(), config.Timelock)) { | ||
const upgradeTx = await upgrades.upgradeProxy( | ||
TARGET_ADDRESS, | ||
tradeMiningManager | ||
); | ||
console.log(`> ⛓ Tx is submitted: ${upgradeTx.deployTransaction.hash}`); | ||
console.log(`> Waiting for tx to be mined...`); | ||
await upgradeTx.deployTransaction.wait(); | ||
|
||
console.log(`> Tx is mined!`); | ||
} else { | ||
const timelock = new MaybeMultisigTimelock(networkInfo.chainId, deployer); | ||
|
||
console.log(`> Queue tx on Timelock to upgrade the implementation`); | ||
await timelock.queueTransaction( | ||
`Upgrade TrademiningManager`, | ||
config.ProxyAdmin, | ||
"0", | ||
"upgrade(address,address)", | ||
["address", "address"], | ||
[TARGET_ADDRESS, newTradeMiningManager], | ||
EXACT_ETA | ||
); | ||
} | ||
|
||
console.log("> ✅ Done"); | ||
}; | ||
|
||
export default func; | ||
func.tags = ["UpgradeTradeMiningManager"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters