Git Product home page Git Product logo

subsquid-token's Introduction

Subsquid Framework Token

Official Implementation for Subsquid ERC20 Upgradable Token.

Version Badge Build

Prerequisites

  • NodeJs@14 +

Environment Variables Needed

Create a .env file at the root of the project and populate the different keys. It will be automatically loaded into the application at run time.

ETHERSCAN_API_KEY="<Paste-Your-Key-here>"
ETH_KEY="<Paste-Your-Private-Key-here>"
INFURA_KEY="<Paste-Your-Key-here>"
COIN_MARKETCAP_KEY="<Paste-Your-Key-here>"
GNOSIS_CONTRACT_ADDRESS="<Paste-Your-Address>" # For testnets only rinkeby is supported
HARDHAT_VERBOSE=true
  • Etherscan Key is required for contract source code verification. We use hardhat etherscan plugin to automatically verify the contract during deployment. You can get it here.
  • ETH_KEY is the private ethereum key with which the contract is going to be deployed with to the mainnet / testnets. It should have sufficient funds for spending the contract deployment costs.
  • INFURA_KEY can be obtained here.
  • COIN_MARKETCAP_KEY is used to get gas cost estimates while running the tests. It will give an approximate value of gas cost incurred using the gas price (Default 44) in gwei and currency (Default USD) parameters defined in hardhat.config.ts file.
  • Deployment can be transferred to a gnosis multisig contract instead of a central address. Create a gnosis contract and use deployment steps specific to gnosis to use it.

How To Run

  • Clone the repo
  • npm install
  • npm run test // to run the tests and also to get gas estimates for important operations
  • npm run coverage // to get coverage results

Contracts

The smart contracts can be seen in contracts folder. Subsquid.sol is the ERC20 contract and SubsquidV1 in mocks folder is a test contract for testing upgradeability. A flattened version of the contract can also be seen under flatten/Subsquid_flatten.sol. Simply run npm run flatten to update the flattened contract for any changes.

Deployment

Local

Open a separate terminal and run npm run local:node which will start a local node listening to port 8545. In another terminal run npm run deploy:local. You can also run npm run deploy-upgrade:local to upgrade the implementation to another version

Testnets

Make sure the private key has sufficient funds

- npm run deploy:ropsten // for ropsten
- npm run deploy:rinkeby // for rinkeby
- npm run deploy:kovan // for kovan

For Gnosis, Only rinkeby is supported

- npm run deploy:gnosis // for rinkeby

To test upgradeability simply run

npm run deploy-upgrade:<network-name>

For Gnosis npm run deploy-upgrade:gnosis

You will get a new implementation address which you will have to use to create a upgrade proposal in for example openzeppelin defender admin to which it will successfully upgrade after stakeholder approval reaches minimum threshold.

Mainnet

Make sure the private key has sufficient funds. Make sure to comment out the .openzeppelin and artifacts from gitignore as it is needed to be committed which will help for later upgrades if needed.

- npm run deploy:mainnet

For Gnosis

npm run deploy-upgrade:gnosis-mainnet

You will get a new implementation address which you will have to use to create a upgrade proposal in for example openzeppelin defender admin to which it will successfully upgrade after stakeholder approval reaches minimum threshold.

Notes

  • If in case etherscan verification fails, Kindly note the deployed contract address and try to reverify using npx hardhat verify --network <network-name> "<contract-address>

subsquid-token's People

Contributors

dependabot[bot] avatar sachushaji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.