Last active
August 21, 2018 13:37
-
-
Save kyriediculous/bdf090dfdd9cbedc7767246ab3311fcd to your computer and use it in GitHub Desktop.
Bounties-Monolith
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.24; | |
contract Bounties { | |
enum statusOptions {ACTIVE, COMPLETED, ABANDONED} | |
struct Bounty { | |
bytes32 reference; | |
address issuer; | |
uint timestamp; | |
uint deadline; | |
uint reward; | |
statusOptions status; | |
Proposal[] proposals; | |
} | |
struct Proposal { | |
bytes32 reference; | |
address author; | |
bool accepted; | |
uint timestamp; | |
} | |
Bounty[] bounties; | |
function createBounty(bytes32 _reference, uint _deadline) payable external { | |
require(msg.value > 0); | |
require(_deadline > now); | |
bounties.length++; | |
bounties[bounties.length-1].reference = _reference; | |
bounties[bounties.length-1].timestamp = now; | |
bounties[bounties.length-1].deadline = _deadline; | |
bounties[bounties.length-1].status = statusOptions.ACTIVE; | |
bounties[bounties.length-1].issuer = msg.sender; | |
bounties[bounties.length-1].reward = msg.value; | |
bounties[bountyCount] = newBounty; | |
bountyCount++; | |
} | |
function getBounty(uint _id) external view returns (bytes32, address, uint, uint, uint, statusOptions) { | |
return ( | |
bounties[_id].reference, | |
bounties[_id].issuer, | |
bounties[_id].timestamp, | |
bounties[_id].deadline, | |
bounties[_id].reward, | |
bounties[_id].status | |
); | |
} | |
//FULL CODE ON GITHUB...................... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment