Get started to build on Pragma
get_asset_price
, which takes as input the asset id of the asset we want to retrieve the price of, and returns the price of the asset. The asset id is a felt252, and can be converted from a string using the felt252
conversion. The asset id is used to identify the data feed we want to retrieve (for example BTC/USD).
Then comes the contract itself:
AggregationMode
enum is used to specify the aggregation mode of the data, the DataType
enum is used to specify the type of data to be retrieved, and the PragmaPricesResponse
structure is used to store the response to the function call.
Activate the Starknet Plugin
Compile the Code
Interact with the Contract