convert SplitPayment to initializers
This commit is contained in:
10
contracts/mocks/SplitPaymentMock.sol
Normal file
10
contracts/mocks/SplitPaymentMock.sol
Normal file
@ -0,0 +1,10 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
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);
|
||||
|
||||
|
||||
@ -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('SplitPaymentMock');
|
||||
|
||||
contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1, payer1]) {
|
||||
const amount = web3.toWei(1.0, 'ether');
|
||||
|
||||
Reference in New Issue
Block a user