Skip to content

Commit 1296699

Browse files
committed
Updates to Pulsechain support
1 parent e0d302c commit 1296699

11 files changed

+38
-83
lines changed

.github/ISSUE_TEMPLATE/new_query_type.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ body:
4545
value: >
4646
## Query Parameters |
4747
48-
A query's parameters may change for each instance of your query type. For example, a `SpotPrice` query has both an `asset` and `currency` parameter. One instance of a `SpotPrice` query could have parameter values of `eth` (asset) and `usd` (currency), while another's `currency` parameter value might be `eur`. Query parameters should be styled in `mixedCase`, matching Solidity styling. The definition of your new query type's parameters must each include:
48+
A query's parameters may change for each instance of your query type. For example, a `SpotPrice` query has both an `asset` and `currency` parameter. One instance of a `SpotPrice` query could have parameter values of `pls` (asset) and `usd` (currency), while another's `currency` parameter value might be `eur`. Query parameters should be styled in `mixedCase`, matching Solidity styling. The definition of your new query type's parameters must each include:
4949
- Parameter name (a string)
5050
- Description and value specification
5151
- Valid ABI type

types/ComboQuery.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ The query response will consist of a bytes value in the following format:
4343

4444
*queryData:*
4545

46-
Example for SpotPrice(eth,usd) and SpotPrice(btc,usd)
46+
Example for SpotPrice(pls,usd) and SpotPrice(fetch,usd)
4747

4848
```s
4949
keccak256(abi.encode("ComboQuery", abi.encode(
50-
[abi.encode("SpotPrice", abi.encode("eth","usd")),
51-
abi.encode("SpotPrice", abi.encode("eth","usd"))]
50+
[abi.encode("SpotPrice", abi.encode("pls","usd")),
51+
abi.encode("SpotPrice", abi.encode("fetch","usd"))]
5252
)))
5353
```
5454

