Skip to content

Commit

Permalink
Add ownership transfer scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-turek committed Dec 8, 2023
1 parent 47abb75 commit 302526c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
18 changes: 14 additions & 4 deletions packages/deploy/deploy/300_catalyst/303_catalyst_upgrade-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import {HardhatRuntimeEnvironment} from 'hardhat/types';
const func: DeployFunction = async function (
hre: HardhatRuntimeEnvironment
): Promise<void> {
const {deployments, getNamedAccounts} = hre;
const {deploy} = deployments;

const {deployer, upgradeAdmin} = await getNamedAccounts();
const {deployments, getNamedAccounts, ethers} = hre;
const {execute, read, catchUnknownSigner, deploy} = deployments;
const {deployer, upgradeAdmin, catalystAdmin} = await getNamedAccounts();

await deploy('Catalyst', {
from: deployer,
Expand All @@ -19,6 +18,17 @@ const func: DeployFunction = async function (
upgradeIndex: 1,
},
});

if ((await read('Catalyst', 'owner')) === ethers.constants.AddressZero) {
await catchUnknownSigner(
execute(
'Catalyst',
{from: catalystAdmin, log: true},
'transferOwnership',
catalystAdmin
)
);
}
};
export default func;
func.tags = ['Catalyst_upgrade'];
Expand Down
17 changes: 14 additions & 3 deletions packages/deploy/deploy/400_asset/408_asset_upgrade-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy} = deployments;
const {deployer, upgradeAdmin} = await getNamedAccounts();
const {deployments, getNamedAccounts, ethers} = hre;
const {read, catchUnknownSigner, execute, deploy} = deployments;
const {deployer, upgradeAdmin, assetAdmin} = await getNamedAccounts();

await deploy('Asset', {
from: deployer,
Expand All @@ -16,6 +16,17 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
},
log: true,
});

if ((await read('Asset', 'owner')) === ethers.constants.AddressZero) {
await catchUnknownSigner(
execute(
'Asset',
{from: assetAdmin, log: true},
'transferOwnership',
assetAdmin
)
);
}
};
export default func;

Expand Down

1 comment on commit 302526c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

98.65%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/asset/contracts
   Asset.sol95%90%96.88%98.28%117, 208, 310, 310–311, 77
   AssetCreate.sol94.64%84.21%100%100%140, 142, 200, 216, 333, 74
   AssetReveal.sol94.35%86.21%96.55%98.89%143, 147, 181, 376, 416, 424, 441, 75, 98
   AuthSuperValidator.sol90%83.33%100%88.89%51–52
   Catalyst.sol95.39%92.19%96.15%98.39%124, 126, 139, 151, 223, 79
packages/asset/contracts/interfaces
   IAsset.sol100%100%100%100%
   IAssetCreate.sol100%100%100%100%
   IAssetReveal.sol100%100%100%100%
   ICatalyst.sol100%100%100%100%
   ITokenUtils.sol100%100%100%100%
packages/asset/contracts/libraries
   TokenIdUtils.sol100%100%100%100%

Please sign in to comment.