Skip to content

Commit

Permalink
Merge pull request #411 from lidofinance/develop
Browse files Browse the repository at this point in the history
Develop to main
  • Loading branch information
itaven authored Jul 23, 2024
2 parents ca3e0c1 + a2f5e9a commit e05b742
Show file tree
Hide file tree
Showing 31 changed files with 347 additions and 496 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ CSP_REPORT_URI=https://stake.lido.fi/api/csp-report

# Subgraph endpoint
SUBGRAPH_MAINNET=https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/Sxx812XgeKyzQPaBpR5YZWmGV5fZuBaPdh7DFhzSwiQ
SUBGRAPH_GOERLI=
SUBGRAPH_HOLESKY=

SUBGRAPH_REQUEST_TIMEOUT=5000
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-ipfs-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
WQ_API_BASE_PATH: ${{ vars.WQ_API_BASE_PATH }}
ETH_API_BASE_PATH: ${{ vars.ETH_API_BASE_PATH }}
PREFILL_UNSAFE_EL_RPC_URLS_1: ${{ secrets.PREFILL_UNSAFE_EL_RPC_URLS_1 }}
PREFILL_UNSAFE_EL_RPC_URLS_5: ${{ secrets.PREFILL_UNSAFE_EL_RPC_URLS_5 }}
PREFILL_UNSAFE_EL_RPC_URLS_17000: ${{ secrets.PREFILL_UNSAFE_EL_RPC_URLS_17000 }}
WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID }}
- uses: actions/upload-artifact@v4
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ ARG DEFAULT_CHAIN="1"
ENV NEXT_TELEMETRY_DISABLED=1 \
BASE_PATH=$BASE_PATH \
SUPPORTED_CHAINS=$SUPPORTED_CHAINS \
DEFAULT_CHAIN=$DEFAULT_CHAIN
DEFAULT_CHAIN=$DEFAULT_CHAIN

WORKDIR /app
RUN apk add --no-cache curl=~8
RUN apk add --no-cache curl=~8

COPY --from=build /app /app
RUN chown -R node:node /app/.next

USER node
EXPOSE 3000
Expand Down
5 changes: 0 additions & 5 deletions config/get-secret-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export type SecretConfigType = Modify<
defaultChain: number;

rpcUrls_1: [string, ...string[]];
rpcUrls_5: [string, ...string[]];
rpcUrls_17000: [string, ...string[]];

