Created
August 22, 2018 17:00
-
-
Save eolszewski/e818fbcdd3f3e98713410dbaa6550ea5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
pragma solidity ^0.4.19; | |
import "./EventStoreLib.sol"; | |
contract EventStore { | |
EventStoreLib.Storage store; | |
address public owner; | |
function () public payable { revert(); } | |
constructor() public { | |
owner = tx.origin; | |
} | |
function count() public view | |
returns (uint) { | |
return store.events.length; | |
} | |
function write(bytes32 key, bytes32 value) public { | |
EventStoreLib.write( | |
store, | |
key, | |
value | |
); | |
} | |
function read(uint index) public view | |
returns (uint, address, bytes32, bytes32 ) { | |
return EventStoreLib.read(store, index); | |
} | |
function destroy(address target) public { | |
require(msg.sender == owner); | |
selfdestruct(target); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment