Merge pull request #4265 from ethereum/remove-std

Remove obsolete 'std' directory
This commit is contained in:
chriseth 2018-06-12 16:59:51 +02:00 committed by GitHub
commit 2c8eca5dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 1 additions and 115 deletions

View File

@ -13,6 +13,7 @@ Breaking Changes:
* Type Checker: Disallow arithmetic operations for Boolean variables.
* Disallow trailing dots that are not followed by a number.
* Remove assembly instructions ``sha3`` and ``suicide``
* Remove obsolete ``std`` directory from the Solidity repository. This means accessing ``https://github.com/ethereum/soldity/blob/develop/std/*.sol`` (or ``https://github.com/ethereum/solidity/std/*.sol`` in Remix) will not be possible.
Language Features:
* General: Allow appending ``calldata`` keyword to types, to explicitly specify data location for arguments of external functions.

View File

@ -1,59 +0,0 @@
pragma solidity ^0.4.22;
import "./Token.sol";
contract StandardToken is Token {
uint256 supply;
mapping (address => uint256) balance;
mapping (address =>
mapping (address => uint256)) m_allowance;
constructor(address _initialOwner, uint256 _supply) public {
supply = _supply;
balance[_initialOwner] = _supply;
}
function balanceOf(address _account) view public returns (uint) {
return balance[_account];
}
function totalSupply() view public returns (uint) {
return supply;
}
function transfer(address _to, uint256 _value) public returns (bool success) {
return doTransfer(msg.sender, _to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
if (m_allowance[_from][msg.sender] >= _value) {
if (doTransfer(_from, _to, _value)) {
m_allowance[_from][msg.sender] -= _value;
}
return true;
} else {
return false;
}
}
function doTransfer(address _from, address _to, uint _value) internal returns (bool success) {
if (balance[_from] >= _value && balance[_to] + _value >= balance[_to]) {
balance[_from] -= _value;
balance[_to] += _value;
emit Transfer(_from, _to, _value);
return true;
} else {
return false;
}
}
function approve(address _spender, uint256 _value) public returns (bool success) {
m_allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) view public returns (uint256) {
return m_allowance[_owner][_spender];
}
}

View File

@ -1,13 +0,0 @@
pragma solidity ^0.4.0;
contract Token {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function totalSupply() view public returns (uint256 supply);
function balanceOf(address _owner) view public returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) view public returns (uint256 remaining);
}

View File

@ -1,10 +0,0 @@
pragma solidity ^0.4.0;
import "./owned.sol";
contract mortal is owned {
function kill() public {
if (msg.sender == owner)
selfdestruct(owner);
}
}

View File

@ -1,15 +0,0 @@
pragma solidity ^0.4.22;
contract owned {
address owner;
modifier onlyowner() {
if (msg.sender == owner) {
_;
}
}
constructor() public {
owner = msg.sender;
}
}

View File

@ -1,6 +0,0 @@
pragma solidity ^0.4.0;
import "./owned.sol";
import "./mortal.sol";
import "./Token.sol";
import "./StandardToken.sol";

View File

@ -37,10 +37,6 @@ FULLARGS="--optimize --ignore-missing --combined-json abi,asm,ast,bin,bin-runtim
echo "Checking that the bug list is up to date..."
"$REPO_ROOT"/scripts/update_bugs_by_version.py
echo "Checking that StandardToken.sol, owned.sol and mortal.sol produce bytecode..."
output=$("$REPO_ROOT"/build/solc/solc --bin "$REPO_ROOT"/std/*.sol 2>/dev/null | grep "ffff" | wc -l)
test "${output//[[:blank:]]/}" = "3"
function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput sgr0)"; }
function printError() { echo "$(tput setaf 1)$1$(tput sgr0)"; }
@ -113,14 +109,6 @@ do
done
)
printTask "Compiling all files in std and examples..."
for f in "$REPO_ROOT"/std/*.sol
do
echo "$f"
compileWithoutWarning "$f"
done
printTask "Compiling all examples from the documentation..."
TMPDIR=$(mktemp -d)
(