Skip to content

Commit 65706b5

Browse files
committed
Oracle precompile + formatting
1 parent 143a5f0 commit 65706b5

File tree

4 files changed

+54
-3
lines changed

4 files changed

+54
-3
lines changed

pages/dev-advanced-concepts/interoperability/precompiles/_meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"cosmwasm": "CosmWasm",
88
"ibc": "IBC",
99
"json": "JSON",
10+
"oracle": "Oracle",
1011
"governance": "Governance"
1112
}

pages/dev-advanced-concepts/interoperability/precompiles/ibc.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This precompile enables funds transfer over IBC protocol.
3838
- `transferWithDefaultTimeout`: Send funds to another chain using IBC protocol. Calculates the timeout
3939
height/timestamp based on the current block timestamp.
4040

41-
```solidity
41+
```solidity
4242
/// Send funds to another chain using IBC protocol. Calculates the timeout height/timestamp
4343
/// based on the current block timestamp.
4444
/// @param toAddress The recipient's address on the other chain

pages/dev-advanced-concepts/interoperability/precompiles/json.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This precompile enables EVM clients to query JSON data.
2222
```
2323

2424
- `extractAsBytesList`: Extracts data as a list of bytes from the input using the specified key.
25-
```solidity
25+
```solidity
2626
/// Extracts data as a list of bytes from the input using the specified key.
2727
/// @param input The input data.
2828
/// @param key The key to extract.
@@ -33,7 +33,7 @@ This precompile enables EVM clients to query JSON data.
3333
```
3434

3535
- `extractAsUint256`: Extracts data as a uint256 from the input using the specified key.
36-
```solidity
36+
```solidity
3737
/// Extracts data as a list of bytes from the input using the specified key.
3838
/// @param input The input data.
3939
/// @param key The key to extract.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { Callout } from "nextra/components";
2+
3+
# Orcale Precompile
4+
5+
**Address**: `0x0000000000000000000000000000000000001008`
6+
7+
This precompile enables EVM clients to query the Oracle module.
8+
9+
## Functions
10+
11+
### Queries
12+
- `getExchangeRates`: Gets the corresponding Sei Address from the given EVM Address
13+
```solidity
14+
/// Retrieves the exchange rates for all denominations.
15+
/// @return An array of denomination and exchange rate pairs.
16+
function getExchangeRates() external view returns (DenomOracleExchangeRatePair[] memory);
17+
18+
// Structs
19+
struct OracleExchangeRate {
20+
string exchangeRate;
21+
string lastUpdate;
22+
int64 lastUpdateTimestamp;
23+
}
24+
25+
struct DenomOracleExchangeRatePair {
26+
string denom;
27+
OracleExchangeRate oracleExchangeRateVal;
28+
}
29+
```
30+
31+
- `getOracleTwaps`: Retrieves Oracle Time-Weighted Average Prices (TWAPs) for the specified lookback period.
32+
```solidity
33+
/// Retrieves Oracle Time-Weighted Average Prices (TWAPs) for the specified lookback period.
34+
/// @param lookback_seconds The lookback period in seconds.
35+
/// @return An array of denomination and TWAP pairs.
36+
function getOracleTwaps(
37+
uint64 lookback_seconds) external view returns (OracleTwap[] memory);
38+
39+
// Structs
40+
struct OracleTwap {
41+
string denom;
42+
string twap;
43+
int64 lookbackSeconds;
44+
}
45+
```
46+
47+
<Callout type="info">
48+
View the Oracle precompile source code and the contract ABI
49+
[here](https://github.com/sei-protocol/sei-chain/tree/main/precompiles/oracle).
50+
</Callout>

0 commit comments

Comments
 (0)