Commit aa6a44bb by Francisco Giordano

convert PullPayment to initializers

parent 10642d14
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../payment/PullPayment.sol"; import "../payment/PullPayment.sol";
// mock class using PullPayment // 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 // test helper function to call asyncTransfer
function callTransfer(address dest, uint256 amount) public { function callTransfer(address dest, uint256 amount) public {
......
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "../Initializable.sol";
import "./Escrow.sol"; import "./Escrow.sol";
...@@ -8,11 +9,15 @@ import "./Escrow.sol"; ...@@ -8,11 +9,15 @@ import "./Escrow.sol";
* @dev Base contract supporting async send for pull payments. Inherit from this * @dev Base contract supporting async send for pull payments. Inherit from this
* contract and use _asyncTransfer instead of send or transfer. * contract and use _asyncTransfer instead of send or transfer.
*/ */
contract PullPayment { contract PullPayment is Initializable {
Escrow private _escrow; Escrow private _escrow;
constructor() public { function initialize() public initializer {
// conditional added to make initializer idempotent in case of diamond inheritance
if (address(_escrow) == address(0)) {
_escrow = new Escrow(); _escrow = new Escrow();
_escrow.initialize();
}
} }
/** /**
......
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