import"hardhat-deploy";import"@nomiclabs/hardhat-ethers";import{task,types}from"hardhat/config";import{loadSolc}from"../utils/solc";task("codesize","Displays the codesize of the contracts").addParam("skipcompile","should not compile before printing size",false,types.boolean,true).addParam("contractname","name of the contract",undefined,types.string,true).setAction(async(taskArgs,hre)=>{if(!taskArgs.skipcompile){awaithre.run("compile")}constcontracts=awaithre.artifacts.getAllFullyQualifiedNames()for(constcontractofcontracts){constartifact=awaithre.artifacts.readArtifact(contract)if(taskArgs.contractname&&taskArgs.contractname!==artifact.contractName)continueconsole.log(artifact.contractName,Math.max(0,(artifact.deployedBytecode.length-2)/2),"bytes (limit is 24576)")}});task("yulcode","Outputs yul code for contracts").addParam("contractname","name of the contract",undefined,types.string,true).setAction(async(taskArgs,hre)=>{constcontracts=awaithre.artifacts.getAllFullyQualifiedNames()for(constcontractofcontracts){if(taskArgs.contractname&&!contract.endsWith(taskArgs.contractname))continueconstbuildInfo=awaithre.artifacts.getBuildInfo(contract)if(!buildInfo)returnconsole.log({buildInfo})buildInfo.input.settings.outputSelection['*']['*'].push("ir","evm.assembly")constsolcjs=awaitloadSolc(buildInfo.solcLongVersion)constcompiled=solcjs.compile(JSON.stringify(buildInfo.input))constoutput=JSON.parse(compiled);console.log(output.contracts[contract.split(":")[0]])console.log(output.errors)}});export{}