Skip to content

Commit

Permalink
get at risk vaults from redis
Browse files Browse the repository at this point in the history
  • Loading branch information
ewansheldon committed Mar 7, 2025
1 parent 06c822b commit d801aea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { getTransactions, vaultTransactionsAddress } = require('./src/transaction
const { getLiquidationPoolData, liquidationPoolsAddress } = require('./src/liquidationPools.js');
const { getRedemptionData, getRedemptionMultiData, vaultRedemptionsAddress, getVaultRedemptionData } = require('./src/redemptions.js');
const { supplyAddress, getSupplyData } = require('./src/supply.js');
const { getAtRiskVaults } = require('./src/liquidations.js');
const port = process.env.PORT || 3000;


Expand Down Expand Up @@ -41,7 +42,7 @@ const server = http.createServer(async (req, res) => {
} else if (supplyAddress(req.url)) {
res.end(JSON.stringify(await getSupplyData(req.url)))
} else if (req.url === '/liquidations') {
res.end(JSON.stringify([]))
res.end(JSON.stringify(await getAtRiskVaults()))
}
// }

Expand Down
14 changes: 14 additions & 0 deletions src/liquidations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { ethers } = require("ethers");
const Pool = require('pg-pool')
const { redisClient } = require("./redis");

const getAtRiskVaults = async _ => {
return (await redisClient.SMEMBERS('atRiskVaults'))
.map(tokenID => {
return { tokenID };
})
}

module.exports = {
getAtRiskVaults
};

0 comments on commit d801aea

Please sign in to comment.