Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
aa6a44bb
Commit
aa6a44bb
authored
Sep 25, 2018
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert PullPayment to initializers
parent
10642d14
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
PullPaymentMock.sol
contracts/mocks/PullPaymentMock.sol
+5
-2
PullPayment.sol
contracts/payment/PullPayment.sol
+8
-3
No files found.
contracts/mocks/PullPaymentMock.sol
View file @
aa6a44bb
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 {
...
...
contracts/payment/PullPayment.sol
View file @
aa6a44bb
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();
}
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment