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

Commit

Permalink
test again
Browse files Browse the repository at this point in the history
  • Loading branch information
leovct committed Dec 5, 2023
1 parent f41d3d1 commit 9a32b67
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions migrations/7_pol_migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,34 @@ async function deployNewDepositManager(depositManagerProxy) {
return newDepositManager
}

async function migrateMatic(governance, depositManagerProxy, mintAmount) {
async function migrateMatic(governance, depositManager, mintAmount) {
// Mint MATIC to DepositManager.
const maticToken = await TestToken.at(contractAddresses.root.tokens.MaticToken)
let result = await maticToken.mint(depositManagerProxy.address, mintAmount)
let result = await maticToken.mint(depositManager.address, mintAmount)
console.log('MaticToken minted to DepositManager:', result.tx)

// Migrate MATIC.
result = await governance.update(
depositManagerProxy.address,
depositManagerProxy.contract.methods.migrateMatic(mintAmount).encodeABI()
depositManager.address,
depositManager.contract.methods.migrateMatic(mintAmount).encodeABI()
)
}

module.exports = async function(deployer, _, _) {
deployer.then(async() => {
const governance = await Governance.at(contractAddresses.root.GovernanceProxy)
const depositManagerProxy = await DepositManagerProxy.at(contractAddresses.root.DepositManagerProxy)

// Deploy contracts.
console.log('> Deploying POL token contracts...')
const mintAmount = web3.utils.toBN('10').pow(web3.utils.toBN('18')).toString()

console.log('\n> Updating DepositManager...')
const governance = await Governance.at(contractAddresses.root.GovernanceProxy)
const { polToken, polygonMigration } = await deployPOLToken(governance, mintAmount)
const depositManagerProxy = await DepositManagerProxy.at(contractAddresses.root.DepositManagerProxy)
const newDepositManager = await deployNewDepositManager(depositManagerProxy)

// Migrate MATIC.
console.log('\n> Migrating MATIC to POL...')
await migrateMatic(governance, depositManagerProxy, mintAmount)
await migrateMatic(governance, newDepositManager, mintAmount)

const newDepositManagerPOLBalance = await polToken.balanceOf(newDepositManager.address).call()
utils.assertBigNumberEquality(newDepositManagerPOLBalance, mintAmount)
Expand Down

0 comments on commit 9a32b67

Please sign in to comment.