Skip to content

Commit

Permalink
rewards format
Browse files Browse the repository at this point in the history
  • Loading branch information
ewansheldon committed Dec 7, 2023
1 parent 49038cc commit eee2db3
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/liquidationPools.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ let pool = new Pool({
user: POSTGRES_USERNAME,
password: POSTGRES_PASSWORD,
host: POSTGRES_HOST,
port: POSTGRES_PORT,
max: 20, // set pool max size to 20
idleTimeoutMillis: 1000, // close idle clients after 1 second
connectionTimeoutMillis: 1000, // return an error after 1 second if connection could not be established
maxUses: 7500, // close (and replace) a connection after it has been used 7500 times (see below for discussion)
port: POSTGRES_PORT
});

const liquidationPoolsAddress = url => {
Expand All @@ -31,21 +27,9 @@ const getDBData = async userAddress => {
return result;
}

const formatRewards = data => {
return data.map(snapshot => {
snapshot.rewards = snapshot.rewards.map(reward => {
return {
symbol: reward[0],
amount: reward[1]
};
});
return snapshot;
});
}

const getLiquidationPoolData = async url => {
const userAddress = liquidationPoolsAddress(url).address.toLowerCase();
return formatRewards(await getDBData(userAddress));
return await getDBData(userAddress);
};

module.exports = {
Expand Down

0 comments on commit eee2db3

Please sign in to comment.