Skip to content
This repository has been archived by the owner on May 8, 2023. It is now read-only.

rsksmart/erc677

Repository files navigation

logo

@rsksmart/erc677

Simple implementation of ERC-677 token contract, compatible with RIF Token.

Coverage Status npm

This package is only to use for testing purposes

Install

npm i @rsksmart/erc677

Usage

const ERC677 = artifacts.require('@rsksmart/erc677');

contract('My contract tests', async accounts => {
  let erc677;

  beforeEach(async () => {
    erc677 = await ERC677.new(
      accounts[0],
      web3.utils.toBN('1000000000000000000000'),
      'RIFOS',
      'RIF',
      web3.utils.toBN('18'),
    );
  });
});

JS

const Web3 = require('web3');
const ERC677Data = require('@rsksmart/erc677/ERC677Data.json');
const web3 = new Web3('https://public-node.rsk.co')
const ERC677 = new web3.eth.Contract(ERC677Data.abi, ERC677Data.address.rskMainnet);

Types

There are TypeScript typing definitions of the contracts published together with the original contracts. Supported contract's libraries are:

  • web3 version 1.* - web3-v1-contracts
  • web3 version 2.* - web3-v2-contracts
  • truffle - truffle-contracts
  • ethers - ethers-contracts

You can use them as follow:

import Web3 from 'web3'
import ERC677 from '@rsksmart/erc677/types/web3-v1-contracts/ERC677Data.d.ts'
import ERC677Data from '@rsksmart/erc677/ERC677Data.json'

const web3 = new Web3('https://public-node.rsk.co')
const rif = new web3.eth.Contract(ERC677Data.abi, ERC677Data.address.rskMainnet) as ERC677

Replace web3-v1-contracts with the proper library version.

Versions

  • Installing v1 will use Solidity v5
  • Installing v2 will use Solidity v8

RIF Token:

About

Simple implementation of ERC-677 token contract, compatible with RIF Token.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •