I'm using Truffle, Solidity, Web3.js, and Ganache. Whenever I deploy a smart contract, I have to copy and paste the new ABI & address of the contract. How can I dynamically change the value so that every time a new smart contract is deployed it saves me from having to copy and paste these new values into my .js file?
1 Answer
artifacts.require("<contract_name>") will fetch the contracts json file(which is generated in build folder after compiling every time) within truffle project.
index.js
it imports the contract artifactimport metaCoinArtifact from "../../build/contracts/MetaCoin.json"
directly from the truffle output.