Skip to content

Commit

Permalink
fix: accouting scratch deploy fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
loga4 committed Nov 29, 2024
1 parent 9b59268 commit 728d828
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
3 changes: 1 addition & 2 deletions scripts/scratch/steps/0090-deploy-non-aragon-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ export async function main() {
}

// Deploy Accounting
const accounting = await deployWithoutProxy(Sk.accounting, "Accounting", deployer, [
admin,
const accounting = await deployBehindOssifiableProxy(Sk.accounting, "Accounting", proxyContractsOwner, deployer, [
locator.address,
lidoAddress,
treasuryAddress,
Expand Down
6 changes: 6 additions & 0 deletions scripts/scratch/steps/0120-initialize-non-aragon-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ export async function main() {
const eip712StETHAddress = state[Sk.eip712StETH].address;
const withdrawalVaultAddress = state[Sk.withdrawalVault].proxy.address;
const oracleDaemonConfigAddress = state[Sk.oracleDaemonConfig].address;
const accountingAddress = state[Sk.accounting].proxy.address;

// Set admin addresses (using deployer for testnet)
const testnetAdmin = deployer;
const accountingOracleAdmin = testnetAdmin;
const exitBusOracleAdmin = testnetAdmin;
const stakingRouterAdmin = testnetAdmin;
const withdrawalQueueAdmin = testnetAdmin;
const accountingAdmin = testnetAdmin;

// Initialize NodeOperatorsRegistry

Expand Down Expand Up @@ -139,4 +141,8 @@ export async function main() {
}

await makeTx(oracleDaemonConfig, "renounceRole", [CONFIG_MANAGER_ROLE, testnetAdmin], { from: testnetAdmin });

// Initialize Accounting
const accounting = await loadContract("Accounting", accountingAddress);
await makeTx(accounting, "initialize", [accountingAdmin], { from: deployer });
}
16 changes: 8 additions & 8 deletions scripts/scratch/steps/0130-grant-roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function main() {
const stakingRouterAddress = state[Sk.stakingRouter].proxy.address;
const withdrawalQueueAddress = state[Sk.withdrawalQueueERC721].proxy.address;
const accountingOracleAddress = state[Sk.accountingOracle].proxy.address;
const accountingAddress = state[Sk.accounting].address;
const accountingAddress = state[Sk.accounting].proxy.address;
const validatorsExitBusOracleAddress = state[Sk.validatorsExitBusOracle].proxy.address;
const depositSecurityModuleAddress = state[Sk.depositSecurityModule].address;

Expand Down Expand Up @@ -50,12 +50,9 @@ export async function main() {
await makeTx(stakingRouter, "grantRole", [await stakingRouter.STAKING_MODULE_MANAGE_ROLE(), agentAddress], {
from: deployer,
});
await makeTx(
stakingRouter,
"grantRole",
[await stakingRouter.getFunction("REPORT_REWARDS_MINTED_ROLE")(), accountingAddress],
{ from: deployer },
);
await makeTx(stakingRouter, "grantRole", [await stakingRouter.REPORT_REWARDS_MINTED_ROLE(), accountingAddress], {
from: deployer,
});

// ValidatorsExitBusOracle
if (gateSealAddress) {
Expand Down Expand Up @@ -105,7 +102,10 @@ export async function main() {

// Accounting
const accounting = await loadContract<Accounting>("Accounting", accountingAddress);
await makeTx(accounting, "grantRole", [await accounting.VAULT_MASTER_ROLE(), deployer], {
await makeTx(accounting, "grantRole", [await accounting.VAULT_MASTER_ROLE(), agentAddress], {
from: deployer,
});
await makeTx(accounting, "grantRole", [await accounting.VAULT_REGISTRY_ROLE(), deployer], {
from: deployer,
});
}
17 changes: 11 additions & 6 deletions scripts/scratch/steps/0145-deploy-vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export async function main() {
const deployer = (await ethers.provider.getSigner()).address;
const state = readNetworkState({ deployer });

const agentAddress = state[Sk.appAgent].proxy.address;
const accountingAddress = state[Sk.accounting].address;
const accountingAddress = state[Sk.accounting].proxy.address;
const lidoAddress = state[Sk.appLido].proxy.address;

const depositContract = state.chainSpec.depositContract;
Expand All @@ -37,11 +36,17 @@ export async function main() {

// Add VaultFactory and Vault implementation to the Accounting contract
const accounting = await loadContract<Accounting>("Accounting", accountingAddress);

// Grant roles for the Accounting contract
const vaultMasterRole = await accounting.VAULT_MASTER_ROLE();
const vaultRegistryRole = await accounting.VAULT_REGISTRY_ROLE();

await makeTx(accounting, "grantRole", [vaultMasterRole, deployer], { from: deployer });
await makeTx(accounting, "grantRole", [vaultRegistryRole, deployer], { from: deployer });

await makeTx(accounting, "addFactory", [factoryAddress], { from: deployer });
await makeTx(accounting, "addImpl", [impAddress], { from: deployer });

// Grant roles for the Accounting contract
const role = await accounting.VAULT_MASTER_ROLE();
await makeTx(accounting, "grantRole", [role, agentAddress], { from: deployer });
await makeTx(accounting, "renounceRole", [role, deployer], { from: deployer });
await makeTx(accounting, "renounceRole", [vaultMasterRole, deployer], { from: deployer });
await makeTx(accounting, "renounceRole", [vaultRegistryRole, deployer], { from: deployer });
}
2 changes: 1 addition & 1 deletion scripts/scratch/steps/0150-transfer-roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function main() {
{ name: "WithdrawalQueueERC721", address: state.withdrawalQueueERC721.proxy.address },
{ name: "OracleDaemonConfig", address: state.oracleDaemonConfig.address },
{ name: "OracleReportSanityChecker", address: state.oracleReportSanityChecker.address },
{ name: "Accounting", address: state.accounting.address },
{ name: "Accounting", address: state.accounting.proxy.address },
];

for (const contract of ozAdminTransfers) {
Expand Down

0 comments on commit 728d828

Please sign in to comment.