gochain / web3

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

add http support for imports #233 #241

Open r-gochain opened 2 years ago

r-gochain commented 2 years ago

adds support of the following imports

pragma solidity ^0.8.10;

import "https://raw.githubusercontent.com/nibbstack/erc721/master/src/contracts/tokens/nf-token-metadata.sol";
import "https://raw.githubusercontent.com/nibbstack/erc721/master/src/contracts/tokens/nf-token.sol";
import "https://raw.githubusercontent.com/nibbstack/erc721/master/src/contracts/tokens/erc721-metadata.sol";
import "https://raw.githubusercontent.com/nibbstack/erc721/master/src/contracts/ownership/ownable.sol";
import "https://raw.githubusercontent.com/nibbstack/erc721/master/src/contracts/tokens/erc721.sol";
import "https://raw.githubusercontent.com/nibbstack/erc721/master/src/contracts/tokens/erc721-token-receiver.sol";
import "https://raw.githubusercontent.com/nibbstack/erc721/master/src/contracts/utils/erc165.sol";
import "https://raw.githubusercontent.com/nibbstack/erc721/master/src/contracts/utils/supports-interface.sol";
import "https://raw.githubusercontent.com/nibbstack/erc721/master/src/contracts/utils/address-utils.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);
}

}
r-gochain commented 2 years ago

@treeder wdyt? The downside is that it requires you to build a list of dependencies and explicitly mention all of them in the header (in theory we could scan every file for imports and try to resolve them)

treeder commented 2 years ago

Why can't we just let solc handle it?

r-gochain commented 2 years ago

@treeder because solc doesn't support that (only remix - they recommend using it) check this thread - https://github.com/gochain/web3/issues/233#issuecomment-1002952217