issue 2 hours and 16 minutes into the course #1009
-
When starting with lesson 2 I've run into an error I can't figure out using this code: //SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import "./simplestorage.sol";
``
contract StorageFactory {
function createsimplestoragecontract() public {
simplestorage _simplestorage = new simplestorage();
}
}
**I'm running into this error:**
from solidity:
DeclarationError: Identifier not found or not unique.
--> contracts/storageFactory.sol:9:9:
|
9 | simplestorage _simplestorage = new simplestorage();
| ^^^^^^^^^^^^^ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @dariocodes
also on your contract you must use the simple storage contract:
Finally I see you have this:
As I said the contract names should be uppercase, so be sure to change it to: And the contract declaration should be like this:
|
Beta Was this translation helpful? Give feedback.
Hello @dariocodes
Contract (class) name should start with upper case so the correct syntax is:
SimpleStorage simpleStorage = new SimpleStorage();
also on your contract you must use the simple storage contract:
contract StorageFactory is SimpleStorage {}
Finally I see you have this:
import "./simplestorage.sol";
As I said the contract names should be uppercase, so be sure to change it to:
SimpleStorage
And the contract declaration should be like this:
contract SimpleStorage {}