gochain/web3

Cannot build.

bitcoinmeetups opened this issue · 12 comments

Hello,

I'm MB. A very nice and polite guy.

This is my contract:

// SPDX-License-Identifier: MIT pragma solidity 0.8.0;

import
"https://github.com/0xcert/ethereum-erc721/src
/contracts/tokens/nf-token-metadata.sol";
import
"https://github.com/0xcert/ethereum-erc721/src
/contracts/ownership/ownable.sol";

contract newNFT is NFTokenMetadata, Ownable {

constructor() {
nftName = "Synth NFT";
nftSymbol = "SYN";
}

function mint(address _to, uint256 _tokenId,
string calldata _uri) external onlyOwner {
super._mint(_to, _tokenId);
super._setTokenUri(_tokenId, _uri);
}

}

When I try to build using this command:

web3 contract build nft.sol

I get this error message:

ERROR: Cannot generate flattened file: read ./.: is a directory

No matter what I type, I don't get a bin file.

What OS are you using?

@bitcoinmeetups github imports are not supported in web3, please download it locally (clone) and import as local files

He's talking about these imports: import
"https://github.com/0xcert/ethereum-erc721/src
/contracts/tokens/nf-token-metadata.sol";

@r-gochain why wouldn't it support that if it's part of solidity now?

https://docs.soliditylang.org/en/v0.8.10/path-resolution.html

@treeder sure, let me check if we can support that in web3 (improve flattening algorithm or maybe just pass to solidity compiler as is)

Or maybe we don't flatten and just let solc do it's thing? I know it's nice to see the flattened file for verification and things, but if solc handles it, why not just use it?

Yes, I'm going to check whichever is easier

hmmm, so solc doesn't support these type of imports (latest version)

image

solcjs doesn't work either, seems like there are only 2 options

Ahh, I see, didn't realize that was remix only.