Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement handling and execution of oracle data #62

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

noot
Copy link
Contributor

@noot noot commented Dec 13, 2024

implement handling of oracle data received via the execution API.

see relevant contract for context: https://github.com/astriaorg/astria-oracle-contracts/blob/main/src/AstriaOracle.sol

flow is as follows:

  • the AstriaOracle contract is deployed on the rollup and the address is set in genesis
  • when the rollup receives RollupData.OracleData via the execution API, which consists of a vector of price updates, it converts these into contract calls to AstriaOracle.
  • if the currency pair in the update is not initialized in the contract, it calls initializeCurrencyPair before calling updatePriceData. this is needed to set the decimals for that pair, which is not updated once the pair has been initialized.
  • if a block does not contain any oracle data, then no price updates happen for that block, but everything else gets executed as normal.

other changes:

  • renamed DepositTx to InjectedTx, as the same type is now being used for deposits and oracle updates. it was not necessary to create a new type, as the previous erc20 calls being done by the DepositTx were generic to what they were calling.
  • split out the grpc/execution/validation.go validation and conversion function into separate functions for each RollupData type, no logic was changed for Deposit/SequencedData.

todo:

  • need to test this end to end and determine gas amounts for the oracle contract calls. updatePriceData will be dependent on the number of prices being updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant