Skip to content

Instantly share code, notes, and snippets.

@eolszewski
Created August 22, 2018 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eolszewski/e818fbcdd3f3e98713410dbaa6550ea5 to your computer and use it in GitHub Desktop.
Save eolszewski/e818fbcdd3f3e98713410dbaa6550ea5 to your computer and use it in GitHub Desktop.
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