convert Escrow to initializers
This commit is contained in:
10
contracts/mocks/EscrowMock.sol
Normal file
10
contracts/mocks/EscrowMock.sol
Normal file
@ -0,0 +1,10 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "../Initializable.sol";
|
||||
import "../payment/Escrow.sol";
|
||||
|
||||
contract EscrowMock is Initializable, Escrow {
|
||||
constructor() public {
|
||||
Escrow.initialize();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "../Initializable.sol";
|
||||
import "../math/SafeMath.sol";
|
||||
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
|
||||
* deposit and withdraw.
|
||||
*/
|
||||
contract Escrow is Secondary {
|
||||
contract Escrow is Initializable, Secondary {
|
||||
using SafeMath for uint256;
|
||||
|
||||
event Deposited(address indexed payee, uint256 weiAmount);
|
||||
@ -19,6 +20,10 @@ contract Escrow is Secondary {
|
||||
|
||||
mapping(address => uint256) private _deposits;
|
||||
|
||||
function initialize() public initializer {
|
||||
Secondary.initialize();
|
||||
}
|
||||
|
||||
function depositsOf(address payee) public view returns (uint256) {
|
||||
return _deposits[payee];
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
const { shouldBehaveLikeEscrow } = require('./Escrow.behavior');
|
||||
|
||||
const Escrow = artifacts.require('Escrow');
|
||||
const Escrow = artifacts.require('EscrowMock');
|
||||
|
||||
contract('Escrow', function ([_, primary, ...otherAccounts]) {
|
||||
beforeEach(async function () {
|
||||
|
||||
Reference in New Issue
Block a user