Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.02 KB | None | 0 0
  1. pragma solidity ^0.4.10;
  2.  
  3. contract Token {
  4. /// @return total amount of tokens
  5. function totalSupply() constant returns (uint256 supply) {}
  6.  
  7. /// @param _owner The address from which the balance will be retrieved
  8. /// @return The balance
  9. function balanceOf(address _owner) constant returns (uint256 balance) {}
  10.  
  11. /// @notice send `_value` token to `_to` from `msg.sender`
  12. /// @param _to The address of the recipient
  13. /// @param _value The amount of token to be transferred
  14. /// @return Whether the transfer was successful or not
  15. function transfer(address _to, uint256 _value) returns (bool success) {}
  16.  
  17. /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
  18. /// @param _from The address of the sender
  19. /// @param _to The address of the recipient
  20. /// @param _value The amount of token to be transferred
  21. /// @return Whether the transfer was successful or not
  22. function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
  23.  
  24. /// @notice `msg.sender` approves `_addr` to spend `_value` tokens
  25. /// @param _spender The address of the account able to transfer the tokens
  26. /// @param _value The amount of wei to be approved for transfer
  27. /// @return Whether the approval was successful or not
  28. function approve(address _spender, uint256 _value) returns (bool success) {}
  29.  
  30. /// @param _owner The address of the account owning tokens
  31. /// @param _spender The address of the account able to transfer the tokens
  32. /// @return Amount of remaining tokens allowed to spent
  33. function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
  34.  
  35. event Transfer(address indexed _from, address indexed _to, uint256 _value);
  36. event Approval(address indexed _owner, address indexed _spender, uint256 _value);
  37.  
  38. uint public decimals;
  39. string public name;
  40. }
  41.  
  42. contract StandardToken is Token {
  43.  
  44. function transfer(address _to, uint256 _value) returns (bool success) {
  45. //Default assumes totalSupply can't be over max (2^256 - 1).
  46. //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
  47. //Replace the if with this one instead.
  48. if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
  49. //if (balances[msg.sender] >= _value && _value > 0) {
  50. balances[msg.sender] -= _value;
  51. balances[_to] += _value;
  52. Transfer(msg.sender, _to, _value);
  53. return true;
  54. } else { return false; }
  55. }
  56.  
  57. function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
  58. //same as above. Replace this line with the following if you want to protect against wrapping uints.
  59. if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
  60. //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
  61. balances[_to] += _value;
  62. balances[_from] -= _value;
  63. allowed[_from][msg.sender] -= _value;
  64. Transfer(_from, _to, _value);
  65. return true;
  66. } else { return false; }
  67. }
  68.  
  69. function balanceOf(address _owner) constant returns (uint256 balance) {
  70. return balances[_owner];
  71. }
  72.  
  73. function approve(address _spender, uint256 _value) returns (bool success) {
  74. allowed[msg.sender][_spender] = _value;
  75. Approval(msg.sender, _spender, _value);
  76. return true;
  77. }
  78.  
  79. function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
  80. return allowed[_owner][_spender];
  81. }
  82.  
  83. mapping(address => uint256) balances;
  84.  
  85. mapping (address => mapping (address => uint256)) allowed;
  86.  
  87. uint256 public totalSupply;
  88. }
  89.  
  90. contract MyERC20 is StandardToken {
  91.  
  92. // metadata
  93. string public constant name = "MyERC20Token";
  94. string public constant symbol = "ERC";
  95. uint public constant decimals = 18;
  96.  
  97. // stakeholder addresses
  98. address public constant FOUNDATION = 0x642dab093d6e7518dfdcb450e23108038cf667c6;
  99. address public constant FOUNDER_1 = 0xb1f49e6c1d2306862253ef516a07aedded28ae15;
  100. address public constant FOUNDER_2 = 0xb1fdea258e9d67fc121821b38ffc32a70c873964;
  101. address public constant INVESTOR_1 = 0xe15268cd67501f4766a9fc20e121d1f82aa397c3;
  102. address public constant INVESTOR_2 = 0x175037c16c0e433f86590d99afb33e5e3560d263;
  103.  
  104. // stakeholder allocations as a percentage of total supply
  105. uint public totalSupply = 10e6 * 10 ** decimals;
  106. uint public constant FOUNDATION_ALLOCATION = 20;
  107. uint public constant FOUNDER_1_ALLOCATION = 5;
  108. uint public constant FOUNDER_2_ALLOCATION = 5;
  109. uint public constant INVESTOR_1_ALLOCATION = 3;
  110. uint public constant INVESTOR_2_ALLOCATION = 2;
  111.  
  112. // constructor
  113. function MyERC20() {
  114. balances[FOUNDATION] = FOUNDATION_ALLOCATION * totalSupply / 100;
  115. balances[FOUNDER_1] = FOUNDER_1_ALLOCATION * totalSupply / 100;
  116. balances[FOUNDER_2] = FOUNDER_2_ALLOCATION * totalSupply / 100;
  117. balances[INVESTOR_1] = INVESTOR_1_ALLOCATION * totalSupply / 100;
  118. balances[INVESTOR_2] = INVESTOR_2_ALLOCATION * totalSupply / 100;
  119. }
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement