-
Factory One address can make many bounties. I think Factory Design Pattern like TokenFactory example is perfect for bounty-dapp.
-
Restricting Access
Some functions should run by owner. So I use Restrict Access Pattern by using modifier onlyOwner inherited from openzeppelin Owner.sol.
modifier onlyOwner {
require(msg.sender == owner);
}-
Circuit Breaker
In emergency, Circuit Breaker will work and All the functions stopped. Only Owner can use the contract in emergency, so Circuit Breaker contract inherits Owner contract. -
State machines
Bounty State is work by State. Now there are two state "Posted" and "Finished".
In Posted state, hunters can submit work and bounty owner can accept their work.
In Finished state, hunters can't submit work and bounty Owner send ether to their account.
I will add more state like "Expired". -
Mortal I add Mortal contract to selfdestruct() contract when contract out of control. There's a two controller "Circuit Breaker" and "Mortal" contract.
-
Speed Bump
It can be used to prevent DoS attack. I'll supplement it later. -
Auto Deprecation
I want to add Expired State in Contract. Then I will use auto deprecation pattern.