Draft EIP 1820 (#1677)

* Add barebones EIP1820 support.

* Update openzeppelin-test-helpers dependency to have ERC1820 support.

* Add tests for ERC1820.

* Improve inline documentation.

* Add changelog entry.

* Update test-helpers, refactor tests to use new helpers.

* Rename ERC1820 to ERC1820Implementer.

* Improve implementer docstring.

* Remove _implementsInterfaceForAddress.

* update openzeppelin-test-helpers to 0.2.0

* Update contracts/drafts/ERC1820Implementer.sol

Co-Authored-By: nventuro <nicolas.venturo@gmail.com>

* Fix how solidity coverage is run to allow for free events.

* Fix coverage testing script.
This commit is contained in:
Nicolás Venturo
2019-03-19 15:13:55 -03:00
committed by GitHub
parent 269e096c5a
commit 308a4c9907
17 changed files with 6847 additions and 136 deletions

View File

@ -30,13 +30,14 @@ contract('PullPayment', function ([_, payer, payee1, payee2]) {
});
it('can withdraw payment', async function () {
(await balance.difference(payee1, async () => {
await this.contract.callTransfer(payee1, amount, { from: payer });
(await this.contract.payments(payee1)).should.be.bignumber.equal(amount);
const balanceTracker = await balance.tracker(payee1);
await this.contract.withdrawPayments(payee1);
})).should.be.bignumber.equal(amount);
await this.contract.callTransfer(payee1, amount, { from: payer });
(await this.contract.payments(payee1)).should.be.bignumber.equal(amount);
await this.contract.withdrawPayments(payee1);
(await balanceTracker.delta()).should.be.bignumber.equal(amount);
(await this.contract.payments(payee1)).should.be.bignumber.equal('0');
});
});

View File

@ -52,10 +52,12 @@ function shouldBehaveLikeEscrow (primary, [payee1, payee2]) {
describe('withdrawals', async function () {
it('can withdraw payments', async function () {
(await balance.difference(payee1, async () => {
await this.escrow.deposit(payee1, { from: primary, value: amount });
await this.escrow.withdraw(payee1, { from: primary });
})).should.be.bignumber.equal(amount);
const balanceTracker = await balance.tracker(payee1);
await this.escrow.deposit(payee1, { from: primary, value: amount });
await this.escrow.withdraw(payee1, { from: primary });
(await balanceTracker.delta()).should.be.bignumber.equal(amount);
(await balance.current(this.escrow.address)).should.be.bignumber.equal('0');
(await this.escrow.depositsOf(payee1)).should.be.bignumber.equal('0');

View File

@ -64,9 +64,9 @@ contract('RefundEscrow', function ([_, primary, beneficiary, refundee1, refundee
});
it('allows beneficiary withdrawal', async function () {
(await balance.difference(beneficiary, () =>
this.escrow.beneficiaryWithdraw()
)).should.be.bignumber.equal(amount.muln(refundees.length));
const balanceTracker = await balance.tracker(beneficiary);
await this.escrow.beneficiaryWithdraw();
(await balanceTracker.delta()).should.be.bignumber.equal(amount.muln(refundees.length));
});
it('prevents entering the refund state', async function () {
@ -98,9 +98,9 @@ contract('RefundEscrow', function ([_, primary, beneficiary, refundee1, refundee
it('refunds refundees', async function () {
for (const refundee of [refundee1, refundee2]) {
(await balance.difference(refundee, () =>
this.escrow.withdraw(refundee, { from: primary }))
).should.be.bignumber.equal(amount);
const balanceTracker = await balance.tracker(refundee);
await this.escrow.withdraw(refundee, { from: primary });
(await balanceTracker.delta()).should.be.bignumber.equal(amount);
}
});