c9639c3860
* tests: add solidity test suite * tests: remove require strings * Update tests-solidity/init-test-node.sh * Update tests-solidity/init-test-node.sh Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
40 lines
1.2 KiB
Solidity
40 lines
1.2 KiB
Solidity
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/common/UnstructuredStorage.sol
|
|
// Adapted to use pragma ^0.5.17 and satisfy our linter rules
|
|
|
|
pragma solidity ^0.5.17;
|
|
|
|
|
|
library UnstructuredStorage {
|
|
function getStorageBool(bytes32 position) internal view returns (bool data) {
|
|
assembly { data := sload(position) }
|
|
}
|
|
|
|
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 setStorageBool(bytes32 position, bool data) internal {
|
|
assembly { sstore(position, data) }
|
|
}
|
|
|
|
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) }
|
|
}
|
|
}
|