IGovernor_v1.sol

Git Source

Functions

init

The module's initializer function.

function init(
    address _communityMultisig,
    address _teamMultisig,
    uint _timelockPeriod,
    address _feeManager,
    address _moduleFactory
) external;

Parameters

NameTypeDescription

_communityMultisig

address

The address of the community multisig.

_teamMultisig

address

The address of the team multisig.

_timelockPeriod

uint256

The timelock period needed to upgrade a {IInverterBeacon_v1}.

_feeManager

address

The address of the initial {FeeManager_v1}.

_moduleFactory

address

The address of the initial {ModuleFactory_v1}.

moduleFactoryInitCallback

Callback function that is called by {ModuleFactory_v1} during initialization.

function moduleFactoryInitCallback(
    IInverterBeacon_v1[] calldata registeredBeacons
) external;

Parameters

NameTypeDescription

registeredBeacons

IInverterBeacon_v1[]

The array of {IInverterBeacon_v1}s that will be registered.

getBeaconTimelock

Returns the current timelock of a {IInverterBeacon_v1} address.

function getBeaconTimelock(address beacon)
    external
    view
    returns (Timelock memory);

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1}.

Returns

NameTypeDescription

<none>

Timelock

The timelock of the {IInverterBeacon_v1} address.

getLinkedBeacons

Returns the list of currently linked {IInverterBeacon_v1}s.

function getLinkedBeacons()
    external
    view
    returns (IInverterBeacon_v1[] memory);

Returns

NameTypeDescription

<none>

IInverterBeacon_v1[]

LinkedBeacons The array of {IInverterBeacon_v1}s that are currently linked to the {Governor_v1}.

getFeeManager

Returns the {FeeManager_v1} address.

function getFeeManager() external view returns (address);

Returns

NameTypeDescription

<none>

address

Address of the {FeeManager_v1}.

getModuleFactory

Returns the {ModuleFactory_v1} address.

function getModuleFactory() external view returns (address);

Returns

NameTypeDescription

<none>

address

Address of the {ModuleFactory_v1}.

setFeeManager

Sets the address of the {FeeManager_v1}.

Can only be accessed by the COMMUNITY_MULTISIG_ROLE.

function setFeeManager(address newFeeManager) external;

Parameters

NameTypeDescription

newFeeManager

address

The address of the new {FeeManager_v1}.

setModuleFactory

Sets the address of the {ModuleFactory_v1}.

Can only be accessed by the COMMUNITY_MULTISIG_ROLE.

function setModuleFactory(address newModuleFactory) external;

Parameters

NameTypeDescription

newModuleFactory

address

The address of the new {ModuleFactory_v1}.

setFeeManagerMaxFee

Sets the maximum fee percentage that can be assigned in the linked {FeeManager_v1}.

Can only be accessed by the COMMUNITY_MULTISIG_ROLE.

The given max fee can not be higher than the BPS.

function setFeeManagerMaxFee(uint maxFee) external;

Parameters

NameTypeDescription

maxFee

uint256

The max Fee in relation to the BPS.

setFeeManagerDefaultProtocolTreasury

Sets the default protocol treasury address in the linked {FeeManager_v1}.

Can only be accessed by the COMMUNITY_MULTISIG_ROLE.

The given treasury address can not be address(0).

function setFeeManagerDefaultProtocolTreasury(address _defaultProtocolTreasury)
    external;

Parameters

NameTypeDescription

_defaultProtocolTreasury

address

The address of the default protocol treasury.

setFeeManagerWorkflowTreasuries

Sets the protocol treasury address for a specific workflow in the linked {FeeManager_v1}.

Can only be accessed by the COMMUNITY_MULTISIG_ROLE.

The given treasury address can not be address(0).

function setFeeManagerWorkflowTreasuries(address workflow, address treasury)
    external;

Parameters

NameTypeDescription

workflow

address

The address of the workflow.

treasury

address

The address of the protocol treasury for that specific workflow.

