ISimpleApprovalWorkflow

Git Source

Interface for simple approval-based governance

Functions

requestApproval

Request approval for an operation

function requestApproval(string calldata operation, bytes calldata callData) external returns (uint256 requestId);

Parameters

Name
Type
Description

operation

string

Description of the operation

callData

bytes

The call data to execute if approved

Returns

Name
Type
Description

requestId

uint256

The ID of the approval request

approve

Approve a pending request

function approve(uint256 requestId) external;

Parameters

Name
Type
Description

requestId

uint256

The request ID to approve

reject

Reject a pending request

function reject(uint256 requestId, string calldata reason) external;

Parameters

Name
Type
Description

requestId

uint256

The request ID to reject

reason

string

Reason for rejection

executeApproval

Execute an approved request

function executeApproval(uint256 requestId) external;

Parameters

Name
Type
Description

requestId

uint256

The request ID to execute

updateApprover

Update the approver address

function updateApprover(address newApprover) external;

Parameters

Name
Type
Description

newApprover

address

New approver address

getApprovalRequest

Get approval request details

function getApprovalRequest(uint256 requestId) external view returns (ApprovalRequest memory request);

Parameters

Name
Type
Description

requestId

uint256

The request ID

Returns

Name
Type
Description

request

ApprovalRequest

The approval request details

getPendingRequests

Get all pending requests

function getPendingRequests() external view returns (uint256[] memory requestIds);

Returns

Name
Type
Description

requestIds

uint256[]

Array of pending request IDs

getApprover

Get the current approver

function getApprover() external view returns (address approver);

Returns

Name
Type
Description

approver

address

The current approver address

canExecute

Check if a request can be executed

function canExecute(uint256 requestId) external view returns (bool canExecute);

Parameters

Name
Type
Description

requestId

uint256

The request ID

Returns

Name
Type
Description

canExecute

bool

True if the request can be executed

Events

ApprovalRequested

event ApprovalRequested(uint256 indexed requestId, address indexed requester, string operation);

ApprovalGranted

event ApprovalGranted(uint256 indexed requestId, address indexed approver);

ApprovalRejected

event ApprovalRejected(uint256 indexed requestId, address indexed approver, string reason);

ApprovalExecuted

event ApprovalExecuted(uint256 indexed requestId, address indexed executor);

ApprovalExpired

event ApprovalExpired(uint256 indexed requestId);

ApproverUpdated

event ApproverUpdated(address indexed oldApprover, address indexed newApprover);

Structs

ApprovalRequest

struct ApprovalRequest {
    uint256 id;
    address requester;
    string operation;
    bytes callData;
    uint256 timestamp;
    uint256 expiryTime;
    ApprovalStatus status;
    address approver;
    string rejectionReason;
}

Enums

ApprovalStatus

enum ApprovalStatus {
    Pending,
    Approved,
    Rejected,
    Executed,
    Expired
}

Last updated

Was this helpful?