index.rst 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. .. zeppelin-solidity documentation master file, created by
  2. sphinx-quickstart on Tue Dec 13 11:35:05 2016.
  3. You can adapt this file completely to your liking, but it should at least
  4. contain the root `toctree` directive.
  5. Documentation
  6. =============================================
  7. **Welcome to Zeppelin-Solidity!** Get familiar with the Zeppelin Smart Contracts.
  8. Documentation
  9. ^^^^^^^^^^^^^^
  10. .. toctree::
  11. :maxdepth: 2
  12. :caption: Contents:
  13. license
  14. hola
  15. * :ref:`genindex`
  16. * :ref:`modindex`
  17. * :ref:`search`
  18. Smart Contracts
  19. ^^^^^^^^^^^^^^^
  20. Ownable
  21. --------
  22. Base contract with an owner.
  23. **Ownable( )**
  24. ++++++++++++++++
  25. Sets the address of the creator of the contract as the owner.
  26. modifier onlyOwner( )
  27. ++++++++++++++++++++++++
  28. Prevents function from running if it is called by anyone other than the owner.
  29. **transfer(address newOwner) onlyOwner**
  30. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  31. Transfers ownership of the contract to the passed address.
  32. ---
  33. ### Stoppable
  34. Base contract that provides an emergency stop mechanism.
  35. Inherits from contract Ownable.
  36. #### emergencyStop( ) external onlyOwner
  37. Triggers the stop mechanism on the contract. After this function is called (by the owner of the contract), any function with modifier stopInEmergency will not run.
  38. #### modifier stopInEmergency
  39. Prevents function from running if stop mechanism is activated.
  40. #### modifier onlyInEmergency
  41. Only runs if stop mechanism is activated.
  42. #### release( ) external onlyOwner onlyInEmergency
  43. Deactivates the stop mechanism.
  44. ---
  45. ### Killable
  46. Base contract that can be killed by owner.
  47. Inherits from contract Ownable.
  48. #### kill( ) onlyOwner
  49. Destroys the contract and sends funds back to the owner.
  50. ___
  51. ### Claimable
  52. Extension for the Ownable contract, where the ownership needs to be claimed
  53. #### transfer(address newOwner) onlyOwner
  54. Sets the passed address as the pending owner.
  55. #### modifier onlyPendingOwner
  56. Function only runs if called by pending owner.
  57. #### claimOwnership( ) onlyPendingOwner
  58. Completes transfer of ownership by setting pending owner as the new owner.
  59. ___
  60. ### Migrations
  61. Base contract that allows for a new instance of itself to be created at a different address.
  62. Inherits from contract Ownable.
  63. #### upgrade(address new_address) onlyOwner
  64. Creates a new instance of the contract at the passed address.
  65. #### setCompleted(uint completed) onlyOwner
  66. Sets the last time that a migration was completed.
  67. ___
  68. ### SafeMath
  69. Provides functions of mathematical operations with safety checks.
  70. #### assert(bool assertion) internal
  71. Throws an error if the passed result is false. Used in this contract by checking mathematical expressions.
  72. #### safeMul(uint a, uint b) internal returns (uint)
  73. Multiplies two unisgned integers. Asserts that dividing the product by the non-zero multiplicand results in the multiplier.
  74. #### safeSub(uint a, unit b) internal returns (uint)
  75. Checks that b is not greater than a before subtracting.
  76. #### safeAdd(unit a, unit b) internal returns (uint)
  77. Checks that the result is greater than both a and b.
  78. ___
  79. ### LimitBalance
  80. Base contract that provides mechanism for limiting the amount of funds a contract can hold.
  81. #### LimitBalance(unit _limit)
  82. Constructor takes an unisgned integer and sets it as the limit of funds this contract can hold.
  83. #### modifier limitedPayable()
  84. Throws an error if this contract's balance is already above the limit.
  85. ___
  86. ### PullPayment
  87. Base contract supporting async send for pull payments.
  88. Inherit from this contract and use asyncSend instead of send.
  89. #### asyncSend(address dest, uint amount) internal
  90. Adds sent amount to available balance that payee can pull from this contract, called by payer.
  91. #### withdrawPayments( )
  92. Sends designated balance to payee calling the contract. Throws error if designated balance is 0, if contract does not hold enough funds ot pay the payee, or if the send transaction is not successful.
  93. ___
  94. ### StandardToken
  95. Based on code by FirstBlood: [FirstBloodToken.sol]
  96. Inherits from contract SafeMath. Implementation of abstract contract ERC20 (see https://github.com/ethereum/EIPs/issues/20)
  97. [FirstBloodToken.sol]: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
  98. #### approve(address _spender, uint _value) returns (bool success)
  99. Sets the amount of the sender's token balance that the passed address is approved to use.
  100. ###allowance(address _owner, address _spender) constant returns (uint remaining)
  101. Returns the approved amount of the owner's balance that the spender can use.
  102. ###balanceOf(address _owner) constant returns (uint balance)
  103. Returns the token balance of the passed address.
  104. ###transferFrom(address _from, address _to, uint _value) returns (bool success)
  105. Transfers tokens from an account that the sender is approved to transfer from. Amount must not be greater than the approved amount or the account's balance.
  106. ###function transfer(address _to, uint _value) returns (bool success)
  107. Transfers tokens from sender's account. Amount must not be greater than sender's balance.
  108. ___
  109. ### BasicToken
  110. Simpler version of StandardToken, with no allowances
  111. #### balanceOf(address _owner) constant returns (uint balance)
  112. Returns the token balance of the passed address.
  113. ###function transfer(address _to, uint _value) returns (bool success)
  114. Transfers tokens from sender's account. Amount must not be greater than sender's balance.
  115. ___
  116. ### CrowdsaleToken
  117. Simple ERC20 Token example, with crowdsale token creation.
  118. Inherits from contract StandardToken.
  119. #### createTokens(address recipient) payable
  120. Creates tokens based on message value and credits to the recipient.
  121. #### getPrice() constant returns (uint result)
  122. Returns the amount of tokens per 1 ether.
  123. .. toctree::
  124. :maxdepth: 2
  125. :caption: Contents:
  126. * :ref:`genindex`
  127. * :ref:`modindex`
  128. * :ref:`search`