Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DZGoldman committed Sep 27, 2023
1 parent f8954f0 commit 3aee852
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src-ts/proposalStage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ export enum ProposalStageStatus {
TERMINATED = 4,
}

/**
* Governor with no timelock and no vetting period (i.e., SecurityCouncilMemberElectionGovernor)
*/
export class BaseGovernorExecuteStage implements ProposalStage {
public readonly identifier: string;

Expand Down Expand Up @@ -163,6 +166,9 @@ export class BaseGovernorExecuteStage implements ProposalStage {
return GovernorUpgradeable__factory.connect(this.governorAddress, this.signerOrProvider);
}

/**
* Extract and instantiate appropriate governor proposal stage
*/
public static async extractStages(
receipt: TransactionReceipt,
arbOneSignerOrProvider: Provider | Signer
Expand All @@ -174,8 +180,6 @@ export class BaseGovernorExecuteStage implements ProposalStage {
const propCreatedEvent = govInterface.parseLog(log)
.args as unknown as ProposalCreatedEventObject;

// ensure gov has no timelock and no vetting period

if (await hasTimelock(log.address, getProvider(arbOneSignerOrProvider)!)) {
proposalStages.push(
new GovernorQueueStage(
Expand Down Expand Up @@ -286,10 +290,11 @@ export class GovernorWithVetterExecuteStage extends BaseGovernorExecuteStage {
}

public async status(): Promise<ProposalStageStatus> {
// If governor status returns "ready", check if in vetting period
const status = await super.status();
if (status == ProposalStageStatus.READY) {
const vettingDeadline = await this.governor.proposalVettingDeadline(this.identifier);
const blockNumber = await getL1BlockNumberFromL2(getProvider(this.signerOrProvider)!)
const blockNumber = await getL1BlockNumberFromL2(getProvider(this.signerOrProvider)!);
if (blockNumber.lte(vettingDeadline)) {
return ProposalStageStatus.PENDING;
}
Expand All @@ -306,18 +311,26 @@ export class GovernorQueueStage extends BaseGovernorExecuteStage {
return "GovernorQueueStage";
}

public async execute(): Promise<void> {
const gov = L2ArbitrumGovernor__factory.connect(this.governorAddress, this.signerOrProvider);
public get governor() {
return L2ArbitrumGovernor__factory.connect(this.governorAddress, this.signerOrProvider);
}

/**
* Execute on timelock
*/
public async execute(): Promise<void> {
await (
await gov.functions.queue(this.targets, this.values, this.callDatas, id(this.description))
await this.governor.functions.queue(
this.targets,
this.values,
this.callDatas,
id(this.description)
)
).wait();
}

public async getExecuteReceipt(): Promise<TransactionReceipt> {
const gov = L2ArbitrumGovernor__factory.connect(this.governorAddress, this.signerOrProvider);

const timelockAddress = await gov.timelock();
const timelockAddress = await this.governor.timelock();
const timelock = ArbitrumTimelock__factory.connect(timelockAddress, this.signerOrProvider);
const opId = await timelock.hashOperationBatch(
this.targets,
Expand Down

0 comments on commit 3aee852

Please sign in to comment.