From f41d3d15044ed71ebe7c0233d110b78b9c230d27 Mon Sep 17 00:00:00 2001 From: leovct Date: Tue, 5 Dec 2023 12:37:04 +0100 Subject: [PATCH] more test --- migrations/7_pol_migration.js | 15 +++++++-------- migrations/utils.js | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/migrations/7_pol_migration.js b/migrations/7_pol_migration.js index 25e092c0..51307e8b 100644 --- a/migrations/7_pol_migration.js +++ b/migrations/7_pol_migration.js @@ -22,7 +22,6 @@ async function deployPOLToken(governance, mintAmount) { console.log('New PolygonMigration deployed at', polygonMigrationTest.address) // Map contracts in governance. - // Note: also add an entry for 'matic'. let result = await utils.updateContractMap(governance, registry, 'pol', polToken.address) console.log('POLToken mapped in Governance:', result.tx) @@ -58,20 +57,20 @@ async function deployNewDepositManager(depositManagerProxy) { return newDepositManager } -async function migrateMatic(governance, depositManager, mintAmount) { +async function migrateMatic(governance, depositManagerProxy, mintAmount) { // Mint MATIC to DepositManager. const maticToken = await TestToken.at(contractAddresses.root.tokens.MaticToken) - let result = await maticToken.mint(depositManager.address, mintAmount) + let result = await maticToken.mint(depositManagerProxy.address, mintAmount) console.log('MaticToken minted to DepositManager:', result.tx) // Migrate MATIC. result = await governance.update( - depositManager.address, - depositManager.migrateMatic(mintAmount).encodeABI() + depositManagerProxy.address, + depositManagerProxy.contract.methods.migrateMatic(mintAmount).encodeABI() ) } -module.exports = async function(deployer, network, accounts) { +module.exports = async function(deployer, _, _) { deployer.then(async() => { const governance = await Governance.at(contractAddresses.root.GovernanceProxy) const depositManagerProxy = await DepositManagerProxy.at(contractAddresses.root.DepositManagerProxy) @@ -86,13 +85,13 @@ module.exports = async function(deployer, network, accounts) { // Migrate MATIC. console.log('\n> Migrating MATIC to POL...') - await migrateMatic(governance, newDepositManager, mintAmount) + await migrateMatic(governance, depositManagerProxy, mintAmount) const newDepositManagerPOLBalance = await polToken.balanceOf(newDepositManager.address).call() utils.assertBigNumberEquality(newDepositManagerPOLBalance, mintAmount) // Update contract addresses. - contractAddresses.root.DepositManager = newDepositManager.address + contractAddresses.root.NewDepositManager = newDepositManager.address contractAddresses.root.PolToken = polToken.address contractAddresses.root.PolygonMigration = polygonMigration.address utils.writeContractAddresses(contractAddresses) diff --git a/migrations/utils.js b/migrations/utils.js index 53cc75e7..f369a836 100644 --- a/migrations/utils.js +++ b/migrations/utils.js @@ -15,6 +15,6 @@ export function writeContractAddresses(contractAddresses) { export async function updateContractMap(governance, registry, name, value) { return governance.update( registry.address, - registry.updateContractMap(ethUtils.keccak256(name), value).encodeABI() + registry.contract.methods.updateContractMap(ethUtils.keccak256(name), value).encodeABI() ) }