Skip to content

Commit

Permalink
fake vault redemption data endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ewansheldon committed Jan 14, 2025
1 parent ce0e5aa commit 8dd933c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { getPrices } = require('./src/pricing');
const { estimateSwap, estimateSwapUrl } = require('./src/swap.js');
const { getTransactions, vaultTransactionsAddress } = require('./src/transactions.js');
const { getLiquidationPoolData, liquidationPoolsAddress } = require('./src/liquidationPools.js');
const { getRedemptionData } = require('./src/redemptions.js');
const { getRedemptionData, vaultRedemptionsAddress, getVaultRedemptionData } = require('./src/redemptions.js');
const { supplyAddress, getSupplyData } = require('./src/supply.js');
const port = process.env.PORT || 3000;

Expand Down Expand Up @@ -34,6 +34,8 @@ const server = http.createServer(async (req, res) => {
res.end(JSON.stringify(await getLiquidationPoolData(req.url)));
} else if (req.url === '/redemption') {
res.end(JSON.stringify(await getRedemptionData()))
} else if (vaultRedemptionsAddress(req.url)) {
res.end(JSON.stringify(await getVaultRedemptionData(req.url)));
} else if (supplyAddress(req.url)) {
res.end(JSON.stringify(await getSupplyData(req.url)))
}
Expand Down
19 changes: 18 additions & 1 deletion src/redemptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,23 @@ const getRedemptionData = async _ => {
return {tokenID: '29', collateral: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', value: ethers.utils.parseEther('1500').toString()};
};

const vaultRedemptionsAddress = url => {
const split = url.split('/');
return split.length === 3 && split[1] === 'redemptions' && split[2];
}

const getVaultRedemptionData = url => {
return [{
collateral: ethers.constants.AddressZero,
amount: '0.5',
amountUSD: '1500',
debtRepaid: '1700',
ts: '1736849302'
}]
}

module.exports = {
getRedemptionData
getRedemptionData,
vaultRedemptionsAddress,
getVaultRedemptionData
};

0 comments on commit 8dd933c

Please sign in to comment.