embark/test_apps/contracts_app/contracts/simple_storage.sol

43 lines
784 B
Solidity

pragma solidity ^0.4.17;
import "ownable.sol";
library Assert {
event TestEvent(bool passed, string message);
function triggerEvent(bool passed, string message) internal {
emit TestEvent(passed, message);
}
}
contract SimpleStorage is Ownable {
uint public storedData;
function() public payable { }
constructor(uint initialValue) public {
storedData = initialValue;
}
function set(uint x) public {
storedData = x;
for(uint i = 0; i < 1000; i++) {
storedData += i;
}
Assert.triggerEvent(true, "hi");
}
function set2(uint x) public onlyOwner {
storedData = x;
}
function get() public view returns (uint retVal) {
return storedData;
}
function getS() public pure returns (string d) {
return "hello";
}
}