Skip to content

Commit

Permalink
add another example contract
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Meister <[email protected]>
  • Loading branch information
MaximilianMeister committed Apr 23, 2017
1 parent eaa31a2 commit ef3bf99
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions contracts/blockshaper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
pragma solidity ^0.4.8;

contract mortal {
address public owner;

function mortal() {
owner = msg.sender;
}

modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}

function kill() onlyOwner {
suicide(owner);
}
}

contract Blockshaper is mortal {
mapping(address=>Video) public videos;

event broadcasted(address from, string url);

struct Video {
string name;
bool active;
uint8 length;
string webmUrl;
uint lastUpdate;
}

function broadcast(address _userAddress, string _name, bool _active, uint8 _videoLength, string _webmUrl) {
if (_userAddress != msg.sender) throw;
videos[_userAddress] = Video({
name: _name,
active: _active,
length: _videoLength,
webmUrl: _webmUrl,
lastUpdate: now
});
broadcasted(_userAddress, _webmUrl);
}
}

0 comments on commit ef3bf99

Please sign in to comment.