@@ -58,8 +58,8 @@ keccak256(abi.encode("ComboQuery", abi.encode(
5858

5959
```s
6060
keccak256(abi.encode("ComboQuery", abi.encode(
61-
[abi.encode("SpotPrice", abi.encode("eth","usd")),
62-
abi.encode("SpotPrice", abi.encode("eth","usd"))]
61+
[abi.encode("SpotPrice", abi.encode("pls","usd")),
62+
abi.encode("SpotPrice", abi.encode("fetch","usd"))]
6363
)))
6464
```
6565

@@ -78,8 +78,8 @@ In the example query:
7878

7979
```
8080
keccak256(abi.encode("ComboQuery", abi.encode(
81-
[abi.encode("SpotPrice", abi.encode("eth","usd")),
82-
abi.encode("SpotPrice", abi.encode("eth","usd"))]
81+
[abi.encode("SpotPrice", abi.encode("pls","usd")),
82+
abi.encode("SpotPrice", abi.encode("pls","usd"))]
8383
)))
8484
8585
```

types/DailyVolatility.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The parameters of the ``DailyVolatility`` query type will be the `asset`, `curre
1515

1616
```
1717
1. asset
18-
- description: Asset ID (ex: ETH)
18+
- description: Asset ID (ex: PLS)
1919
- value type: `string`
2020
2. currency
2121
- description: Selected currency (ex: USD)
@@ -38,7 +38,7 @@ The parameters of the ``DailyVolatility`` query type will be the `asset`, `curre
3838
## Query Data
3939

4040
```s
41-
queryData = abi.encode("`DailyVolatility`", abi.encode("eth", "usd", 30))
41+
queryData = abi.encode("`DailyVolatility`", abi.encode("pls", "usd", 30))
4242
```
4343

4444
## Query ID
@@ -80,10 +80,10 @@ The JSON representation of a `DailyVolatility` query:
8080
## Example
8181
A working example mapping of all the various inputs and parameters to a valid queryID.
8282

83-
The queryData for a 30-day ETH/USD Volatility:
83+
The queryData for a 30-day PLS/USD Volatility:
8484

8585
```s
86-
queryData = abi.encode("DailyVolatility", abi.encode("eth", "usd", 30))
86+
queryData = abi.encode("DailyVolatility", abi.encode("pls", "usd", 30))
8787
queryId = keccack256(queryData)
8888
```
8989

types/FetchOracleAddress.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Description
44

5-
This query returns the latest Fetch oracle address. It is used for updating the time based rewards recipient on Ethereum mainnet.
5+
This query returns the latest Fetch oracle address. It is used for updating the time based rewards recipient on Pulsechain mainnet.
66

77

88
## Query Parameters

types/FetchRNG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Query Description
88

9-
This query returns a pseudorandom number by finding the next bitcoin blockhash after a given timestamp, finding the most recent ethereum blockhash before the bitcoin block, and hashing the two blockhashes together.
9+
This query returns a pseudorandom number by finding the next bitcoin blockhash after a given timestamp, finding the most recent pulsechain blockhash before the bitcoin block, and hashing the two blockhashes together.
1010

1111
## Query Parameters
1212

@@ -71,7 +71,7 @@ A value of `0xa588d598625d216c6f2416efa20970007c501b65a2a815d35389e92d7b944d92`
7171

7272
## Example
7373

74-
When requesting a random number for a timestamp of `1652075943`, one should first find the next bitcoin blockhash. Then find the most recent ethereum blockhash before that bitcoin block. The next bitcoin block is number `735571` with a blockhash of `0000000000000000000201fec7d610dd93645f677dfe68afdd1a3b534194e6af`. The most recent ethereum block before the bitcoin block is number `14740820` with a blockhash of `0xaf3454d3f72c9d3e7b2c26887f6dd1b89431b872e8c6a2c329ee64c8744edf59`. These blockhashes should be converted to strings, encoded with packing into bytes, and hashed using `keccak256` to get a final pseudorandom number of `0x9d6946d952f13e7125134611ad9f5dcc4108d90359b02394d8ef6769cc8574b3`.
74+
When requesting a random number for a timestamp of `1652075943`, one should first find the next bitcoin blockhash. Then find the most recent pulsechain blockhash before that bitcoin block. The next bitcoin block is number `735571` with a blockhash of `0000000000000000000201fec7d610dd93645f677dfe68afdd1a3b534194e6af`. The most recent pulsechain block before the bitcoin block is number `14740820` with a blockhash of `0xaf3454d3f72c9d3e7b2c26887f6dd1b89431b872e8c6a2c329ee64c8744edf59`. These blockhashes should be converted to strings, encoded with packing into bytes, and hashed using `keccak256` to get a final pseudorandom number of `0x9d6946d952f13e7125134611ad9f5dcc4108d90359b02394d8ef6769cc8574b3`.
7575

7676
```solidity
7777
bytes32 randomNumber = keccak256(abi.encodePacked('0xaf3454d3f72c9d3e7b2c26887f6dd1b89431b872e8c6a2c329ee64c8744edf59', '0000000000000000000201fec7d610dd93645f677dfe68afdd1a3b534194e6af'));

types/GasPriceOracle.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Description
88

9-
This is a proposal for a new query type for reporting a gas price in gwei to the Fetch network. The query type will be called `GasPriceOracle`. Its main use case is for gas refunds: protocols will need an accurate estimate for the cost of historical user transactions in gas. Given its approach, this `GasPriceOracle` is best suited for refunding users an approximation of their gas spent according to an average of gas prices from that time period.
9+
This is a proposal for a new query type for reporting a gas price in gbeats to the Fetch network. The query type will be called `GasPriceOracle`. Its main use case is for gas refunds: protocols will need an accurate estimate for the cost of historical user transactions in gas. Given its approach, this `GasPriceOracle` is best suited for refunding users an approximation of their gas spent according to an average of gas prices from that time period.
1010

1111

1212
## Query Parameters
@@ -15,7 +15,7 @@ The parameters of the `GasPriceOracle` query type will be the `chainId` and `tim
1515

1616
```
1717
1. chainId
18-
- description: unique id of the EVM chain (ex: rinkeby is 4)
18+
- description: unique id of the EVM chain (ex: pulsev4 is 943)
1919
- value type: `uint256`
2020
2. timestamp
2121
- description: the unix timestamp to calculate on-chain gas price at
@@ -25,7 +25,7 @@ The parameters of the `GasPriceOracle` query type will be the `chainId` and `tim
2525

2626
## Response Type
2727

28-
`GasPriceOracle`'s response type is an unpacked 256 bit value with 18 decimals of precision. It's response type is measured in gwei:
28+
`GasPriceOracle`'s response type is an unpacked 256 bit value with 18 decimals of precision. It's response type is measured in gbeats:
2929
```
3030
- abi_type: ufixed256x18 (18 decimals of precision)
3131
- packed: false
@@ -77,10 +77,10 @@ The JSON representation of a `GasPriceOracle` query:
7777
## Example
7878
A working example mapping of all the various inputs and parameters to a valid queryID.
7979

80-
The queryData for mainnet ethereum (chainId `1`) at unix timestamp `1650465649`:
80+
The queryData for mainnet pulsechain (chainId `369`) at unix timestamp `1650465649`:
8181

8282
```s
83-
queryData = abi.encode("GasPriceOracle", abi.encode(1, 1650465649))
83+
queryData = abi.encode("GasPriceOracle", abi.encode(369, 1650465649))
8484
queryId = keccack256(queryData)
8585
```
8686

@@ -105,7 +105,7 @@ Note that following this guide does not prevent you from being disputed or guara
105105
- aggregate/medianize gas prices from the relevant block(s)
106106
- be careful when sourcing data from a black box API
107107
- use EIP-1559 gas strategy (the sum of the base fee and priority fee)
108-
- always measured in gwei
108+
- always measured in gbeats
109109

110110

111111

types/LegacyRequest.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

types/LendingPairToxicity.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This query type is used to report a toxicity measure of a given collateral/loan
1010
The `LendingPairToxicity` query has two parameters, which specify the collateral and loan asset pair.
1111

1212
1. **collateral**
13-
- description: Collateral asset symbol (e.g. eth)
13+
- description: Collateral asset symbol (e.g. pls)
1414
- value type: `string`
1515
2. **loan**
1616
- description: Loan asset symbol (e.g. dai)
@@ -30,7 +30,7 @@ The query response will consist of a single 256-bit value in the following forma
3030
For example, to get the query data of an example instance of a `LendingPairToxicity` query using Solidity:
3131

3232
```s
33-
queryData = abi.encode(“LendingPairToxicity, abi.encode("eth", "dai"))
33+
queryData = abi.encode(“LendingPairToxicity, abi.encode("pls", "dai"))
3434
````
3535
3636
## Query ID

types/SpotPrice.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This query returns the spot price of an asset in a specified currency.
1313
The `SpotPrice` query has two parameters, which specify the pricing pair.
1414

1515
1. **asset**
16-
- description: Asset ID (e.g. BTC)
16+
- description: Asset ID (e.g. PLS)
1717
- value type: `string`
1818
2. **currency**
1919
- description: Selected currency (e.g. USD)
@@ -30,42 +30,42 @@ The query response will consist of a single 256-bit value in the following forma
3030

3131
## Examples
3232

33-
### BTC/USD Spot Price
33+
### PLS/USD Spot Price
3434

3535
*Query Descriptor:*
3636

3737
```json
38-
{"type":"SpotPrice","asset":"btc","currency":"usd"}
38+
{"type":"SpotPrice","asset":"pls","currency":"usd"}
3939
```
4040

4141
*queryData:*
4242

4343
```s
44-
abi.encode("SpotPrice", abi.encode("btc", "usd"))
44+
abi.encode("SpotPrice", abi.encode("pls", "usd"))
4545
```
4646

47-
`0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706f745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003627463000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000`
47+
`0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706f745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003706c73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000`
4848

4949
*queryID:*
5050

5151
```s
5252
keccak256(queryData)
5353
```
5454

55-
`0xa6f013ee236804827b77696d350e9f0ac3e879328f2a3021d473a0b778ad78ac`
55+
`0x83245f6a6a2f6458558a706270fbcc35ac3a81917602c1313d3bfa998dcc2d4b`
5656

57-
### TRB/USD Spot Price
57+
### FETCH/USD Spot Price
5858

5959
*Query Descriptor:*
6060

6161
```json
62-
{"type":"SpotPrice","asset":"trb","currency":"usd"}
62+
{"type":"SpotPrice","asset":"fetch","currency":"usd"}
6363
```
6464

6565
*queryData:*
6666

6767
```s
68-
abi.encode("SpotPrice", abi.encode("trb", "usd"))
68+
abi.encode("SpotPrice", abi.encode("fetch", "usd"))
6969
```
7070

7171
`0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706f745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003747262000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000`
@@ -76,7 +76,7 @@ abi.encode("SpotPrice", abi.encode("trb", "usd"))
7676
keccak256(queryData)
7777
```
7878

79-
`0x5c13cd9c97dbb98f2429c101a2a8150e6c7a0ddaff6124ee176a3a411067ded0`
79+
`0x88e6984af423a49262b7d87ef9bc8746ef10def1a819961984e15372b6e1e4ad`
8080

8181

8282
### Encoding/Decoding

types/TWAP.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The parameters of the `TWAP` query type will be the `asset`, `currency`, and `ti
1515

1616
```
1717
1. asset
18-
- description: Asset ID (ex: ETH)
18+
- description: Asset ID (ex: PLS)
1919
- value type: `string`
2020
2. currency
2121
- description: selected currency (ex: USD)
@@ -38,7 +38,7 @@ The parameters of the `TWAP` query type will be the `asset`, `currency`, and `ti
3838
## Query Data
3939

4040
```s
41-
queryData = abi.encode("TWAP", abi.encode("eth", "usd", 86400))
41+
queryData = abi.encode("TWAP", abi.encode("pls", "usd", 86400))
4242
```
4343

4444
## Query ID
@@ -84,10 +84,10 @@ The JSON representation of a `TWAP` query:
8484
## Example
8585
A working example mapping of all the various inputs and parameters to a valid queryID.
8686

87-
The queryData for a 7-day ETH/USD TWAP:
87+
The queryData for a 7-day PLS/USD TWAP:
8888

8989
```s
90-
queryData = abi.encode("TWAP", abi.encode("eth", "usd", 604800))
90+
queryData = abi.encode("TWAP", abi.encode("pls", "usd", 604800))
9191
queryId = keccack256(queryData)
9292
```
9393

types/_NewQueryTypeTemplate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ To generate the query data for an instance of your new Query type, first UTF-8 e
5858

5959
For example, to get the query data of an example instance of a `SpotPrice` query using Solidity:
6060
```s
61-
queryData = abi.encode("SpotPrice", abi.encode("eth", "usd"))
61+
queryData = abi.encode("SpotPrice", abi.encode("pls", "usd"))
6262
```
6363

6464
And for a query with no parameters:

0 commit comments

Comments
 (0)