11import { HardhatRuntimeEnvironment } from "hardhat/types"
22import { DeployFunction } from "hardhat-deploy/types"
3+ import * as fs from "fs"
34
45import { ethers , upgrades } from "hardhat"
56
@@ -29,7 +30,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2930 proxyAddress = existing . address
3031 } else {
3132 // 07_deploy_token_staking saves to TokenStaking.json in deployments dir
32- const fs = require ( "fs" )
3333 const deploymentPath = `deployments/${ hre . network . name } /TokenStaking.json`
3434 if ( ! fs . existsSync ( deploymentPath ) ) {
3535 log ( "TokenStaking not deployed, skipping upgrade" )
@@ -47,12 +47,16 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
4747 "ExtendedTokenStaking"
4848 )
4949
50+ // 07_deploy_token_staking uses deployProxy without specifying kind;
51+ // the OZ plugin defaults to transparent for contracts that lack upgradeTo().
52+ // Verify on-chain with:
53+ // cast storage <PROXY_ADDR> 0xb53127684a568b3173ae13b9f8a6016e243e63b4 --rpc-url $RPC
54+ // Non-zero = transparent proxy (ProxyAdmin slot); zero = UUPS.
5055 const upgraded = await upgrades . upgradeProxy (
5156 proxyAddress ,
5257 ExtendedTokenStaking ,
5358 {
5459 constructorArgs : [ T . address ] ,
55- kind : "transparent" ,
5660 }
5761 )
5862 await upgraded . deployed ( )
@@ -66,7 +70,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
6670 address : upgraded . address ,
6771 abi : JSON . parse ( jsonAbi as string ) ,
6872 }
69- const fs = require ( "fs" )
7073 const deploymentsDir = `deployments/${ hre . network . name } `
7174 fs . writeFileSync (
7275 `${ deploymentsDir } /TokenStaking.json` ,
0 commit comments