Skip to content

Latest commit

 

History

History
32 lines (25 loc) · 1.27 KB

File metadata and controls

32 lines (25 loc) · 1.27 KB

Used Design Pattern

  1. Factory One address can make many bounties. I think Factory Design Pattern like TokenFactory example is perfect for bounty-dapp.

  2. 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);
}
  1. 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.

  2. 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".

  3. Mortal I add Mortal contract to selfdestruct() contract when contract out of control. There's a two controller "Circuit Breaker" and "Mortal" contract.

Unused Design Pattern

  1. Speed Bump
    It can be used to prevent DoS attack. I'll supplement it later.

  2. Auto Deprecation
    I want to add Expired State in Contract. Then I will use auto deprecation pattern.