Moebius is a cross-chain oracle that bridges on-chain Ethereum data to Solana.

Overview
Moebius is a program deployed on Solana that accepts update instructions from the Moebius authority. The authority key is loaded in Moebius Bridge and listen for the Moebius events on the Ethereum blockchain. On noticing such an event, the authority then broadcasts an update instruction to the Moebius program deployed on Solana.The update instruction received by Moebius then invokes an update instruction on the target program and account. The update succeeds if the target program and account follow Moebius-compatible structure, and are capable of decoding and processing the instruction.
In order to enable a cross-chain oracle via Moebius, a user will need to:
- Deploy a target program on Solana, e.g. simple_program.
- Deploy a source contract on Ethereum, e.g. SimpleContract.
- Broadcast a transaction to the Moebius contract's
executefunction.
event MoebiusData(bytes32 programId, bytes32 accountId, bytes _packedData); that the Moebius bridge is listening for.
An event with the above signature would be intercepted, parsed and broadcasted to the Moebius program deployed to Solana by a trusted Moebius authority.
Moebius-Uniswap
Using Moebius Bridge, the first use-case implemented was to bridge Uniswap time-weighted average prices (TWAP) from Ethereum contracts to Solana programs.- A transaction that updated the Uniswap UNI/WETH average price on Ethereum here
- A transaction that updated the Uniswap UNI/WETH pricefeed state on Solana here
Ethereum
The below contracts are deployed on the Ethereum's Ropsten testnet| Contract | Address | |----------------|-------------------------------------------------------------------------------------------------------------------------------| | Moebius | 0x4f2A9aC3A70400636190e1df213Fd7Aa0BCF794d | | Uniswap Oracle | 0x20412cA3DA74560695529C7c5D34C1e766B52AeB |
Solana
The below programs are deployed on Solana's Devnet| Program/Account | Address | |-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------| | Moebius | 6kAHanNCT1LKFoMn3fBdyvJuvHLcWhLpJbTpbHpqRiG4 | | Uniswap Program | G33TSUoKH1xM7bPXTMoQhGQhfwWkWT8dGaW6dunDQoen | | Trusted Moebius Authority | BREEUNEkUnR7TidwEGptGDREGD3aVHu5Qv5Bvan9fjP6 |
- Run script that periodically updates and consults the Uniswap oracle. Make sure the address you use has sufficient Ropsten ETH balance.
$ cd ethereum/
export INFURAAPIKEY=your-infura-api-key
export ETHPRIVATEKEY=your-hex-private-key-excluding-0x
$ npx hardhat run scripts/update-uniswap-oracle.js --network ropsten
- Run Moebius Reporter, a GraphQL server that exposes Uniswap pricefeed from Solana account.
$ cd solana/
$ ./target/debug/reporter
Visit http://localhost:8080/graphiql and query:
query {
uniswapOracle(token0: "1f9840a85d5af5bf1d1762f925bdaddc4201f984", token1: "c778417e063141139fce010982780140aa0cd5ab") {
token0
decimal0
amount0
token1
decimal1
amount1
priceToken0Token1
priceToken1Token0
}
}
where 1f9840a85d5af5bf1d1762f925bdaddc4201f984 is UNI and c778417e063141139fce010982780140aa0cd5ab is WETH. If Moebius bridge is disabled, the reporter will respond with the most recently updated pricefeed.
- Use Moebius API to fetch Uniswap pricefeed in your Solana programs.
//
// [dependencies]
// moebius-api = { git = "https://github.com/roynalnaruto/moebius/solana/moebius-api" }
//
// Instantiate API client
let api = moebius_api::MoebiusApi::new()
.withrpcurl(String::from("https://devnet.solana.com"));
// Fetch UNI-WETH pricefeed
let pricefeed = api.uniswap_oracle(
"1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"c778417e063141139fce010982780140aa0cd5ab"
)?;
// UNI/WETH
let pricetoken0token1 = pricefeed.pricetoken0token1();
// WETH/UNI
let pricetoken1token0 = pricefeed.pricetoken1token0();
Setup Guides
To setup Moebius and its components locally, follow:- Prerequisite setup guide
- Simple Program setup and run guide
- Uniswap Oracle setup and run guide
- Create New Moebius-compatible Program setup guide