1.0.12 • Published 3 years ago

@unizen-io/unizen-flexible-staking v1.0.12

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

unizen-flexible-staking

Smart contracts of the Dynamic Multi Asset Staking (DMAS) of Unizen

Configuration of .env file

To see the mnemonic or seed phrase in Metamask, follow this instruction.

The Metamask account (mnemonic in the .env) needs to have enough funds in the network where you want to interact with the smart contracts. For example, to add funds to the BSC test network, visit Binance Smart Chain Faucet.

cp .env.example .env
vi .env # add an account's mnemonic and an Infura API key

Deploying the smart contracts to the Hardhat local network

yarn install
yarn build
yarn hardhat:node

Deploying the membership system smart contracts to the Rinkeby test network

yarn install
yarn build
yarn deploy:rinkeby

Deploying the smart contracts to the BSC test network

yarn install
yarn build
yarn deploy:bsctest

Publishing to NPM

yarn login
yarn publish --access public

Creating test reward pools

yarn create-reward-pools

Integrating the project into a Dapp (e.g. create-react-app or Next.js)

There are different options to integrate this project into a Dapp:

Installing via npm package

yarn add @unizen-io/unizen-flexible-staking

Linking the project with yarn to sync updates easily

Link unizen-flexible-staking module using yarn link:

cd unizen-flexible-staking
yarn link

To get started on the UI:

cd dapp # folder name of the dapp
yarn install
yarn link unizen-flexible-staking
yarn dev # run a local development server in Next.js

Import in a UI component like so:

import { UZStakingV1, UZStakingV1__factory } from "unizen-flexible-staking";

Setting up the project's GitHub repository as a dependency

  "devDependencies": {
    "GitRepo": "git+https://<token-from-github>:x-oauth-basic@github.com/<user>/<GitRepo>.git"
  }
  "devDependencies": {
    "@unizen-io/unizen-flexible-staking": "https://<PERSONAL_GITHUB_ACCESS_TOKEN>@github.com/unizen-io/unizen-flexible-staking.git#main"
  }
cd dapp # folder name of the dapp
yarn install
yarn upgrade @unizen-io/unizen-flexible-staking
yarn install-@unizen-io/unizen-flexible-staking # install the dependencies from a dapp project
yarn build-@unizen-io/unizen-flexible-staking # build the smart contracts from a dapp project
yarn dev # run a local development server in a Next.js dapp

Import in a UI component like so:

import { UZStakingV1, UZStakingV1__factory } from "@unizen-io/unizen-flexible-staking";

Specific Commands

# install dependencies
$ yarn install

# update env variables
$ cp .env.example .env
$ vi .env

# compile smart contracts and create typechain interfaces
$ yarn compile

# compile smart contracts, create typechain interfaces, and copy/paste typechain declarations to dist
$ yarn build

# run the Hardhat local network and deploy the smart contracts to that Hardhat local network
$ yarn hardhat:node

# run unit-tests including gas-report
$ yarn test:gas

# run code coverage report
$ yarn coverage

# prettify smart contract files
$ yarn prettier:sol

# lint smart contract files
$ yarn lint:sol

# prettify TypeScript files
$ yarn prettier:ts

# lint TypeScript files
$ yarn lint:ts

# lint and fix TypeScript files
$ yarn lint:ts-fix

# deploy smart contracts to the Hardhat local network
$ yarn deploy:localnet

# deploy smart contracts to the BSC test network
$ yarn deploy:bsctest

# deploy smart contracts to the BSC main network
$ yarn deploy:bscmain

# deploy the membership system smart contracts to the Rinkeby test network
$ yarn deploy:rinkeby
1.0.11

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.2

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago