Giter VIP home page Giter VIP logo

nethereum-erc20-wrapper's Introduction

Nethereum ERC20 Wrapper

A simple wrapper around nethereum to manage basic ERC20 minting, burning and transfer.

Local Chain

  1. Install Ganache

Local Chain Setup

  1. npm install (inside ./Chain)
  2. truffle compile --all (inside ./Chain)
  3. truffle deploy (inside ./Chain)
  4. Assign MINTER_ROLE and BURNER_ROLE to the address that will be used by the server.

App Settings Setup

  1. Update ChainInfo data to match local chain or remote chain
  2. Assign a private key belonging to an account that has MINTER_ROLE and BURNER_ROLE

API

  1. ~/balance gets the balance of the account sent as query param in wei.
{
  "amount": 70
}
  1. ~/mint requests to mint an amount of the token in wei at the account. The response is the transaction hash as well as the nonce used asuming the tx is successful. An exception is thrown otherwise.
{
  "account": "0x25b62DD8416D8bE58f6dE9DAf2a68FfBEfe0ba31",
  "amount": 60
}
{
  "tx": "0x68ebd1f6c8d08eb8db174a59a1a95077d2ddf356a0444e5b5a7aba93cd54fe62",
  "nonce": 8612
}
  1. ~/burn burns an amount of the token in wei that is in the balance of the server account. The response is the transaction hash as well as the nonce used asuming the tx is successful. An exception is thrown otherwise.
{
  "amount": 20
}
{
  "tx": "0x153eeaeda03a171c487f7866f828578a07283768464f569b6494f6259755df0e",
  "nonce": 8615
}
  1. ~/transfer tranfers an amount of the token in wei from the server account to the account.

The response is the transaction hash as well as the nonce used asuming the tx is successful. An exception is thrown otherwise.

{
  "account": "0x4B4AABaf30921059e3baD5Ab10f8d19d88cccC60",
  "amount": 10
}
{
  "tx": "0x2500f0ec6097997169a5b15ecf1e39b44ebf4ed9d1051b0c140eedf48dff68d6",
  "nonce": 8616
}

Version History

  1. 2023-12-15: Initial release v1.0.0

Disclaimer

This implementation was made for educational / training purposes only.

License

License is MIT

MISC

Birbia is coming

nethereum-erc20-wrapper's People

Contributors

bilbolprime avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.