Skip to content

Commit

Permalink
Merge pull request #46 from pnetwork-association/chore/forwarder-tasks
Browse files Browse the repository at this point in the history
Update forwarder-tasks, addresses, and tests
  • Loading branch information
oliviera9 authored Mar 15, 2024
2 parents a60fea7 + 399dd81 commit 38d70d5
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 131 deletions.
13 changes: 4 additions & 9 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,19 @@ module.exports = {
},
mainnet: {
url: getEnvironmentVariable('MAINNET_NODE'),
accounts,
gasPrice: 20e9
accounts
},
polygon: {
url: getEnvironmentVariable('POLYGON_NODE'),
accounts,
gasPrice: 250e9
accounts
},
gnosis: {
url: getEnvironmentVariable('GNOSIS_NODE'),
accounts,
gasPrice: 15e9,
gas: 5e6
accounts
},
bsc: {
url: getEnvironmentVariable('BSC_NODE'),
accounts,
gasPrice: 5e9
accounts
}
},
etherscan: {
Expand Down
11 changes: 6 additions & 5 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,30 @@ module.exports = {
SAFE: '0xfE8BCE5b156D9bCD28b5373CDC6b4F08B4b9646a',
FINANCE_VAULT: '0x6239968e6231164687CB40f8389d933dD7f7e0A5',
FINANCE: '0x3d749Bc0eb27795Da58d2f67a2D6527A95567aEC',
FORWARDER: '0x99405B4E46256dD28e424A0EDf296A28e2aE32a0',
FORWARDER: '0x2422eb5B6a20C7b8e3567C12Ed6f5ED9d1Cf1f79',
PNT: '0x8805Aa0C1a8e59b03fA95740F691E28942Cf44f6',
DAOPNT: '0xFF8Ce5Aca26251Cc3f31e597291c71794C06092a',
TOKEN_MANAGER: '0xCec0058735D50de98d3715792569921FEb9EfDC1',
PNT_MINTER: '0x53d51f8801f40657ca566a1ae25b27eada97413c'
},
POLYGON: {
PNT: '0xb6bcae6468760bc0cdfb9c8ef4ee75c9dd23e1ed',
FORWARDER: '0xC85cd78555DF9991245F15c7AA6c4eDBb7791c19',
FORWARDER: '0xC4A989fcb73c6563580dfe9d5439088a98D6C1de',
PNT_MINTER: '0x66917DDA63bC429AE6555e6a2ec17f583FeA732a',
SAFE: '0x9203CD49BAb23Ed6e1EE8D6AB376DD5A9CA8486B'
},
BSC: {
PNT: '0xdaacB0Ab6Fb34d24E8a67BfA14BF4D95D4C7aF92',
FORWARDER: '0x23bAa1e6572233f3cf02a002db865FCa495f2926',
FORWARDER: '0x545d1Da3095a74336D121a8e2078104DDC64AfCE',
SAFE: '0x9203CD49BAb23Ed6e1EE8D6AB376DD5A9CA8486B'
},
MAINNET: {
PNT: '0x89Ab32156e46F46D02ade3FEcbe5Fc4243B9AAeD',
ETHPNT: '0xf4ea6b892853413bd9d9f1a5d3a620a0ba39c5b2',
PBTC: '0x62199b909fb8b8cf870f97bef2ce6783493c4908',
FORWARDER: '0x4200Bf8D6eEb6D7EA46b9C99564cCb4246416412',
CROSS_EXECUTOR: '0xE0bFE5Ae5ceBbf666C381f267187379117d0dA73',
FORWARDER_PNT: '0xe2cb2C8fDc086FC576b49aCF2F71D44DDe7e3804',
FORWARDER_ETHPNT: '0xD60792770ca2B54b9231041c8AF641f48818dA8D',
CROSS_EXECUTOR: '0x6a4Bd6DE0de7b80F24A307f31B40856da975b5A7',
ERC20_VAULT: '0xe396757EC7E6aC7C8E5ABE7285dde47b98F22db8',
DANDELION_VOTING: '0x2211bFD97b1c02aE8Ac305d206e9780ba7D8BfF4',
FINANCE_VAULT: '0xdd92eb1478d3189707ab7f4a5ace3a615cdd0476',
Expand Down
3 changes: 1 addition & 2 deletions tasks/decode-forwarder-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ task('utils:decode-forwarder-metadata', 'Decode the pNetwork Forwarder Metadata'
protocolReceipt
} = decodeMetadata(ethers, metadata)

const [callsAndTargets, originAddress, callerAddress] = abiCoder.decode(['bytes', 'address', 'address'], userData)
const [callsAndTargets, callerAddress] = abiCoder.decode(['bytes', 'address'], userData)

console.log({
version,
userData: {
callsAndTargets,
originAddress,
callerAddress
},
sourceNetworkId,
Expand Down
12 changes: 9 additions & 3 deletions tasks/deploy_forwarder_bsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@ const { task } = require('hardhat/config')

const {
ADDRESSES: {
BSC: { PNT }
BSC: { PNT, SAFE, FORWARDER }
}
} = require('../lib/constants')

const deploy = async (_args, _hre) => {
if (_hre.network.name !== 'bsc') {
throw new Error('Invalid network')
}
const Forwarder = await _hre.ethers.getContractFactory('ForwarderHost')
const Forwarder = await _hre.ethers.getContractFactory('Forwarder')
console.log('Deploying forwarder on BSC ...')
const forwarder = await Forwarder.deploy(PNT)
const forwarder = await Forwarder.deploy(PNT, _hre.ethers.ZeroAddress)
console.log('Forwarder deployed at', forwarder.target)
}

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

task('deploy:forwarder-bsc', 'Deploy Forwarder on BSC', deploy)
12 changes: 9 additions & 3 deletions tasks/deploy_forwarder_gnosis.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@ const { task } = require('hardhat/config')

const {
ADDRESSES: {
GNOSIS: { PNT }
GNOSIS: { PNT, FORWARDER, SAFE }
}
} = require('../lib/constants')

const deploy = async (_args, _hre) => {
if (_hre.network.name !== 'gnosis') {
throw new Error('Invalid network')
}
const Forwarder = await _hre.ethers.getContractFactory('ForwarderHost')
const Forwarder = await _hre.ethers.getContractFactory('Forwarder')
console.log('Deploying forwarder on Gnosis ...')
const forwarder = await Forwarder.deploy(PNT)
const forwarder = await Forwarder.deploy(PNT, _hre.ethers.ZeroAddress)
console.log('Forwarder deployed at', forwarder.target)
}

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

task('deploy:forwarder-gnosis', 'Deploy Forwarder on Gnosis', deploy)
31 changes: 27 additions & 4 deletions tasks/deploy_forwarder_mainnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,41 @@ const { task } = require('hardhat/config')

const {
ADDRESSES: {
MAINNET: { PNT, ERC20_VAULT }
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')
}
const Forwarder = await _hre.ethers.getContractFactory('ForwarderNative')
const Forwarder = await _hre.ethers.getContractFactory('Forwarder')
console.log('Deploying forwarder on Ethereum ...')
const forwarder = await Forwarder.deploy(PNT, ERC20_VAULT)
console.log('Forwarder deployed at', forwarder.target)
}

task('deploy:forwarder-mainnet', 'Deploy Forwarder on Mainnet', deploy)
// eslint-disable-next-line no-unused-vars
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', deployForwarderPNT)
12 changes: 9 additions & 3 deletions tasks/deploy_forwarder_polygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@ const { task } = require('hardhat/config')

const {
ADDRESSES: {
POLYGON: { PNT }
POLYGON: { PNT, FORWARDER, SAFE }
}
} = require('../lib/constants')

const deploy = async (_args, _hre) => {
if (_hre.network.name !== 'polygon') {
throw new Error('Invalid network')
}
const Forwarder = await _hre.ethers.getContractFactory('ForwarderHost')
const Forwarder = await _hre.ethers.getContractFactory('Forwarder')
console.log('Deploying forwarder on Polygon ...')
const forwarder = await Forwarder.deploy(PNT)
const forwarder = await Forwarder.deploy(PNT, _hre.ethers.ZeroAddress)
console.log('Forwarder deployed at', forwarder.target)
}

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

task('deploy:forwarder-polygon', 'Deploy Forwarder on Polygon', deploy)
Loading

0 comments on commit 38d70d5

Please sign in to comment.