The Sui Gas Oracle Module is a high-performance price feed provider deployed on the Sui blockchain. It stores real-time gas price data for multiple EVM chains (in wei) and provides advanced features like buy signals and 24-hour price tracking.
The core smart contract logic for the oracle.
- Data Precision: Stores gas prices in
u128(wei) to ensure full precision across all chains. - Multi-Chain Support: Tracks data for Ethereum, Base, Arbitrum, Polygon (MATIC), and Optimism.
- Price Tracking: Maintains 24-hour high and low prices for each chain.
- Buy Signals: Implements
get_buy_signalwhich detects if current gas prices are significantly lower (>10%) than the 24h average. - Authorization: Uses an
OracleAdminCapto restrict price updates to authorized bots. - Staleness Protection: Includes checks to verify that price data has been updated within a 5-minute threshold.
A comprehensive bash script to simplify the deployment of the Move module.
- System Checks: Verifies Sui CLI installation and current network configuration.
- Automated Build: Triggers
sui move buildbefore deployment. - Deployment: Publishes the package to Sui Testnet with appropriate gas budgets.
- Configuration Guide: Provides instructions on extracting
ORACLE_PACKAGE_ID,ORACLE_OBJECT_ID, andADMIN_CAP_IDfrom the JSON response.
First install Rust on your system.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shLoad Rust into your shell
source $HOME/.cargo/envInstall suiup
curl -sSfL \
https://raw.githubusercontent.com/Mystenlabs/suiup/main/install.sh \
| shThen, Install Sui
suiup install sui@testnetsui client new-address ed25519List all addresses:
sui client addressesCheck active address:
sui client active-addresssui client switch --env testnetOption A: Discord Faucet
- Join Sui Discord
- Go to
#testnet-faucet - Type:
!faucet <YOUR_ADDRESS>
Option B: CLI Faucet
sui client faucet# Navigate to this directory
cd sui-modules
# Build
sui move build# Use the helper script
./deploy.sh
# OR manually:
sui client publish --gas-budget 100000000Save these IDs from the deployment output (JSON):
ORACLE_PACKAGE_ID: The ID of the published packageORACLE_OBJECT_ID: The ID of theGasOracleobjectADMIN_CAP_ID: The ID of theOracleAdminCapobject
You will need these to configure your Bot .env and Relayer .env files.
| Function | Description |
|---|---|
update_gas_price |
Update single chain price (wei, u128) |
batch_update_gas_prices |
Update all chains at once (wei, u128) |
get_current_price |
Read current price in wei |
get_gas_token |
Get gas token symbol (ETH, MATIC, etc.) |
get_price_data |
Get full price data including high/low |
get_buy_signal |
Check if good time to buy (>10% cheaper than avg) |
add_chain |
Add new chain with gas token |
| Chain | Gas Token | Chain ID |
|---|---|---|
| ethereum | ETH | 11155111 (Sepolia) |
| base | ETH | 84532 (Sepolia) |
| arbitrum | ETH | 421614 (Sepolia) |
| polygon | MATIC | 80002 (Amoy) |
| optimism | ETH | 11155420 (Sepolia) |