This service aggregates data from Spark Protocol across multiple chains, providing a crucial link between Spark Lend and applications that wish to utilize its data. Spark Lend is a lending market based on the Aave v3 codebase, that is currently live on Gnosis and Ethereum.
This Data Service was initially developed to be used in conjugation with Spark Nexus, but it can also be run stand-alone.
Note: for an Aave-exclusive Data Service, see the following branch.
- Aggregates and serves market data from Spark Lend.
- Provides user-specific deposit, debt, and health factor information.
- Supports multiple blockchains (i.e. where Spark Protocol is deployed)
- Is accesible as public API
You can deploy this locally, or have it run on Cloudflare.
We have deployed it at https://spark-api.pages.dev/
Before running the service locally, ensure you have the following installed:
- Node.js
- Yarn package manager
- Clone the repository to your local machine.
- Run
yarn install
to install dependencies. - Use
yarn start
to run the app server locally onlocalhost:8080
.
Deploy the service to Cloudflare Pages with the yarn deploy
command.
Ensure you have the correct permissions and environmental variables set up.
i.e. in the Cloudflare Dashboard, under Workers & Pages
create a Page with name spark-api
(or which name you defined in package.json
). You do not need to link it to the Github repo.
- Ethereum Mainnet (1)
- Gnosis (100)
- For debuggin purposes only: Polygon Mainnet (137) (fetching data from Aave v3 on Polygon)
-
markets
-
GET
/:chainId/markets
-
Get all available Spark Lend markets
-
chainId
: Spark Lend supported chain IDExample query: https://spark-api.pages.dev/100/markets
Example local query: http://localhost:8080/100/markets
-
-
deposits
GET
/:chainId/deposits/:user
- Get user deposits
chainId
: Spark Lend supported chain IDuser
: user address
Example query: https://spark-api.pages.dev/100/deposits/0xca4aD39F872E89Ef23eABd5716363Fc22513E147
Example local query: http://localhost:8080/100/deposits/0xca4aD39F872E89Ef23eABd5716363Fc22513E147
-
debts
-
GET
/:chainId/debts/:user
-
Get user debts
-
chainId
: Spark Lend supported chain ID -
user
: user addressExample query: https://spark-api.pages.dev/100/debts/0xca4aD39F872E89Ef23eABd5716363Fc22513E147
Example local query: http://localhost:8080/100/debts/0xca4aD39F872E89Ef23eABd5716363Fc22513E147
-
-
health factor
-
GET
/:chainId/health/:user
-
Estimate user's new health factor after certain action
-
chainId
: Spark Lend supported chain ID -
user
: user address -
query params
action
:deposit
|withdraw
|borrow
|repay
amount
: token USD valueasset
: token address
Example local query: http://localhost:8080/100/health/0xca4aD39F872E89Ef23eABd5716363Fc22513E147?action=deposit&amount=10&asset=0xe91d153e0b41518a2ce8dd3d7944fa863463a97d
-
A special thank you to the contributors and maintainers of the Aave Data Service, originally developed for the AAVE v3 NEAR BOS Component, upon which this project is based.
References: https://github.com/corndao/aave-data-service