mirror of
https://github.com/tornadocash/nova-upgrade-proposal.git
synced 2024-11-22 01:26:50 +01:00
add test upgrade bsc-xdai
This commit is contained in:
parent
1dc13e68e5
commit
e7b360b7f9
@ -1,6 +0,0 @@
|
||||
{
|
||||
"novaProxy": "0xD692Fd2D0b2Fbd2e52CFa5B5b9424bC981C30696",
|
||||
"newNovaImpl": "TODO",
|
||||
"ethAmbBridge": "0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e",
|
||||
"gasLimit": 200000
|
||||
}
|
23
contracts/helpers/TestExecutor.sol
Normal file
23
contracts/helpers/TestExecutor.sol
Normal file
@ -0,0 +1,23 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.6.12;
|
||||
|
||||
import "@openzeppelin/contracts/utils/Address.sol";
|
||||
|
||||
contract TestExecutor {
|
||||
event ProposalExecuted(address indexed target);
|
||||
|
||||
function execute(address target) public payable virtual {
|
||||
require(Address.isContract(target), "Governance::execute: not a contract");
|
||||
(bool success, bytes memory data) = target.delegatecall(abi.encodeWithSignature("executeProposal()"));
|
||||
if (!success) {
|
||||
if (data.length > 0) {
|
||||
revert(string(data));
|
||||
} else {
|
||||
revert("Proposal execution failed");
|
||||
}
|
||||
}
|
||||
|
||||
emit ProposalExecuted(target);
|
||||
}
|
||||
}
|
@ -66,5 +66,11 @@ module.exports = {
|
||||
: { mnemonic: 'test test test test test junk' },
|
||||
timeout: 2147483647,
|
||||
},
|
||||
bsc: {
|
||||
url: process.env.ETH_RPC || 'https://bsc-dataseed.binance.org/',
|
||||
accounts: process.env.PRIVATE_KEY
|
||||
? [process.env.PRIVATE_KEY]
|
||||
: { mnemonic: 'test test test test test junk' },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -1,7 +1,18 @@
|
||||
const { ethers } = require('hardhat')
|
||||
const config = require('../config')
|
||||
|
||||
async function main() {
|
||||
const gasLimit = 200000
|
||||
|
||||
// BSC TEST VALUES
|
||||
const novaProxy = '0xC953965A9287d298bbECF13fd59aA3F4cE69d322' // test one
|
||||
const newNovaImpl = '0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59' // random contract
|
||||
const ethAmbBridge = '0x05185872898b6f94AA600177EF41B9334B1FA48B' // on bsc
|
||||
|
||||
// MAINNET VALUES
|
||||
// const novaProxy = "0xD692Fd2D0b2Fbd2e52CFa5B5b9424bC981C30696"
|
||||
// const newNovaImpl = "TODO"
|
||||
// const ethAmbBridge = "0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e"
|
||||
|
||||
const [deployer] = await ethers.getSigners()
|
||||
|
||||
console.log('Deploying contracts with the account:', deployer.address)
|
||||
@ -9,12 +20,7 @@ async function main() {
|
||||
console.log('Account balance:', (await deployer.getBalance()).toString())
|
||||
|
||||
const Proposal = await ethers.getContractFactory('NovaUpgradeProposal')
|
||||
const proposal = await Proposal.deploy(
|
||||
config.novaProxy,
|
||||
config.newNovaImpl,
|
||||
config.ethAmbBridge,
|
||||
config.gasLimit,
|
||||
)
|
||||
const proposal = await Proposal.deploy(novaProxy, newNovaImpl, ethAmbBridge, gasLimit)
|
||||
|
||||
console.log('Proposal address:', proposal.address)
|
||||
}
|
||||
|
22
scripts/deployExecutor.js
Normal file
22
scripts/deployExecutor.js
Normal file
@ -0,0 +1,22 @@
|
||||
const { ethers } = require('hardhat')
|
||||
|
||||
async function main() {
|
||||
const [deployer] = await ethers.getSigners()
|
||||
|
||||
console.log('Deploying contracts with the account:', deployer.address)
|
||||
|
||||
console.log('Account balance:', (await deployer.getBalance()).toString())
|
||||
|
||||
const Executor = await ethers.getContractFactory('TestExecutor')
|
||||
const executor = await Executor.deploy()
|
||||
await executor.deployed()
|
||||
|
||||
console.log('Executor address:', executor.address)
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
22
scripts/testUpgrade.js
Normal file
22
scripts/testUpgrade.js
Normal file
@ -0,0 +1,22 @@
|
||||
const { ethers } = require('hardhat')
|
||||
|
||||
async function main() {
|
||||
const [sender] = await ethers.getSigners()
|
||||
|
||||
console.log('Calling contracts with the account:', sender.address)
|
||||
console.log('Account balance:', (await sender.getBalance()).toString())
|
||||
|
||||
const executor = await ethers.getContractAt('TestExecutor', '0xC953965A9287d298bbECF13fd59aA3F4cE69d322')
|
||||
console.log('Executor address:', executor.address)
|
||||
|
||||
const tx = await executor.connect(sender).execute('0x189A86fB2c334095efd04B1F00d0ee27A54c74f5')
|
||||
let receipt = await tx.wait()
|
||||
console.log('Upgrade receipt:', receipt)
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
Loading…
Reference in New Issue
Block a user