Skip to main content

PluginRepo

Description

The plugin repository contract required for managing and publishing different plugin versions within the Aragon DAO framework.

Implementation

public struct Tag

struct Tag {
uint8 release;
uint16 build;
}

public struct Version

struct Version {
struct PluginRepo.Tag tag;
address pluginSetup;
bytes buildMetadata;
}

public variable MAINTAINER_PERMISSION_ID

The ID of the permission required to call the createVersion function.

bytes32 MAINTAINER_PERMISSION_ID

public variable UPGRADE_REPO_PERMISSION_ID

The ID of the permission required to call the createVersion function.

bytes32 UPGRADE_REPO_PERMISSION_ID

internal variable buildsPerRelease

The mapping between release and build numbers.

mapping(uint8 => uint16) buildsPerRelease

internal variable versions

The mapping between the version hash and the corresponding version information.

mapping(bytes32 => struct PluginRepo.Version) versions

internal variable latestTagHashForPluginSetup

The mapping between the plugin setup address and its corresponding version hash.

mapping(address => bytes32) latestTagHashForPluginSetup

public variable latestRelease

The ID of the latest release.

uint8 latestRelease

The maximum release number is 255.

error VersionHashDoesNotExist

Thrown if a version does not exist.

error VersionHashDoesNotExist(bytes32 versionHash)
InputTypeDescription
versionHashbytes32The tag hash.

error InvalidPluginSetupInterface

Thrown if a plugin setup contract does not inherit from PluginSetup.

error InvalidPluginSetupInterface()

error ReleaseZeroNotAllowed

Thrown if a release number is zero.

error ReleaseZeroNotAllowed()

error InvalidReleaseIncrement

Thrown if a release number is incremented by more than one.

error InvalidReleaseIncrement(uint8 latestRelease, uint8 newRelease)
InputTypeDescription
latestReleaseuint8The latest release number.
newReleaseuint8The new release number.

error PluginSetupAlreadyInPreviousRelease

Thrown if the same plugin setup contract exists already in a previous releases.

error PluginSetupAlreadyInPreviousRelease(uint8 release, uint16 build, address pluginSetup)
InputTypeDescription
releaseuint8The release number of the already existing plugin setup.
builduint16The build number of the already existing plugin setup.
pluginSetupaddressThe plugin setup contract address.

error EmptyReleaseMetadata

Thrown if the metadata URI is empty.

error EmptyReleaseMetadata()

error ReleaseDoesNotExist

Thrown if release does not exist.

error ReleaseDoesNotExist()

event VersionCreated

Thrown if the same plugin setup exists in previous releases.

event VersionCreated(uint8 release, uint16 build, address pluginSetup, bytes buildMetadata)
InputTypeDescription
releaseuint8The release number.
builduint16The build number.
pluginSetupaddressThe address of the plugin setup contract.
buildMetadatabytesThe build metadata URI.

event ReleaseMetadataUpdated

Thrown when a release's metadata was updated.

event ReleaseMetadataUpdated(uint8 release, bytes releaseMetadata)
InputTypeDescription
releaseuint8The release number.
releaseMetadatabytesThe release metadata URI.

public function constructor

constructor() public

Used to disallow initializing the implementation contract by an attacker for extra safety.

external function initialize

Initializes the contract by

  • initializing the permission manager
  • granting the MAINTAINER_PERMISSION_ID permission to the initial owner.
function initialize(address initialOwner) external

This method is required to support ERC-1822.

external function createVersion

Creates a new plugin version as the latest build for an existing release number or the first build for a new release number for the provided PluginSetup contract address and metadata.

function createVersion(uint8 _release, address _pluginSetup, bytes _buildMetadata, bytes _releaseMetadata) external
InputTypeDescription
_releaseuint8The release number.
_pluginSetupaddress
_buildMetadatabytesThe build metadata URI.
_releaseMetadatabytesThe release metadata URI.

external function updateReleaseMetadata

Updates the metadata for release with content @fromHex(_releaseMetadata).

function updateReleaseMetadata(uint8 _release, bytes _releaseMetadata) external
InputTypeDescription
_releaseuint8The release number.
_releaseMetadatabytesThe release metadata URI.

public function getLatestVersion

Returns the latest version for a given release number.

function getLatestVersion(uint8 _release) public view returns (struct PluginRepo.Version)
InputTypeDescription
_releaseuint8The release number.
Output
0struct PluginRepo.VersionThe latest version of this release.

public function getLatestVersion

Returns the latest version for a given plugin setup.

function getLatestVersion(address _pluginSetup) public view returns (struct PluginRepo.Version)
InputTypeDescription
_pluginSetupaddressThe plugin setup address
Output
0struct PluginRepo.VersionThe latest version associated with the plugin Setup.

public function getVersion

Returns the version associated with a tag.

function getVersion(struct PluginRepo.Tag _tag) public view returns (struct PluginRepo.Version)
InputTypeDescription
_tagstruct PluginRepo.TagThe version tag.
Output
0struct PluginRepo.VersionThe version associated with the tag.

public function getVersion

Returns the version for a tag hash.

function getVersion(bytes32 _tagHash) public view returns (struct PluginRepo.Version)
InputTypeDescription
_tagHashbytes32The tag hash.
Output
0struct PluginRepo.VersionThe version associated with a tag hash.

public function buildCount

Gets the total number of builds for a given release number.

function buildCount(uint8 _release) public view returns (uint256)
InputTypeDescription
_releaseuint8The release number.
Output
0uint256The number of builds of this release.

internal function tagHash

The hash of the version tag obtained from the packed, bytes-encoded release and build number.

function tagHash(struct PluginRepo.Tag _tag) internal pure returns (bytes32)
InputTypeDescription
_tagstruct PluginRepo.TagThe version tag.
Output
0bytes32The version tag hash.

internal function _authorizeUpgrade

Internal method authorizing the upgrade of the contract via the upgradeability mechanism for UUPS proxies (see ERC-1822).

function _authorizeUpgrade(address) internal virtual

The caller must have the UPGRADE_REPO_PERMISSION_ID permission.

public function supportsInterface

Checks if this or the parent contract supports an interface by its ID.

function supportsInterface(bytes4 _interfaceId) public view virtual returns (bool)
InputTypeDescription
_interfaceIdbytes4The ID of the interface.
Output
0boolReturns true if the interface is supported.
© 2024