Smart Contracts: Don’t Reinvent the Wheel
Always use OpenZeppelin

Don’t get me wrong, writing smart contracts from scratch is a great learning tool. Tasking yourself with creating an ERC20-compliant contract from start to finish is one of the best ways to gain an understanding of the logic behind it.
However, for production applications, don’t reinvent the wheel.
Libraries like OpenZeppelin are scrutinized by the Ethereum development community at large. They’re continuously being updated and reviewed. They’re also publically accessible and easy to use. It doesn’t make sense to create your own when libraries like this exist.
Importing OpenZeppelin
Note: Higher versions are available, but we’re using library version 2.5.0 because it’s the last version of OpenZeppelin contracts running Solidity version 0.5.x.
To install OpenZeppelin into your project, run the following command:
npm install @openzeppelin/contracts@2.5.0 --saveThis will download all smart contracts into node_modules/.
Once installed, you can import smart contracts into your own. This is an example of importing the OpenZeppelin ERC20 token contract in a smart contract:
pragma solidity ^0.5.5;import "@openzeppelin/contracts/token/ERC20/ERC720.sol";contract MyContract is ERC20 { ...Here are some useful Token, Math, Utils, and Ownable contracts from OpenZeppelin you can easily implement in your projects.
Tokens
ERC20
There are six publically available functions that ERC20 contracts need to implement, as well as two events. By importing OpenZeppelin’s ERC20 contract, you don’t need to implement any of these yourself.





