Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
51 changes: 51 additions & 0 deletions deploy/25-deploy-usdt-chainlink-oracle.ts
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, SEQUENCER } from "../helpers/deploymentConfig";

const func: DeployFunction = async function ({ getNamedAccounts, deployments, network }: HardhatRuntimeEnvironment) {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const proxyOwnerAddress = network.live ? ADDRESSES[network.name].timelock : deployer;
const defaultProxyAdmin = await hre.artifacts.readArtifact(
"hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol:ProxyAdmin",
);

const sequencer = SEQUENCER[network.name];
let contractName = "ChainlinkOracle";
if (sequencer !== undefined) contractName = "SequencerChainlinkOracle";

await deploy("USDTChainlinkOracle", {
contract: network.live ? contractName : "MockChainlinkOracle",
from: deployer,
log: true,
deterministicDeployment: false,
skipIfAlreadyDeployed: true,
args: sequencer ? [sequencer] : [],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentUpgradeableProxy",
execute: {
methodName: "initialize",
args: network.live ? [ADDRESSES[network.name].acm] : [],
},
viaAdminContract: {
name: "DefaultProxyAdmin",
artifact: defaultProxyAdmin,
},
},
});

const usdtChainlinkOracle = await hre.ethers.getContract("USDTChainlinkOracle");
const usdtChainlinkOracleOwner = await usdtChainlinkOracle.owner();

if (usdtChainlinkOracleOwner === deployer && network.live) {
await usdtChainlinkOracle.transferOwnership(proxyOwnerAddress);
console.log(`Ownership of ChainlinkOracle transfered from deployer to Timelock (${proxyOwnerAddress})`);
}
};

func.tags = ["deploy-usdt-chainlink-oracle"];
func.skip = async env => !env.network.live;
export default func;
Loading
Loading