cspReportOnly: boolean;
Expand Down Expand Up @@ -38,10 +37,6 @@ export const getSecretConfig = (): SecretConfigType => {
string,
...string[],
],
rpcUrls_5: (serverRuntimeConfig.rpcUrls_5?.split(',') ?? []) as [
string,
...string[],
],
rpcUrls_17000: (serverRuntimeConfig.rpcUrls_17000?.split(',') ?? []) as [
string,
...string[],
Expand Down
2 changes: 1 addition & 1 deletion config/groups/estimate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { parseEther } from '@ethersproject/units';

// account for gas estimation
// will always have >=0.001 ether, >=0.001 stETH, >=0.001 wstETH
// on Mainnet, Goerli, Holesky
// on Mainnet, Holesky
export const ESTIMATE_ACCOUNT = '0x87c0e047F4e4D3e289A56a36570D4CB957A37Ef1';

export const ESTIMATE_AMOUNT = parseEther('0.001');
23 changes: 5 additions & 18 deletions config/rpc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,19 @@ export const useGetRpcUrlByChainId = () => {

return useCallback(
(chainId: CHAINS) => {
// This condition is needed because in 'providers/web3.tsx' we add `wagmiChains.polygonMumbai` to supportedChains as a workaround.
// polygonMumbai (80001) may cause an invariant throwing.
// And we always need Mainnet RPC for some requests, e.g. ETH to USD price, ENS lookup.
if (
chainId !== CHAINS.Mainnet &&
!userConfig.supportedChainIds.includes(chainId)
) {
// Has no effect on functionality. Just a fix.
// Return empty string as a stub
// (see: 'providers/web3.tsx' --> jsonRpcBatchProvider --> getStaticRpcBatchProvider)
return '';
}

if (config.ipfsMode) {
const rpc =
userConfig.savedUserConfig.rpcUrls[chainId] ||
userConfig.prefillUnsafeElRpcUrls[chainId]?.[0];

invariant(rpc, '[useGetRpcUrlByChainId] RPC is required!');
return rpc;
} else {
return (
userConfig.savedUserConfig.rpcUrls[chainId] ||
getBackendRPCPath(chainId)
);
}

return (
userConfig.savedUserConfig.rpcUrls[chainId] ||
getBackendRPCPath(chainId)
);
},
[userConfig],
);
Expand Down
1 change: 0 additions & 1 deletion config/user-config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export type UserConfigDefaultType = {
supportedChainIds: number[];
prefillUnsafeElRpcUrls: {
[CHAINS.Mainnet]: string[];
[CHAINS.Goerli]: string[];
[CHAINS.Holesky]: string[];
};
walletconnectProjectId: string | undefined;
Expand Down
1 change: 0 additions & 1 deletion config/user-config/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const getUserConfigDefault = (): UserConfigDefaultType => {
supportedChainIds: config.supportedChains,
prefillUnsafeElRpcUrls: {
[CHAINS.Mainnet]: config.prefillUnsafeElRpcUrls1,
[CHAINS.Goerli]: config.prefillUnsafeElRpcUrls5,
[CHAINS.Holesky]: config.prefillUnsafeElRpcUrls17000,
},
walletconnectProjectId: config.walletconnectProjectId,
Expand Down
1 change: 0 additions & 1 deletion consts/chains.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const enum CHAINS {
Mainnet = 1,
Goerli = 5,
Holesky = 17000,
}
2 changes: 1 addition & 1 deletion consts/matomo-click-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export const MATOMO_CLICK_EVENTS: Record<
[MATOMO_CLICK_EVENTS_TYPES.withdrawalGoToBebop]: [
'Ethereum_Withdrawals_Widget',
'Click on «Go to Bebop» in aggregators list on Request tab',
'eth_withdrawals_request_go_to_1inch',
'eth_withdrawals_request_go_to_Bebop',
],
[MATOMO_CLICK_EVENTS_TYPES.withdrawalGoToCowSwap]: [
'Ethereum_Withdrawals_Widget',
Expand Down
1 change: 0 additions & 1 deletion consts/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export const WSTETH_APPROVE_GAS_LIMIT = BigNumber.from(78000);

export const WRAP_FROM_ETH_GAS_LIMIT = BigNumber.from(100000);
export const WRAP_GAS_LIMIT = BigNumber.from(140000);
export const WRAP_GAS_LIMIT_GOERLI = BigNumber.from(120000);
export const UNWRAP_GAS_LIMIT = BigNumber.from(115000);
2 changes: 0 additions & 2 deletions env-dynamics.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ export const supportedChains = process.env?.SUPPORTED_CHAINS?.split(',').map(
/** @type string[] */
export const prefillUnsafeElRpcUrls1 = process.env.PREFILL_UNSAFE_EL_RPC_URLS_1?.split(',') ?? [];
/** @type string[] */
export const prefillUnsafeElRpcUrls5 = process.env.PREFILL_UNSAFE_EL_RPC_URLS_5?.split(',') ?? [];
/** @type string[] */
export const prefillUnsafeElRpcUrls17000 = process.env.PREFILL_UNSAFE_EL_RPC_URLS_17000?.split(',') ?? [];

/** @type boolean */
Expand Down
18 changes: 0 additions & 18 deletions features/rewards/fetchers/rpcFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,20 @@ export type TOKENS = (typeof TOKENS)[keyof typeof TOKENS];

export const TOKENS_BY_CHAIN_ID = {
[CHAINS.Mainnet]: [TOKENS.STETH, TOKENS.WSTETH, TOKENS.CURVE],
[CHAINS.Rinkeby]: [TOKENS.STETH, TOKENS.WSTETH],
[CHAINS.Goerli]: [TOKENS.STETH, TOKENS.LDO_REWARDS, TOKENS.WSTETH],
} as const;

export const TOKEN_ADDRESS_BY_CHAIN_ID = {
[CHAINS.Mainnet]: {
[TOKENS.STETH]: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
[TOKENS.CURVE]: '0xDC24316b9AE028F1497c275EB9192a3Ea0f67022',
},
[CHAINS.Ropsten]: {},
[CHAINS.Rinkeby]: {
[TOKENS.STETH]: '0xbA453033d328bFdd7799a4643611b616D80ddd97',
},
[CHAINS.Goerli]: {
[TOKENS.STETH]: '0x1643e812ae58766192cf7d2cf9567df2c37e9b7f',
},
[CHAINS.Kovan]: {},
} as const;

export const TOKEN_ABI_BY_CHAIN_ID = {
[CHAINS.Mainnet]: {
[TOKENS.STETH]: STETH_ABI,
[TOKENS.CURVE]: CURVE_ABI,
},
[CHAINS.Ropsten]: {},
[CHAINS.Rinkeby]: {
[TOKENS.STETH]: STETH_ABI,
},
[CHAINS.Goerli]: {
[TOKENS.STETH]: STETH_ABI,
},
[CHAINS.Kovan]: {},
} as const;

export const getTokenAddress = (
Expand Down
2 changes: 0 additions & 2 deletions features/stake/stake.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { FaqPlaceholder } from 'features/ipfs';
import { useWeb3Key } from 'shared/hooks/useWeb3Key';
import NoSSRWrapper from 'shared/components/no-ssr-wrapper';
import { GoerliSunsetBanner } from 'shared/banners/goerli-sunset';
import { OnlyInfraRender } from 'shared/components/only-infra-render';

import { StakeFaq } from './stake-faq/stake-faq';
Expand All @@ -12,7 +11,6 @@ export const Stake = () => {
const key = useWeb3Key();
return (
<>
<GoerliSunsetBanner />
<NoSSRWrapper>
<StakeForm key={key} />
</NoSSRWrapper>
Expand Down
4 changes: 0 additions & 4 deletions features/withdrawals/withdrawals-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { Switch } from 'shared/components';

import { WITHDRAWALS_CLAIM_PATH, WITHDRAWALS_REQUEST_PATH } from 'consts/urls';

import { GoerliSunsetBanner } from 'shared/banners/goerli-sunset';

import { ClaimDataProvider } from './contexts/claim-data-context';
import { useWithdrawals } from './contexts/withdrawals-context';
import { Claim } from './claim';
Expand All @@ -25,8 +23,6 @@ export const WithdrawalsTabs = () => {
return (
<ClaimDataProvider>
<Switch checked={isClaimTab} routes={withdrawalRoutes} />

<GoerliSunsetBanner />
{isClaimTab ? <Claim /> : <Request />}
</ClaimDataProvider>
);
Expand Down
2 changes: 0 additions & 2 deletions features/wsteth/wrap-unwrap-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import NoSsrWrapper from 'shared/components/no-ssr-wrapper';

import { WrapFaq } from './shared/wrap-faq/wrap-faq';
import { UnwrapForm } from './unwrap/unwrap-form';
import { GoerliSunsetBanner } from 'shared/banners/goerli-sunset';
import { OnlyInfraRender } from 'shared/components/only-infra-render';
import { FaqPlaceholder } from 'features/ipfs';

Expand All @@ -25,7 +24,6 @@ export const WrapUnwrapTabs = ({ mode }: WrapUnwrapLayoutProps) => {
<>
<NoSsrWrapper>
<Switch checked={isUnwrapMode} routes={NAV_ROUTES} />
<GoerliSunsetBanner />
<Wallet />
{isUnwrapMode ? <UnwrapForm /> : <WrapForm />}
</NoSsrWrapper>
Expand Down
16 changes: 3 additions & 13 deletions features/wsteth/wrap/hooks/use-wrap-gas-limit.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { useWeb3 } from 'reef-knot/web3-react';
import { useLidoSWR, useWSTETHContractRPC } from '@lido-sdk/react';
import { CHAINS } from '@lido-sdk/constants';

import { config } from 'config';
import {
WRAP_FROM_ETH_GAS_LIMIT,
WRAP_GAS_LIMIT,
WRAP_GAS_LIMIT_GOERLI,
} from 'consts/tx';
import { WRAP_FROM_ETH_GAS_LIMIT, WRAP_GAS_LIMIT } from 'consts/tx';
import { useCurrentStaticRpcProvider } from 'shared/hooks/use-current-static-rpc-provider';
import { applyGasLimitRatio } from 'features/stake/stake-form/utils';

Expand Down Expand Up @@ -41,9 +36,7 @@ export const useWrapGasLimit = () => {
});
} catch (error) {
console.warn(`${_key}::[steth]`, error);
return chainId === CHAINS.Goerli
? WRAP_GAS_LIMIT_GOERLI
: WRAP_GAS_LIMIT;
return WRAP_GAS_LIMIT;
}
};

Expand All @@ -61,9 +54,6 @@ export const useWrapGasLimit = () => {

return {
gasLimitETH: data?.gasLimitETH || WRAP_FROM_ETH_GAS_LIMIT,
gasLimitStETH:
data?.gasLimitStETH || chainId === CHAINS.Goerli
? WRAP_GAS_LIMIT_GOERLI
: WRAP_GAS_LIMIT,
gasLimitStETH: data?.gasLimitStETH || WRAP_GAS_LIMIT,
};
};
2 changes: 0 additions & 2 deletions global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ declare module 'next/config' {

defaultChain: string;
rpcUrls_1: string | undefined;
rpcUrls_5: string | undefined;
rpcUrls_17000: string | undefined;
ethplorerApiKey: string | undefined;

Expand All @@ -37,7 +36,6 @@ declare module 'next/config' {
cspReportOnly: string | undefined;

subgraphMainnet: string | undefined;
subgraphGoerli: string | undefined;
subgraphHolesky: string | undefined;
subgraphRequestTimeout: string | undefined;

Expand Down
2 changes: 0 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ export default withBundleAnalyzer({

defaultChain: process.env.DEFAULT_CHAIN,
rpcUrls_1: process.env.EL_RPC_URLS_1,
rpcUrls_5: process.env.EL_RPC_URLS_5,
rpcUrls_17000: process.env.EL_RPC_URLS_17000,
ethplorerApiKey: process.env.ETHPLORER_API_KEY,

Expand All @@ -155,7 +154,6 @@ export default withBundleAnalyzer({
cspReportOnly: process.env.CSP_REPORT_ONLY,

subgraphMainnet: process.env.SUBGRAPH_MAINNET,
subgraphGoerli: process.env.SUBGRAPH_GOERLI,
subgraphHolesky: process.env.SUBGRAPH_HOLESKY,
subgraphRequestTimeout: process.env.SUBGRAPH_REQUEST_TIMEOUT,

Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"react-hook-form": "^7.45.2",
"react-is": "^18.2.0",
"react-transition-group": "^4.4.2",
"reef-knot": "5.0.3",
"reef-knot": "5.2.1",
"remark": "^13.0.0",
"remark-external-links": "^8.0.0",
"remark-html": "^13.0.1",
Expand All @@ -78,7 +78,7 @@
"tiny-invariant": "^1.1.0",
"uuid": "^8.3.2",
"viem": "2.13.3",
"wagmi": "2.10.4"
"wagmi": "2.11.2"
},
"devDependencies": {
"@commitlint/cli": "^17.4.4",
Expand Down Expand Up @@ -131,9 +131,7 @@
},
"resolutions": {
"postcss": "^8.4.31",
"crypto-js": "^4.2.0",
"@ledgerhq/hw-transport-webhid": "6.28.1",
"@ledgerhq/hw-transport": "6.30.1"
"crypto-js": "^4.2.0"
},
"lint-staged": {
"./**/*.{ts,tsx}": [
Expand Down
2 changes: 0 additions & 2 deletions pages/rewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Layout } from 'shared/components';
import { TopCard, RewardsList } from 'features/rewards/features';
import RewardsHistoryProvider from 'providers/rewardsHistory';
import { Fallback } from 'shared/wallet';
import { GoerliSunsetBanner } from 'shared/banners/goerli-sunset';

const Rewards: FC = () => {
return (
Expand All @@ -24,7 +23,6 @@ const Rewards: FC = () => {
</Head>
<RewardsHistoryProvider>
<Fallback />
<GoerliSunsetBanner />
<TopCard />
<RewardsList />
</RewardsHistoryProvider>
Expand Down
7 changes: 0 additions & 7 deletions providers/web3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ const Web3Provider: FC<PropsWithChildren> = ({ children }) => {
supportedChainIds.includes(chain.id),
);

// Adding Mumbai as a temporary workaround
// for the wagmi and walletconnect bug, when some wallets are failing to connect
// when there are only one supported network, so we need at least 2 of them.
// Mumbai should be the last in the array, otherwise wagmi can send request to it.
// TODO: remove after updating wagmi to v1+
supportedChains.push(wagmiChains.polygonMumbai);

const defaultChain =
supportedChains.find((chain) => chain.id === defaultChainId) ||
supportedChains[0]; // first supported chain as fallback
Expand Down
31 changes: 0 additions & 31 deletions shared/banners/goerli-sunset/goerli-sunset-banner.tsx

This file was deleted.

1 change: 0 additions & 1 deletion shared/banners/goerli-sunset/index.ts

This file was deleted.

Loading

0 comments on commit e05b742

Please sign in to comment.