Skip to content

Commit

Permalink
expose initialization data for verification
Browse files Browse the repository at this point in the history
  • Loading branch information
doerfli committed Sep 2, 2024
1 parent 9c4663e commit 1f14a3b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
8 changes: 7 additions & 1 deletion contracts/upgradeability/UpgradableProxyWithAdmin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transpa

contract UpgradableProxyWithAdmin is TransparentUpgradeableProxy {

bytes internal _initializationData;

constructor(address implementation, address initialProxyAdminOwner, bytes memory data)
TransparentUpgradeableProxy(implementation, initialProxyAdminOwner, data)
{}
{
_initializationData = data;
}

function getProxyAdmin() external returns (ProxyAdmin) { return ProxyAdmin(_proxyAdmin()); }

function getInitializationData() external view returns (bytes memory) { return _initializationData; }
}
19 changes: 17 additions & 2 deletions scripts/libs/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {
StakingReader,
StakingStore,
Staking__factory,
TokenRegistry
TokenRegistry,
UpgradableProxyWithAdmin__factory
} from "../../typechain-types";
import { logger } from "../logger";
import { deployContract } from "./deployment";
Expand Down Expand Up @@ -282,11 +283,25 @@ export async function deployAndInitializeRegistry(owner: Signer, libraries: Libr
await resolveAddress(owner));

// verify staking implementation
const stakingImplenentationAddress = await getImplementationAddress(hhEthers.provider, await stakingManager.getProxy());
await prepareVerificationData(
"Staking",
await getImplementationAddress(hhEthers.provider, await stakingManager.getProxy()),
stakingImplenentationAddress,
[],
undefined);

// verify staking proxy
const stakingProxyAddress = await stakingManager.getProxy();
const proxy = UpgradableProxyWithAdmin__factory.connect(stakingProxyAddress, owner);
await prepareVerificationData(
"UpgradableProxyWithAdmin",
stakingProxyAddress,
[
stakingImplenentationAddress,
stakingManagerAddress,
await proxy.getInitializationData(),
],
undefined);

await prepareVerificationData(
"TokenHandler",
Expand Down

0 comments on commit 1f14a3b

Please sign in to comment.