The home for Hyperlane core contracts, sdk packages, and other infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
hyperlane-monorepo/solidity/abacus-core/test/upgrade.test.ts

44 lines
1.3 KiB

import { ethers } from 'hardhat';
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { UpgradeTestHelpers, MysteryMathUpgrade } from './lib/upgrade';
import {
UpgradeBeaconController__factory,
UpgradeBeaconController,
MysteryMathV2__factory,
} from '../typechain';
describe('Upgrade', async () => {
const utils = new UpgradeTestHelpers();
let signer: SignerWithAddress,
mysteryMath: MysteryMathUpgrade,
ubc: UpgradeBeaconController;
before(async () => {
// set signer
[signer] = await ethers.getSigners();
const ubcFactory = new UpgradeBeaconController__factory(signer);
ubc = await ubcFactory.deploy();
// deploy upgrade setup for mysteryMath contract
mysteryMath = await utils.deployMysteryMathUpgradeSetup(signer, ubc);
});
it('Pre-Upgrade returns values from MysteryMathV1', async () => {
await utils.expectMysteryMathV1(mysteryMath.proxy);
});
it('Upgrades without problem', async () => {
// Deploy Implementation 2
const factory = new MysteryMathV2__factory(signer);
const implementation = await factory.deploy();
// Upgrade to implementation 2
await ubc.upgrade(mysteryMath.beacon.address, implementation.address);
});
it('Post-Upgrade returns values from MysteryMathV2', async () => {
await utils.expectMysteryMathV2(mysteryMath.proxy);
});
});