From 99c585fd8a11ff6e10e7f59632dc060fd05065a1 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 11 Jun 2018 18:12:23 +0100 Subject: [PATCH] Remove obsolete 'std' directory --- Changelog.md | 1 + std/StandardToken.sol | 59 ------------------------------------------- std/Token.sol | 13 ---------- std/mortal.sol | 10 -------- std/owned.sol | 15 ----------- std/std.sol | 6 ----- test/cmdlineTests.sh | 12 --------- 7 files changed, 1 insertion(+), 115 deletions(-) delete mode 100644 std/StandardToken.sol delete mode 100644 std/Token.sol delete mode 100644 std/mortal.sol delete mode 100644 std/owned.sol delete mode 100644 std/std.sol diff --git a/Changelog.md b/Changelog.md index f28278b3c..7125bd302 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,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. diff --git a/std/StandardToken.sol b/std/StandardToken.sol deleted file mode 100644 index c2fc3a669..000000000 --- a/std/StandardToken.sol +++ /dev/null @@ -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]; - } -} diff --git a/std/Token.sol b/std/Token.sol deleted file mode 100644 index 7348a8f52..000000000 --- a/std/Token.sol +++ /dev/null @@ -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); -} diff --git a/std/mortal.sol b/std/mortal.sol deleted file mode 100644 index c43f1e4f7..000000000 --- a/std/mortal.sol +++ /dev/null @@ -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); - } -} diff --git a/std/owned.sol b/std/owned.sol deleted file mode 100644 index 75007f3ec..000000000 --- a/std/owned.sol +++ /dev/null @@ -1,15 +0,0 @@ -pragma solidity ^0.4.22; - -contract owned { - address owner; - - modifier onlyowner() { - if (msg.sender == owner) { - _; - } - } - - constructor() public { - owner = msg.sender; - } -} diff --git a/std/std.sol b/std/std.sol deleted file mode 100644 index 4d65bef2a..000000000 --- a/std/std.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma solidity ^0.4.0; - -import "./owned.sol"; -import "./mortal.sol"; -import "./Token.sol"; -import "./StandardToken.sol"; diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index 74b6a5a7c..e8ff69de7 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -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) (