Skip to content

Instantly share code, notes, and snippets.

@kyriediculous
Last active August 21, 2018 13:40
Show Gist options
  • Save kyriediculous/87e46d175d7bc55042f461ecd166c3e9 to your computer and use it in GitHub Desktop.
Save kyriediculous/87e46d175d7bc55042f461ecd166c3e9 to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.24;
contract BountyFactory {
address[] bounties;
function createBounty(bytes32 _reference, uint _deadline) external payable {
address newBounty = (new Bounty).value(msg.value)(_reference, msg.sender, _deadline, msg.value);
bounties.push(newBounty);
}
}
contract Bounty {
//STATE VARIABLES
address self;
bytes32 reference;
address issuer;
uint timestamp;
uint deadline;
uint reward;
statusOptions status;
Proposal[] proposals;
struct Proposal {
bytes32 reference;
address author;
bool accepted;
uint timestamp;
}
enum statusOptions {ACTIVE, COMPLETED, ABANDONED}
constructor(
bytes32 _reference,
address _issuer,
uint _deadline,
uint _reward) payable public {
require(_deadline > now, "Deadline must be a future date");
require(_reward > 0, "Reward must be greater than 0");
reference = _reference;
issuer = _issuer;
timestamp = now;
deadline = _deadline;
reward = _reward;
status = statusOptions.ACTIVE;
}
function getBounty() external view returns (bytes32, address, uint, uint, uint, statusOptions status) {
return (reference, issuer, timestamp, deadline, reward, status);
}
//FULL CODE ON GITHUB. ................
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment