embark/test_apps/test_app/app/contracts/simple_storage.sol

47 lines
895 B
Solidity
Raw Normal View History

2017-10-22 09:38:54 -04:00
pragma solidity ^0.4.17;
2017-07-16 14:11:37 -04:00
import "ownable.sol";
2018-02-07 19:39:11 -05:00
library Assert {
event TestEvent(bool passed, string message);
function triggerEvent(bool passed, string message) internal {
2018-09-14 14:20:41 -04:00
emit TestEvent(passed, message);
2018-02-07 19:39:11 -05:00
}
}
2017-07-16 14:11:37 -04:00
contract SimpleStorage is Ownable {
2017-02-09 19:38:02 -05:00
uint public storedData;
2018-06-06 10:39:02 -04:00
address public registar;
2018-06-12 11:38:25 -04:00
event EventOnSet2(bool passed, string message);
2017-02-09 19:38:02 -05:00
2017-10-21 15:01:09 -04:00
function() public payable { }
2017-04-02 14:12:12 -04:00
2018-09-14 14:20:41 -04:00
constructor(uint initialValue) public {
2017-02-09 19:38:02 -05:00
storedData = initialValue;
}
2017-10-21 15:01:09 -04:00
function set(uint x) public {
2017-02-09 19:38:02 -05:00
storedData = x;
2018-02-07 19:39:11 -05:00
Assert.triggerEvent(true, "hi");
2017-02-09 19:38:02 -05:00
}
2018-09-14 14:20:41 -04:00
function set2(uint x) public onlyOwner {
storedData = x;
2018-06-12 11:38:25 -04:00
emit EventOnSet2(true, "hi");
}
2017-10-21 15:01:09 -04:00
function get() public view returns (uint retVal) {
2017-02-09 19:38:02 -05:00
return storedData;
}
2017-10-21 15:01:09 -04:00
function getS() public pure returns (string d) {
return "hello";
}
2018-06-06 10:39:02 -04:00
function setRegistar(address x) public {
registar = x;
}
2017-02-09 19:38:02 -05:00
}