Moved Escrows into an escrow subdirectory, improved docs. (#1430)

* Moved Escrows into an escrow subdirectory, improved docs.

* Fixed escrow mock.

* Fixed some more imports.

(cherry picked from commit f3df2dab3d)
This commit is contained in:
Nicolás Venturo
2018-10-17 17:22:25 -03:00
committed by Leo Arias
parent 88f48be287
commit c5a8680a9c
10 changed files with 35 additions and 24 deletions

View File

@ -2,7 +2,7 @@ pragma solidity ^0.4.24;
import "../../math/SafeMath.sol"; import "../../math/SafeMath.sol";
import "./FinalizableCrowdsale.sol"; import "./FinalizableCrowdsale.sol";
import "../../payment/RefundEscrow.sol"; import "../../payment/escrow/RefundEscrow.sol";
/** /**
* @title RefundableCrowdsale * @title RefundableCrowdsale

View File

@ -1,6 +1,6 @@
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "../payment/ConditionalEscrow.sol"; import "../payment/escrow/ConditionalEscrow.sol";
// mock class using ConditionalEscrow // mock class using ConditionalEscrow
contract ConditionalEscrowMock is ConditionalEscrow { contract ConditionalEscrowMock is ConditionalEscrow {

View File

@ -1,6 +1,6 @@
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "./Escrow.sol"; import "./escrow/Escrow.sol";
/** /**
* @title PullPayment * @title PullPayment

View File

@ -5,6 +5,7 @@ import "./Escrow.sol";
/** /**
* @title ConditionalEscrow * @title ConditionalEscrow
* @dev Base abstract escrow to only allow withdrawal if a condition is met. * @dev Base abstract escrow to only allow withdrawal if a condition is met.
* @dev Intended usage: See Escrow.sol. Same usage guidelines apply here.
*/ */
contract ConditionalEscrow is Escrow { contract ConditionalEscrow is Escrow {
/** /**

View File

@ -1,14 +1,19 @@
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "../math/SafeMath.sol"; import "../../math/SafeMath.sol";
import "../ownership/Secondary.sol"; import "../../ownership/Secondary.sol";
/** /**
* @title Escrow * @title Escrow
* @dev Base escrow contract, holds funds destinated to a payee until they * @dev Base escrow contract, holds funds designated for a payee until they
* withdraw them. The contract that uses the escrow as its payment method * withdraw them.
* should be its primary, and provide public methods redirecting to the escrow's * @dev Intended usage: This contract (and derived escrow contracts) should be a
* deposit and withdraw. * 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 primary, and provide public methods redirecting
* to the escrow's deposit and withdraw.
*/ */
contract Escrow is Secondary { contract Escrow is Secondary {
using SafeMath for uint256; using SafeMath for uint256;

View File

@ -4,9 +4,14 @@ import "./ConditionalEscrow.sol";
/** /**
* @title RefundEscrow * @title RefundEscrow
* @dev Escrow that holds funds for a beneficiary, deposited from multiple parties. * @dev Escrow that holds funds for a beneficiary, deposited from multiple
* The primary account may close the deposit period, and allow for either withdrawal * parties.
* by the beneficiary, or refunds to the depositors. * @dev Intended usage: See Escrow.sol. Same usage guidelines apply here.
* @dev The primary account (that is, the contract that instantiates this
* contract) may deposit, close the deposit period, and allow for either
* withdrawal by the beneficiary, or refunds to the depositors. All interactions
* with RefundEscrow will be made through the primary contract. See the
* RefundableCrowdsale contract for an example of RefundEscrows use.
*/ */
contract RefundEscrow is ConditionalEscrow { contract RefundEscrow is ConditionalEscrow {
enum State { Active, Refunding, Closed } enum State { Active, Refunding, Closed }

View File

@ -1,7 +1,7 @@
const { shouldBehaveLikeEscrow } = require('./Escrow.behavior'); const { shouldBehaveLikeEscrow } = require('./Escrow.behavior');
const shouldFail = require('../helpers/shouldFail'); const shouldFail = require('../../helpers/shouldFail');
const { ether } = require('../helpers/ether'); const { ether } = require('../../helpers/ether');
const BigNumber = web3.BigNumber; const BigNumber = web3.BigNumber;

View File

@ -1,7 +1,7 @@
const expectEvent = require('../helpers/expectEvent'); const expectEvent = require('../../helpers/expectEvent');
const shouldFail = require('../helpers/shouldFail'); const shouldFail = require('../../helpers/shouldFail');
const { ethGetBalance } = require('../helpers/web3'); const { ethGetBalance } = require('../../helpers/web3');
const { ether } = require('../helpers/ether'); const { ether } = require('../../helpers/ether');
const BigNumber = web3.BigNumber; const BigNumber = web3.BigNumber;

View File

@ -1,8 +1,8 @@
const shouldFail = require('../helpers/shouldFail'); const shouldFail = require('../../helpers/shouldFail');
const expectEvent = require('../helpers/expectEvent'); const expectEvent = require('../../helpers/expectEvent');
const { ethGetBalance } = require('../helpers/web3'); const { ethGetBalance } = require('../../helpers/web3');
const { ether } = require('../helpers/ether'); const { ether } = require('../../helpers/ether');
const { ZERO_ADDRESS } = require('../helpers/constants'); const { ZERO_ADDRESS } = require('../../helpers/constants');
const BigNumber = web3.BigNumber; const BigNumber = web3.BigNumber;