Closed null-prophet closed 3 years ago
What I do is simply add a file for each contract on the respective network's deployment folder
Also if the project expose the deployment file on its npm package you can set it up in the external config : https://github.com/wighawag/hardhat-deploy#importing-deployment-from-other-projects-with-truffle-support
ok I kind of get that, this is more for constants.
For instance I might want to deploy to a testnet and talk to a uniswap router or something else like an oracle and the addresses are specific per chainId. The deployments kind of makes sense, but your not deploying anything per se, you just want some specific values per chain.
so this block:
{
external: {
contracts: [
{
artifacts: "node_modules/@cartesi/arbitration/export/artifacts",
deploy: "node_modules/@cartesi/arbitration/export/deploy"
},
{
artifacts: "node_modules/someotherpackage/artifacts",
}
],
deployments: {
rinkeby: ["node_modules/@cartesi/arbitration/build/contracts"],
},
}
}
How could you use the deployments.rinkeby
in this case inside a deploy script? Would you get back some kind of files or does it just deploy these for you?
I was hoping more to get back a map or some kind of typed object (I'm using this with TS) to use.
deployments: {
rinkeby: ["node_modules/@cartesi/arbitration/build/contracts"],
},
}
this would add the contract contained in node_modules/@cartesi/arbitration/build/contracts
to the list of contract tracked by hardhat-deploy on rinkeby
so if you are on rinkeby, you can get them via deployments.get(<name>)
or deployments.all()
will give you access to all of
them
Ah ok, I get it now, that makes sense, your relying on that deployed contract info to be available to get your info on addressess etc on rather than hardcoding it. That makes sense.
I just need to confirm I can grab the contract json files for the SC's in question. 😄
Hi, this is more of a general convention question that I couldn't seem to see any general answer for around contract deployment configurations.
Say I have a token contract that depends on specific contract addresses (uniswap for example) in testnet or mainnet.
How best to possibly externalise those addresses/variables so deploy scripts could pick up the testnet variants or mainnet variants when deploying to specific networks?
Sushiswap has an excellent paradigm of AddressMaps which are maps of addresses keyed on chainIds as a good general solution to things like this. Is there something in hardhat that would achieve this or would I have to roll my own config/chainId config generator?
I can probably put something together quite easily using json config files or similar but hoped someone might have already solved this problem.
Thanks