Advertisement
Guest User

Untitled

a guest
May 25th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. import 'erc20/erc20.sol'
  2. import 'feedbase/user.sol';
  3.  
  4. contract TokenOption is FeedBaseUser(0) {
  5. address _beneficiary;
  6. ERC20 _token;
  7. ERC20 _buy_with;
  8. address _optionee;
  9. uint _expiration;
  10. uint _price;
  11. function TokenOption(ERC20 token, address beneficiary, address optionee, uint strike_price, uint event_feed_id, uint expiration) {
  12. _token = token;
  13. _beneficiary = beneficiary;
  14. _optionee = optionee;
  15. _expiration = expiration;
  16. }
  17. function exercise() {
  18. if( msg.sender != _optionee ) {
  19. throw;
  20. }
  21. var (value,
  22. _buy_with.transferFrom(msg.sender, _beneficiary, _price);
  23. _token.transfer(_optionee, _token.balanceOf(this));
  24. }
  25. function reclaim() {
  26. if( msg.sender != _beneficiary ) {
  27. throw;
  28. }
  29. _token.transfer(_beneficiary, _token.balanceOf(this));
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement