Created
July 5, 2016 10:42
-
-
Save blackyblack/079d8cabf8d8b24008745b4b840cf3c5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* A contract to store a list of messages. Obtainable as events. */ | |
/* Deployment: | |
Owner: 0xeb5fa6cbf2aca03a0df228f2df67229e2d3bd01e | |
Last address: 0xd39fe1cffd8f070429169b416b7e07f486d553cf | |
ABI: [{"constant":false,"inputs":[{"name":"datainfo","type":"string"},{"name":"version","type":"uint256"},{"name":"datatype","type":"uint256"},{"name":"timespan","type":"uint256"}],"name":"add","outputs":[],"type":"function"},{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"},{"constant":false,"inputs":[],"name":"flush","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"contentCount","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"inputs":[],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"datainfo","type":"string"},{"indexed":true,"name":"version","type":"uint256"},{"indexed":true,"name":"sender","type":"address"},{"indexed":true,"name":"datatype","type":"uint256"},{"indexed":false,"name":"timespan","type":"uint256"},{"indexed":false,"name":"payment","type":"uint256"}],"name":"content","type":"event"}] | |
Optimized: yes | |
Solidity version: 0.3.2-9e36bdda | |
*/ | |
contract store { | |
address owner; | |
uint public contentCount = 0; | |
event content(string datainfo, uint indexed version, address indexed sender, uint indexed datatype, uint timespan, uint payment); | |
modifier onlyowner { if (msg.sender == owner) _ } | |
function store() public { owner = msg.sender; } | |
///TODO: remove in release | |
function kill() onlyowner { suicide(owner); } | |
function flush() onlyowner { | |
owner.send(this.balance); | |
} | |
function add(string datainfo, uint version, uint datatype, uint timespan) { | |
//item listing | |
if(datatype == 1) { | |
//2 weeks listing costs 0,04 USD = 0,004 ether | |
if(timespan <= 1209600) { | |
if(msg.value < (4 finney)) return; | |
//4 weeks listing costs 0,06 USD = 0,006 ether | |
} else if(timespan <= 2419200) { | |
if(msg.value < (6 finney)) return; | |
//limit 4 weeks max | |
} else { | |
timespan = 2419200; | |
if(msg.value < (6 finney)) return; | |
} | |
} | |
//revert higher payment transactions | |
if(msg.value > (6 finney)) throw; | |
contentCount++; | |
content(datainfo, version, msg.sender, datatype, timespan, msg.value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment