Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'erc20/erc20.sol'
- import 'feedbase/user.sol';
- contract TokenOption is FeedBaseUser(0) {
- address _beneficiary;
- ERC20 _token;
- ERC20 _buy_with;
- address _optionee;
- uint _expiration;
- uint _price;
- function TokenOption(ERC20 token, address beneficiary, address optionee, uint strike_price, uint event_feed_id, uint expiration) {
- _token = token;
- _beneficiary = beneficiary;
- _optionee = optionee;
- _expiration = expiration;
- }
- function exercise() {
- if( msg.sender != _optionee ) {
- throw;
- }
- var (value,
- _buy_with.transferFrom(msg.sender, _beneficiary, _price);
- _token.transfer(_optionee, _token.balanceOf(this));
- }
- function reclaim() {
- if( msg.sender != _beneficiary ) {
- throw;
- }
- _token.transfer(_beneficiary, _token.balanceOf(this));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement