Commit 884d5e01 by Francisco Giordano

convert SplitPayment to initializers

parent 8d28bd44
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);
}
}
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../math/SafeMath.sol"; import "../math/SafeMath.sol";
...@@ -8,7 +9,7 @@ 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 * @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. * of people and split proportionately to some number of shares they own.
*/ */
contract SplitPayment { contract SplitPayment is Initializable {
using SafeMath for uint256; using SafeMath for uint256;
uint256 private _totalShares = 0; uint256 private _totalShares = 0;
...@@ -21,7 +22,7 @@ contract SplitPayment { ...@@ -21,7 +22,7 @@ contract SplitPayment {
/** /**
* @dev Constructor * @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 == shares.length);
require(payees.length > 0); require(payees.length > 0);
......
...@@ -8,7 +8,7 @@ require('chai') ...@@ -8,7 +8,7 @@ require('chai')
const { expectThrow } = require('../helpers/expectThrow'); const { expectThrow } = require('../helpers/expectThrow');
const { EVMRevert } = require('../helpers/EVMRevert.js'); 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]) { contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1, payer1]) {
const amount = web3.toWei(1.0, 'ether'); const amount = web3.toWei(1.0, 'ether');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment