Skip to content

Commit

Permalink
refactor(tasks): revise task for deploying forwarder on mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviera9 committed Mar 14, 2024
1 parent ad7f33c commit 2525751
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions tasks/deploy_forwarder_mainnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ const { task } = require('hardhat/config')

const {
ADDRESSES: {
MAINNET: { PNT, ERC20_VAULT, FORWARDER, SAFE }
MAINNET: { PNT, ETHPNT, ERC20_VAULT, FORWARDER_PNT, FORWARDER_ETHPNT, SAFE }
}
} = require('../lib/constants')

const deploy = async (_args, _hre) => {
const deployForwarderPNT = async (_args, _hre) => {
if (_hre.network.name !== 'mainnet') {
throw new Error('Invalid network')
}
Expand All @@ -17,9 +17,26 @@ const deploy = async (_args, _hre) => {
}

// eslint-disable-next-line no-unused-vars
const transferOwnership = async (_args, _hre) => {
const c = await _hre.ethers.getContractAt('Forwarder', FORWARDER)
const deployForwarderEthPNT = async (_args, _hre) => {
if (_hre.network.name !== 'mainnet') {
throw new Error('Invalid network')
}
const Forwarder = await _hre.ethers.getContractFactory('Forwarder')
console.log('Deploying forwarder on Ethereum ...')
const forwarder = await Forwarder.deploy(ETHPNT, ERC20_VAULT)
console.log('Forwarder deployed at', forwarder.target)
}

// eslint-disable-next-line no-unused-vars
const transferOwnershipForwarderPNT = async (_args, _hre) => {
const c = await _hre.ethers.getContractAt('Forwarder', FORWARDER_PNT)
await c.transferOwnership(SAFE)
}

// eslint-disable-next-line no-unused-vars
const transferOwnershipForwarderEthPNT = async (_args, _hre) => {
const c = await _hre.ethers.getContractAt('Forwarder', FORWARDER_ETHPNT)
await c.transferOwnership(SAFE)
}

task('deploy:forwarder-mainnet', 'Deploy Forwarder on Mainnet', deploy)
task('deploy:forwarder-mainnet', 'Deploy Forwarder on Mainnet', deployForwarderPNT)

0 comments on commit 2525751

Please sign in to comment.