Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
more test
Browse files Browse the repository at this point in the history
  • Loading branch information
leovct committed Dec 5, 2023
1 parent a4d5d0e commit f41d3d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions migrations/7_pol_migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion migrations/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
}

0 comments on commit f41d3d1

Please sign in to comment.