|
7 jaren geleden | |
---|---|---|
.github | 7 jaren geleden | |
audit | 8 jaren geleden | |
contracts | 7 jaren geleden | |
migrations | 7 jaren geleden | |
scripts | 7 jaren geleden | |
test | 7 jaren geleden | |
.babelrc | 8 jaren geleden | |
.editorconfig | 7 jaren geleden | |
.env.example | 7 jaren geleden | |
.eslintrc | 7 jaren geleden | |
.gitattributes | 7 jaren geleden | |
.gitignore | 7 jaren geleden | |
.node-version | 7 jaren geleden | |
.solcover.js | 7 jaren geleden | |
.soliumignore | 8 jaren geleden | |
.soliumrc.json | 7 jaren geleden | |
.travis.yml | 7 jaren geleden | |
CODE_OF_CONDUCT.md | 7 jaren geleden | |
CONTRIBUTING.md | 7 jaren geleden | |
LICENSE | 8 jaren geleden | |
README.md | 7 jaren geleden | |
ethpm.json | 7 jaren geleden | |
package-lock.json | 7 jaren geleden | |
package.json | 7 jaren geleden | |
truffle-config.js | 7 jaren geleden |
OpenZeppelin is a library for writing secure Smart Contracts on Ethereum.
With OpenZeppelin, you can build distributed applications, protocols and organizations:
NOTE: New to smart contract development? Check our introductory guide.
OpenZeppelin integrates with Truffle and Embark.
To use with Truffle, first install it and initialize your project with truffle init
.
npm install -g truffle
mkdir myproject && cd myproject
truffle init
To use with Embark, first install it and initialize your project with embark new MyApp
.
npm install -g embark
embark new MyApp
cd MyApp
After installing either Framework, to install the OpenZeppelin library, run the following in your Solidity project root directory:
npm init -y
npm install -E openzeppelin-solidity
Note that OpenZeppelin does not currently follow semantic versioning. You may encounter breaking changes upon a minor version bump. We recommend pinning the version of OpenZeppelin you use, as done by the -E
(--save-exact
) option.
After that, you'll get all the library's contracts in the node_modules/openzeppelin-solidity/contracts
folder. You can use the contracts in the library like so:
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
contract MyContract is Ownable {
...
}
If you are using Embark, you can also import directly from github:
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol#v1.9.0";
contract MyContract is Ownable {
...
}
The following provides visibility into how OpenZeppelin's contracts are organized:
proposals - A collection of smart contracts that reflect community Ethereum Improvement Proposals (EIPs). These contracts are under development and standardization. They are not recommended for production, but they are useful for experimentation with pending EIP standards. Go here for more information.
token - A collection of approved ERC standard tokens -- their interfaces and implementations.
Unit test are critical to the OpenZeppelin framework. They help ensure code quality and mitigate against security vulnerabilities. The directory structure within the /tests
directory corresponds to the /contracts
directory. OpenZeppelin uses Mocha’s JavaScript testing framework and Chai’s assertion library. To learn more about how to tests are structured, please reference OpenZeppelin’s Testing Guide.
When using OpenZeppelin to build your own distributed applications, for security reasons we encourage you NOT to modify the framework’s base contracts, libraries, and interfaces. In order to leverage and extend their functionality, we encourage you to inherit from them or compose them together with your own contracts.
The Solidity programming language supports multiple inheritance. This is very powerful yet it can also be confusing: the more complexity you introduce to your distributed applications through multiple inheritance, the greater your application’s attack surface is.
You’ll notice in the /mocks
directory there are a collection of abstract contracts used primarily for unit testing purposes that can also be used as the foundation for your own custom implementations. These mock contracts demonstrate how OpenZeppelin’s secure base contracts can be used with multiple inheritance.
To learn more about combining OpenZeppelin contracts with your own custom contracts using multiple inheritance we encourage you to read the following: On crowdsales and multiple inheritance
OpenZeppelin 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.
The core development principles and strategies that OpenZeppelin is based on include: security in depth, simple and modular code, clarity-driven naming conventions, comprehensive unit testing, pre-and-post-condition sanity checks, code consistency, and regular audits.
If you find a security issue, please email security@openzeppelin.org.
Building a distributed application, protocol or organization with OpenZeppelin?
Read documentation: https://openzeppelin.org/api/docs/open-zeppelin.html
Ask for help and follow progress at: https://slack.openzeppelin.org/
Interested in contributing to OpenZeppelin?
Code released under the MIT License.