hyperlane-xyz / hyperlane-monorepo

The home for Hyperlane core contracts, sdk packages, and other infrastructure
https://hyperlane.xyz
Other
338 stars 373 forks source link

Express write/read web2 API calls inside the Mailbox and ISM abstraction #4703

Open nambrot opened 1 month ago

nambrot commented 1 month ago

Sometimes smart contracts need to either read state from web2 apis, or may want web2 apis to induce a state transition on a smart contract. There are products such as Gelato Web3 Functions or Chainlink Functions which accomplish this. Interoperability is really just a specific subset of the general oracle problem, so it would be pretty interesting to see these kind of oracles expressed as such. This bounty calls for a PoC of such.

To call an API, you could imagine this being implemented:

To read data from an API call, you could imagine the following:

The latter is inspired by protocols that are trying to improve the trust assumptions of bringing Web2 data on-chain like Predicate and Opacity. This bounty would give message senders the ability to leverage these services but have a consistent interface for interacting with the world outside the chain + specifying the trust assumptions of that.

muskbuster commented 1 month ago

Hey @nambrot I'll be taking this up. I think I had already demonstrated similar functionality at eth sg with ccip read.

nambrot commented 1 month ago

Quick feet :)