This repository contains the smart contracts of the Superform Dapp.
- LayerZero - OmniChain communication Protocol
- Hardhat - Smart Contract Development Suite
- Solhint - Linting Suite
- Prettier - Automatic Code Formatting
- Solidity - Smart Contract Programming Language
- Chai - Smart Contract Testing Language
The repository is built using hardhat. So it is recommended to install hardhat globally through npm or yarn using the following commands. Also the development of these smart contracts are done in npm version 6.14.8 & NodeJs version 14.15.0
sudo npm i -g hardhat
Step by step instructions on setting up the project and running it
-
Clone the repository
git clone https://github.com/superform-xyz/superform-contracts-beta
-
Install Dependencies
npm install
ornpm i
-
Compiling Smart Contracts (Auto compiles all .sol file inside contracts directory)
npx hardhat compile
-
Deploying Smart Contracts
npx hardhat run scripts/<contract-name>.deploy.js --network <network-name>
Name of the smart contracts can be found inside the corresponding solidity files of the smart contract
-
Verification of Smart Contracts are configured in deployment scripts.
All configuration is done in hardhat.config.js & linting configurations are made in .solhint.json & .prettierrc
.
├── contracts
├── interface
├── lib
├── mocks
├── layerzero
├── types
├── utils
├── lzApp
├── test
├── scripts
├── .prettierrc
├── .eslintrc.js
├── .solcover.js
├── .solhint.json
├── hardhat.config.js
├── package.json
├── config.testnet.js
└── README.md
It makes our project structure easily scannable:
contracts
are self-explanatory. All Smart Contract Codes are found inside /contractsinterface
are where we add our custom written interfaces as well as external protocol interfaces /contracts/interface.types
is where all re-used types are written and used across different smart contracts. /contract/typeslzApp
is where all layezero contracts are done. /contracts/lzApp
I sort imports in this order:
- Openzeppelin (or) NPM Contracts
- Current Contract's Interfaces
- Other Local Interfaces
- Library Contracts/Interfaces
- Tunnel Contracts/Interfaces
- Type Contract
- Error Contract
For running unit & integration tests:
$ npm run test
For forked state tests with Vault templates:
$ npm run test:vaults
To run coverage:
$ npm run coverage
To run contract size check:
$ npx hardhat size-contracts