In your hardhat project folder go to file hardhat.config.js
and put the following code in the module.exports
`module.exports = {module.exports = { solidity: { version: "0.5.15", settings: { optimizer: { enabled: true, runs: 200 } } }
solidity: { version: "0.5.15", settings: { optimizer: { enabled: true, runs: 200 } } }, ` hopehope it helps you..