Core Contracts API

The natspec generated API for the core contracts. You can also find the contracts on the following repository.

Core

DAO

Public API of the Aragon DAO framework.

EXECUTE_PERMISSION_ID() → bytes32 public

UPGRADE_DAO_PERMISSION_ID() → bytes32 public

SET_METADATA_PERMISSION_ID() → bytes32 public

SET_TRUSTED_FORWARDER_PERMISSION_ID() → bytes32 public

REGISTER_STANDARD_CALLBACK_PERMISSION_ID() → bytes32 public

VALIDATE_SIGNATURE_PERMISSION_ID() → bytes32 public

MAX_ACTIONS() → uint256 internal

ReentrantCall() error

Thrown if a call is reentrant.

TooManyActions() error

Thrown if the action array length is larger than MAX_ACTIONS.

ActionFailed(uint256 index) error

Thrown if action execution has failed.

InsufficientGas() error

Thrown if an action has insufficient gas left.

ZeroAmount() error

Thrown if the deposit amount is zero.

NativeTokenDepositAmountMismatch(uint256 expected, uint256 actual) error

Thrown if there is a mismatch between the expected and actually deposited amount of native tokens.

ProtocolVersionUpgradeNotSupported(uint8[3] protocolVersion) error

Thrown if an upgrade is not supported from a specific protocol version .

FunctionRemoved() error

Thrown when a function is removed but left to not corrupt the interface ID.

AlreadyInitialized() error

Thrown when initialize is called after it has already been executed.

NewURI(string daoURI) event

Emitted when a new DAO URI is set.

nonReentrant() modifier

onlyCallAtInitialization() modifier

constructor() public

initialize(bytes _metadata, address _initialOwner, address _trustedForwarder, string daoURI_) external

Initializes the DAO by - setting the reentrancy status variable to _NOT_ENTERED - registering the [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID - setting the trusted forwarder for meta transactions - giving the ROOT_PERMISSION_ID permission to the initial owner (that should be revoked and transferred to the DAO after setup).

This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).

initializeFrom(uint8[3] _previousProtocolVersion, bytes _initData) external

Initializes the DAO after an upgrade from a previous protocol version.

isPermissionRestrictedForAnyAddr(bytes32 _permissionId) → bool internal

_authorizeUpgrade(address) internal

setTrustedForwarder(address _newTrustedForwarder) external

Setter for the trusted forwarder verifying the meta transaction.

getTrustedForwarder() → address external

Getter for the trusted forwarder verifying the meta transaction.

hasPermission(address _where, address _who, bytes32 _permissionId, bytes _data) → bool external

Checks if an address has permission on a contract via a permission identifier and considers if ANY_ADDRESS was used in the granting process.

setMetadata(bytes _metadata) external

Updates the DAO metadata (e.g., an IPFS hash).

execute(bytes32 _callId, struct Action[] _actions, uint256 _allowFailureMap) → bytes[] execResults, uint256 failureMap external

deposit(address _token, uint256 _amount, string _reference) external

Deposits (native) tokens to the DAO contract with a reference string.

setSignatureValidator(address) external

Removed function being left here to not corrupt the IDAO interface ID. Any call will revert.

Introduced in v1.0.0. Removed in v1.4.0.

isValidSignature(bytes32 _hash, bytes _signature) → bytes4 external

Checks whether a signature is valid for a provided hash according to [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271).

Relays the validation logic determining who is allowed to sign on behalf of the DAO to its permission manager. Caller specific bypassing can be set direct granting (i.e., grant({_where: dao, _who: specificErc1271Caller, _permissionId: VALIDATE_SIGNATURE_PERMISSION_ID})). Caller specific signature validation logic can be set by granting with a PermissionCondition (i.e., grantWithCondition({_where: dao, _who: specificErc1271Caller, _permissionId: VALIDATE_SIGNATURE_PERMISSION_ID, _condition: yourConditionImplementation})) Generic signature validation logic can be set for all calling contracts by granting with a PermissionCondition to PermissionManager.ANY_ADDR() (i.e., grantWithCondition({_where: dao, _who: PermissionManager.ANY_ADDR(), _permissionId: VALIDATE_SIGNATURE_PERMISSION_ID, _condition: yourConditionImplementation})).

receive() external

fallback(bytes _input) → bytes external

_setMetadata(bytes _metadata) internal

_setTrustedForwarder(address _trustedForwarder) internal

registerStandardCallback(bytes4 _interfaceId, bytes4 _callbackSelector, bytes4 _magicNumber) external

