1.0.1 • Published 3 years ago

@unizen-test/unizen-flexible-staking v1.0.1

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

unizen-flexible-staking

.env file configuration

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 serve-hardhat-localnet-and-deploy-there

Deploying the smart contracts to the BSC test network

yarn install
yarn build
yarn deploy:testnet

Deploying the membership system smart contracts to the Ropsten test network

yarn install
yarn build
yarn deploy:ropsten

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

You can link 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";

Or you can set 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#develop"
  }
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 serve-hardhat-localnet-and-deploy-there

# 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:testnet

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

# deploy the membership system smart contracts to the Ropsten test network
$ yarn deploy:ropsten
1.0.1

3 years ago

1.0.0

3 years ago