Skip to content

Commit

Permalink
Disable deposit to zkEVM (#1433)
Browse files Browse the repository at this point in the history
* Disable deposit to zkEVM

* Disable deposit to zk when connected to L1

* Disabled info message update

* fix: redirect to assets page after changing the network (#1435)

---------

Co-authored-by: Roy <[email protected]>
  • Loading branch information
bobo-k2 and impelcrypto authored Jan 7, 2025
1 parent c03b1de commit 5073524
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 29 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
.thumbs.db
node_modules
.env

# Quasar core related directories
.quasar
Expand Down Expand Up @@ -52,3 +53,4 @@ astar-collator

# Chopstick binaries
db.sqlite*
.vercel
2 changes: 1 addition & 1 deletion src/components/bridge/ethereum/L1Bridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export default defineComponent({
const store = useStore();
const isHandling = ref<boolean>(false);
const isLoading = computed<boolean>(() => store.getters['general/isLoading']);
const isEnabledWithdrawal = computed<boolean>(() => true);
const isEnabledWithdrawal = computed<boolean>(() => false);
const isHighTrafficModalOpen = ref<boolean>(false);
const isWarningHighTraffic = computed<boolean>(() => false);
Expand Down
2 changes: 1 addition & 1 deletion src/components/bridge/layerzero/LzBridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export default defineComponent({
const store = useStore();
const isHandling = ref<boolean>(false);
const isLoading = computed<boolean>(() => store.getters['general/isLoading']);
const isEnabledWithdrawal = computed<boolean>(() => true);
const isEnabledWithdrawal = computed<boolean>(() => false);
const isNativeToken = computed<boolean>(() => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/features.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Bridges
export const nativeBridgeEnabled = true;
export const layerZeroBridgeEnabled = true;
export const layerSwapBridgeEnabled = true;
export const layerSwapBridgeEnabled = false;
export const celerBridgeEnabled = true;
export const omniBridgeEnabled = true;
export const ccipMinatoBridgeEnabled = true;
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/bridge/useL1Bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export const useL1Bridge = () => {
const isGasPayable = ref<boolean | undefined>(undefined);
const isLoadingGasPayable = ref<boolean>(true);
const errMsg = ref<string>('');
const fromChainName = ref<EthBridgeNetworkName>(l1Network.value);
const toChainName = ref<EthBridgeNetworkName>(l2Network.value);
const fromChainName = ref<EthBridgeNetworkName>(l2Network.value);
const toChainName = ref<EthBridgeNetworkName>(l1Network.value);
const isApproved = ref<boolean>(false);
const isApproving = ref<boolean>(false);
const isApproveMaxAmount = ref<boolean>(false);
Expand Down
10 changes: 2 additions & 8 deletions src/hooks/bridge/useLayerZeroBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import { HistoryTxType, addLzHistories } from 'src/modules/account';
import { isHex } from '@polkadot/util';

export const useLayerZeroBridge = () => {
const { isAstar } = useNetworkInfo();

const lzTokens = ref<LayerZeroToken[]>([]);
const selectedToken = ref<LayerZeroToken>(LayerZeroTokens[0]);
const importTokenAddress = ref<string>('');
Expand All @@ -37,12 +35,8 @@ export const useLayerZeroBridge = () => {
const isGasPayable = ref<boolean | undefined>(undefined);
const isLoadingGasPayable = ref<boolean>(true);
const errMsg = ref<string>('');
const fromChainName = ref<LayerZeroNetworkName>(
isAstar.value ? LayerZeroNetworkName.AstarEvm : LayerZeroNetworkName.AstarZk
);
const toChainName = ref<LayerZeroNetworkName>(
isAstar.value ? LayerZeroNetworkName.AstarZk : LayerZeroNetworkName.AstarEvm
);
const fromChainName = ref<LayerZeroNetworkName>(LayerZeroNetworkName.AstarZk);
const toChainName = ref<LayerZeroNetworkName>(LayerZeroNetworkName.AstarEvm);
const isApproved = ref<boolean>(false);
const isApproving = ref<boolean>(false);
const isApproveMaxAmount = ref<boolean>(false);
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/en-US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ export default {
completed: 'Completed',
inProgress: 'In Progress',
approvalMaxAmount: 'Approve Max Amount (option)',
disabledWithdrawal: 'Bridge to {network} is temporarily disabled',
disabledWithdrawal: 'Bridge to {network} is disabled.',
thirdPartyBridge: '3rd Party Bridge',
bridgeMaintenanceMode: 'Bridge is currently under maintenance mode. Please come back later.',
ethereumBridge: {
Expand Down
20 changes: 5 additions & 15 deletions src/router/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,15 @@ export const buildXvmTransferPageLink = (symbol: string): string => {
};

/**
* A helper function to replace the network params to the selected network
* EX: `http://localhost:8080/shiden/assets` -> `http://localhost:8080/astar/assets`
* A helper function to build the URL and redirect to the selected network's assets page
* EX: `http://localhost:8080/shiden/bridge` -> `http://localhost:8080/astar/assets`
* @param network networkAlias in providerEndpoints
* @returns URL
*/
export const buildNetworkUrl = (network: string) => {
const href = window.location.href;
const hrefArray = href.split('/');
const networkIndex = 3;

const url = hrefArray
.slice(0, hrefArray.length)
.map((it: string, index: number) => (index === networkIndex ? network : it))
.join('/');

// Memo: `window.open(url, '_self')` won't work with `#`
if (url.includes('#staking')) {
return url.replace('#staking', '');
}

// Memo: Extract the protocol + host
const host = hrefArray.slice(0, 3).join('/');
const url = `${host}/${network}${Path.Assets}`;
return url;
};

0 comments on commit 5073524

Please sign in to comment.