gochain / web3

A CLI tool to interact with web3 blockchains - Ethereum, GoChain, etc
https://gochain.io
Apache License 2.0
401 stars 88 forks source link

Cannot build. #233

Open bitcoinmeetups opened 2 years ago

bitcoinmeetups commented 2 years ago

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

bitcoinmeetups commented 2 years ago

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

treeder commented 2 years ago

What OS are you using?

r-gochain commented 2 years ago

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

treeder commented 2 years ago

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

r-gochain commented 2 years ago

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

treeder commented 2 years ago

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?

r-gochain commented 2 years ago

Yes, I'm going to check whichever is easier

r-gochain commented 2 years ago

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

image

r-gochain commented 2 years ago

so - https://docs.soliditylang.org/en/latest/layout-of-source-files.html#import-paths

r-gochain commented 2 years ago

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

r-gochain commented 2 years ago

https://github.com/ethereum/remix-project/blob/b52433aa7e123691481c9390dc504554a671f5c1/libs/remix-url-resolver/src/resolve.ts#L42-L74

treeder commented 2 years ago

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