Skip to content

Instantly share code, notes, and snippets.

@simondlr
Created March 5, 2018 10:07
Show Gist options
  • Save simondlr/dcfd2096debc3ba23101d0af178c026e to your computer and use it in GitHub Desktop.
Save simondlr/dcfd2096debc3ba23101d0af178c026e to your computer and use it in GitHub Desktop.
pragma solidity 0.4.19;
import "./utils/strings.sol"; // github.com/Arachnid/solidity-stringutils/strings.sol
contract Registry {
using strings for *;
event LogPublish(address issuer, address subject, bytes32 action, bytes32 contentType, string cid);
function publish(address[] _subjects, bytes32[] _actions, bytes32[] _contentTypes, string _cids) public {
require(_subjects.length == _actions.length && _actions.length == _contentTypes.length);
var prepCids = _cids.toSlice();
for (uint8 i = 0; i < _contentTypes.length; i++) {
string memory cid = prepCids.split("|".toSlice()).toString();
require(bytes(cid).length != 0);
LogPublish(msg.sender, _subjects[i], _actions[i], _contentTypes[i], cid);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment