I have my Contract A which creates an ERC20 in the constructor. In the ContractA.t.sol I want to get the ERC20 to interact with it (I have a public method inside Contract A to get the ERC20 address). Does Foundry provide something like the ethers.getContractAt?

1 Answer 1


You can :

1.Write a solidity depoly script and return your deployed ERC20 object in the script and import it in your test file.


  1. Deploy it in your setUp() and use the object if you're testing locally.

There are also tools that can help you to get the deployed contract data from out(I guess)folder.

Your Answer

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

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