1

I get a huge error message (~1MB) starting with

Error: invalid address (arg="_readAccess", coderType="address", value={"constructor":{"contractName":"SenderAccess","abi":[...

when executing a test written in TypeScript:

it("should be possible to create such an option", async () => {
    const accessControl = await SenderAccess.new(); // OK
    const validator = await NumberRangeValidation.new(1, 5); // OK
    // This will crash
    const option = await NumberConfigOptionDefinition.new('foo.bar.baz', accessControl, accessControl, validator);
});

The contract looks like this:

contract NumberConfigOptionDefinition is ConfigOptionDefinition {
    NumberValidation public validator;

    constructor(string memory _name, AccessControl _readAccess, AccessControl _writeAccess, NumberValidation _validator)
        ConfigOptionDefinition(_name, _readAccess, _writeAccess) public {
        validator = _validator;
    }
}

contract ConfigOptionDefinition {
    ... fields ...

    constructor(string memory _name, AccessControl _readAccess, AccessControl _writeAccess) internal {
        name = _name;
        readAccess = _readAccess;
        writeAccess = _writeAccess;
    }

What did I do wrong?

1
  • Can you console log the content of the accessControl variable?
    – wtk219
    Nov 22, 2019 at 18:36

1 Answer 1

0

Change this:

const option = await NumberConfigOptionDefinition.new(
    'foo.bar.baz',
    accessControl,
    accessControl,
    validator
);

To this:

const option = await NumberConfigOptionDefinition.new(
    'foo.bar.baz',
    accessControl.address,
    accessControl.address,
    validator.address
);
1
  • Now it starts to make sense: The huge dump is actually the JavaScript representation of the contract object! Thanks. Nov 27, 2019 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.