daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Aug 13th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pragma solidity ^0.4.0;
  2.  
  3. import './ERC20.sol';
  4.  
  5.  
  6. contract AccreditedToken is ERC20 {
  7.  
  8.     //Mapping of all approved investors who have been verified TODO: ADD VALUE FOR TIME ADDED
  9.     mapping(address => bool) public approvedInvestors;
  10.  
  11.     /**
  12.      * @dev Checks modifier and allows transfer if accreditation of proposed transferee address has been verified.
  13.      * @param _to The address that will receive the tokens.
  14.      * @param _value The amount of tokens to be transferred.
  15.      */
  16.     modifier accreditationVerified (address investorAddress) {
  17.         //Check tokenRegistered value to determine if registration statement filed
  18.         //If registration filed, modifier evaluates to true and returns to function
  19.         //If false, then proceeds to verify investor
  20.         //Evaluate if investorAddress stored in map of approved accredited investors
  21.         //Require bool value returned to evaluate to true
  22.         //otherwise, exit function
  23.         _;
  24.     }
  25.  
  26.     /**
  27.     * @dev Checks whether it can transfer or otherwise throws.
  28.      NOTE THIS RELATES TO TRANSFERFROM FUNCTION--NOT ACCREDITATION STATUS
  29.     */
  30.     modifier canTransfer(address _sender, uint256 _value) {
  31.         require(_value <= transferableTokens(_sender, uint64(now)));
  32.         _;
  33.     }
  34.  /**
  35.      * @dev Function that triggers API call to third party accreditation service to verify status approved
  36.      * @param _to The address that will receive the tokens.
  37.      * @param _value The amount of tokens to be transferred.
  38.      */
  39.  
  40.     function registrationFiled() returns (bool) {
  41.         //msg.sender must equal designated officers authorized to remove restriction on transfers;
  42.         //If true, sets value of registrationStatementFiled = true;
  43.         //otherwise, exit function
  44.     }
  45.  
  46.     /**
  47.      * @dev Function that triggers API call to third party accreditation service to verify status approved
  48.      * @param _to The address that will receive the tokens.
  49.      * @param _value The amount of tokens to be transferred.
  50.      */
  51.  
  52.     function establishAccreditation() returns (bool) {
  53.         //address _investor = msg.sender;
  54.         //Call API
  55.         //if true value returned, then add _investor address to map of approved investors;
  56.         //[TODO: ADD EXPIRATION TO APPROVAL;
  57.         //otherwise, exit function
  58.     }
  59.  
  60.     /**
  61.      * @dev Checks modifier and allows transfer if accreditation of proposed transferee address has been verified.
  62.      * @param _to The address that will receive the tokens.
  63.      * @param _value The amount of tokens to be transferred.
  64.      */
  65.     function transfer(address _to, uint256 _value) accreditationVerified(_to) returns (bool) {
  66.         return super.transfer(_to, _value);
  67.     }
  68.  
  69.     /**
  70.     * @dev Checks modifier and allows transfer if tokens are not locked.
  71.     * @param _from The address that will send the tokens.
  72.     * @param _to The address that will receive the tokens.
  73.     * @param _value The amount of tokens to be transferred.
  74.     */
  75.     function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) returns (bool) {
  76.         return super.transferFrom(_from, _to, _value);
  77.     }
  78.  
  79.     /**
  80.      * @dev Default transferable tokens function returns all tokens for a holder (no limit).
  81.      * @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the
  82.      * specific logic for limiting token transferability for a holder over time.
  83.      */
  84.     function transferableTokens(address holder, uint64 time) constant public returns (uint256) {
  85.         return balanceOf(holder);
  86. }
  87.  
  88.  
  89. }
RAW Paste Data
Top