web3 icon indicating copy to clipboard operation
web3 copied to clipboard

add http support for imports #233

Open r-gochain opened this issue 3 years ago • 3 comments

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 avatar Dec 30 '21 12:12 r-gochain

@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)

r-gochain avatar Dec 30 '21 13:12 r-gochain

Why can't we just let solc handle it?

treeder avatar Jan 03 '22 17:01 treeder

@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

r-gochain avatar Jan 04 '22 11:01 r-gochain