-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move AragonApp to unstructured storage (#376)
- Loading branch information
Showing
16 changed files
with
266 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* SPDX-License-Identitifer: MIT | ||
*/ | ||
|
||
pragma solidity ^0.4.18; | ||
|
||
|
||
library UnstructuredStorage { | ||
function getStorageAddress(bytes32 position) internal view returns (address data) { | ||
assembly { data := sload(position) } | ||
} | ||
|
||
function getStorageBytes32(bytes32 position) internal view returns (bytes32 data) { | ||
assembly { data := sload(position) } | ||
} | ||
|
||
function getStorageUint256(bytes32 position) internal view returns (uint256 data) { | ||
assembly { data := sload(position) } | ||
} | ||
|
||
function setStorageAddress(bytes32 position, address data) internal { | ||
assembly { sstore(position, data) } | ||
} | ||
|
||
function setStorageBytes32(bytes32 position, bytes32 data) internal { | ||
assembly { sstore(position, data) } | ||
} | ||
|
||
function setStorageUint256(bytes32 position, uint256 data) internal { | ||
assembly { sstore(position, data) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
pragma solidity 0.4.18; | ||
|
||
import "../../contracts/apps/AppProxyPinned.sol"; | ||
import "../../contracts/kernel/IKernel.sol"; | ||
|
||
|
||
contract AppStubPinnedStorage is AppProxyPinned { | ||
bytes32 constant FAKE_APP_ID = keccak256('FAKE_APP_ID'); | ||
address constant FAKE_APP_ADDR = address(1); | ||
|
||
// Allow the mock to be created without any arguments | ||
function AppStubPinnedStorage() | ||
AppProxyPinned(IKernel(0), FAKE_APP_ID, new bytes(0)) | ||
public // solium-disable-line visibility-first | ||
{} | ||
|
||
// Overload base to return our own fake address | ||
function getAppBase(bytes32 _appId) internal view returns (address) { | ||
return FAKE_APP_ADDR; | ||
} | ||
|
||
function setPinnedCodeExt(address _pinnedCode) public { | ||
setPinnedCode(_pinnedCode); | ||
} | ||
|
||
function getPinnedCodePosition() public view returns (bytes32) { | ||
return PINNED_CODE_POSITION; | ||
} | ||
|
||
function pinnedCodeExt() public view returns (address) { | ||
return pinnedCode(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
pragma solidity 0.4.18; | ||
|
||
import "../../contracts/apps/AragonApp.sol"; | ||
|
||
|
||
contract AppStubStorage is AragonApp { | ||
function initialize() onlyInit public { | ||
initialized(); | ||
} | ||
|
||
function setKernelExt(IKernel _kernel) public { | ||
setKernel(_kernel); | ||
} | ||
|
||
function setAppIdExt(bytes32 _appId) public { | ||
setAppId(_appId); | ||
} | ||
|
||
function getKernelPosition() public view returns (bytes32) { | ||
return KERNEL_POSITION; | ||
} | ||
|
||
function getAppIdPosition() public view returns (bytes32) { | ||
return APP_ID_POSITION; | ||
} | ||
|
||
function getInitializationBlockPosition() public view returns (bytes32) { | ||
return INITIALIZATION_BLOCK_POSITION; | ||
} | ||
} |
Oops, something went wrong.