Skip to content

Commit

Permalink
chore: deploy v0.8.6 (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCardinalError authored May 27, 2024
1 parent c8fd670 commit 98afc35
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 99 deletions.
22 changes: 10 additions & 12 deletions deploy/main/005_deploy_roles_postage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@ const func: DeployFunction = async function ({ deployments, getNamedAccounts })
const { deployer } = await getNamedAccounts();

log('Setting PostageStamps roles');
const adminRole = await read('StakeRegistry', 'DEFAULT_ADMIN_ROLE');

const priceOracleRole = await read('PostageStamp', 'PRICE_ORACLE_ROLE');
await execute('PostageStamp', { from: deployer }, 'grantRole', priceOracleRole, (await get('PriceOracle')).address);
if (await read('PostageStamp', { from: deployer }, 'hasRole', adminRole)) {
const priceOracleRole = await read('PostageStamp', 'PRICE_ORACLE_ROLE');
await execute('PostageStamp', { from: deployer }, 'grantRole', priceOracleRole, (await get('PriceOracle')).address);

const redistributorRole = await read('PostageStamp', 'REDISTRIBUTOR_ROLE');
await execute(
'PostageStamp',
{ from: deployer },
'grantRole',
redistributorRole,
(
await get('Redistribution')
).address
);
const redisRole = await read('PostageStamp', 'REDISTRIBUTOR_ROLE');
const redisAddress = (await get('Redistribution')).address;
await execute('PostageStamp', { from: deployer }, 'grantRole', redisRole, redisAddress);
} else {
log('DEPLOYER NEEDS TO HAVE ADMIN ROLE TO ASSIGN THE REDISTRIBUTION ROLE, PLEASE ASSIGN IT OR GRANT ROLE MANUALLY');
}

log('----------------------------------------------------');
};
Expand Down
6 changes: 2 additions & 4 deletions deploy/main/007_deploy_roles_staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ const func: DeployFunction = async function ({ deployments, getNamedAccounts })
// As currently we are reusing staking, and there is multisig wallet as ADMIN
// we either need to add deployer temporarly as ADMIN or do this manually over multisig

const redisAddress = (await get('Redistribution')).address;
const adminRole = await read('StakeRegistry', 'DEFAULT_ADMIN_ROLE');

if (await read('StakeRegistry', { from: deployer }, 'hasRole', adminRole)) {
const redisRole = await read('StakeRegistry', 'REDISTRIBUTOR_ROLE');
const redisAddress = (await get('Redistribution')).address;
await execute('StakeRegistry', { from: deployer }, 'grantRole', redisRole, redisAddress);
} else {
log(
'DEPLOYER NEEDS TO HAVE ADMIN ROLE TO ASSIGN THE REDISTRIBUTION ROLE, PLEASE ASSIGN IT AND/OR GRANT ROLE MANUALLY'
);
log('DEPLOYER NEEDS TO HAVE ADMIN ROLE TO ASSIGN THE REDISTRIBUTION ROLE, PLEASE ASSIGN IT OR GRANT ROLE MANUALLY');
}

log('----------------------------------------------------');
Expand Down
12 changes: 9 additions & 3 deletions deploy/main/008_deploy_roles_oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ const func: DeployFunction = async function ({ deployments, getNamedAccounts })

log('Setting Oracles roles');

const redisAddress = (await get('Redistribution')).address;
const adminRole = await read('StakeRegistry', 'DEFAULT_ADMIN_ROLE');

if (await read('StakeRegistry', { from: deployer }, 'hasRole', adminRole)) {
const redisAddress = (await get('Redistribution')).address;
const updaterRole = await read('PriceOracle', 'PRICE_UPDATER_ROLE');
await execute('PriceOracle', { from: deployer }, 'grantRole', updaterRole, redisAddress);
} else {
log('DEPLOYER NEEDS TO HAVE ADMIN ROLE TO ASSIGN THE REDISTRIBUTION ROLE, PLEASE ASSIGN IT OR GRANT ROLE MANUALLY');
}

const updaterRole = await read('PriceOracle', 'PRICE_UPDATER_ROLE');
await execute('PriceOracle', { from: deployer }, 'grantRole', updaterRole, redisAddress);
log('----------------------------------------------------');
};

Expand Down
8 changes: 4 additions & 4 deletions deploy/main/011_deploy_multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ const func: DeployFunction = async function ({ deployments, getNamedAccounts, ne

// ADD Roles to Multisig
const adminRole = await read('PostageStamp', 'DEFAULT_ADMIN_ROLE');
await execute('PostageStamp', { from: deployer }, 'grantRole', adminRole, networkConfig['mainnet'].multisig);
await execute('PriceOracle', { from: deployer }, 'grantRole', adminRole, networkConfig['mainnet'].multisig);
await execute('StakeRegistry', { from: deployer }, 'grantRole', adminRole, networkConfig['mainnet'].multisig);
// await execute('PostageStamp', { from: deployer }, 'grantRole', adminRole, networkConfig['mainnet'].multisig);
// await execute('PriceOracle', { from: deployer }, 'grantRole', adminRole, networkConfig['mainnet'].multisig);
// await execute('StakeRegistry', { from: deployer }, 'grantRole', adminRole, networkConfig['mainnet'].multisig);
await execute('Redistribution', { from: deployer }, 'grantRole', adminRole, networkConfig['mainnet'].multisig);

// REMOVE Roles from deployer
// await execute('PostageStamp', { from: deployer }, 'renounceRole', adminRole, deployer);
// await execute('PriceOracle', { from: deployer }, 'renounceRole', adminRole, deployer);
// await execute('StakeRegistry', { from: deployer }, 'renounceRole', adminRole, deployer);
// await execute('Redistribution', { from: deployer }, 'renounceRole', adminRole, deployer);
await execute('Redistribution', { from: deployer }, 'renounceRole', adminRole, deployer);

log('----------------------------------------------------');
}
Expand Down
153 changes: 83 additions & 70 deletions deployments/mainnet/Redistribution.json

Large diffs are not rendered by default.

Loading

0 comments on commit 98afc35

Please sign in to comment.