Lesson 13 getContractAt() without ABI? #2126
-
I'm just wondering how the getContractAt() works since we're not actually giving it an ABI. We're only giving it our IWeth interface. Do they have the same ABI, if so why? getWeth.js IWeth.sol interface IWeth {
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey @asserules the |
Beta Was this translation helpful? Give feedback.
-
It is because we can use |
Beta Was this translation helpful? Give feedback.
Hey @asserules the
ethers.getContractAt()
method takes three parameters: The ABI, the contract address, and the signer. In this case,IWeth
provides the ABI. Yes the interface and the real contract have the same ABI. In simple terms, the ABI is a collection of parts or fragments that specify how we interact with different functions and components of a contract. And that's what interfaces are for right? Interfaces give us the skeleton structure of the real contracts in terms of of its functions. So if you compile the interface and the contract you will get the same ABI.