Skip to content

Commit

Permalink
IAragonApp interface: move it up to AragonApp (out of AppStorage)
Browse files Browse the repository at this point in the history
  • Loading branch information
ßingen committed Jul 23, 2020
1 parent cc88e41 commit 79389f2
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 19 deletions.
12 changes: 0 additions & 12 deletions contracts/apps/AppProxyBase.sol
Expand Up @@ -32,18 +32,6 @@ contract AppProxyBase is AppStorage, DepositableDelegateProxy, KernelNamespaceCo
}
}

/**
* @dev Query if a contract implements a certain interface
* We implement it here to break the bridge to IAragonApp (through AppStorage)
* in the inheritance graph.
* @param _interfaceId The interface identifier being queried, as specified in ERC-165
* @return True if the contract implements the requested interface and if its not 0xffffffff, false otherwise
*/
function supportsInterface(bytes4 _interfaceId) public view returns (bool) {
address target = implementation();
return IAragonApp(target).supportsInterface(_interfaceId);
}

function getAppBase(bytes32 _appId) internal view returns (address) {
return kernel().getApp(KERNEL_APP_BASES_NAMESPACE, _appId);
}
Expand Down
3 changes: 1 addition & 2 deletions contracts/apps/AppStorage.sol
Expand Up @@ -6,10 +6,9 @@ pragma solidity ^0.4.24;

import "../common/UnstructuredStorage.sol";
import "../kernel/IKernel.sol";
import "./IAragonApp.sol";


contract AppStorage is IAragonApp {
contract AppStorage {
using UnstructuredStorage for bytes32;

/* Hardcoded constants to save gas
Expand Down
3 changes: 2 additions & 1 deletion contracts/apps/AragonApp.sol
Expand Up @@ -5,6 +5,7 @@
pragma solidity ^0.4.24;

import "./AppStorage.sol";
import "./IAragonApp.sol";
import "../acl/ACLSyntaxSugar.sol";
import "../common/Autopetrified.sol";
import "../common/ConversionHelpers.sol";
Expand All @@ -18,7 +19,7 @@ import "../evmscript/EVMScriptRunner.sol";
// Unless overriden, this behaviour enforces those contracts to be usable only behind an AppProxy.
// ReentrancyGuard, EVMScriptRunner, and ACLSyntaxSugar are not directly used by this contract, but
// are included so that they are automatically usable by subclassing contracts
contract AragonApp is AppStorage, Autopetrified, VaultRecoverable, ReentrancyGuard, EVMScriptRunner, ACLSyntaxSugar {
contract AragonApp is IAragonApp, AppStorage, Autopetrified, VaultRecoverable, ReentrancyGuard, EVMScriptRunner, ACLSyntaxSugar {
string private constant ERROR_AUTH_FAILED = "APP_AUTH_FAILED";

modifier auth(bytes32 _role) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/apps/IAragonApp.sol
Expand Up @@ -19,7 +19,7 @@ contract IAragonApp is ERC165 {
* @param _interfaceId The interface identifier being queried, as specified in ERC-165
* @return True if the contract implements the requested interface and if its not 0xffffffff, false otherwise
*/
function supportsInterface(bytes4 _interfaceId) public view returns (bool) {
function supportsInterface(bytes4 _interfaceId) public pure returns (bool) {
return super.supportsInterface(_interfaceId) || _interfaceId == ARAGON_APP_INTERFACE_ID;
}
}
2 changes: 1 addition & 1 deletion contracts/apps/disputable/IDisputable.sol
Expand Up @@ -35,7 +35,7 @@ contract IDisputable is ERC165 {
* @param _interfaceId The interface identifier being queried, as specified in ERC-165
* @return True if the contract implements the requested interface and if its not 0xffffffff, false otherwise
*/
function supportsInterface(bytes4 _interfaceId) public view returns (bool) {
function supportsInterface(bytes4 _interfaceId) public pure returns (bool) {
return super.supportsInterface(_interfaceId) || _interfaceId == DISPUTABLE_INTERFACE_ID;
}
}
2 changes: 1 addition & 1 deletion contracts/lib/arbitration/IArbitrable.sol
Expand Up @@ -56,7 +56,7 @@ contract IArbitrable is ERC165 {
* @param _interfaceId The interface identifier being queried, as specified in ERC-165
* @return True if this contract supports the given interface, false otherwise
*/
function supportsInterface(bytes4 _interfaceId) public view returns (bool) {
function supportsInterface(bytes4 _interfaceId) public pure returns (bool) {
return _interfaceId == ARBITRABLE_INTERFACE_ID || _interfaceId == ERC165_INTERFACE_ID;
}
}
2 changes: 1 addition & 1 deletion contracts/lib/standards/ERC165.sol
Expand Up @@ -13,7 +13,7 @@ contract ERC165 {
* @param _interfaceId The interface identifier being queried, as specified in ERC-165
* @return True if the contract implements the requested interface and if its not 0xffffffff, false otherwise
*/
function supportsInterface(bytes4 _interfaceId) public view returns (bool) {
function supportsInterface(bytes4 _interfaceId) public pure returns (bool) {
return _interfaceId == ERC165_INTERFACE_ID;
}
}

0 comments on commit 79389f2

Please sign in to comment.