Skip to content

lista-dao/lista-token

Repository files navigation

Lista DAO

Lista DAO token and governance contracts.

Lista Token

Given as an incentive for users of the protocol. Can be locked in VeLista to receive lock weight, which gives governance power within the Lista DAO.

How to run unit tests

Requirements

Install dependencies

Install dependencies with Yarn:

# Execute this command in the root directory of the repository
yarn
forge install foundry-rs/forge-std --no-commit

Configure environment variables

  1. Copy the .env.example file to .env:
cp .env.example .env
  1. Fill in the environment variables in the .env file:
ETHERSCAN_API_KEY=
BSCSCAN_API_KEY=
DEPLOYER_PRIVATE_KEY=
BSC_TESTNET_RPC=
BSC_RPC=
SEPOLIA_RPC=
ETHEREUM_RPC=

DEPLOYER_PRIVATE_KEY is the private key of the account that will deploy the contracts. It should have enough BNB/ETH to pay for the gas fees.

Run tests

Run all tests:

yarn test:all
# or
npx hardhat test

Run a specific test file:

npx hardhat test <path/to/file>

Run a specific test file with forge:

forge test --match-contract <Contract Test Script Name> -vvv
forge test --match-contract <Contract Test Script Name> -vvv --via-ir
forge test --match-contract <Contract Test Script Name> --match-test <Test Name> -vvv

# Examples
forge test --match-contract BuybackTest -vvv
# clean the cache and run the test
forge clean && forge test --match-contract BuybackTest -vvv
# run a specific test in the contract
forge test --match-contract BuybackTest --match-test "test_buyback" -vvv

Run coverage

Generate coverage report:

yarn coverage

Open coverage report in browser: coverage/index.html

How to deploy on bsc

  1. Run npx hardhat deploy:ListaToken --network bsc <ownerAddress>, which will deploy Lista contracts on bsc, the owner address is the address that will receive the total supply of tokens
  2. Run npx hardhat verify --network bsc <contractAddress> <ownerAddress>, which will verify Lista contracts on bsc

How to deploy on bsc with foundry

Run forge script <path_to_script> --rpc-url <your_rpc_url> --private-key <your_private_key> --etherscan-api-key <bscscan-api-key> --broadcast --verify -vvv, which will deploy Lista contracts on bsc with foundry, for example:

# deploy the proxy contract of Buyback
forge script scripts/buyback/Buyback.s.sol:BuybackScript --rpc-url https://bsc-dataseed.binance.org --etherscan-api-key <bscscan-api-key> --broadcast --verify -vvv

Code style

The contracts in folder contracts/buyback are formatted using Prettier. To check and fix linting errors:

# Check for linting errors
yarn run check

# Fix linting errors
yarn run fix

Check and fix linting errors for a specific contract

  1. Run npx prettier --check <contract> to check for linting errors, for example:
npx prettier --check contracts/buyback/Buyback.sol
  1. Run npx prettier --write <contract> to fix linting errors, for example:
npx prettier --write contracts/buyback/Buyback.sol