Using Visual Studio Code with the extension https://github.com/juanfranblanco/vscode-solidity I get the same error until I install the packages (takes a minute or two to compile).
Were the packages installed when you got this error?
Yeah, nothing changed since last week, same folder, same project, for some reason it is giving me errors today.
I created a new smart contract and here is the code snippet…
Smart Contract AST20.sol
pragma solidity >=0.5.0 <0.7.0;
/// 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";
contract AST20 is Initializable, Ownable, Pausable {
using SafeMath for uint256;
/// states
address aST20Owner;
/// events
event TokenDeployed(address _owner);
/// functions
/// initialize function
function initialize(
string memory tokenName,
string memory tokenTicker,
uint _DECIMALS,
uint256 _INITIALSUPPLY,
address tokenOwner,
address[] memory minters,
address[] memory pausers
)
public initializer
returns(address)
{
aST20Owner = tokenOwner;
Pausable.initialize(aST20Owner);
/// intantiate ERC20
StandaloneERC20 newStandaloneERC20 = new StandaloneERC20();
newStandaloneERC20.initialize(tokenName, tokenTicker, _DECIMALS, _INITIALSUPPLY, tokenOwner, minters, pausers);
emit TokenDeployed(address(newStandaloneERC20));
return address(newStandaloneERC20);
}
/// return the name of a token
function getTokenName(address tokenAddress)
public view
returns(string memory)
{
return tokenAddress.name();
}
}
oz check Error
$ oz check
✖ Compiling contracts with solc 0.5.11 (commit.c082d0b4)
Compilation errors:
contracts/AST20.sol:34:9: TypeError: Member "initialize" not found or not visible after argument-dependent lookup in contract StandaloneERC20.
newStandaloneERC20.initialize(tokenName, tokenTicker, _DECIMALS, _INITIALSUPPLY, tokenOwner, minters, pausers);
^---------------------------^
@abcoathup Any ideas? I bet it is a silly mistake somewhere.
The first issue reported was with imports, the second is with parameters being passed into the function not matching the types required by the function.
I created a new project, pasted in your contract and then added the dependencies
npm i @openzeppelin/upgrades
oz link @openzeppelin/contracts-ethereum-package
I then get the following error which is caused by _DECIMALS being declared as uint rather than uint8:
$ oz check
✖ Compiling contracts with solc 0.5.11 (commit.c082d0b4)
Compilation errors:
contracts/AST20.sol:34:9: TypeError: Member "initialize" not found or not visible after argument-dependent lookup in contract StandaloneERC20.
newStandaloneERC20.initialize(tokenName, tokenTicker, _DECIMALS, _INITIALSUPPLY, tokenOwner, minters, pausers);
^---------------------------^
Apologies if this is confusing, they are all related to the same thing I am trying to build…
Essentially I am trying to do the following and keep needing to change the approach, as I found out that the inherited functions are not showing up in Terminal when I am trying to test the API.
Trying to build
One instance of Registry Contract – STRegister.sol
One instance of Factory Contract – STFactory.sol
Multiple instances of StandaloneERC20 Contract – AST20.sol
Given AST20.sol is a slightly modified version of StandaloneERC20.sol and it inherits the following contracts (listed below), I was hoping to call the following functions (listed below) w/in the same contract or a separate contract.