Skip to main content

Operate the Oracle

With the enclave deployed, registered, and the contract published, you can now start submitting price updates.

Update Prices​

Fetch the signed price from the enclave and submit it on-chain:

sh contracts/script/update_price.sh $PUBLIC_IP $DEMO_PACKAGE_ID $ORACLE_ID $REGISTRY_ID

This script:

  1. Calls GET http://$PUBLIC_IP:3000/price to get the signed price payload
  2. Submits the data to the update_sui_price Move function
  3. The contract verifies the signature and stores the price

You can run this manually or set up a cron job for automated updates:

# Update every 5 minutes
*/5 * * * * /path/to/sui-oyster-demo/contracts/script/update_price.sh $PUBLIC_IP $DEMO_PACKAGE_ID $ORACLE_ID $REGISTRY_ID

Query Prices​

You can fetch the latest signed price directly from the enclave using the provided script:

sh contracts/script/get_price.sh $PUBLIC_IP

This calls the enclave's /price endpoint and displays the price (in USD), timestamp, and signature.

To view prices that have been submitted on-chain, inspect the PriceOracle object fields directly on SuiScan by searching for the ORACLE_ID.