Venus Periphery is an extension of the Venus Protocol ecosystem that contains auxiliary smart contracts used for advanced interactions with the core protocol. These contracts enhance the protocol’s usability, composability, and integration with external systems.
The first major addition in this repository is the CollateralSwapper, a flexible module that enables users to swap their supplied collateral from one market to another directly within the Venus ecosystem.
- NodeJS - 20.x
- Solc - v0.8.25 (https://github.com/ethereum/solidity/releases/tag/v0.8.25)
yarn install
yarn test
npx hardhat coverage
REPORT_GAS=true npx hardhat test
- To run fork tests add FORK=true, FORKED_NETWORK and one ARCHIVE_NODE var in the .env file.
npx hardhat deploy
- This command will execute all the deployment scripts in
./deploy
directory - It will skip only deployment scripts which implement askip
condition - Here is example of a skip condition: - Skipping deployment script onbsctestnet
networkfunc.skip = async (hre: HardhatRuntimeEnvironment) => hre.network.name !== "bsctestnet";
- The default network will be
hardhat
- Deployment to another network: - Make sure the desired network is configured in
hardhat.config.ts
- AddMNEMONIC
variable in.env
file - Execute deploy command by adding--network <network_name>
in the deploy command above - E.g.npx hardhat deploy --network bsctestnet
- Execution of single or custom set of scripts is possible, if:
- In the deployment scripts you have added
tags
for example: -func.tags = ["MockTokens"];
- Once this is done, adding
--tags "<tag_name>,<tag_name>..."
to the deployment command will execute only the scripts containing the tags.
- In the deployment scripts you have added
To simulate what contracts would be deployed on a given network the deployment scripts support running on a forked network. To run the deployment scripts on a forked network the HARDHAT_FORK_NETWORK
env variable needs to be set.
For example
HARDHAT_FORK_NETWORK=ethereum npx hardhat deploy
Deployed contract abis and addresses are exported in the deployments
directory. To create a summary export of all contracts deployed to a network run
$ yarn hardhat export --network <network-name> --export ./deployments/<network-name>.json
In order to verify the source code of already deployed contracts, run:
npx hardhat etherscan-verify --network <network_name>
Make sure you have added ETHERSCAN_API_KEY
in .env
file.
npx hardhat accounts
npx hardhat compile
npx hardhat clean
npx hardhat test
npx hardhat node
npx hardhat help
REPORT_GAS=true npx hardhat test
npx hardhat coverage
TS_NODE_FILES=true npx ts-node scripts/deploy.ts
npx eslint '**/*.{js,ts}'
npx eslint '**/*.{js,ts}' --fix
npx prettier '**/*.{json,sol,md}' --check
npx prettier '**/*.{json,sol,md}' --write
npx solhint 'contracts/**/*.sol'
npx solhint 'contracts/**/*.sol' --fix
MNEMONIC="<>" BSC_API_KEY="<>" npx hardhat run ./script/hardhat/deploy.ts --network testnet
Documentation is autogenerated using solidity-docgen.
They can be generated by running yarn docgen
- Website : https://venus.io
- Twitter : https://twitter.com/venusprotocol
- Telegram : https://t.me/venusprotocol
- Discord : https://discord.com/invite/pTQ9EBHYtF
- Github: https://github.com/VenusProtocol
- Youtube: https://www.youtube.com/@venusprotocolofficial