github.com/status-im/status-go@v1.1.0/contracts/snt/snt.sol (about)

     1  // This solidity file was added to the project to generate the ABI to consume
     2  // the smart contract deployed at 0x744d70fdbe2ba4cf95131626614a1763df805b9e
     3  
     4  pragma solidity ^0.4.11;
     5  
     6  // Abstract contract for the full ERC 20 Token standard
     7  // https://github.com/ethereum/EIPs/issues/20
     8  
     9  contract ERC20Token {
    10      /* This is a slight change to the ERC20 base standard.
    11      function totalSupply() constant returns (uint256 supply);
    12      is replaced with:
    13      uint256 public totalSupply;
    14      This automatically creates a getter function for the totalSupply.
    15      This is moved to the base contract since public getter functions are not
    16      currently recognised as an implementation of the matching abstract
    17      function by the compiler.
    18      */
    19      /// total amount of tokens
    20      uint256 public totalSupply;
    21  
    22      /// @param _owner The address from which the balance will be retrieved
    23      /// @return The balance
    24      function balanceOf(address _owner) constant returns (uint256 balance);
    25  
    26      /// @notice send `_value` token to `_to` from `msg.sender`
    27      /// @param _to The address of the recipient
    28      /// @param _value The amount of token to be transferred
    29      /// @return Whether the transfer was successful or not
    30      function transfer(address _to, uint256 _value) returns (bool success);
    31  
    32      /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
    33      /// @param _from The address of the sender
    34      /// @param _to The address of the recipient
    35      /// @param _value The amount of token to be transferred
    36      /// @return Whether the transfer was successful or not
    37      function transferFrom(
    38          address _from,
    39          address _to,
    40          uint256 _value
    41      ) returns (bool success);
    42  
    43      /// @notice `msg.sender` approves `_spender` to spend `_value` tokens
    44      /// @param _spender The address of the account able to transfer the tokens
    45      /// @param _value The amount of tokens to be approved for transfer
    46      /// @return Whether the approval was successful or not
    47      function approve(address _spender, uint256 _value) returns (bool success);
    48  
    49      /// @param _owner The address of the account owning tokens
    50      /// @param _spender The address of the account able to transfer the tokens
    51      /// @return Amount of remaining tokens allowed to spent
    52      function allowance(address _owner, address _spender)
    53          constant
    54          returns (uint256 remaining);
    55  
    56      event Transfer(address indexed _from, address indexed _to, uint256 _value);
    57      event Approval(
    58          address indexed _owner,
    59          address indexed _spender,
    60          uint256 _value
    61      );
    62  }
    63  
    64  /*
    65      Copyright 2016, Jordi Baylina
    66  
    67      This program is free software: you can redistribute it and/or modify
    68      it under the terms of the GNU General Public License as published by
    69      the Free Software Foundation, either version 3 of the License, or
    70      (at your option) any later version.
    71  
    72      This program is distributed in the hope that it will be useful,
    73      but WITHOUT ANY WARRANTY; without even the implied warranty of
    74      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    75      GNU General Public License for more details.
    76  
    77      You should have received a copy of the GNU General Public License
    78      along with this program.  If not, see <http://www.gnu.org/licenses/>.
    79   */
    80  
    81  /// @title MiniMeToken Contract
    82  /// @author Jordi Baylina
    83  /// @dev This token contract's goal is to make it easy for anyone to clone this
    84  ///  token using the token distribution at a given block, this will allow DAO's
    85  ///  and DApps to upgrade their features in a decentralized manner without
    86  ///  affecting the original token
    87  /// @dev It is ERC20 compliant, but still needs to under go further testing.
    88  
    89  /// @dev The token controller contract must implement these functions
    90  contract TokenController {
    91      /// @notice Called when `_owner` sends ether to the MiniMe Token contract
    92      /// @param _owner The address that sent the ether to create tokens
    93      /// @return True if the ether is accepted, false if it throws
    94      function proxyPayment(address _owner) payable returns (bool);
    95  
    96      /// @notice Notifies the controller about a token transfer allowing the
    97      ///  controller to react if desired
    98      /// @param _from The origin of the transfer
    99      /// @param _to The destination of the transfer
   100      /// @param _amount The amount of the transfer
   101      /// @return False if the controller does not authorize the transfer
   102      function onTransfer(
   103          address _from,
   104          address _to,
   105          uint256 _amount
   106      ) returns (bool);
   107  
   108      /// @notice Notifies the controller about an approval allowing the
   109      ///  controller to react if desired
   110      /// @param _owner The address that calls `approve()`
   111      /// @param _spender The spender in the `approve()` call
   112      /// @param _amount The amount in the `approve()` call
   113      /// @return False if the controller does not authorize the approval
   114      function onApprove(
   115          address _owner,
   116          address _spender,
   117          uint256 _amount
   118      ) returns (bool);
   119  }
   120  
   121  contract Controlled {
   122      address public controller;
   123  
   124      function Controlled() {}
   125  
   126      /// @notice Changes the controller of the contract
   127      /// @param _newController The new controller of the contract
   128      function changeController(address _newController) {}
   129  }
   130  
   131  contract ApproveAndCallFallBack {
   132      function receiveApproval(
   133          address from,
   134          uint256 _amount,
   135          address _token,
   136          bytes _data
   137      );
   138  }
   139  
   140  /// @dev The actual token contract, the default controller is the msg.sender
   141  ///  that deploys the contract, so usually this token will be deployed by a
   142  ///  token controller contract, which Giveth will call a "Campaign"
   143  contract MiniMeToken is Controlled {
   144      string public name; //The Token's name: e.g. DigixDAO Tokens
   145      uint8 public decimals; //Number of decimals of the smallest unit
   146      string public symbol; //An identifier: e.g. REP
   147      string public version = "MMT_0.1"; //An arbitrary versioning scheme
   148  
   149      /// @dev `Checkpoint` is the structure that attaches a block number to a
   150      ///  given value, the block number attached is the one that last changed the
   151      ///  value
   152      struct Checkpoint {
   153          // `fromBlock` is the block number that the value was generated from
   154          uint128 fromBlock;
   155          // `value` is the amount of tokens at a specific block number
   156          uint128 value;
   157      }
   158  
   159      // `parentToken` is the Token address that was cloned to produce this token;
   160      //  it will be 0x0 for a token that was not cloned
   161      MiniMeToken public parentToken;
   162  
   163      // `parentSnapShotBlock` is the block number from the Parent Token that was
   164      //  used to determine the initial distribution of the Clone Token
   165      uint256 public parentSnapShotBlock;
   166  
   167      // `creationBlock` is the block number that the Clone Token was created
   168      uint256 public creationBlock;
   169  
   170      // `balances` is the map that tracks the balance of each address, in this
   171      //  contract when the balance changes the block number that the change
   172      //  occurred is also included in the map
   173      mapping(address => Checkpoint[]) balances;
   174  
   175      // `allowed` tracks any extra transfer rights as in all ERC20 tokens
   176      mapping(address => mapping(address => uint256)) allowed;
   177  
   178      // Tracks the history of the `totalSupply` of the token
   179      Checkpoint[] totalSupplyHistory;
   180  
   181      // Flag that determines if the token is transferable or not.
   182      bool public transfersEnabled;
   183  
   184      // The factory used to create new clone tokens
   185      MiniMeTokenFactory public tokenFactory;
   186  
   187      ////////////////
   188      // Constructor
   189      ////////////////
   190  
   191      /// @notice Constructor to create a MiniMeToken
   192      /// @param _tokenFactory The address of the MiniMeTokenFactory contract that
   193      ///  will create the Clone token contracts, the token factory needs to be
   194      ///  deployed first
   195      /// @param _parentToken Address of the parent token, set to 0x0 if it is a
   196      ///  new token
   197      /// @param _parentSnapShotBlock Block of the parent token that will
   198      ///  determine the initial distribution of the clone token, set to 0 if it
   199      ///  is a new token
   200      /// @param _tokenName Name of the new token
   201      /// @param _decimalUnits Number of decimals of the new token
   202      /// @param _tokenSymbol Token Symbol for the new token
   203      /// @param _transfersEnabled If true, tokens will be able to be transferred
   204      function MiniMeToken(
   205          address _tokenFactory,
   206          address _parentToken,
   207          uint256 _parentSnapShotBlock,
   208          string _tokenName,
   209          uint8 _decimalUnits,
   210          string _tokenSymbol,
   211          bool _transfersEnabled
   212      ) {}
   213  
   214      ///////////////////
   215      // ERC20 Methods
   216      ///////////////////
   217  
   218      /// @notice Send `_amount` tokens to `_to` from `msg.sender`
   219      /// @param _to The address of the recipient
   220      /// @param _amount The amount of tokens to be transferred
   221      /// @return Whether the transfer was successful or not
   222      function transfer(address _to, uint256 _amount) returns (bool success) {}
   223  
   224      /// @notice Send `_amount` tokens to `_to` from `_from` on the condition it
   225      ///  is approved by `_from`
   226      /// @param _from The address holding the tokens being transferred
   227      /// @param _to The address of the recipient
   228      /// @param _amount The amount of tokens to be transferred
   229      /// @return True if the transfer was successful
   230      function transferFrom(
   231          address _from,
   232          address _to,
   233          uint256 _amount
   234      ) returns (bool success) {}
   235  
   236      /// @param _owner The address that's balance is being requested
   237      /// @return The balance of `_owner` at the current block
   238      function balanceOf(address _owner) constant returns (uint256 balance) {}
   239  
   240      /// @notice `msg.sender` approves `_spender` to spend `_amount` tokens on
   241      ///  its behalf. This is a modified version of the ERC20 approve function
   242      ///  to be a little bit safer
   243      /// @param _spender The address of the account able to transfer the tokens
   244      /// @param _amount The amount of tokens to be approved for transfer
   245      /// @return True if the approval was successful
   246      function approve(address _spender, uint256 _amount)
   247          returns (bool success)
   248      {}
   249  
   250      /// @dev This function makes it easy to read the `allowed[]` map
   251      /// @param _owner The address of the account that owns the token
   252      /// @param _spender The address of the account able to transfer the tokens
   253      /// @return Amount of remaining tokens of _owner that _spender is allowed
   254      ///  to spend
   255      function allowance(address _owner, address _spender)
   256          constant
   257          returns (uint256 remaining)
   258      {}
   259  
   260      /// @notice `msg.sender` approves `_spender` to send `_amount` tokens on
   261      ///  its behalf, and then a function is triggered in the contract that is
   262      ///  being approved, `_spender`. This allows users to use their tokens to
   263      ///  interact with contracts in one function call instead of two
   264      /// @param _spender The address of the contract able to transfer the tokens
   265      /// @param _amount The amount of tokens to be approved for transfer
   266      /// @return True if the function call was successful
   267      function approveAndCall(
   268          address _spender,
   269          uint256 _amount,
   270          bytes _extraData
   271      ) returns (bool success) {}
   272  
   273      /// @dev This function makes it easy to get the total number of tokens
   274      /// @return The total number of tokens
   275      function totalSupply() constant returns (uint256) {}
   276  
   277      ////////////////
   278      // Query balance and totalSupply in History
   279      ////////////////
   280  
   281      /// @dev Queries the balance of `_owner` at a specific `_blockNumber`
   282      /// @param _owner The address from which the balance will be retrieved
   283      /// @param _blockNumber The block number when the balance is queried
   284      /// @return The balance at `_blockNumber`
   285      function balanceOfAt(address _owner, uint256 _blockNumber)
   286          constant
   287          returns (uint256)
   288      {}
   289  
   290      /// @notice Total amount of tokens at a specific `_blockNumber`.
   291      /// @param _blockNumber The block number when the totalSupply is queried
   292      /// @return The total amount of tokens at `_blockNumber`
   293      function totalSupplyAt(uint256 _blockNumber) constant returns (uint256) {}
   294  
   295      ////////////////
   296      // Clone Token Method
   297      ////////////////
   298  
   299      /// @notice Creates a new clone token with the initial distribution being
   300      ///  this token at `_snapshotBlock`
   301      /// @param _cloneTokenName Name of the clone token
   302      /// @param _cloneDecimalUnits Number of decimals of the smallest unit
   303      /// @param _cloneTokenSymbol Symbol of the clone token
   304      /// @param _snapshotBlock Block when the distribution of the parent token is
   305      ///  copied to set the initial distribution of the new clone token;
   306      ///  if the block is zero than the actual block, the current block is used
   307      /// @param _transfersEnabled True if transfers are allowed in the clone
   308      /// @return The address of the new MiniMeToken Contract
   309      function createCloneToken(
   310          string _cloneTokenName,
   311          uint8 _cloneDecimalUnits,
   312          string _cloneTokenSymbol,
   313          uint256 _snapshotBlock,
   314          bool _transfersEnabled
   315      ) returns (address) {}
   316  
   317      ////////////////
   318      // Generate and destroy tokens
   319      ////////////////
   320  
   321      /// @notice Generates `_amount` tokens that are assigned to `_owner`
   322      /// @param _owner The address that will be assigned the new tokens
   323      /// @param _amount The quantity of tokens generated
   324      /// @return True if the tokens are generated correctly
   325      function generateTokens(address _owner, uint256 _amount) returns (bool) {}
   326  
   327      /// @notice Burns `_amount` tokens from `_owner`
   328      /// @param _owner The address that will lose the tokens
   329      /// @param _amount The quantity of tokens to burn
   330      /// @return True if the tokens are burned correctly
   331      function destroyTokens(address _owner, uint256 _amount) returns (bool) {}
   332  
   333      ////////////////
   334      // Enable tokens transfers
   335      ////////////////
   336  
   337      /// @notice Enables token holders to transfer their tokens freely if true
   338      /// @param _transfersEnabled True if transfers are allowed in the clone
   339      function enableTransfers(bool _transfersEnabled) {}
   340  
   341      /// @dev Helper function to return a min betwen the two uints
   342      function min(uint256 a, uint256 b) internal returns (uint256) {
   343          return a < b ? a : b;
   344      }
   345  
   346      /// @notice The fallback function: If the contract's controller has not been
   347      ///  set to 0, then the `proxyPayment` method is called which relays the
   348      ///  ether and creates tokens as described in the token controller contract
   349      function() payable {}
   350  
   351      //////////
   352      // Safety Methods
   353      //////////
   354  
   355      /// @notice This method can be used by the controller to extract mistakenly
   356      ///  sent tokens to this contract.
   357      /// @param _token The address of the token contract that you want to recover
   358      ///  set to 0 in case you want to extract ether.
   359      function claimTokens(address _token) {}
   360  
   361      ////////////////
   362      // Events
   363      ////////////////
   364  
   365      event ClaimedTokens(
   366          address indexed _token,
   367          address indexed _controller,
   368          uint256 _amount
   369      );
   370      event Transfer(address indexed _from, address indexed _to, uint256 _amount);
   371      event NewCloneToken(address indexed _cloneToken, uint256 _snapshotBlock);
   372      event Approval(
   373          address indexed _owner,
   374          address indexed _spender,
   375          uint256 _amount
   376      );
   377  }
   378  
   379  ////////////////
   380  // MiniMeTokenFactory
   381  ////////////////
   382  
   383  /// @dev This contract is used to generate clone contracts from a contract.
   384  ///  In solidity this is the way to create a contract from a contract of the
   385  ///  same class
   386  contract MiniMeTokenFactory {
   387      /// @notice Update the DApp by creating a new token with new functionalities
   388      ///  the msg.sender becomes the controller of this clone token
   389      /// @param _parentToken Address of the token being cloned
   390      /// @param _snapshotBlock Block of the parent token that will
   391      ///  determine the initial distribution of the clone token
   392      /// @param _tokenName Name of the new token
   393      /// @param _decimalUnits Number of decimals of the new token
   394      /// @param _tokenSymbol Token Symbol for the new token
   395      /// @param _transfersEnabled If true, tokens will be able to be transferred
   396      /// @return The address of the new token contract
   397      function createCloneToken(
   398          address _parentToken,
   399          uint256 _snapshotBlock,
   400          string _tokenName,
   401          uint8 _decimalUnits,
   402          string _tokenSymbol,
   403          bool _transfersEnabled
   404      ) returns (MiniMeToken);
   405  }
   406  
   407  /*
   408      Copyright 2017, Jarrad Hope (Status Research & Development GmbH)
   409  */
   410  contract SNT is MiniMeToken {
   411  
   412  }