setFeeManagerDefaultCollateralFee

Sets the default collateral fee of the protocol in the linked {FeeManager_v1}.

Can only be accessed by the COMMUNITY_MULTISIG_ROLE.

The given fee needs to be less than the BPS.

function setFeeManagerDefaultCollateralFee(uint _defaultCollateralFee)
    external;

Parameters

NameTypeDescription

_defaultCollateralFee

uint256

The default collateral fee of the protocol in relation to the BPS.

setFeeManagerDefaultIssuanceFee

Sets the default issuance fee of the protocol in the linked {FeeManager_v1}.

Can only be accessed by the COMMUNITY_MULTISIG_ROLE.

The given fee needs to be less than the BPS.

function setFeeManagerDefaultIssuanceFee(uint _defaultIssuanceFee) external;

Parameters

NameTypeDescription

_defaultIssuanceFee

uint256

The default issuance fee of the protocol in relation to the BPS.

setFeeManagerCollateralWorkflowFee

Sets the collateral fee for a specific workflow module function in the linked {FeeManager_v1}.

Can only be accessed by either the COMMUNITY_MULTISIG_ROLE or the TEAM_MULTISIG_ROLE.

The given fee needs to be less than the BPS.

function setFeeManagerCollateralWorkflowFee(
    address workflow,
    address module,
    bytes4 functionSelector,
    bool set,
    uint fee
) external;

Parameters

NameTypeDescription

workflow

address

The address of the workflow that contains the module function.

module

address

The address of the module that contains the function.

functionSelector

bytes4

The function selector of the target function.

set

bool

Boolean that determines if the fee is actually used or not.

fee

uint256

The collateral fee in relation to the BPS.

setFeeManagerIssuanceWorkflowFee

Sets the issuance fee for a specific workflow module function in the linked {FeeManager_v1}.

Can only be accessed by either the COMMUNITY_MULTISIG_ROLE or the TEAM_MULTISIG_ROLE.

The given fee needs to be less than the BPS.

function setFeeManagerIssuanceWorkflowFee(
    address workflow,
    address module,
    bytes4 functionSelector,
    bool set,
    uint fee
) external;

Parameters

NameTypeDescription

workflow

address

The address of the workflow that contains the module function.

module

address

The address of the module that contains the function.

functionSelector

bytes4

The function selector of the target function.

set

bool

Boolean that determines if the fee is actually used or not.

fee

uint256

The issuance fee in relation to the BPS.

registerMetadataInModuleFactory

Registers a {IInverterBeacon_v1} with the provided metadata in the target {ModuleFactory_v1}.

Can only be accessed by either the COMMUNITY_MULTISIG_ROLE or the TEAM_MULTISIG_ROLE.

function registerMetadataInModuleFactory(
    IModule_v1.Metadata memory metadata,
    IInverterBeacon_v1 beacon
) external;

Parameters

NameTypeDescription

metadata

IModule_v1.Metadata

The metadata that will be registered.

beacon

IInverterBeacon_v1

The {IInverterBeacon_v1} that will be registered.

upgradeBeaconWithTimelock

Starts the upgrade process of a {IInverterBeacon_v1} by creating a timelock period after which the {IInverterBeacon_v1} can be upgraded via triggerUpgradeBeaconWithTimelock().

This function will override previous timelocks even if they are active.

Can only be accessed by either the COMMUNITY_MULTISIG_ROLE or the TEAM_MULTISIG_ROLE.

function upgradeBeaconWithTimelock(
    address beacon,
    address newImplementation,
    uint newMinorVersion,
    uint newPatchVersion
) external;

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1} that is intended to be upgraded.

newImplementation

address

The address of the intended new Implementation of the {IInverterBeacon_v1}.

newMinorVersion

uint256

The intended new minor version of the {IInverterBeacon_v1}.

newPatchVersion

uint256

The intended new patch version of the {IInverterBeacon_v1}.

