Skip to content

Instantly share code, notes, and snippets.

@simondlr
Created March 5, 2018 10:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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