@idle-finance/hardhat-proposals-plugin
Version:
Hardhat plugin for governance proposals
92 lines • 3.74 kB
TypeScript
import { BigNumberish, BigNumber, BytesLike, Signer } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { IProposal, IAction, IProposalBuilder } from "./types";
/**
* This is an internal state of the proposal which is used to keep track of a proposal.
*/
export declare enum InternalProposalState {
UNSUBMITTED = 0,
SIMULATED = 1,
SUBMITTED = 2
}
/**
* Abstract implementation of a proposal
*
* This implementation only contains a subset of the actions required for a proposal
*/
export declare abstract class Proposal implements IProposal {
protected readonly hre: HardhatRuntimeEnvironment;
protected internalState: InternalProposalState;
proposer?: Signer;
targets: string[];
values: BigNumber[];
signatures: string[];
calldatas: BytesLike[];
constructor(hre: HardhatRuntimeEnvironment);
protected markAsSubmitted(): void;
/**
* Run a simulation of the proposal
*
* This method will not update the propsal id.
*
* If the proposal has already been simulated, an exception will be thrown to the called.
* This can be disabled by using the flag `simulate(force=true)`
*
* Each proposal type will have its own implmenentation for simulating the proposal,
* therefore refer to the relavent proposal for details on how the simulate method method works.
*
* There may be some nuance the the implementation to pay attention to in particular.
*
* For example
* - Each action may be exected as distinct transactions instead of one
* - The timestamps for each action may be slightly different.
* - The gas costs from this method should not be relied upon for executing a proposal.
*
* If you want a more accurate (but significantly slower) simulation of the proposal
* run this method with the flag `simulate(fullSimulation=true)`
*
* @param fullSimulation Whether to run a full simulation of the proposal (default: false)
* @param force Re-execute the proposal even if it has already been simulated before (default: false)
*/
simulate(fullSimulation?: boolean, force?: boolean): Promise<void>;
/**
* Implementation for running a proposal simulation.
*/
protected abstract _simulate(): Promise<void>;
/**
* Implenentation for running a full proposal simulation
*/
protected abstract _fullSimulate(): Promise<void>;
addAction(action: IAction): void;
/**
* Fetch a proposal from the block chain and return that new proposal
*
* @param data Any data required to load the proposal. Determined by the implementation
*/
abstract loadProposal(data: any): Promise<Proposal>;
protected getProvider(): import("hardhat/types").EthereumProvider;
protected getEthersProvider(): import("@ethersproject/providers").JsonRpcProvider;
protected mineBlocks(blocks: any): Promise<void>;
protected mineBlock(timestamp?: number): Promise<void>;
}
export declare abstract class ProposalBuilder implements IProposalBuilder {
private readonly hre;
abstract proposal: Proposal;
constructor(hre: HardhatRuntimeEnvironment);
/**
* Build and return the proposal
*
* @returns The built proposal
*/
abstract build(): Proposal;
/**
* Add an action to the proposal
*
* @param target Target contract address
* @param value tx value to send
* @param signature Contract function signature to call
* @param calldata Call data to pass to function
*/
abstract addAction(target: string, value: BigNumberish, signature: string, calldata: BytesLike): ProposalBuilder;
}
//# sourceMappingURL=proposal.d.ts.map