Issue: Why can't we call the inherited smart contract functions

Background:

  • I have a Factory contract that calls a StandardERC20 contract from oz ethereum package
  • The StandardERC20 contract also has dependencies (ERC20Detailed, ERC20Mintable, ERC20Pausable)

Error:

  • Unable to build an API for the inherited functions (e.g. name(), symbol(), decimals(), mint(), transfer(), transferFrom(), approve(), increaseAllowance(), decreaseAllowance())
  • As I can’t find them in the Factory contract ABI

Factory Contract dependencies

/// dependencies
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/lifecycle/Pausable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/StandaloneERC20.sol";

StandardERC20 Contract dependencies

import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "./ERC20Detailed.sol";
import "./ERC20Mintable.sol";
import "./ERC20Pausable.sol";

Does anyone have any tips or come across the same issue?

1 Like

Hi @pkr,

You should be able to use truffle console to call functions on the StandaloneERC20 contract for manual testing.

You could also use tools such as OneClickDapp to create a test user interface. Once the contract is verified on Etherscan you can also use the user interface created by Etherscan.

Unfortunately OpenZeppelin CLI doesn’t currently support call or send-tx for non-upgradeable contracts, e.g. a contract deployed via a factory.

Which tool are you using to generate an API?

I suggest creating a cut down example of a simple factory contract creating an instance and ask the API project how to make this work.