Skip to content

Commit

Permalink
chore: merge branch
Browse files Browse the repository at this point in the history
  • Loading branch information
james-a-morris committed Oct 24, 2023
2 parents 703312b + 33ddbde commit 1d77eb5
Show file tree
Hide file tree
Showing 41 changed files with 1,293 additions and 436 deletions.
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,15 @@ REACT_APP_DISABLED_CHAINS=
# - /token-list
REACT_APP_DISABLED_CHAINS_FOR_AVAILABLE_ROUTES=

# Comma-separated list of token symbols to disable in the UI and the following API handlers:
# - /available-routes
# - /token-list
REACT_APP_DISABLED_TOKENS_FOR_AVAILABLE_ROUTES=

# Comma-separated list of wallet addresses to block from UI
REACT_APP_WALLET_BLACKLIST=

# Gas estimation padding multiplier.
# JSON with format: {[chainId]: }
# e.g: { "1": 1.1, "10": 1.05 }
REACT_APP_GAS_ESTIMATION_MULTIPLIER_PER_CHAIN={"1": 1.1}
38 changes: 31 additions & 7 deletions api/_constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ const defaultRelayerFeeCapitalCostConfig: {
} = {
ETH: {
lowerBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.0004").toString(),
cutoff: ethers.utils.parseUnits("750").toString(),
decimals: 18,
},
WETH: {
lowerBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.0004").toString(),
cutoff: ethers.utils.parseUnits("750").toString(),
decimals: 18,
},
Expand All @@ -35,20 +35,20 @@ const defaultRelayerFeeCapitalCostConfig: {
},
DAI: {
lowerBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.0001").toString(),
cutoff: ethers.utils.parseUnits("250000").toString(),
upperBound: ethers.utils.parseUnits("0.0004").toString(),
cutoff: ethers.utils.parseUnits("1500000").toString(),
decimals: 18,
},
USDC: {
lowerBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.0004").toString(),
cutoff: ethers.utils.parseUnits("1500000").toString(),
decimals: 6,
},
USDT: {
lowerBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.0001").toString(),
cutoff: ethers.utils.parseUnits("250000").toString(),
upperBound: ethers.utils.parseUnits("0.0004").toString(),
cutoff: ethers.utils.parseUnits("1500000").toString(),
decimals: 6,
},
UMA: {
Expand All @@ -63,12 +63,36 @@ const defaultRelayerFeeCapitalCostConfig: {
cutoff: ethers.utils.parseUnits("5000").toString(),
decimals: 18,
},
ACX: {
lowerBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.001").toString(),
cutoff: ethers.utils.parseUnits("1000000").toString(),
decimals: 18,
},
BAL: {
lowerBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.001").toString(),
cutoff: ethers.utils.parseUnits("10000").toString(),
decimals: 18,
},
POOL: {
lowerBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.001").toString(),
cutoff: ethers.utils.parseUnits("10000").toString(),
decimals: 18,
},
BOBA: {
lowerBound: ethers.utils.parseUnits("0.0003").toString(),
upperBound: ethers.utils.parseUnits("0.001").toString(),
cutoff: ethers.utils.parseUnits("100000").toString(),
decimals: 18,
},
SNX: {
lowerBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.0005").toString(),
cutoff: ethers.utils.parseUnits("10000").toString(),
decimals: 18,
},
};

const relayerFeeCapitalCostOverrides: Record<
Expand Down
10 changes: 4 additions & 6 deletions api/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ export const DEFAULT_GAS_MARKUP = 0;
// Don't permit HUB_POOL_CHAIN_ID=0
export const HUB_POOL_CHAIN_ID = Number(REACT_APP_HUBPOOL_CHAINID || 1);

// Permit REACT_APP_FLAT_RELAY_CAPITAL_FEE=0
export const FLAT_RELAY_CAPITAL_FEE = Number(
process.env.REACT_APP_FLAT_RELAY_CAPITAL_FEE ?? 0.03
); // 0.03%

// Tokens that should be disabled in the routes
export const DISABLED_ROUTE_TOKENS = (
process.env.DISABLED_ROUTE_TOKENS || ""
Expand All @@ -84,6 +79,10 @@ export const DISABLED_CHAINS_FOR_AVAILABLE_ROUTES = (
process.env.REACT_APP_DISABLED_CHAINS_FOR_AVAILABLE_ROUTES || ""
).split(",");

export const DISABLED_TOKENS_FOR_AVAILABLE_ROUTES = (
process.env.REACT_APP_DISABLED_TOKENS_FOR_AVAILABLE_ROUTES || ""
).split(",");

const _ENABLED_ROUTES =
HUB_POOL_CHAIN_ID === 1
? enabledMainnetRoutesAsJson
Expand Down Expand Up @@ -443,7 +442,6 @@ export const getRelayerFeeCalculator = (destinationChainId: number) => {

const relayerFeeCalculatorConfig = {
feeLimitPercent: maxRelayFeePct * 100,
capitalCostsPercent: FLAT_RELAY_CAPITAL_FEE, // This is set same way in ./src/utils/bridge.ts
queries: queryFn(),
capitalCostsConfig: relayerFeeCapitalCostConfig,
};
Expand Down
13 changes: 12 additions & 1 deletion api/available-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ENABLED_ROUTES,
handleErrorCondition,
DISABLED_CHAINS_FOR_AVAILABLE_ROUTES,
DISABLED_TOKENS_FOR_AVAILABLE_ROUTES,
} from "./_utils";
import { TypedVercelRequest } from "./_types";

Expand Down Expand Up @@ -64,10 +65,14 @@ const handler = async (
originChainId: number;
destinationChainId: number;
destinationToken: string;
fromTokenSymbol: string;
}) =>
![route.originChainId, route.destinationChainId].some((chainId) =>
DISABLED_CHAINS_FOR_AVAILABLE_ROUTES.includes(String(chainId))
) &&
!DISABLED_TOKENS_FOR_AVAILABLE_ROUTES.some(
(s) => s.toUpperCase() === route.fromTokenSymbol.toUpperCase()
) &&
(!originToken ||
originToken.toLowerCase() === route.originToken.toLowerCase()) &&
(!originChainId || originChainId === String(route.originChainId)) &&
Expand All @@ -81,12 +86,18 @@ const handler = async (
originChainId: route.fromChain,
originToken: route.fromTokenAddress,
destinationChainId: route.toChain,
fromTokenSymbol: route.fromTokenSymbol,
// Resolve destination chain directly from the
// l1TokensToDestinationTokens map
destinationToken:
l1TokensToDestinationTokens[route.l1TokenAddress][route.toChain],
})
);
).map((route) => ({
originChainId: route.originChainId,
originToken: route.originToken,
destinationChainId: route.destinationChainId,
destinationToken: route.destinationToken,
}));

