Created
March 5, 2018 10:07
-
-
Save simondlr/dcfd2096debc3ba23101d0af178c026e to your computer and use it in GitHub Desktop.
This file contains 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 "./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