Add Prettier for linting and fix Solhint config (#2697)

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
Hadrien Croubois
2021-06-07 17:33:03 +02:00
committed by GitHub
parent e3661abe84
commit b0cf6fbb7a
134 changed files with 1816 additions and 1526 deletions

View File

@ -5,19 +5,19 @@ pragma solidity ^0.8.0;
import "../../access/Ownable.sol";
import "../Address.sol";
/**
* @title Escrow
* @dev Base escrow contract, holds funds designated for a payee until they
* withdraw them.
*
* Intended usage: This contract (and derived escrow contracts) should be a
* standalone contract, that only interacts with the contract that instantiated
* it. That way, it is guaranteed that all Ether will be handled according to
* the `Escrow` rules, and there is no need to check for payable functions or
* transfers in the inheritance tree. The contract that uses the escrow as its
* payment method should be its owner, and provide public methods redirecting
* to the escrow's deposit and withdraw.
*/
/**
* @title Escrow
* @dev Base escrow contract, holds funds designated for a payee until they
* withdraw them.
*
* Intended usage: This contract (and derived escrow contracts) should be a
* standalone contract, that only interacts with the contract that instantiated
* it. That way, it is guaranteed that all Ether will be handled according to
* the `Escrow` rules, and there is no need to check for payable functions or
* transfers in the inheritance tree. The contract that uses the escrow as its
* payment method should be its owner, and provide public methods redirecting
* to the escrow's deposit and withdraw.
*/
contract Escrow is Ownable {
using Address for address payable;

View File

@ -17,19 +17,23 @@ import "./ConditionalEscrow.sol";
contract RefundEscrow is ConditionalEscrow {
using Address for address payable;
enum State { Active, Refunding, Closed }
enum State {
Active,
Refunding,
Closed
}
event RefundsClosed();
event RefundsEnabled();
State private _state;
address payable immutable private _beneficiary;
address payable private immutable _beneficiary;
/**
* @dev Constructor.
* @param beneficiary_ The beneficiary of the deposits.
*/
constructor (address payable beneficiary_) {
constructor(address payable beneficiary_) {
require(beneficiary_ != address(0), "RefundEscrow: beneficiary is the zero address");
_beneficiary = beneficiary_;
_state = State.Active;
@ -71,7 +75,7 @@ contract RefundEscrow is ConditionalEscrow {
/**
* @dev Allows for refunds to take place, rejecting further deposits.
*/
function enableRefunds() public onlyOwner virtual {
function enableRefunds() public virtual onlyOwner {
require(state() == State.Active, "RefundEscrow: can only enable refunds while active");
_state = State.Refunding;
emit RefundsEnabled();