// Two different explanations for how `stale-while-revalidate` works:

Expand Down
1 change: 1 addition & 0 deletions api/suggested-fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ const handler = async (
responseJson,
});

response.setHeader("Cache-Control", "s-maxage=10");
response.status(200).json(responseJson);
} catch (error) {
return handleErrorCondition("suggested-fees", response, logger, error);
Expand Down
4 changes: 4 additions & 0 deletions api/token-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getFallbackTokenLogoURI,
ENABLED_ROUTES,
DISABLED_CHAINS_FOR_AVAILABLE_ROUTES,
DISABLED_TOKENS_FOR_AVAILABLE_ROUTES,
} from "./_utils";
import { TypedVercelRequest } from "./_types";
import { TOKEN_SYMBOLS_MAP } from "./_constants";
Expand All @@ -18,6 +19,9 @@ const handler = async (_: TypedVercelRequest<{}>, response: VercelResponse) => {
(route) =>
![route.fromChain, route.toChain].some((chainId) =>
DISABLED_CHAINS_FOR_AVAILABLE_ROUTES.includes(String(chainId))
) &&
!DISABLED_TOKENS_FOR_AVAILABLE_ROUTES.some(
(s) => s.toUpperCase() === route.fromTokenSymbol.toUpperCase()
)
)
.reduce(
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/logo-small.png" />
<link rel="icon" href="/favicon.svg" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1"
Expand All @@ -21,14 +21,14 @@
property="og:description"
content="Across is the fastest, cheapest and most secure cross-chain bridge for Ethereum, Arbitrum, Optimism, Polygon and other Layer 1 and Layer 2 networks. Transfer tokens with Across."
/>
<meta property="og:image" content="/logo-small.png" />
<meta property="og:image" content="/thumbnail.png" />
<meta name="twitter:site" content="Across" />
<meta
name="twitter:card"
content="Across is the fastest, cheapest and most secure cross-chain bridge for Ethereum, Arbitrum, Optimism, Polygon and other Layer 1 and Layer 2 networks. Transfer tokens with Across."
/>
<meta name="twitter:creator" content="@UMAprotocol" />
<meta name="twitter:image" content="/logo-small.png" />
<meta name="twitter:image" content="/thumbnail.png" />
<meta name="robots" content="index, follow" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
"@fortawesome/react-fontawesome": "^0.2.0",
"@google-cloud/logging": "^10.1.1",
"@reach/dialog": "^0.16.2",
"@safe-global/safe-apps-provider": "^0.18.0",
"@safe-global/safe-apps-sdk": "^8.1.0",
"@sentry/react": "^7.37.2",
"@uma/sdk": "^0.22.2",
"@web3-onboard/coinbase": "^2.2.4",
"@web3-onboard/core": "^2.20.4",
"@web3-onboard/gnosis": "^2.1.10",
"@web3-onboard/injected-wallets": "^2.10.2",
"@web3-onboard/react": "^2.8.9",
"@web3-onboard/walletconnect": "^2.4.1",
"@web3-onboard/coinbase": "^2.2.5",
"@web3-onboard/core": "^2.21.2",
"@web3-onboard/gnosis": "^2.2.0",
"@web3-onboard/injected-wallets": "^2.10.6",
"@web3-onboard/react": "^2.8.13",
"@web3-onboard/walletconnect": "^2.4.6",
"axios": "^0.27.2",
"bnc-notify": "^1.9.8",
"copy-to-clipboard": "^3.3.3",
Expand All @@ -50,7 +52,7 @@
},
"scripts": {
"start": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && vite",
"dev": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && vite --port $PORT",
"dev": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && vite --port $PORT --host",
"build": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && tsc && vite build",
"analyze": "yarn build --stats && webpack-bundle-analyzer build/bundle-stats.json -m server -r build/bundle-stats.html",
"test": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && jest --env jsdom src",
Expand Down
13 changes: 0 additions & 13 deletions patches/@web3-onboard+walletconnect+2.4.1.patch

This file was deleted.

4 changes: 4 additions & 0 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/logo-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1d77eb5

Please sign in to comment.