-
Notifications
You must be signed in to change notification settings - Fork 36
/
blockads.sol
42 lines (34 loc) · 881 Bytes
/
blockads.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
pragma solidity ^0.4.8;
contract mortal {
address public owner;
function mortal() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) revert();
_;
}
function kill() onlyOwner {
selfdestruct(owner);
}
}
contract BlockCaster is mortal {
mapping(address=>Video) public videos;
event broadcasted(address from, string url);
struct Video {
string name;
uint8 length;
string url;
uint lastUpdate;
}
function broadcast(address _userAddress, string _name, uint8 _length, string _url) {
if (_userAddress != msg.sender) revert();
videos[_userAddress] = Video({
name: _name,
length: _length,
url: _url,
lastUpdate: now
});
broadcasted(_userAddress, _url);
}
}