-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Description
For the treasury there are multiple data collection points to account for, should be cached every day. Everything should be converted to USDC for its rate. See yam treasury assets to understand where is it located at, and be able to pull it to then save it into the database and serve it on the endpoints.
Endpoints
/treasury
- Data should be fetched and saved on the database every 1 day at 01:00 AM UTC.
- Should return:
- One object.
{
timestamp: TIMESTAMP, // time last saved when the data was collected
values: {
assets: {
...
"USDC": 400000,
"WETH": 600000,
"UMA": 100000,
...
},
total: 1100000 // total combined assets value when the data was collected
}
}
/treasury-history
- Data should be fetched and saved on the database every 1 day at 01:00 AM UTC.
- Should return:
- Multiple objects and each is an average of 7 days data.
- Maximum objects returned are always the past 52 objects.
{
...
{
timestamp: TIMESTAMP,
values: {
assets: {
...
"USDC": 0,
"WETH": 0,
"UMA": 0,
...
},
total: 0
}
},
{
timestamp: TIMESTAMP,
values: {
assets: {
...
"USDC": 400,
"WETH": 600,
"UMA": 100,
...
},
total: 1100
}
},
{
timestamp: TIMESTAMP,
values: {
assets: {
...
"USDC": 400000,
"WETH": 600000,
"UMA": 100000,
...
},
total: 1100000
}
},
...
}
Follow the .env.example
to add or use secrets if needed.
Requirements
- Adding call for the specified endpoints.
- Caching the data every hour using cron to the mongo database, appending the last cached data for the
/treasury
endpoint calls. - On your PR include examples of what the endpoints are returning.
- Use your own mongo database for testing.
- Documenting the code.
Metadata
Metadata
Assignees
Labels
No labels