I'm going through Maker's OTC contract and they have this:

function isTokenPairWhitelisted(
    ERC20 baseToken,
    ERC20 quoteToken
    returns (bool)
    return (_menu[keccak256(baseToken, quoteToken)] || _menu[keccak256(quoteToken, baseToken)]);

I'm trying to interact with it in truffle, but this isn't working:

  test1 = await ERC20.new();
  test2 = await ERC20.new();
  await oasisDex.isTokenPairWhitelisted(test1,test2);

I get the 'Invalid number of arguments to Solidity function'. Any idea?


Web3 v0.x: await oasisDex.isTokenPairWhitelisted(test1.address,test2.address);

Web3 v1.x: await oasisDex.isTokenPairWhitelisted(test1._address,test2._address);

Web3 v0.x is used in all Truffle versions up to v4.1.14, and possibly even later.

In addition, you might want to obtain the returned value (i.e., var x = await ...).

| improve this answer | |
  • Thanks! So it's just the address? why do they have it specified as the whole contract? – thefett Sep 26 '18 at 18:08
  • To let you know that they expect this contract to be deployed at the addresses that you provide. – goodvibration Sep 26 '18 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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