Skip to content

Commit

Permalink
logging liq pool data indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
ewansheldon committed Feb 26, 2024
1 parent 93c9077 commit 7f60981
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ schedulePricingIndexing();
// scheduleStatIndexing();
scheduleIndexYieldData();
scheduleVaultTransactionIndexing();
// scheduleLiquidationPoolData();
scheduleLiquidationPoolData();

const server = http.createServer(async (req, res) => {
res.statusCode = 200;
Expand Down
17 changes: 9 additions & 8 deletions src/liquidationPools.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const fetchPrices = async (networkName, wallet) => {
};

const scheduleLiquidationPoolData = async _ => {
schedule.scheduleJob('22 * * * *', async _ => {
schedule.scheduleJob('* * * * *', async _ => {
console.log('indexing liquidation pool snapshots')
const network = getNetwork('arbitrum');
const provider = new getDefaultProvider(network.rpc);
Expand All @@ -79,13 +79,14 @@ const scheduleLiquidationPoolData = async _ => {
const now = new Date();
const client = await pool.connect();
try {
const query = 'INSERT INTO user_pool_snapshots (user_address,assets,snapshot_at) VALUES ($1,$2,$3);';
const data = [
holderAddress.toLowerCase(),
assets,
now
];
await client.query(query, data);
console.log(POSTGRES_HOST, POSTGRES_PORT, POSTGRES_DB, POSTGRES_USERNAME, POSTGRES_PASSWORD.length)
// const query = 'INSERT INTO user_pool_snapshots (user_address,assets,snapshot_at) VALUES ($1,$2,$3);';
// const data = [
// holderAddress.toLowerCase(),
// assets,
// now
// ];
// await client.query(query, data);
} catch (e) {
console.log(e);
} finally {
Expand Down

0 comments on commit 7f60981

Please sign in to comment.