Không có mô tả

Steve Ellis 5f6b7f9301 add check prevening ownables from getting stuck 9 năm trước cách đây
contracts 5f6b7f9301 add check prevening ownables from getting stuck 9 năm trước cách đây
migrations a3362f7216 Merge pull request #51 from AugustoL/master 9 năm trước cách đây
scripts 99c8ac9a28 fix stoppablebid, add package.json 9 năm trước cách đây
test 5f6b7f9301 add check prevening ownables from getting stuck 9 năm trước cách đây
.gitignore e49f9c42a9 ignore build folder 9 năm trước cách đây
CONTRIBUTING.md 4fc0d99bfc update repo name to zeppelin-solidity 9 năm trước cách đây
LICENSE 8e22caaac7 LICENSE formatting 9 năm trước cách đây
README.md 278f060c56 Replace composition for inheritance in Bounty 9 năm trước cách đây
package.json 5683417d61 v0.0.11 9 năm trước cách đây
truffle.js 50a290e10a use truffle 9 năm trước cách đây

README.md

Zeppelin Solidity

Zeppelin is a library for writing secure Smart Contracts on Ethereum.

With Zeppelin, you can build distributed applications, protocols and organizations:

Getting Started

Zeppelin integrates with Truffle, an Ethereum development environment. Please install Truffle and initialize your project with truffle init.

sudo npm install -g truffle
mkdir myproject && cd myproject
truffle init

To install the Zeppelin library, run:

npm i zeppelin-solidity

After that, you'll get all the library's contracts in the contracts/zeppelin folder. You can use the contracts in the library like so:

import "./zeppelin/Rejector.sol";

contract MetaCoin is Rejector {
  ...
}

NOTE: The current distribution channel is npm, which is not ideal. We're looking into providing a better tool for code distribution, and ideas are welcome.

Add your own bounty contract

To create a bounty for your contract, inherit from the base Bounty contract and provide an implementation for deployContract() returning the new contract address.

import "./zeppelin/Bounty.sol";
import "./YourContract.sol";

contract YourBounty is Bounty {
  function deployContract() internal returns(address) {
    return new YourContract()
  }
}

Implement invariant logic into your smart contract

At contracts/YourContract.sol

contract YourContract {
  function checkInvariant() returns(bool) {
    // Implement your logic to make sure that none of the state is broken.
  }
}

Deploy your bounty contract as usual

At migrations/2_deploy_contracts.js

module.exports = function(deployer) {
  deployer.deploy(YourContract);
  deployer.deploy(YourBounty);
};

Add a reward to the bounty contract

After deploying the contract, send rewards money into the bounty contract.

From truffle console

address = 'your account address'
reward = 'reward to pay to a researcher'

web3.eth.sendTransaction({
  from:address,
  to:bounty.address,
  value: web3.toWei(reward, "ether")
}

Researchers hack the contract and claim their reward.

For each researcher who wants to hack the contract and claims the reward, refer to our test for the detail.

Ends the contract

If you manage to protect your contract from security researchers and wants to end the bounty, kill the contract so that all the rewards go back to the owner of the bounty contract.

bounty.kill()

Truffle Beta Support

We also support Truffle Beta npm integration. If you're using Truffle Beta, the contracts in node_modules will be enough, so feel free to delete the copies at your contracts folder. If you're using Truffle Beta, you can use Zeppelin contracts like so:

import "zeppelin-solidity/contracts/Rejector.sol";

contract MetaCoin is Rejector {
  ...
}

For more info see the Truffle Beta package management tutorial.

Security

Zeppelin is meant to provide secure, tested and community-audited code, but please use common sense when doing anything that deals with real money! We take no responsibility for your implementation decisions and any security problem you might experience.

If you find a security issue, please email security@openzeppelin.org.

Developer Resources

Building a distributed application, protocol or organization with Zeppelin?

Interested in contributing to Zeppelin?

Projects using Zeppelin

Contracts

TODO

License

Code released under the MIT License.