Registers an ERC standard having a callback by registering its [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID and callback function signature.

daoURI() → string external

A distinct Uniform Resource Identifier (URI) pointing to a JSON object following the "EIP-4824 DAO JSON-LD Schema". This JSON file splits into four URIs: membersURI, proposalsURI, activityLogURI, and governanceURI. The membersURI should point to a JSON file that conforms to the "EIP-4824 Members JSON-LD Schema". The proposalsURI should point to a JSON file that conforms to the "EIP-4824 Proposals JSON-LD Schema". The activityLogURI should point to a JSON file that conforms to the "EIP-4824 Activity Log JSON-LD Schema". The governanceURI should point to a flatfile, normatively a .md file. Each of the JSON files named above can be statically hosted or dynamically-generated.

setDaoURI(string newDaoURI) external

Updates the set DAO URI to a new value.

_setDaoURI(string daoURI_) internal

IDAO

The interface required for DAOs within the Aragon App DAO framework.

hasPermission(address _where, address _who, bytes32 _permissionId, bytes _data) → bool external

Checks if an address has permission on a contract via a permission identifier and considers if ANY_ADDRESS was used in the granting process.

setMetadata(bytes _metadata) external

Updates the DAO metadata (e.g., an IPFS hash).

MetadataSet(bytes metadata) event

Emitted when the DAO metadata is updated.

StandardCallbackRegistered(bytes4 interfaceId, bytes4 callbackSelector, bytes4 magicNumber) event

Emitted when a standard callback is registered.

deposit(address _token, uint256 _amount, string _reference) external

Deposits (native) tokens to the DAO contract with a reference string.

Deposited(address sender, address token, uint256 amount, string _reference) event

Emitted when a token deposit has been made to the DAO.

NativeTokenDeposited(address sender, uint256 amount) event

Emitted when a native token deposit has been made to the DAO.

This event is intended to be emitted in the receive function and is therefore bound by the gas limitations for send/transfer calls introduced by [ERC-2929](https://eips.ethereum.org/EIPS/eip-2929).

setTrustedForwarder(address _trustedForwarder) external

Setter for the trusted forwarder verifying the meta transaction.

getTrustedForwarder() → address external

Getter for the trusted forwarder verifying the meta transaction.

TrustedForwarderSet(address forwarder) event

Emitted when a new TrustedForwarder is set on the DAO.

isValidSignature(bytes32 _hash, bytes _signature) → bytes4 external

Checks whether a signature is valid for a provided hash according to [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271).

registerStandardCallback(bytes4 _interfaceId, bytes4 _callbackSelector, bytes4 _magicNumber) external

Registers an ERC standard having a callback by registering its [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID and callback function signature.

setSignatureValidator(address) external

Removed function being left here to not corrupt the IDAO interface ID. Any call will revert.

Introduced in v1.0.0. Removed in v1.4.0.

PermissionManager

The abstract permission manager used in a DAO, its associated plugins, and other framework-related components.

ROOT_PERMISSION_ID() → bytes32 public

ANY_ADDR() → address internal

UNSET_FLAG() → address internal

ALLOW_FLAG() → address internal

permissionsHashed() → mapping(bytes32 => address) internal

Unauthorized(address where, address who, bytes32 permissionId) error

Thrown if a call is unauthorized.

PermissionAlreadyGrantedForDifferentCondition(address where, address who, bytes32 permissionId, address currentCondition, address newCondition) error

Thrown if a permission has been already granted with a different condition.

This makes sure that condition on the same permission can not be overwriten by a different condition.

ConditionNotAContract(contract IPermissionCondition condition) error

ConditionInterfaceNotSupported(contract IPermissionCondition condition) error

PermissionsForAnyAddressDisallowed() error

Thrown for ROOT_PERMISSION_ID or EXECUTE_PERMISSION_ID permission grants where who or where is ANY_ADDR.

AnyAddressDisallowedForWhoAndWhere() error

Thrown for permission grants where who and where are both ANY_ADDR.

GrantWithConditionNotSupported() error

Thrown if Operation.GrantWithCondition is requested as an operation but the method does not support it.

Granted(bytes32 permissionId, address here, address where, address who, address condition) event

Emitted when a permission permission is granted in the context here to the address _who for the contract _where.

Revoked(bytes32 permissionId, address here, address where, address who) event

Emitted when a permission permission is revoked in the context here from the address _who for the contract _where.

auth(bytes32 _permissionId) modifier

__PermissionManager_init(address _initialOwner) internal

grant(address _where, address _who, bytes32 _permissionId) external

Grants permission to an address to call methods in a contract guarded by an auth modifier with the specified permission identifier.

Requires the ROOT_PERMISSION_ID permission.Note, that granting permissions with _who or _where equal to ANY_ADDR does not replace other permissions with specific _who and _where addresses that exist in parallel.

grantWithCondition(address _where, address _who, bytes32 _permissionId, contract IPermissionCondition _condition) external

revoke(address _where, address _who, bytes32 _permissionId) external

Revokes permission from an address to call methods in a target contract guarded by an auth modifier with the specified permission identifier.

Requires the ROOT_PERMISSION_ID permission.Note, that revoking permissions with _who or _where equal to ANY_ADDR does not revoke other permissions with specific _who and _where addresses that exist in parallel.

applySingleTargetPermissions(address _where, struct PermissionLib.SingleTargetPermission[] items) external

applyMultiTargetPermissions(struct PermissionLib.MultiTargetPermission[] _items) external

isGranted(address _where, address _who, bytes32 _permissionId, bytes _data) → bool public

Checks if the caller address has permission on the target contract via a permission identifier and relays the answer to a condition contract if this was declared during the granting process.

_checkCondition(address _condition, address _where, address _who, bytes32 _permissionId, bytes _data) → bool internal

_initializePermissionManager(address _initialOwner) internal

_grant(address _where, address _who, bytes32 _permissionId) internal

_grantWithCondition(address _where, address _who, bytes32 _permissionId, contract IPermissionCondition _condition) internal

_revoke(address _where, address _who, bytes32 _permissionId) internal

_auth(bytes32 _permissionId) internal

permissionHash(address _where, address _who, bytes32 _permissionId) → bytes32 internal

isPermissionRestrictedForAnyAddr(bytes32 _permissionId) → bool internal

CallbackHandler

This callback handling functionality is intended to be used by executor contracts (i.e., DAO.sol).

callbackMagicNumbers() → mapping(bytes4 => bytes4) internal

UNREGISTERED_CALLBACK() → bytes4 internal

UnknownCallback(bytes4 callbackSelector, bytes4 magicNumber) error

Thrown if the callback function is not registered.

CallbackReceived(address sender, bytes4 sig, bytes data) event

Emitted when _handleCallback is called.

_handleCallback(bytes4 _callbackSelector, bytes _data) → bytes4 internal

_registerCallback(bytes4 _callbackSelector, bytes4 _magicNumber) internal