Skip to content

megabyte0x/oraclesub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Price Oracle Subscription

price_oracle is a subscribable process which sends the notification to the subscribers on every price update.

Tutorial Video

Price Oracle Subscription Tutorial

Tools Utilized

  • 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-tool was used to install subscribable and 0rbit package.
  • betterIDEa was used to test the process.

How to Start

Step 1: Price Oracle Subscribable Process [Terminal 1]

  1. Start AOS

    aos price_oracle
  2. Load price_oracle.lua file in your process

    .load price_oracle.lua
  3. Fund price_oracle process Id with $0RBT

Step 2: Subscribing to Price Oracle Subscribable Process [Terminal 2]

  1. Start AOS

    aos subscriber
  2. Send the message to Register-Subscriber

    Send({
        Target = <PRICE_ORACLE_PROCESS_ID>,
        Action = 'Register-Subscriber',
        Topics = json.encode({ 'price-update' })
    })
  3. Fund the Subscriber process ID with $0RBT

  4. Send the message to Pay-For-Subscription

    send({
            Target = 0RBT,
            Action = 'Transfer',
            Recipient =  <PRICE_ORACLE_PROCESS_ID>,
            Quantity = "1000000000000",
            ["X-Action"] = "Pay-For-Subscription",
            ["X-Subscriber-Process-Id"] = ao.id
        })

Step 3: Updating the price [Terminal 1]

  1. 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.


Subscription Overview

Register Subscriber

Register_Subscriber

Pay for Subscription

Pay_For_Sub

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages