Flatten a Smart Contract
Flattening a smart contract is the process of combining the main contract with all its dependencies (interfaces, libraries, inherited contracts) into a single, standalone .sol file. This makes it much easier to validate the deployed contract.
Because Chiliz Chain is an EVM-compatible blockchain, there are several tools available to flatten a contract.
Flatten using Remix IDE
In the File Explorer, right-click your main contract, and choose "Flatten" in the menu.

Remix will generate a CONTRACT_flattened.sol contract in your folder.
Flatten using Hardhat
Adapt the following line to your workflow:
Because a flattened contract can be thousands of lines long, they are terrible for actual development and maintenance.
They should only be generated when you need them, for instance when verifying the deployed contract.
Last updated
Was this helpful?