-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from valorem-labs-inc/alcibiades/val-575-erc20…
…-spot-price-streaming Spot price streaming interface
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
syntax = "proto3"; | ||
|
||
// Import additional EVM data types types. | ||
import "types.proto"; | ||
|
||
package valorem.trade.v1; | ||
|
||
// Spot service offers methods related to the spot tokens | ||
// on various Ethereum-related chains. | ||
service Spot { | ||
|
||
// GetSpotPriceStream is a server-streaming RPC. It provides real-time spot prices | ||
// for a list of tokens across multiple chains. | ||
// | ||
// Parameters: | ||
// SpotPriceRequest: Contains information about which tokens' spot prices | ||
// should be fetched on their respective chains. | ||
// Returns: | ||
// stream of SpotPriceResponse: Continuously streams data about the spot prices | ||
// of the requested tokens on their respective chains | ||
// as updates are available. | ||
rpc GetSpotPrice (SpotPriceRequest) returns (stream SpotPriceResponse); | ||
} | ||
|
||
// SpotPriceRequest encapsulates the details of the tokens for which | ||
// spot prices are desired. | ||
message SpotPriceRequest { | ||
|
||
// spot_price_info contains the details of each token (like its address and the | ||
// chain it's on) for which the spot price should be fetched. | ||
repeated SpotPriceInfo spot_price_info = 1; | ||
} | ||
|
||
// SpotPriceResponse provides the fetched spot prices for the tokens specified in the request. | ||
message SpotPriceResponse { | ||
|
||
// spot_price_info holds the data about the fetched spot prices for each of the | ||
// tokens specified in the request. | ||
repeated SpotPriceInfo spot_price_info = 1; | ||
} | ||
|
||
// SpotPriceInfo represents the details and the spot price (if available) for a single token | ||
// on a particular blockchain. | ||
message SpotPriceInfo { | ||
|
||
// chain_id denotes the specific chain on which the token is located. | ||
uint64 chain_id = 1; | ||
|
||
// token_address is the Ethereum address of the token, usually in H160 format. | ||
H160 token_address = 2; | ||
|
||
// spot_price, if available, is the current spot price in USD of the token. | ||
// It is represented in a 60x18 (42 integer digits, 18 decimals) H256 format | ||
// for high precision. This field is optional since the spot price might not | ||
// always be available for every token, and because this message is reused | ||
// in the request and response stream. | ||
optional H256 spot_price = 3; | ||
} |