* signing prefix added
* Minor improvement
* Tests changed
* Successfully tested
* Minor improvements
* Minor improvements
* Revert "Dangling commas are now required. (#1359)"
This reverts commit a6889776f4.
* fixes #1358
* linting done
* suggested changes
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
const { ethGetBalance, ethSendTransaction } = require('./helpers/web3');
|
const { ethGetBalance, ethSendTransaction } = require('./helpers/web3');
|
||||||
|
const { sendEther } = require('./helpers/sendTransaction');
|
||||||
const expectEvent = require('./helpers/expectEvent');
|
const expectEvent = require('./helpers/expectEvent');
|
||||||
const { assertRevert } = require('./helpers/assertRevert');
|
const { assertRevert } = require('./helpers/assertRevert');
|
||||||
|
|
||||||
@ -17,13 +18,13 @@ contract('BreakInvariantBounty', function ([_, owner, researcher, anyone, nonTar
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('can set reward', async function () {
|
it('can set reward', async function () {
|
||||||
await ethSendTransaction({ from: owner, to: this.bounty.address, value: reward });
|
await sendEther(owner, this.bounty.address, reward);
|
||||||
(await ethGetBalance(this.bounty.address)).should.be.bignumber.equal(reward);
|
(await ethGetBalance(this.bounty.address)).should.be.bignumber.equal(reward);
|
||||||
});
|
});
|
||||||
|
|
||||||
context('with reward', function () {
|
context('with reward', function () {
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
await ethSendTransaction({ from: owner, to: this.bounty.address, value: reward });
|
await sendEther(owner, this.bounty.address, reward);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('destroy', function () {
|
describe('destroy', function () {
|
||||||
|
|||||||
@ -15,7 +15,16 @@ function sendTransaction (target, name, argsTypes, argsValues, opts) {
|
|||||||
return target.sendTransaction(Object.assign({ data: encodedData }, opts));
|
return target.sendTransaction(Object.assign({ data: encodedData }, opts));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sendEther (from, to, value) {
|
||||||
|
web3.eth.sendTransaction({
|
||||||
|
from: from,
|
||||||
|
to: to,
|
||||||
|
value: value,
|
||||||
|
gasPrice: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
module.exports = {
|
module.exports = {
|
||||||
findMethod,
|
findMethod,
|
||||||
sendTransaction,
|
sendTransaction,
|
||||||
|
sendEther,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
const { ethGetBalance, ethSendTransaction } = require('../helpers/web3');
|
const { ethGetBalance } = require('../helpers/web3');
|
||||||
|
const { sendEther } = require('./../helpers/sendTransaction');
|
||||||
|
|
||||||
const BigNumber = web3.BigNumber;
|
const BigNumber = web3.BigNumber;
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1,
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should accept payments', async function () {
|
it('should accept payments', async function () {
|
||||||
await ethSendTransaction({ from: owner, to: this.contract.address, value: amount });
|
await sendEther(owner, this.contract.address, amount);
|
||||||
|
|
||||||
(await ethGetBalance(this.contract.address)).should.be.bignumber.equal(amount);
|
(await ethGetBalance(this.contract.address)).should.be.bignumber.equal(amount);
|
||||||
});
|
});
|
||||||
@ -76,12 +77,12 @@ contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1,
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw if non-payee want to claim', async function () {
|
it('should throw if non-payee want to claim', async function () {
|
||||||
await ethSendTransaction({ from: payer1, to: this.contract.address, value: amount });
|
await sendEther(payer1, this.contract.address, amount);
|
||||||
await expectThrow(this.contract.release(nonpayee1), EVMRevert);
|
await expectThrow(this.contract.release(nonpayee1), EVMRevert);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should distribute funds to payees', async function () {
|
it('should distribute funds to payees', async function () {
|
||||||
await ethSendTransaction({ from: payer1, to: this.contract.address, value: amount });
|
await sendEther(payer1, this.contract.address, amount);
|
||||||
|
|
||||||
// receive funds
|
// receive funds
|
||||||
const initBalance = await ethGetBalance(this.contract.address);
|
const initBalance = await ethGetBalance(this.contract.address);
|
||||||
|
|||||||
Reference in New Issue
Block a user