From 2aa5dd26be11c93d1909bc0bce467e8845447d4c Mon Sep 17 00:00:00 2001 From: Leo Arias Date: Wed, 5 Sep 2018 08:24:26 -0600 Subject: [PATCH] Improve encapsulation on BreakInvariantBounty (#1267) * Improve encapsulation on BreakInvariantBounty * Make researchers private * Do not prefix getters --- contracts/bounties/BreakInvariantBounty.sol | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/contracts/bounties/BreakInvariantBounty.sol b/contracts/bounties/BreakInvariantBounty.sol index c889fbe60..878279aa0 100644 --- a/contracts/bounties/BreakInvariantBounty.sol +++ b/contracts/bounties/BreakInvariantBounty.sol @@ -9,8 +9,8 @@ import "../payment/PullPayment.sol"; * @dev This bounty will pay out to a researcher if they break invariant logic of the contract. */ contract BreakInvariantBounty is PullPayment, Ownable { - bool public claimed; - mapping(address => address) public researchers; + bool private claimed_; + mapping(address => address) private researchers; event TargetCreated(address createdAddress); @@ -18,7 +18,15 @@ contract BreakInvariantBounty is PullPayment, Ownable { * @dev Fallback function allowing the contract to receive funds, if they haven't already been claimed. */ function() external payable { - require(!claimed); + require(!claimed_); + } + + /** + * @dev Determine if the bounty was claimed. + * @return true if the bounty was claimed, false otherwise. + */ + function claimed() public view returns(bool) { + return claimed_; } /** @@ -43,7 +51,7 @@ contract BreakInvariantBounty is PullPayment, Ownable { // Check Target contract invariants require(!_target.checkInvariant()); _asyncTransfer(researcher, address(this).balance); - claimed = true; + claimed_ = true; } /**