Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve(limits): Allow developer to set minDepositUSD #1197

Merged
merged 4 commits into from
Sep 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions api/limits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ const handler = async (
} = process.env;
const provider = getProvider(HUB_POOL_CHAIN_ID);

const minDeposits = REACT_APP_MIN_DEPOSIT_USD
? JSON.parse(REACT_APP_MIN_DEPOSIT_USD)
: {};

const fullRelayers = !REACT_APP_FULL_RELAYERS
? []
: (JSON.parse(REACT_APP_FULL_RELAYERS) as string[]).map((relayer) => {
Expand All @@ -88,6 +84,12 @@ const handler = async (
outputToken,
} = validateChainAndTokenParams(query);

const minDepositUsdForDestinationChainId = Number(
process.env[`REACT_APP_MIN_DEPOSIT_USD_${destinationChainId}`] ??
REACT_APP_MIN_DEPOSIT_USD ??
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooc, does this actually need the REACT_APP prefix? I thought that was what gets pushed client side, but this is in the API.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair point

0
);

const hubPool = getHubPool(provider);
const configStoreClient = new sdk.contracts.acrossConfigStore.Client(
ENABLED_ROUTES.acrossConfigStoreAddress,
Expand Down Expand Up @@ -193,7 +195,7 @@ const handler = async (
? ethers.BigNumber.from(0)
: ethers.utils
.parseUnits(
(minDeposits[destinationChainId] ?? 0).toString(),
minDepositUsdForDestinationChainId.toString(),
l1Token.decimals
)
.mul(ethers.utils.parseUnits("1"))
Expand Down
Loading