convert PullPayment to initializers

This commit is contained in:
Francisco Giordano
2018-09-25 19:38:15 -03:00
parent 10642d14ea
commit aa6a44bb20
2 changed files with 13 additions and 5 deletions

View File

@ -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 {

View File

@ -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();
}
}
/**