【发布时间】:2022-01-05 20:46:56
【问题描述】:
我收到以下错误:ChunkedEncodingError: ("Connection broken: ConnectionResetError(54, 'Connection reset by peer') 下载时:从https://solc-bin.ethereum.org/macosx-amd64/solc-macosx-amd64-v0.8.11+commit.d7f03943 下载。请告诉我如何解决这个问题。谢谢你提前!!!
代码如下:
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.11;
import "@chainlink/contracts/src/v0.4/ERC677Token.sol";
import {StandardToken as linkStandardToken} from "@chainlink/contracts/src/v0.4/vendor/StandardToken.sol";
contract LinkToken is linkStandardToken, ERC677Token {
uint256 public constant totalSupply = 10**27;
string public constant name = "ChainLink Token";
uint8 public constant decimals = 18;
string public constant symbol = "LINK";
function LinkToken() public {
balances[msg.sender] = totalSupply;
}
/**
* @dev transfer token to a specified address with additional data if the recipient is a contract.
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
* @param _data The extra data to be passed to the receiving contract.
*/
function transferAndCall(
address _to,
uint256 _value,
bytes _data
) public validRecipient(_to) returns (bool success) {
return super.transferAndCall(_to, _value, _data);
}
/**
* @dev transfer token to a specified address.
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value)
public
validRecipient(_to)
returns (bool success)
{
return super.transfer(_to, _value);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value)
public
validRecipient(_spender)
returns (bool)
{
return super.approve(_spender, _value);
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
) public validRecipient(_to) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
// MODIFIERS
modifier validRecipient(address _recipient) {
require(_recipient != address(0) && _recipient != address(this));
_;
}
}
这是一条错误消息:
Downloading from https://solc-bin.ethereum.org/macosx-amd64/solc-macosx-amd64-v0.8.11+commit.d7f03943
37%|████████████████████████████████████████████▉ | 14.2M/38.5M [00:53<01:32, 264kiB/s]
File "brownie/_cli/__main__.py", line 64, in main
importlib.import_module(f"brownie._cli.{cmd}").main()
File "brownie/_cli/run.py", line 40, in main
active_project = project.load()
File "brownie/project/main.py", line 751, in load
return Project(name, project_path)
File "brownie/project/main.py", line 183, in __init__
self.load()
File "brownie/project/main.py", line 238, in load
self._compile(changed, self._compiler_config, False)
File "brownie/project/main.py", line 95, in _compile
build_json = compiler.compile_and_format(
File "brownie/project/compiler/__init__.py", line 105, in compile_and_format
find_solc_versions(solc_sources, install_needed=True, silent=silent)
File "brownie/project/compiler/solidity.py", line 173, in find_solc_versions
install_solc(*to_install)
File "brownie/project/compiler/solidity.py", line 105, in install_solc
solcx.install_solc(version, show_progress=True)
File "solcx/install.py", line 454, in install_solc
_install_solc_unix(version, filename, show_progress, solcx_binary_path)
File "solcx/install.py", line 603, in _install_solc_unix
content = _download_solc(download, show_progress)
File "solcx/install.py", line 589, in _download_solc
for data in response.iter_content(1024, decode_unicode=True):
File "requests/utils.py", line 536, in stream_decode_response_unicode
for item in iterator:
File "requests/models.py", line 761, in generate
raise ChunkedEncodingError(e)
ChunkedEncodingError: ("Connection broken: ConnectionResetError(54, 'Connection reset by peer')", ConnectionResetError(54, 'Connection reset by peer'))
【问题讨论】:
-
好奇:你的代码的上下文是什么?为什么要使用这么旧版本的solidity?