generated from PaulRBerg/hardhat-template
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: deploy binance and pyth in seperate scripts
- Loading branch information
Showing
8 changed files
with
96 additions
and
65 deletions.
There are no files selected for viewing
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,51 @@ | ||
import hre from "hardhat"; | ||
import { DeployFunction } from "hardhat-deploy/dist/types"; | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
|
||
import { ADDRESSES } from "../helpers/deploymentConfig"; | ||
|
||
const func: DeployFunction = async function ({ getNamedAccounts, deployments, network }: HardhatRuntimeEnvironment) { | ||
const { deploy } = deployments; | ||
const { deployer } = await getNamedAccounts(); | ||
|
||
const accessControlManagerAddress = ADDRESSES[network.name].acm; | ||
const proxyOwnerAddress = ADDRESSES[network.name].timelock; | ||
const timelock = ADDRESSES[network.name].timeloc; | ||
|
||
const { sidRegistryAddress, feedRegistryAddress } = ADDRESSES[network.name]; | ||
|
||
// Skip if no sidRegistryAddress address in config | ||
if (sidRegistryAddress) { | ||
await deploy("BinanceOracle", { | ||
contract: "BinanceOracle", | ||
from: deployer, | ||
log: true, | ||
deterministicDeployment: false, | ||
args: [], | ||
proxy: { | ||
owner: proxyOwnerAddress, | ||
proxyContract: "OptimizedTransparentProxy", | ||
execute: { | ||
methodName: "initialize", | ||
args: [sidRegistryAddress, accessControlManagerAddress], | ||
}, | ||
}, | ||
}); | ||
const binanceOracle = await hre.ethers.getContract("BinanceOracle"); | ||
const binanceOracleOwner = await binanceOracle.owner(); | ||
|
||
if (sidRegistryAddress === "0x0000000000000000000000000000000000000000") { | ||
await binanceOracle.setFeedRegistryAddress(feedRegistryAddress); | ||
} | ||
|
||
if (binanceOracleOwner === deployer) { | ||
await binanceOracle.transferOwnership(timelock); | ||
console.log(`Ownership of BinanceOracle transfered from deployer to Timelock (${timelock})`); | ||
} | ||
} | ||
}; | ||
|
||
func.tags = ["deploy-binance-oracle"]; | ||
func.skip = async env => !env.network.live; | ||
|
||
export default func; |
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,45 @@ | ||
import hre from "hardhat"; | ||
import { DeployFunction } from "hardhat-deploy/dist/types"; | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
|
||
import { ADDRESSES } from "../helpers/deploymentConfig"; | ||
|
||
const func: DeployFunction = async function ({ getNamedAccounts, deployments, network }: HardhatRuntimeEnvironment) { | ||
const { deploy } = deployments; | ||
const { deployer } = await getNamedAccounts(); | ||
|
||
const accessControlManagerAddress = ADDRESSES[network.name].acm; | ||
const proxyOwnerAddress = ADDRESSES[network.name].timelock; | ||
const { timelock, pythOracleAddress } = ADDRESSES[network.name]; | ||
|
||
// Skip if no pythOracle address in config | ||
if (pythOracleAddress) { | ||
await deploy("PythOracle", { | ||
contract: "PythOracle", | ||
from: deployer, | ||
log: true, | ||
deterministicDeployment: false, | ||
args: [], | ||
proxy: { | ||
owner: proxyOwnerAddress, | ||
proxyContract: "OptimizedTransparentProxy", | ||
execute: { | ||
methodName: "initialize", | ||
args: [pythOracleAddress, accessControlManagerAddress], | ||
}, | ||
}, | ||
}); | ||
|
||
const pythOracle = await hre.ethers.getContract("PythOracle"); | ||
const pythOracleOwner = await pythOracle.owner(); | ||
|
||
if (pythOracleOwner === deployer) { | ||
await pythOracle.transferOwnership(timelock); | ||
console.log(`Ownership of PythOracle transfered from deployer to Timelock (${timelock})`); | ||
} | ||
} | ||
}; | ||
func.tags = ["deploy-pyth-oracle"]; | ||
func.skip = async env => !env.network.live; | ||
|
||
export default func; |
File renamed without changes.