Bond/Unbond to Oracles

Bonding and Unbonding processes allow users to purchase dots with Zap tokens, or redeem dots to receive Zap tokens from Oracles.

I. Checking the price of dots

To purchase data from Zap Oracle, users need to call bond method to convert zap token to dots ( 1 dot= 1query / 1 block in subscription). Oracles can set the price for their dots with a price curve, which can make the price of each dot change depending on how many dots is currently issued by the Oracle's endpoint. Checking the price of number of dots you are to purchase will help you determine exact price at that moment. You then can decide to go ahead and purchase or wait for a more preferable time when the price of the same number of dots can be cheaper, normally due to the dots being issued have changed, or you can decide to use a different Oracle with better price for the same data.

To calculate whats the price of the next dot will be , we can simply follow the formula of the bonding curve we want to bond, and replace x with issued dot + 1

Following table provides some examples of bonding curve , issued dot and the result of the next dot's price

Endpoint

Bonding Curve

Dots issued

Next 1 dot price

Btcprice

2 + x^2

3

2 + 4^2 = 18 weiZap

Ethprice

3^10^18 + 10^18x

5

3^10^18 + 10^18*6 = 9*10^18 weiZap = 9 Zap

  • Zap-term cli tool provides options for calculating dots price

  • Web admin can provide visualize for dots price

II. Bond and Unbond

Bond

Method that will hold User's Zap token in Bondage contract and assign number of dots from requested endpoint to user's address.

By bonding sufficient amount of Zap Token, User can have number of dots issued and ready for use. For example from above table, if User bond 9 Zap to Ethprice endpoint, he/she will have 1 dot (the 6th dot) issued and ready for use

Unbond

Method that will release issued dot and redeemed Zap Token to user's address

By unbonding issued dots, User can have Zap Token back, sometime with more or less than what they put in, depends on the current state of bonding curve

Delegate Bond

When User needs data response from Oracle directly to a dapp, or when User wants to bond for someone else, User can do so using method DelegateBond.