AragonAppcontract. It makes the following functionality available.
AragonAppcontract manages two very important state variables in the app:
kernel: A reference to the Kernel contract. The
Kernelmanages upgradeability and access control for the app.
appId: An identifier for the app (the ENS name of the package repo of the app).
AppProxyon its constructor and should never be modified by the app as it could produce an unexpected state and leave the app unprotected or inaccessible.
kernel.newAppInstance(address appId, address base)function, an app is registered in the Kernel and a proxy for that app is created. At any point the base contract of the app can be upgraded using
kernel.setApp(bytes32 namespace, bytes32 appId, address app).
AragonApp, the base contract is disabled on deployment and cannot be used directly (only behind proxies). This is a security feature to avoid scenarios when a contract that proxies rely on can be destructed and all proxies are rendered useless.
onlyInitmodifier to protect a function from being called after
initialized()has been completed and the
isInitializedmodifiers to protect against a function from being called before the initialization is complete.
sendFunds()was called before initialization was complete, it would transfer the ETH sent with the call to
receiverwasn't set. By adding the
isInitializedmodifier, the function will fail until the contract has been initialized. It is a good practice to require all functions that modify state to be initialized before they can be used.
0, even though the expectation reading the code is that it will be
onlyOwner, you can just protect functions by adding the
auth()modifier is present in a function it will check with the connected Kernel's ACL whether the entity performing the call is allowed to perform the action in the app prior to its execution.
bytes32value. This identifier can be a constant value so it doesn't take up any storage space. The standard name for a role identifier is the
keccak256hash of its name as other tooling in the stack expects this to be the case. See this example:
receiverin the contract.
address(0)as the address of ETH. aragonOS includes
ETH = address(0).
uint256-precision for UNIX timestamps (in seconds) or blocks (in ~15s intervals), we generally cast these values down to
uint64s so we can pack them to save gas. aragonOS provides
Uint256Helpersas utility contracts for obtaining these values safely.
Do you have a question? Leave your comments here at our Discourse forum 👇