1

I'm using Truffle to compile my contracts. I'd like to create an instance of a contract compiled and deployed previously by someone else so that I can interact with it.

Can this be done without recompiling their entire contract? I assume I would just need the ABI, which I can grab from etherscan.

tl;dr how do I take an ABI from etherscan and then, in solidity, instantiate an instance of it at a particular deployed address?

0

1 Answer 1

0

as of Truffle v5.1.52, you can import ABI JSON files directly from Solidity if they are in your contracts/ folder.

import "./Uniswap.abi.json";

Under the hood, truffle uses https://github.com/gnidan/abi-to-sol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.