0

I am learning about importing contracts and noticed with the following contract there is an external interface function with no code block. Where does this code come from?

function version() external view returns (uint256);

https://github.com/smartcontractkit/chainlink/blob/00528a0217dc78fcdf509728b89ac986a1b6aa9f/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol#L9

1 Answer 1

2

This is the interface definition in Solidity docs

Interfaces cannot have any functions implemented. (...) Interfaces are basically limited to what the Contract ABI can represent, and the conversion between the ABI and an interface should be possible without any information loss.

One way to know the source code is know a address of an interface deployed on a network which has its code verified.

Talking specifically about the AggregatorV3Interface.sol, there are one implementation for each data feed, for example:

AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331)

is the data feed ETH/USD on Ethereum testnet Kovan network.

If you go to the implementation address 0x9326BFA02ADD2366b30bacB125260Af641031331 on Kovan, you will find the source code.

Check it out the Data Feeds API Reference for more information about the AggregatorV3Interface and the addresses of Ethereum Data Feeds.

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.