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
884d5e01
Commit
884d5e01
authored
Sep 26, 2018
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert SplitPayment to initializers
parent
8d28bd44
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
+14
-3
SplitPaymentMock.sol
contracts/mocks/SplitPaymentMock.sol
+10
-0
SplitPayment.sol
contracts/payment/SplitPayment.sol
+3
-2
SplitPayment.test.js
test/payment/SplitPayment.test.js
+1
-1
No files found.
contracts/mocks/SplitPaymentMock.sol
0 → 100644
View file @
884d5e01
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../payment/SplitPayment.sol";
contract SplitPaymentMock is Initializable, SplitPayment {
constructor(address[] payees, uint256[] shares) public {
SplitPayment.initialize(payees, shares);
}
}
contracts/payment/SplitPayment.sol
View file @
884d5e01
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../math/SafeMath.sol";
...
...
@@ -8,7 +9,7 @@ import "../math/SafeMath.sol";
* @dev This contract can be used when payments need to be received by a group
* of people and split proportionately to some number of shares they own.
*/
contract SplitPayment {
contract SplitPayment
is Initializable
{
using SafeMath for uint256;
uint256 private _totalShares = 0;
...
...
@@ -21,7 +22,7 @@ contract SplitPayment {
/**
* @dev Constructor
*/
constructor(address[] payees, uint256[] shares) public payable
{
function initialize(address[] payees, uint256[] shares) public payable initializer
{
require(payees.length == shares.length);
require(payees.length > 0);
...
...
test/payment/SplitPayment.test.js
View file @
884d5e01
...
...
@@ -8,7 +8,7 @@ require('chai')
const
{
expectThrow
}
=
require
(
'../helpers/expectThrow'
);
const
{
EVMRevert
}
=
require
(
'../helpers/EVMRevert.js'
);
const
SplitPayment
=
artifacts
.
require
(
'SplitPayment'
);
const
SplitPayment
=
artifacts
.
require
(
'SplitPayment
Mock
'
);
contract
(
'SplitPayment'
,
function
([
_
,
owner
,
payee1
,
payee2
,
payee3
,
nonpayee1
,
payer1
])
{
const
amount
=
web3
.
toWei
(
1.0
,
'ether'
);
...
...
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