// An example using hardhat to create a contract and multicall the increment function n-times in a single transaction. import { artifacts, ethers } from "hardhat"; async function main() { const Clicker = await ethers.getContractFactory("CookieClicker"); const clicker = await Clicker.deploy() await clicker.deployed() const amt = 10 // times to multicall the same smart contract function // get the abi of the function you wish to call const inc = await getIncAbi() // call the multicall function var tx = await clicker.multicall( Array(amt).fill(inc) // makes an array with n-times the same element ) } async function getIncAbi() { const artifact = await ethers.getContractFactory("CookieClicker"); var functions = Object.keys(artifact.interface.functions) functions.forEach(function (part, index) { this[index] = "function " + part; }, functions); let iface = new ethers.utils.Interface(functions); return iface.encodeFunctionData("inc") } main()