Learn about the different functionality available in the Interchain Messaging Registry.
TeleporterRegistry keeps track of TeleporterMessenger contract versions. Cross-Avalanche L1 dApps can request the latest or a specific version of the TeleporterMessenger:
Internally the TeleporterRegistry maintains a mapping of TeleporterMessenger contract versions to their addresses.
Each registry's mapping of version to contract address is independent of registries on other blockchains, and chains can decide on their own registry mapping entries. So the contract of version 4 on one chain does not have to be equal to that version on another chain.
In the TeleporterRegistry contract, the latestVersion state variable returns the highest version number that has been registered in the registry. The getLatestTeleporter function returns the ITeleporterMessenger that is registered with the corresponding version. Version zero is an invalid version, and is used to indicate that a TeleporterMessenger contract has not been registered yet.
If a cross-Avalanche L1 dApps prefers a specific version, it can also call directly the getAddressFromVersion function:
If you are interested in the entire implementation, check it out here.