triggerUpgradeBeaconWithTimelock

Upgrades a {IInverterBeacon_v1} with the data provided by the active timelock.

Can only be accessed by either the COMMUNITY_MULTISIG_ROLE or the TEAM_MULTISIG_ROLE.

function triggerUpgradeBeaconWithTimelock(address beacon) external;

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1} that is intended to be upgraded.

cancelUpgrade

Cancels an upgrade of {IInverterBeacon_v1} by setting the active timelock to inactive.

Can only be accessed by either the COMMUNITY_MULTISIG_ROLE or the TEAM_MULTISIG_ROLE.

function cancelUpgrade(address beacon) external;

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1} for which the timelock should be canceled.

setTimelockPeriod

Sets the timelock period of a {IInverterBeacon_v1} upgrade process.

Can only be accessed by the COMMUNITY_MULTISIG_ROLE.

function setTimelockPeriod(uint newtimelockPeriod) external;

Parameters

NameTypeDescription

newtimelockPeriod

uint256

The new timelock period.

initiateBeaconShutdown

Initiates the shutdown of a {IInverterBeacon_v1}.

Can only be accessed by either the COMMUNITY_MULTISIG_ROLE or the TEAM_MULTISIG_ROLE.

function initiateBeaconShutdown(address beacon) external;

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1} that should be shut down.

initiateBeaconShutdownForAllLinkedBeacons

Initiates the shutdown of all linked {IInverterBeacon_v1}s.

Can only be accessed by either the COMMUNITY_MULTISIG_ROLE or the TEAM_MULTISIG_ROLE.

function initiateBeaconShutdownForAllLinkedBeacons() external;

forceUpgradeBeaconAndRestartImplementation

This function forces the upgrade of a beacon and restarts the implementation afterwards.

Can only be accessed by the COMMUNITY_MULTISIG_ROLE.

function forceUpgradeBeaconAndRestartImplementation(
    address beacon,
    address newImplementation,
    uint newMinorVersion,
    uint newPatchVersion
) external;

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1} that is intended to be upgraded and restarted.

newImplementation

address

The address of the intended new Implementation of the {IInverterBeacon_v1}.

newMinorVersion

uint256

The intended new minor version of the {IInverterBeacon_v1}.

newPatchVersion

uint256

The intended new patch version of the {IInverterBeacon_v1}.

restartBeaconImplementation

Restarts the {IInverterBeacon_v1} implementation.

Can only be accessed by the COMMUNITY_MULTISIG_ROLE.

function restartBeaconImplementation(address beacon) external;

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1} that should restarted.

acceptOwnership

Accepts the ownership over the target address.

Can only be accessed by the COMMUNITY_MULTISIG_ROLE or TEAM_MULTISIG_ROLE.

function acceptOwnership(address adr) external;

Parameters

NameTypeDescription

adr

address

The address of target that wants to hand over the ownership.

Events

BeaconTimelockStarted

Event emitted when a new timelock period for a upgrade of a {IInverterBeacon_v1} is started.

event BeaconTimelockStarted(
    address beacon,
    address newImplementation,
    uint newMinorVersion,
    uint newPatchVersion,
    uint timelockExceeded
);

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1}.

newImplementation

address

The address of the new Implementation.

newMinorVersion

uint256

The new minor version.

newPatchVersion

uint256

The new patch version.

timelockExceeded

uint256

Timestamp of when the timelock is exceeded.

BeaconUpgraded

Event emitted when a {IInverterBeacon_v1} is upgraded.

event BeaconUpgraded(
    address beacon,
    address newImplementation,
    uint newMinorVersion,
    uint newPatchVersion
);

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1}.

newImplementation

address

The address of the new Implementation.

newMinorVersion

uint256

The new minor version.

newPatchVersion

uint256

The new patch version.

BeaconUpgradedCanceled

Event emitted when a {IInverterBeacon_v1} upgraded is canceled.

event BeaconUpgradedCanceled(address beacon);

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1}.

