diff --git a/contracts/mocks/PullPaymentMock.sol b/contracts/mocks/PullPaymentMock.sol index d6da3ed70..e4182066b 100644 --- a/contracts/mocks/PullPaymentMock.sol +++ b/contracts/mocks/PullPaymentMock.sol @@ -1,13 +1,16 @@ pragma solidity ^0.4.24; +import "../Initializable.sol"; import "../payment/PullPayment.sol"; // mock class using PullPayment -contract PullPaymentMock is PullPayment { +contract PullPaymentMock is Initializable, PullPayment { - constructor() public payable { } + constructor() public payable { + PullPayment.initialize(); + } // test helper function to call asyncTransfer function callTransfer(address dest, uint256 amount) public { diff --git a/contracts/payment/PullPayment.sol b/contracts/payment/PullPayment.sol index 8399fa4e1..03f3f8f75 100644 --- a/contracts/payment/PullPayment.sol +++ b/contracts/payment/PullPayment.sol @@ -1,5 +1,6 @@ pragma solidity ^0.4.24; +import "../Initializable.sol"; import "./Escrow.sol"; @@ -8,11 +9,15 @@ import "./Escrow.sol"; * @dev Base contract supporting async send for pull payments. Inherit from this * contract and use _asyncTransfer instead of send or transfer. */ -contract PullPayment { +contract PullPayment is Initializable { Escrow private _escrow; - constructor() public { - _escrow = new Escrow(); + function initialize() public initializer { + // conditional added to make initializer idempotent in case of diamond inheritance + if (address(_escrow) == address(0)) { + _escrow = new Escrow(); + _escrow.initialize(); + } } /**