Skip to Content
DocumentationEVM OracleDemo DApp: Dogeball

Dogeball Demo

This interactive demo showcases the Morpher Oracle’s ability to provide real-time price data on-chain through ERC-4337 account abstraction. You can mint Dogeball tokens for $5 worth of the network’s native token, with the price determined at transaction time by the oracle.

How It Works

You are currently interacting with a javascript client on this nextJS website, which is using a modified version of CandideLabs AbstractionKit.

The client is fetching the Data Requirements from the Dogeball contract and creating a data-dependent user operation, an enhanced version of the standard ERC-4337 user operation. In this case the Requirements of the minting functions are the price of ETH provided by Morpher.

How It Works

Each Data Requirement specifies 3 things:

  • Who is providing the data (the EOA address of the data provider). In this case, the Morpher data provider.
  • The bytes32 key that identifies the data needed. In this case it’s keccak256(“MORPHER:CRYPTO_ETH”) (The key definition is up to the provider)
  • The address which is consuming the data when the function is called. In this case, the Dogeball contract itself.

To estimate gas and submit the user operation, this client is relying on a modified version of CandideLabs Voltaire Bundler. Note that at this current version of the bundler implementation, the client is not free to choose any entity which is running the modded bundler, but it MUST submit the user operation to the bundler hosted by the Data Requirement’s provider, since the latter is the only one that have access to the requested data. In this case, only the Moprher data provider can provide “MORPHER:CRYPTO_ETH” price signed by the private key of the provider address specified in the Data Requirement.

Upon receiving the user operation, the bundler includes both your user operation and a new user operation which call storeData on the Oracle Entrypoint contract in the bundle and send it to the ERC-4337 entrypoint. In the end, within a single transaction, the data is stored and consumed without any delay.