PluginCloneable
Abstract contract · src/common/plugin/PluginCloneable.sol
Explained in: Choosing a plugin base
Author: Aragon X - 2022-2024
Inherits: IPlugin, ERC165Upgradeable, DaoAuthorizableUpgradeable, ProtocolVersion
An abstract, non-upgradeable contract to inherit from when creating a plugin being deployed via the minimal clones pattern (see ERC-1167).
security-contact: sirt@aragon.org
Functions
dao
function dao() external view returns (IDAO)Selector: 0x4162169f
Returns the DAO contract.
| Returns | Type | Description |
|---|---|---|
[0] | IDAO |
getCurrentTargetConfig
function getCurrentTargetConfig() external view returns (IPlugin.TargetConfig)Selector: 0xc98425ee
Returns the currently set target contract.
| Returns | Type | Description |
|---|---|---|
[0] | IPlugin.TargetConfig |
getTargetConfig
function getTargetConfig() external view returns (IPlugin.TargetConfig)Selector: 0xdd63c06f
A convenient function to get current target config only if its target is not address(0), otherwise dao().
| Returns | Type | Description |
|---|---|---|
[0] | IPlugin.TargetConfig |
pluginType
function pluginType() external pure returns (IPlugin.PluginType)Selector: 0x41de6830
Returns the plugin's type
| Returns | Type | Description |
|---|---|---|
[0] | IPlugin.PluginType |
protocolVersion
function protocolVersion() external pure returns (uint8[3])Selector: 0x2ae9c600
Returns the semantic Aragon OSx protocol version number that the implementing contract is associated with.
Dev: This version number is not to be confused with the
releaseandbuildnumbers found in theVersion.Tagstruct inside thePluginRepocontract being used to version plugin setup and associated plugin implementation contracts.
| Returns | Type | Description |
|---|---|---|
[0] | uint8[3] | Returns the semantic Aragon OSx protocol version number. |
setTargetConfig
function setTargetConfig(IPlugin.TargetConfig _targetConfig) externalSelector: 0xbb225da2
Dev: Sets the target to a new target (
newTarget). The caller must have theSET_TARGET_CONFIG_PERMISSION_IDpermission.
| Parameter | Type | Description |
|---|---|---|
_targetConfig | IPlugin.TargetConfig | The target Config containing the address and operation type. |
supportsInterface
function supportsInterface(bytes4 _interfaceId) external view returns (bool)Selector: 0x01ffc9a7
Checks if this or the parent contract supports an interface by its ID.
| Parameter | Type | Description |
|---|---|---|
_interfaceId | bytes4 | The ID of the interface. |
Events
Initialized
event Initialized(uint8 version)Dev: Triggered when the contract has been initialized or reinitialized.
TargetSet
event TargetSet(IPlugin.TargetConfig newTargetConfig)Emitted each time the TargetConfig is set.
| Parameter | Type | Description |
|---|---|---|
newTargetConfig | IPlugin.TargetConfig |
Errors
DaoUnauthorized
error DaoUnauthorized(address dao, address where, address who, bytes32 permissionId)Thrown if a call is unauthorized in the associated DAO.
| Parameter | Type | Description |
|---|---|---|
dao | address | The associated DAO. |
where | address | The context in which the authorization reverted. |
who | address | The address (EOA or contract) missing the permission. |
permissionId | bytes32 | The permission identifier. |
DelegateCallFailed
error DelegateCallFailed()Thrown when delegatecall fails.
InvalidTargetConfig
error InvalidTargetConfig(IPlugin.TargetConfig targetConfig)Thrown when target is of type 'IDAO', but operation is delegateCall.
| Parameter | Type | Description |
|---|---|---|
targetConfig | IPlugin.TargetConfig | The target config to update it to. |
Constants
Public, so each is also readable through a generated getter.
SET_TARGET_CONFIG_PERMISSION_ID
bytes32 public constant SET_TARGET_CONFIG_PERMISSION_ID =
keccak256("SET_TARGET_CONFIG_PERMISSION");Value: 0x568cc693d84eb1901f8bcecba154cbdef23ca3cf67efc0a0b698528a06c660f7
The ID of the permission required to call the setTargetConfig function.
Enums
Operation
Inherited from IPlugin.
enum Operation {
Call,
DelegateCall
}| Option | Value |
|---|---|
Call | 0 |
DelegateCall | 1 |
PluginType
Inherited from IPlugin.
enum PluginType {
UUPS,
Cloneable,
Constructable
}| Option | Value |
|---|---|
UUPS | 0 |
Cloneable | 1 |
Constructable | 2 |
Structs
TargetConfig
Inherited from IPlugin.
struct TargetConfig {
address target;
IPlugin.Operation operation;
}| Field | Type | Description |
|---|---|---|
target | address | |
operation | IPlugin.Operation |