LendefiGovernor

Git Source

Inherits: GovernorUpgradeable, GovernorSettingsUpgradeable, GovernorCountingSimpleUpgradeable, GovernorVotesUpgradeable, GovernorVotesQuorumFractionUpgradeable, GovernorTimelockControlUpgradeable, AccessControlUpgradeable, UUPSUpgradeable

Standard OZUpgradeable governor with UUPS and AccessControl

Implements a secure and upgradeable DAO governor with consistent role patterns

Notes:

  • security-contact: security@nebula-labs.xyz

  • oz-upgrades:

State Variables

UPGRADER_ROLE

Role identifier for addresses that can upgrade the contract

Note: security: Should be granted carefully as this is a critical permission

bytes32 internal constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");

DEFAULT_VOTING_DELAY

Default voting delay in blocks (approximately 1 day)

The period after a proposal is created during which voting cannot start

DEFAULT_VOTING_PERIOD

Default voting period in blocks (approximately 1 week)

The period during which voting can occur

DEFAULT_PROPOSAL_THRESHOLD

Default proposal threshold (20,000 tokens)

The minimum number of votes needed to submit a proposal

UPGRADE_TIMELOCK_DURATION

Duration of the timelock for upgrade operations (3 days)

Time that must elapse between scheduling and executing an upgrade

Note: security: Provides time for users to respond to potentially malicious upgrades

uupsVersion

UUPS upgrade version tracker

Incremented with each upgrade to track contract versions

pendingUpgrade

Information about the currently pending upgrade

Will have exists=false if no upgrade is pending

__gap

Reserved storage space for future upgrades

Note: oz-upgrades-unsafe-allow: state-variable-immutable

Functions

constructor

Note: oz-upgrades-unsafe-allow: constructor

initialize

Initializes the UUPS contract

Parameters

Name
Type
Description

_token

IVotes

IVotes token instance

_timelock

TimelockControllerUpgradeable

timelock instance

_gnosisSafe

address

multisig address for emergency functions and upgrades

scheduleUpgrade

Schedules an upgrade to a new implementation with timelock

Can only be called by addresses with UPGRADER_ROLE

Parameters

Name
Type
Description

newImplementation

address

Address of the new implementation contract

cancelUpgrade

Cancels a previously scheduled upgrade

Only callable by addresses with UPGRADER_ROLE

upgradeTimelockRemaining

Returns the remaining time before a scheduled upgrade can be executed

Returns

Name
Type
Description

<none>

uint256

timeRemaining The time remaining in seconds, or 0 if no upgrade is scheduled or timelock has passed

supportsInterface

votingDelay

votingPeriod

quorum

state

proposalNeedsQueuing

proposalThreshold

_queueOperations

_executeOperations

_cancel

_authorizeUpgrade

_executor

Events

Initialized

Emitted when the contract is initialized

Parameters

Name
Type
Description

src

address

The address that initialized the contract

Upgrade

Emitted when the contract is upgraded

Parameters

Name
Type
Description

src

address

The address that executed the upgrade

implementation

address

The address of the new implementation

UpgradeScheduled

Emitted when an upgrade is scheduled

Parameters

Name
Type
Description

scheduler

address

The address scheduling the upgrade

implementation

address

The new implementation contract address

scheduledTime

uint64

The timestamp when the upgrade was scheduled

effectiveTime

uint64

The timestamp when the upgrade can be executed

UpgradeCancelled

Emitted when a scheduled upgrade is cancelled

Parameters

Name
Type
Description

canceller

address

The address that cancelled the upgrade

implementation

address

The implementation address that was cancelled

Errors

ZeroAddress

Error thrown when a zero address is provided

UpgradeTimelockActive

Error thrown when attempting to execute an upgrade before timelock expires

Parameters

Name
Type
Description

timeRemaining

uint256

The time remaining until the upgrade can be executed

UpgradeNotScheduled

Error thrown when attempting to execute an upgrade that wasn't scheduled

ImplementationMismatch

Error thrown when implementation address doesn't match scheduled upgrade

Parameters

Name
Type
Description

scheduledImpl

address

The address that was scheduled for upgrade

attemptedImpl

address

The address that was attempted to be used

Structs

UpgradeRequest

Structure to store pending upgrade details

Properties

Name
Type
Description

implementation

address

Address of the new implementation contract

scheduledTime

uint64

Timestamp when the upgrade was scheduled

exists

bool

Boolean flag indicating if an upgrade is currently scheduled

Last updated