You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"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.
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.
Setting the decimals (uint8) to 8 in the ChainLink interface is the most common.
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).
Problem
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
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.
decimals (uint8)
to 8 in the ChainLink interface is the most common.getRoundData
for historical data in their contracts. Everyone used thelatestRoundData
method and ignored the values forroundId
andansweredInRound
, paying attention only to timestamps and the data feed value (price).The text was updated successfully, but these errors were encountered: