aboutsummaryrefslogtreecommitdiffstats
path: root/test/compilationTests/zeppelin/token/TokenTimelock.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/token/TokenTimelock.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/token/TokenTimelock.sol')
-rw-r--r--test/compilationTests/zeppelin/token/TokenTimelock.sol41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/compilationTests/zeppelin/token/TokenTimelock.sol b/test/compilationTests/zeppelin/token/TokenTimelock.sol
new file mode 100644
index 00000000..595bf8d0
--- /dev/null
+++ b/test/compilationTests/zeppelin/token/TokenTimelock.sol
@@ -0,0 +1,41 @@
+pragma solidity ^0.4.11;
+
+
+import './ERC20Basic.sol';
+
+/**
+ * @title TokenTimelock
+ * @dev TokenTimelock is a token holder contract that will allow a
+ * beneficiary to extract the tokens after a given release time
+ */
+contract TokenTimelock {
+
+ // ERC20 basic token contract being held
+ ERC20Basic token;
+
+ // beneficiary of tokens after they are released
+ address beneficiary;
+
+ // timestamp when token release is enabled
+ uint releaseTime;
+
+ function TokenTimelock(ERC20Basic _token, address _beneficiary, uint _releaseTime) {
+ require(_releaseTime > now);
+ token = _token;
+ beneficiary = _beneficiary;
+ releaseTime = _releaseTime;
+ }
+
+ /**
+ * @dev beneficiary claims tokens held by time lock
+ */
+ function claim() {
+ require(msg.sender == beneficiary);
+ require(now >= releaseTime);
+
+ uint amount = token.balanceOf(this);
+ require(amount > 0);
+
+ token.transfer(beneficiary, amount);
+ }
+}