Commit 10642d14 by Francisco Giordano

convert Escrow to initializers

parent 6ac45333
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../payment/Escrow.sol";
contract EscrowMock is Initializable, Escrow {
constructor() public {
Escrow.initialize();
}
}
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../math/SafeMath.sol"; import "../math/SafeMath.sol";
import "../ownership/Secondary.sol"; import "../ownership/Secondary.sol";
...@@ -11,7 +12,7 @@ import "../ownership/Secondary.sol"; ...@@ -11,7 +12,7 @@ import "../ownership/Secondary.sol";
* should be its primary, and provide public methods redirecting to the escrow's * should be its primary, and provide public methods redirecting to the escrow's
* deposit and withdraw. * deposit and withdraw.
*/ */
contract Escrow is Secondary { contract Escrow is Initializable, Secondary {
using SafeMath for uint256; using SafeMath for uint256;
event Deposited(address indexed payee, uint256 weiAmount); event Deposited(address indexed payee, uint256 weiAmount);
...@@ -19,6 +20,10 @@ contract Escrow is Secondary { ...@@ -19,6 +20,10 @@ contract Escrow is Secondary {
mapping(address => uint256) private _deposits; mapping(address => uint256) private _deposits;
function initialize() public initializer {
Secondary.initialize();
}
function depositsOf(address payee) public view returns (uint256) { function depositsOf(address payee) public view returns (uint256) {
return _deposits[payee]; return _deposits[payee];
} }
......
const { shouldBehaveLikeEscrow } = require('./Escrow.behavior'); const { shouldBehaveLikeEscrow } = require('./Escrow.behavior');
const Escrow = artifacts.require('Escrow'); const Escrow = artifacts.require('EscrowMock');
contract('Escrow', function ([_, primary, ...otherAccounts]) { contract('Escrow', function ([_, primary, ...otherAccounts]) {
beforeEach(async function () { beforeEach(async function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment