Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lock delegated tokens in a separate contract
- Loading branch information
Showing
5 changed files
with
99 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
Contract to allow an owning contract to receive tokens (ERC20, not ERC223), transfer them at will, and do absolutely nothing else. | ||
Used to allow DAO shareholders to lock tokens for vote delegation but prevent the DAO from doing anything with the locked tokens. | ||
Much thanks to @adamkolar on Github - https://github.com/ProjectWyvern/wyvern-ethereum/issues/4 | ||
*/ | ||
|
||
pragma solidity 0.4.18; | ||
|
||
import "zeppelin-solidity/contracts/token/ERC20.sol"; | ||
|
||
/** | ||
* @title TokenLocker | ||
* @author Project Wyvern Developers | ||
*/ | ||
contract TokenLocker { | ||
|
||
address public owner; | ||
|
||
ERC20 public token; | ||
|
||
/** | ||
* @dev Create a new TokenLocker contract | ||
* @param tokenAddr ERC20 token this contract will be used to lock | ||
*/ | ||
function TokenLocker (ERC20 tokenAddr) public { | ||
owner = msg.sender; | ||
token = tokenAddr; | ||
} | ||
|
||
/** | ||
* @dev Call the ERC20 `transfer` function on the underlying token contract | ||
* @param dest Token destination | ||
* @param amount Amount of tokens to be transferred | ||
*/ | ||
function transfer(address dest, uint amount) public returns (bool) { | ||
require(msg.sender == owner); | ||
return token.transfer(dest, amount); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters