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

[evm] Oracle precompile UX would be improved by update time information #2075

Open
1 of 2 tasks
Unique-Divine opened this issue Oct 11, 2024 · 0 comments
Open
1 of 2 tasks
Assignees

Comments

@Unique-Divine
Copy link
Member

Unique-Divine commented Oct 11, 2024

Problem

"Why does the precompile only return the price without also including the timestamp at which the price was last updated? This info is usually very important for contracts as you would want to verify if the price is stale by checking the timestamp." - from @berndartmueller in Audit comment

Solution

Here are some common interfaces that are standard for many Ethereum developers:

The Oracle Module exposes all of this information, so we can implement both of these interfaces over time on Nibiru's Oracle.sol precompiled contract. Let's focus on the ChainLink one for now since that's been cited as a more common request and handle the Pyth interface as a separate ticket.

The Ask

  • Expose timestamp information for the oracle exchange rate query. Completed by feat(oracle): Add new DatedExchangeRate query with block timestamp and block height #2097
  • Implement the ChainLink interface on the oracle precompile using 8 decimals and setting the round ID as the block number for simplicity. You can import the interface as an npm dependency and write an "is" statement to guarantee compatibility for users that import the precompiled contract.

2024-11-08 - Note on User Expectations

I asked around to a few of the teams building apps on top of Nibiru, and all of them mentioned that they want to follow the conventions for constants that are seen on Ethereum.

  1. Setting the decimals (uint8) to 8 in the ChainLink interface is the most common.
  2. No one I spoke to uses getRoundData for historical data in their contracts. Everyone used the latestRoundData method and ignored the values for roundId and answeredInRound, paying attention only to timestamps and the data feed value (price).

@github-project-automation github-project-automation bot moved this to ⚡ Building 🧱 in ⚛️ Nibiru (Hougyoku) Oct 11, 2024
@github-actions github-actions bot added the S-triage Status: This issue is waiting on initial triage. More Info: https://tinyurl.com/25uty9w5 label Oct 11, 2024
@Unique-Divine Unique-Divine self-assigned this Nov 12, 2024
@Unique-Divine Unique-Divine removed the S-triage Status: This issue is waiting on initial triage. More Info: https://tinyurl.com/25uty9w5 label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ⚡ Building 🧱
Development

No branches or pull requests

1 participant