-
I came across the following error when running cmd
Found 0 additional information about the error on the internet. Here is dependencies:
# taken from https://docs.openzeppelin.com/contracts/3.x/erc721#constructing_an_erc721_token_contract
- OpenZeppelin/[email protected]
compiler:
solc:
remappings:
- '@openzeppelin=OpenZeppelin/[email protected]'
dotenv: .env
wallets:
from_key: ${PRIVATE_KEY} Here is // SPDX-Licence-Identifier: MIT
pragma solidity 0.6.6; // also works fine with the ^0.8.0 version.
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract SimpleCollectible is ERC721 {
uint256 public tokenCounter;
constructor () public ERC721 ("Dogie", "DOG") {
tokenCounter = 0;
}
function createCollectible(string memory tokenURI) public returns (uint256) {
uint256 newTokenId = tokenCounter;
_safeMint(msg.sender, newTokenId);
_setTokenURI(newTokenId, tokenURI);
tokenCounter = tokenCounter + 1;
return newTokenId;
}
}
Here is from scripts.helpful_scripts import get_account
from brownie import SimpleCollectible
# If you can not see through this link you need to add an extension to your browser like IPFS Companion.
# tokenURI
sample_token_uri = "https://ipfs.io/ipfs/Qmd9MCGtdVz2miNumBHDbvj8bigSgTwnr4SbyH6DNnpWdt?filename=0-PUG.json"
# In order to view image of NFT.
OPENSEA_URL = "https://testnets.opensea.io/assets/{}/{}"
def main():
account = get_account()
simple_collectible = SimpleCollectible.deploy({"from": account})
tx = simple_collectible.createCollectible(sample_token_uri, {"from": account})
tx.wait(1)
print(
f"Awesome, you can view your NFT at {OPENSEA_URL.format(simple_collectible.address, simple_collectible.tokenCounter() - 1)}"
)
print("Please wait up to 20 minutes, and hit the refresh metadata button.")
from brownie import accounts, network, config
LOCAL_BLOCKCHAIN_ENVIRONMENTS = [
"development",
"ganache",
"hardhat",
"local-ganache",
"mainnet-fork",
]
def get_account(index=None, id=None):
if index:
return accounts[index]
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
return accounts[0]
if id:
return accounts.load(id)
if network.show_active() in config["networks"]:
return accounts.add(config["wallets"]["from_key"])
return None And an example of export PRIVATE_KEY=0xaxaxa
export WEB3_INFURA_PROJECT_ID=a7ceaxaxax
export ETHERSCAN_TOKEN=xxxaxax
Glad to hear any suggestions 😁 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hello @moonwake769 this is extremely weird because your syntax appears to be ok as you can see here so I think something is wrong with your brownie.. Please try this:
|
Beta Was this translation helpful? Give feedback.
Hello @moonwake769 this is extremely weird because your syntax appears to be ok as you can see here so I think something is wrong with your brownie.. Please try this: