Add ERC20 opt-in migration contract (#1054)

* Extract standard token behaviuor to reuse it in other tests

* Add opt in ERC20 migration contract

* Make migration contract not to depend from standard token

* Changes based on feedback

* Improve MigratableERC20 inline documentation

* move behaviors to behaviors directory

* refactor MigratableERC20 into ERC20Migrator

* fix errors

* change expectEvent to support multiple events with same name

* fix tests

* update documentation

* rename MigratableERC20 files to ERC20Migrator

* move to drafts

* test beginMigration

* rename to ERC20Migrator

* missing semicolon  (╯°□°)╯︵ ┻━┻

* add non-zero check

* improve documentation based on review comments

* improve test descriptions

* improve docs

* add getters

* fix contract

* improve tests
This commit is contained in:
Facundo Spagnuolo
2018-09-07 19:13:23 +02:00
committed by Francisco Giordano
parent 4b33eaefa2
commit 92133be7ea
9 changed files with 284 additions and 14 deletions

View File

@ -1,12 +1,24 @@
const should = require('chai').should();
function inLogs (logs, eventName, eventArgs = {}) {
const event = logs.find(e => e.event === eventName);
const event = logs.find(function (e) {
if (e.event === eventName) {
let matches = true;
for (const [k, v] of Object.entries(eventArgs)) {
if (e.args[k] !== v) {
matches = false;
}
}
if (matches) {
return true;
}
}
});
should.exist(event);
for (const [k, v] of Object.entries(eventArgs)) {
should.exist(event.args[k]);
event.args[k].should.equal(v);
}
return event;
}