aboutsummaryrefslogtreecommitdiffstats
path: root/test/compilationTests/zeppelin/ownership/HasNoTokens.sol
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-07-12 21:03:29 +0800
committerGitHub <noreply@github.com>2017-07-12 21:03:29 +0800
commit106acd9cbb827a39cd9bfd67866dafe0eeeb31de (patch)
treed51cec3ba7cad7ccad440312ae2e19a7a62d2509 /test/compilationTests/zeppelin/ownership/HasNoTokens.sol
parentfca8d781b4490026dce657fd344a1fe36c9179f2 (diff)
parentac84b36144f746662e5ddb984d283e053c7d06ba (diff)
downloaddexon-solidity-106acd9cbb827a39cd9bfd67866dafe0eeeb31de.tar.gz
dexon-solidity-106acd9cbb827a39cd9bfd67866dafe0eeeb31de.tar.zst
dexon-solidity-106acd9cbb827a39cd9bfd67866dafe0eeeb31de.zip
Merge pull request #2522 from ethereum/testCode
Added various contracts for testing.
Diffstat (limited to 'test/compilationTests/zeppelin/ownership/HasNoTokens.sol')
-rw-r--r--test/compilationTests/zeppelin/ownership/HasNoTokens.sol34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/compilationTests/zeppelin/ownership/HasNoTokens.sol b/test/compilationTests/zeppelin/ownership/HasNoTokens.sol
new file mode 100644
index 00000000..d1dc4b3e
--- /dev/null
+++ b/test/compilationTests/zeppelin/ownership/HasNoTokens.sol
@@ -0,0 +1,34 @@
+pragma solidity ^0.4.11;
+
+import "./Ownable.sol";
+import "../token/ERC20Basic.sol";
+
+/**
+ * @title Contracts that should not own Tokens
+ * @author Remco Bloemen <remco@2π.com>
+ * @dev This blocks incoming ERC23 tokens to prevent accidental loss of tokens.
+ * Should tokens (any ERC20Basic compatible) end up in the contract, it allows the
+ * owner to reclaim the tokens.
+ */
+contract HasNoTokens is Ownable {
+
+ /**
+ * @dev Reject all ERC23 compatible tokens
+ * @param from_ address The address that is transferring the tokens
+ * @param value_ uint256 the amount of the specified token
+ * @param data_ Bytes The data passed from the caller.
+ */
+ function tokenFallback(address from_, uint256 value_, bytes data_) external {
+ throw;
+ }
+
+ /**
+ * @dev Reclaim all ERC20Basic compatible tokens
+ * @param tokenAddr address The address of the token contract
+ */
+ function reclaimToken(address tokenAddr) external onlyOwner {
+ ERC20Basic tokenInst = ERC20Basic(tokenAddr);
+ uint256 balance = tokenInst.balanceOf(this);
+ tokenInst.transfer(owner, balance);
+ }
+}