Building with Aave market data
Aave markets data (assets reserves, incentives, etc) are stored in the Alpine global store aaveMarkets.
How to use it
- Prerequisite: in the markup, add
x-datato give the DOM node + its descendants access to this global store - in your markup, use
$store.aaveMarkets.<property name>to access any value defined in the store
$store.aaveMarkets Store Structure
1.$store.aaveMarkets.fetchStatus
- Type:
string - Description: Represents the status of the Aave markets query.
- Possible Values:
"idle","pending","success","refreshing" - Defaults to:
"idle"
2. $store.aaveMarkets.markets
- Type:
Array - Description: Contains detailed markets data.
- Defaults to:
undefined - Value Set by:
fetchMarketsDatafunction.
Store Methods
$store.aaveMarkets.fetchMarketsData
- Type:
Promise<void> - Description: Initiates a query to retrieve Aave markets data. Refer to Aave Utilities documentation for detailed description.
- Automatic Execution: Initialized during store initialization and triggered whenever a
Supply,Borrow,Repay, orWithdrawevent occurs.
$store.aaveMarkets.watchContractsEvents
- Type:
Promise<void> - Description: Actively listens to
Supply,Borrow,Repay, andWithdrawevents. - Automatic Execution: Initialized during store initialization.
- Functionality: Calls
fetchMarketsDatain response to these events and dispatches custom events on thewindowobject.