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
47585b11
Commit
47585b11
authored
Nov 24, 2017
by
Matt Condon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: make SplitPayment payable by default
parent
b7e7c765
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
13 deletions
+8
-13
SplitPayment.sol
contracts/payment/SplitPayment.sol
+6
-1
SplitPayment.js
test/SplitPayment.js
+2
-2
SplitPaymentMock.sol
test/helpers/SplitPaymentMock.sol
+0
-10
No files found.
contracts/payment/SplitPayment.sol
View file @
47585b11
...
@@ -20,7 +20,7 @@ contract SplitPayment {
...
@@ -20,7 +20,7 @@ contract SplitPayment {
/**
/**
* @dev Constructor
* @dev Constructor
*/
*/
function SplitPayment(address[] _payees, uint256[] _shares) public {
function SplitPayment(address[] _payees, uint256[] _shares) public
payable
{
require(_payees.length == _shares.length);
require(_payees.length == _shares.length);
for (uint256 i = 0; i < _payees.length; i++) {
for (uint256 i = 0; i < _payees.length; i++) {
...
@@ -62,4 +62,9 @@ contract SplitPayment {
...
@@ -62,4 +62,9 @@ contract SplitPayment {
payee.transfer(payment);
payee.transfer(payment);
}
}
/**
* @dev payable fallback
*/
function () public payable {}
}
}
test/SplitPayment.js
View file @
47585b11
...
@@ -6,7 +6,7 @@ const should = require('chai')
...
@@ -6,7 +6,7 @@ const should = require('chai')
.
should
()
.
should
()
const
EVMThrow
=
require
(
'./helpers/EVMThrow.js'
)
const
EVMThrow
=
require
(
'./helpers/EVMThrow.js'
)
const
SplitPayment
Mock
=
artifacts
.
require
(
'./helpers/SplitPaymentMock
.sol'
)
const
SplitPayment
=
artifacts
.
require
(
'../contracts/payment/SplitPayment
.sol'
)
contract
(
'SplitPayment'
,
function
([
owner
,
payee1
,
payee2
,
payee3
,
nonpayee1
,
payer1
])
{
contract
(
'SplitPayment'
,
function
([
owner
,
payee1
,
payee2
,
payee3
,
nonpayee1
,
payer1
])
{
const
amount
=
web3
.
toWei
(
1.0
,
'ether'
)
const
amount
=
web3
.
toWei
(
1.0
,
'ether'
)
...
@@ -15,7 +15,7 @@ contract('SplitPayment', function ([owner, payee1, payee2, payee3, nonpayee1, pa
...
@@ -15,7 +15,7 @@ contract('SplitPayment', function ([owner, payee1, payee2, payee3, nonpayee1, pa
this
.
payees
=
[
payee1
,
payee2
,
payee3
]
this
.
payees
=
[
payee1
,
payee2
,
payee3
]
this
.
shares
=
[
20
,
10
,
70
]
this
.
shares
=
[
20
,
10
,
70
]
this
.
contract
=
await
SplitPayment
Mock
.
new
(
this
.
payees
,
this
.
shares
)
this
.
contract
=
await
SplitPayment
.
new
(
this
.
payees
,
this
.
shares
)
})
})
it
(
'should accept payments'
,
async
function
()
{
it
(
'should accept payments'
,
async
function
()
{
...
...
test/helpers/SplitPaymentMock.sol
deleted
100644 → 0
View file @
b7e7c765
pragma solidity ^0.4.18;
import '../../contracts/payment/SplitPayment.sol';
// mock class using SplitPayment
contract SplitPaymentMock is SplitPayment {
function SplitPaymentMock(address[] _payees, uint256[] _shares) public
SplitPayment(_payees, _shares) payable {}
function () external payable {}
}
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