price_oracle is a subscribable process which sends the notification to the subscribers on every price update.
- Off-chain price for $AR is being fetched using 0rbit.
- The subscription on an AO process was implemented by the Subscribable Package by Autonomous Finance.
apm-toolwas used to install subscribable and 0rbit package.- betterIDEa was used to test the process.
-
Start AOS
aos price_oracle
-
Load
price_oracle.luafile in your process.load price_oracle.lua
-
Fund
price_oracleprocess Id with $0RBT- DM @megabyte0x or @lucifer0x17 or @0rbit to get $0RBT
-
Start AOS
aos subscriber
-
Send the message to
Register-SubscriberSend({ Target = <PRICE_ORACLE_PROCESS_ID>, Action = 'Register-Subscriber', Topics = json.encode({ 'price-update' }) }) -
Fund the
Subscriberprocess ID with$0RBT -
Send the message to
Pay-For-Subscriptionsend({ Target = 0RBT, Action = 'Transfer', Recipient = <PRICE_ORACLE_PROCESS_ID>, Quantity = "1000000000000", ["X-Action"] = "Pay-For-Subscription", ["X-Subscriber-Process-Id"] = ao.id })
-
Send the message to update the price
Send({Target = ao.id, Action="UpdatePrice"})
After following the above steps you will receive a message on Terminal 2 (Subscriber Process) with updated price.