FeeManagerUpdated

Event emitted when the fee manager is updated.

event FeeManagerUpdated(address feeManager);

Parameters

NameTypeDescription

feeManager

address

The address of the fee manager.

ModuleFactoryUpdated

Event emitted when the module factory is updated.

event ModuleFactoryUpdated(address moduleFactory);

Parameters

NameTypeDescription

moduleFactory

address

The address of the module factory.

TimelockPeriodSet

Event emitted when a timelock period is set.

event TimelockPeriodSet(uint newTimelockPeriod);

Parameters

NameTypeDescription

newTimelockPeriod

uint256

The new timelock period.

BeaconShutdownInitiated

Event emitted when a {IInverterBeacon_v1} shutdown is initiated.

event BeaconShutdownInitiated(address beacon);

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1}.

BeaconForcefullyUpgradedAndImplementationRestarted

Event emitted when a {IInverterBeacon_v1} is forcefully upgraded and the implementation gets restarted immediately.

event BeaconForcefullyUpgradedAndImplementationRestarted(
    address beacon,
    address newImplementation,
    uint newMinorVersion,
    uint newPatchVersion
);

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1}.

newImplementation

address

The address of the new Implementation.

newMinorVersion

uint256

The new minor version.

newPatchVersion

uint256

The new patch version.

BeaconImplementationRestarted

Event emitted when a {IInverterBeacon_v1} implementation is restarted.

event BeaconImplementationRestarted(address beacon);

Parameters

NameTypeDescription

beacon

address

The address of the {IInverterBeacon_v1}.

OwnershipAccepted

Event emitted when the {Governor_v1} contract accepts the ownership over another contract.

event OwnershipAccepted(address adr);

Parameters

NameTypeDescription

adr

address

The address of the contract that distributed the ownership.

Errors

Governor__OnlyLinkedModuleFactory

This function can only be accessed by the linked {ModuleFactory_v1}.

error Governor__OnlyLinkedModuleFactory();

Governor__LinkedBeaconsNotEmpty

This function can only be called when the linked {IInverterBeacon_v1} array is empty.

error Governor__LinkedBeaconsNotEmpty();

Governor__InvalidAddress

The given address is invalid.

error Governor__InvalidAddress(address adr);

Governor__InvalidTimelockPeriod

The given amount is invalid.

error Governor__InvalidTimelockPeriod(uint amt);

Governor__BeaconNotAccessible

The given target address is not accessible.

error Governor__BeaconNotAccessible(address target);

Governor__OnlyCommunityOrTeamMultisig

This function can only be accessed by the CommunityMultisig or TeamMultisig.

error Governor__OnlyCommunityOrTeamMultisig();

Governor__TimelockPeriodNotExceeded

The timelock period needed for the {IInverterBeacon_v1} to be upgraded has not been exceeded yet.

error Governor__TimelockPeriodNotExceeded();

Governor__UpgradeProcessNotStarted

This upgrade process for this {IInverterBeacon_v1} has not yet been started.

error Governor__UpgradeProcessNotStarted();

Governor__CallToTargetContractFailed

The call to the target contract has failed.

error Governor__CallToTargetContractFailed();

Structs

Timelock

Struct used to store information about a timelock for a {IInverterBeacon_v1} upgrade.

The timelock is needed to upgrade a {IInverterBeacon_v1} to new implementation.

struct Timelock {
    bool timelockActive;
    uint timelockUntil;
    address intendedImplementation;
    uint intendedMinorVersion;
    uint intendedPatchVersion;
}

Properties

NameTypeDescription

timelockActive

bool

Is the timelock currently active.

timelockUntil

uint256

intendedImplementation

address

The new inteded Implementation address of the {IInverterBeacon_v1}.

intendedMinorVersion

uint256

The new intended minor version of the {IInverterBeacon_v1}.

intendedPatchVersion

uint256

The new intended patch version of the {IInverterBeacon_v1}.

Last updated