Skip to content

Commit

Permalink
feat: bridge exposes gasless settings
Browse files Browse the repository at this point in the history
  • Loading branch information
wrap-that-potassium committed Sep 15, 2022
1 parent 4bd4fc8 commit 909ef8d
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,14 @@ app.get("/history/:blockchain/:ban", async (req: Request, res: Response) => {
});

app.get("/prices", async (req: Request, res: Response) => {
const [
banPrice,
bnbPrice,
ethPrice,
maticPrice,
ftmPrice,
] = await Promise.all([
new CoinExPricer("BANUSDT").getPriceInUSD(),
new CoinExPricer("BNBUSDC").getPriceInUSD(),
new CoinExPricer("ETHUSDC").getPriceInUSD(),
new CoinExPricer("MATICUSDC").getPriceInUSD(),
new CoinExPricer("FTMUSDC").getPriceInUSD(),
]);
const [banPrice, bnbPrice, ethPrice, maticPrice, ftmPrice] =
await Promise.all([
new CoinExPricer("BANUSDT").getPriceInUSD(),
new CoinExPricer("BNBUSDC").getPriceInUSD(),
new CoinExPricer("ETHUSDC").getPriceInUSD(),
new CoinExPricer("MATICUSDC").getPriceInUSD(),
new CoinExPricer("FTMUSDC").getPriceInUSD(),
]);
res.send({
ban: banPrice,
bnb: bnbPrice,
Expand All @@ -277,12 +272,15 @@ app.get("/gasless/settings", async (req: Request, res: Response) => {
enabled: config.BlockchainRelayerEnabled,
banThreshold: config.BlockchainGasLessBananoThreshold,
cryptoThreshold: config.BlockchainGasLessCryptoBalanceThreshold,
swapContract: config.WBANGaslessSwapAddress,
});
});

app.get("/gasless/settings/:ban", async (req: Request, res: Response) => {
const banWallet = req.params.ban;
const freeSwapDone = await usersDepositsService.isFreeSwapAlreadyDone(banWallet);
const freeSwapDone = await usersDepositsService.isFreeSwapAlreadyDone(
banWallet
);
res.type("json").send({
gaslessSwapAllowed: !freeSwapDone,
});
Expand Down

0 comments on commit 909ef8d

Please sign in to comment.