-
In the following deploy script the constructor args are hardcoded, but that is not dynamic. I need to supply the constructor args from outside the script. There are a number of similar question but non was answered. (https://ethereum.stackexchange.com/questions/112004/how-do-you-deploy-a-smart-contracts-constructor-arguments-with-hardhat) Could someone please help me with this? module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
const args = ["Ford", "Figo", "Blue", 2010, true, ethers.utils.parseEther("0.002")]
const carAuction = await deploy("CarAuction", {
from: deployer,
args: args,
log: true,
waitConfirmations: network.config.blockChainConfirmations || 1,
})
if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
await verify(carAuction.address, args)
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
What do you mean by "dynamic"? The smart contract deployment itself is indeed correct,
is the problem with you wanting a modified args to some conditional for the contract deployment? |
Beta Was this translation helpful? Give feedback.
-
You are looking for this I think It seems like you want to create different contracts for each individual car but why? you can simply create struct for Cars and add as many cars you want for auction through a single contract. |
Beta Was this translation helpful? Give feedback.
You are looking for this I think
https://stackoverflow.com/questions/4351521
It seems like you want to create different contracts for each individual car but why? you can simply create struct for Cars and add as many cars you want for auction through a single contract.