daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Nov 8th, 2018 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pragma solidity ^0.4.24;
  2.  
  3. contract ERC20_Utility {
  4.   function transfer(address _sender, address _to, uint _amt) external returns (bool);
  5. }
  6.  
  7. contract RegisterAccount {
  8.  
  9.   // Maps addresses to registry status
  10.   mapping (address => bool) public registered;
  11.  
  12.   /**
  13.    * @dev Meta-ERC20-Transfer function. Requires that _to is a registered address
  14.    * @param _token The ERC20_Utility compatible token in which the transfer is being performed
  15.    * @param _to The intended recipient of the token transfer
  16.    * @param _amt The amount of tokens to transfer
  17.    * @return bool Whether the transfer was successful
  18.    */
  19.   function transferERC20(address _token, address _to, uint _amt) external returns (bool) {
  20.     // Ensure the destination is registered
  21.     require(registered[_to], "Destination not registered!");
  22.  
  23.     // Register the sender, if they are not registered already
  24.     if (!registered[msg.sender]) {
  25.       registered[msg.sender] = true;
  26.     }
  27.  
  28.     // Perform the transfer, ensure it returns 'true'
  29.     require(ERC20_Utility(_token).transfer(msg.sender, _to, _amt));
  30.     return true;
  31.   }
  32.  
  33.   /**
  34.    * @dev Allows an account to register themselves
  35.    */
  36.   function registerAccount() external {
  37.     require(!registered[msg.sender]);
  38.     registered[msg.sender] = true;
  39.   }
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top