Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@0xcert/ethereum-erc20

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xcert/ethereum-erc20

Fungible token standard implementation for the Ethereum blockchain.

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Build Status NPM Version Dependencies Status Bug Bounty

This is a complete implementation of the ERC-20 fungible token standard for the Ethereum blockchain. This is an open source project build with Truffle framework.

Purpose of this implementation is to provide a good starting point for anyone who wants to use and develop fungible tokens on the Ethereum blockchain. Instead of re-implementing the ERC-20 yourself you can use this code which has gone through multiple audits and we hope it will be extensively used by the community in the future.

Structure

Since this is a Truffle project, you will find all tokens in contracts/tokens/ directory.

Requirements

  • NodeJS 9.0+ recommended.
  • Windows, Linux or Mac OS X.

Installation

NPM

This is an NPM module for Truffle framework. In order to use it as a dependency in your Javascript project, you must install it through the npm command:

$ npm install @0xcert/ethereum-erc20

Source

Clone the repository and install the required npm dependencies:

$ git clone git@github.com:0xcert/ethereum-erc20.git
$ cd ethereum-erc20
$ npm install

Make sure that everything has been set up correctly:

$ npm run test

Usage

NPM

To interact with package's contracts within JavaScript code, you simply need to require that package's .json files:

const contract = require("@0xcert/ethereum-erc20/build/contracts/Token.json");
console.log(contract);

Source

Creating smart contract

The easiest way to start is to create a new file under contracts/tokens/ (e.g. MyToken.sol):

pragma solidity ^0.4.24;

import "../tokens/Token.sol";

contract MyToken is Token {

  constructor()
    public
  {
    tokenName = "My Token";
    tokenSymbol = "MTK";
    tokenDecimals = 18;
    tokenTotalSupply = 100000000000000000000000000;
    balances[msg.sender] = totalTokenSupply; // Give the owner of the contract the whole balance
  }
}

That's it. Let's compile the contract:

$ npm run compile

The easiest way to deploy it locally and start interacting with the contract (minting and transferring tokens) is to deploy it on your personal (local) blockchain using Ganache. Follow the steps in the Truffle documentation which are described here.

Contributing

See CONTRIBUTING.md for how to help out.

Licence

See LICENSE for details.

Keywords

FAQs

Package last updated on 07 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc