convert PullPayment to initializers
This commit is contained in:
@ -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 {
|
||||
|
||||
@ -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 {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user