Skip to content

Commit

Permalink
chore(bridge-ui): update env vars (#13702)
Browse files Browse the repository at this point in the history
Co-authored-by: David <david@taiko.xyz>
  • Loading branch information
jscriptcoder and davidtaikocha authored May 4, 2023
1 parent 2a6f5a4 commit 801162c
Show file tree
Hide file tree
Showing 15 changed files with 110 additions and 116 deletions.
25 changes: 13 additions & 12 deletions packages/bridge-ui/.default.env
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
VITE_NODE_ENV=dev

VITE_L1_RPC_URL=""
VITE_L2_RPC_URL=""

VITE_RELAYER_URL=""

VITE_TEST_ERC20=[]

VITE_MAINNET_CHAIN_ID=
VITE_TAIKO_CHAIN_ID=
VITE_L1_CHAIN_ID=
VITE_L2_CHAIN_ID=

VITE_MAINNET_CHAIN_NAME=""
VITE_TAIKO_CHAIN_NAME=""
VITE_L1_CHAIN_NAME=""
VITE_L2_CHAIN_NAME=""

VITE_MAINNET_TOKEN_VAULT_ADDRESS=""
VITE_TAIKO_TOKEN_VAULT_ADDRESS=""
VITE_L1_TOKEN_VAULT_ADDRESS=""
VITE_L2_TOKEN_VAULT_ADDRESS=""

VITE_MAINNET_HEADER_SYNC_ADDRESS=""
VITE_TAIKO_HEADER_SYNC_ADDRESS=""
VITE_L1_CROSS_CHAIN_SYNC_ADDRESS=""
VITE_L2_CROSS_CHAIN_SYNC_ADDRESS=""

VITE_MAINNET_BRIDGE_ADDRESS=""
VITE_TAIKO_BRIDGE_ADDRESS=""
VITE_L1_BRIDGE_ADDRESS=""
VITE_L2_BRIDGE_ADDRESS=""

VITE_MAINNET_SIGNAL_SERVICE_ADDRESS=""
VITE_TAIKO_SIGNAL_SERVICE_ADDRESS=""
VITE_L1_SIGNAL_SERVICE_ADDRESS=""
VITE_L2_SIGNAL_SERVICE_ADDRESS=""
36 changes: 18 additions & 18 deletions packages/bridge-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ You can use the following values in the `.env` file to spin up the Bridge UI loc

```
VITE_NODE_ENV=dev
VITE_L1_RPC_URL=<sepolia_rpc>
VITE_L2_RPC_URL="https://rpc.a2.taiko.xyz/"
VITE_L1_RPC_URL=https://l1rpc.internal.taiko.xyz
VITE_L2_RPC_URL="https://l2rpc.internal.taiko.xyz"
VITE_L1_EXPLORER_URL="https://sepolia.etherscan.io/"
VITE_L2_EXPLORER_URL="https://explorer.a2.taiko.xyz/"
VITE_L1_EXPLORER_URL="https://l1explorer.internal.taiko.xyz"
VITE_L2_EXPLORER_URL="https://l2explorer.internal.taiko.xyz"
VITE_RELAYER_URL="https://relayer.a2.taiko.xyz/"
VITE_RELAYER_URL="https://relayer.internal.taiko.xyz/"
VITE_MAINNET_CHAIN_ID=11155111
VITE_TAIKO_CHAIN_ID=167004
VITE_L1_CHAIN_ID=31336
VITE_L2_CHAIN_ID=167001
VITE_MAINNET_CHAIN_NAME="Sepolia"
VITE_TAIKO_CHAIN_NAME="Taiko A2"
VITE_L1_CHAIN_NAME="Ethereum A3"
VITE_L2_CHAIN_NAME="Taiko A3"
VITE_MAINNET_TOKEN_VAULT_ADDRESS="0x4284890d4AcD0bcb017eCE481B96fD4Cb457CAc8"
VITE_TAIKO_TOKEN_VAULT_ADDRESS="0x0000777700000000000000000000000000000002"
VITE_L1_TOKEN_VAULT_ADDRESS="0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f"
VITE_L2_TOKEN_VAULT_ADDRESS="0x0000777700000000000000000000000000000002"
VITE_MAINNET_HEADER_SYNC_ADDRESS="0xAC9251ee97Ed8beF31706354310C6b020C35d87b"
VITE_TAIKO_HEADER_SYNC_ADDRESS="0x0000777700000000000000000000000000000001"
VITE_L1_CROSS_CHAIN_SYNC_ADDRESS="0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
VITE_L2_CROSS_CHAIN_SYNC_ADDRESS="0x0000777700000000000000000000000000000001"
VITE_MAINNET_BRIDGE_ADDRESS="0x2aB7C0ab9AB47fcF370d13058BfEE28f2Ec0940c"
VITE_TAIKO_BRIDGE_ADDRESS="0x0000777700000000000000000000000000000004"
VITE_L1_BRIDGE_ADDRESS="0x59b670e9fA9D0A427751Af201D676719a970857b"
VITE_L2_BRIDGE_ADDRESS="0x0000777700000000000000000000000000000004"
VITE_MAINNET_SIGNAL_SERVICE_ADDRESS="0x07130410064Ab5C32486CC36904fb219ae97156F"
VITE_TAIKO_SIGNAL_SERVICE_ADDRESS="0xbB203a6f73F805E44E97dcC0c894eFe0fAf72498"
VITE_L1_SIGNAL_SERVICE_ADDRESS="0x09635F643e140090A9A8Dcd712eD6285858ceBef"
VITE_L2_SIGNAL_SERVICE_ADDRESS="0x0000777700000000000000000000000000000007"
VITE_TEST_ERC20=[{"address": "0x5B9fEDd37f0B92E7E282B19cEbCF06F57B77C604", "symbol": "BLL", "name": "Bull Token"}, {"address": "0x1E8C104D068F22D351859cdBfE41A697A98E6EA2", "symbol": "HORSE", "name": "Horse Token"}]
VITE_TEST_ERC20=[{"address": "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1", "symbol": "BLL", "name": "Bull Token"}, {"address": "0x0B306BF915C4d645ff596e518fAf3F9669b97016", "symbol": "HORSE", "name": "Horse Token"}]
```
11 changes: 6 additions & 5 deletions packages/bridge-ui/src/bridge/ERC20Bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ export class ERC20Bridge implements Bridge {
sender: opts.srcBridgeAddress,
srcBridgeAddress: opts.srcBridgeAddress,
destChain: opts.message.destChainId,
destHeaderSyncAddress:
chains[opts.message.destChainId].headerSyncAddress,
destCrossChainSyncAddress:
chains[opts.message.destChainId].crossChainSyncAddress,
srcSignalServiceAddress:
chains[opts.message.srcChainId].signalServiceAddress,
});
Expand Down Expand Up @@ -240,9 +240,10 @@ export class ERC20Bridge implements Bridge {
sender: opts.srcBridgeAddress,
destBridgeAddress: opts.destBridgeAddress,
destChain: opts.message.destChainId,
destHeaderSyncAddress:
chains[opts.message.destChainId].headerSyncAddress,
srcHeaderSyncAddress: chains[opts.message.srcChainId].headerSyncAddress,
destCrossChainSyncAddress:
chains[opts.message.destChainId].crossChainSyncAddress,
srcCrossChainSyncAddress:
chains[opts.message.srcChainId].crossChainSyncAddress,
};

const proof = await this.prover.generateReleaseProof(proofOpts);
Expand Down
11 changes: 6 additions & 5 deletions packages/bridge-ui/src/bridge/ETHBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export class ETHBridge implements Bridge {
sender: opts.srcBridgeAddress,
srcBridgeAddress: opts.srcBridgeAddress,
destChain: opts.message.destChainId,
destHeaderSyncAddress:
chains[opts.message.destChainId].headerSyncAddress,
destCrossChainSyncAddress:
chains[opts.message.destChainId].crossChainSyncAddress,
srcSignalServiceAddress:
chains[opts.message.srcChainId].signalServiceAddress,
};
Expand Down Expand Up @@ -179,9 +179,10 @@ export class ETHBridge implements Bridge {
sender: opts.srcBridgeAddress,
destBridgeAddress: opts.destBridgeAddress,
destChain: opts.message.destChainId,
destHeaderSyncAddress:
chains[opts.message.destChainId].headerSyncAddress,
srcHeaderSyncAddress: chains[opts.message.srcChainId].headerSyncAddress,
destCrossChainSyncAddress:
chains[opts.message.destChainId].crossChainSyncAddress,
srcCrossChainSyncAddress:
chains[opts.message.srcChainId].crossChainSyncAddress,
};

const proof = await this.prover.generateReleaseProof(proofOpts);
Expand Down
8 changes: 4 additions & 4 deletions packages/bridge-ui/src/chain/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import {
L1_CHAIN_ID,
L1_CHAIN_NAME,
L1_EXPLORER_URL,
L1_HEADER_SYNC_ADDRESS,
L1_CROSS_CHAIN_SYNC_ADDRESS,
L1_RPC,
L1_SIGNAL_SERVICE_ADDRESS,
L2_BRIDGE_ADDRESS,
L2_CHAIN_ID,
L2_CHAIN_NAME,
L2_EXPLORER_URL,
L2_HEADER_SYNC_ADDRESS,
L2_CROSS_CHAIN_SYNC_ADDRESS,
L2_RPC,
L2_SIGNAL_SERVICE_ADDRESS,
} from '../constants/envVars';
Expand All @@ -26,7 +26,7 @@ export const mainnetChain: Chain = {
enabled: true,
icon: Eth,
bridgeAddress: L1_BRIDGE_ADDRESS,
headerSyncAddress: L1_HEADER_SYNC_ADDRESS,
crossChainSyncAddress: L1_CROSS_CHAIN_SYNC_ADDRESS,
explorerUrl: L1_EXPLORER_URL,
signalServiceAddress: L1_SIGNAL_SERVICE_ADDRESS,
};
Expand All @@ -38,7 +38,7 @@ export const taikoChain: Chain = {
enabled: true,
icon: Taiko,
bridgeAddress: L2_BRIDGE_ADDRESS,
headerSyncAddress: L2_HEADER_SYNC_ADDRESS,
crossChainSyncAddress: L2_CROSS_CHAIN_SYNC_ADDRESS,
explorerUrl: L2_EXPLORER_URL,
signalServiceAddress: L2_SIGNAL_SERVICE_ADDRESS,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
if (transaction.status !== MessageStatus.New) return true;
const contract = new Contract(
chains[transaction.toChainId].headerSyncAddress,
chains[transaction.toChainId].crossChainSyncAddress,
HeaderSyncABI,
providers[chains[transaction.toChainId].id],
);
Expand Down
18 changes: 8 additions & 10 deletions packages/bridge-ui/src/components/modals/FaucetModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
import Modal from './Modal.svelte';
import { onMount } from 'svelte';
import { token } from '../../store/token';
import { L1_CHAIN_ID } from '../../constants/envVars';
import {
L1_CHAIN_ID,
L1_CHAIN_NAME,
L2_CHAIN_NAME,
} from '../../constants/envVars';
import { errorToast, successToast } from '../Toast.svelte';
export let isOpen: boolean = false;
Expand Down Expand Up @@ -90,12 +94,6 @@
}
$: shouldEnableButton().catch((e) => console.error(e));
$: mainnetName = import.meta.env
? import.meta.env.VITE_MAINNET_CHAIN_NAME
: 'Ethereum A2';
$: taikonetName = import.meta.env
? import.meta.env.VITE_TAIKO_CHAIN_NAME
: 'Taiko A2';
onMount(() => {
shouldEnableButton();
Expand All @@ -104,9 +102,9 @@

<Modal title={'ERC20 Faucet'} bind:isOpen>
You can request 50 {$token.symbol}. {$token.symbol} is only available to be minted
on {mainnetName}. If you are on {taikonetName}, your network will be changed
first. You must have a small amount of ETH in your {mainnetName} wallet to send
the transaction.
on {L1_CHAIN_NAME}. If you are on {L2_CHAIN_NAME}, your network will be
changed first. You must have a small amount of ETH in your {L1_CHAIN_NAME} wallet
to send the transaction.
<br />
<button
class="btn btn-dark-5 h-[60px] text-base"
Expand Down
22 changes: 11 additions & 11 deletions packages/bridge-ui/src/constants/__mocks__/envVars.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
export const L1_RPC = 'https://l1rpc.internal.taiko.xyz';

export const L1_TOKEN_VAULT_ADDRESS =
'0xAE4C9bD0f7AE5398Df05043079596E2BF0079CE9';
'0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f';

export const L1_BRIDGE_ADDRESS = '0xAE4C9bD0f7AE5398Df05043079596E2BF0079CE9';
export const L1_BRIDGE_ADDRESS = '0x59b670e9fA9D0A427751Af201D676719a970857b';

export const L1_HEADER_SYNC_ADDRESS =
'0x9b557777Be33A8A2fE6aF93E017A0d139B439E5D';
export const L1_CROSS_CHAIN_SYNC_ADDRESS =
'0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE';

export const L1_SIGNAL_SERVICE_ADDRESS =
'0x162A36c9821eadeCFF9669A3940b7f72d055Cd1c';
'0x09635F643e140090A9A8Dcd712eD6285858ceBef';

export const L1_CHAIN_ID = 31336;

export const L1_CHAIN_NAME = 'Ethereum A2';
export const L1_CHAIN_NAME = 'Ethereum A3';

export const L1_EXPLORER_URL = 'https://l1explorer.internal.taiko.xyz';

Expand All @@ -23,31 +23,31 @@ export const L2_TOKEN_VAULT_ADDRESS =
'0x0000777700000000000000000000000000000002';

export const L2_BRIDGE_ADDRESS =
import.meta.env?.VITE_TAIKO_BRIDGE_ADDRESS ??
import.meta.env?.VITE_L2_BRIDGE_ADDRESS ??
'0x0000777700000000000000000000000000000004';

export const L2_HEADER_SYNC_ADDRESS =
export const L2_CROSS_CHAIN_SYNC_ADDRESS =
'0x0000777700000000000000000000000000000001';

export const L2_SIGNAL_SERVICE_ADDRESS =
'0x0000777700000000000000000000000000000007';

export const L2_CHAIN_ID = 167001;

export const L2_CHAIN_NAME = 'Taiko A2';
export const L2_CHAIN_NAME = 'Taiko A3';

export const L2_EXPLORER_URL = 'https://l2explorer.internal.taiko.xyz';

export const RELAYER_URL = 'https://relayer.internal.taiko.xyz/';

export const TEST_ERC20 = [
{
address: '0x5B9fEDd37f0B92E7E282B19cEbCF06F57B77C604',
address: '0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1',
symbol: 'BLL',
name: 'Bull Token',
},
{
address: '0xAED64948E0d09f4eb07d8B76A65Cd3d517c6Fb15',
address: '0x0B306BF915C4d645ff596e518fAf3F9669b97016',
symbol: 'HORSE',
name: 'Horse Token',
},
Expand Down
32 changes: 14 additions & 18 deletions packages/bridge-ui/src/constants/envVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,40 @@ import type { Address, ChainID } from '../domain/chain';
export const L1_RPC: string = import.meta.env?.VITE_L1_RPC_URL;

export const L1_TOKEN_VAULT_ADDRESS: Address = import.meta.env
?.VITE_MAINNET_TOKEN_VAULT_ADDRESS;
?.VITE_L1_TOKEN_VAULT_ADDRESS;

export const L1_BRIDGE_ADDRESS: Address = import.meta.env
?.VITE_MAINNET_BRIDGE_ADDRESS;
?.VITE_L1_BRIDGE_ADDRESS;

export const L1_HEADER_SYNC_ADDRESS: Address = import.meta.env
?.VITE_MAINNET_HEADER_SYNC_ADDRESS;
export const L1_CROSS_CHAIN_SYNC_ADDRESS: Address = import.meta.env
?.VITE_L1_CROSS_CHAIN_SYNC_ADDRESS;

export const L1_SIGNAL_SERVICE_ADDRESS: Address = import.meta.env
?.VITE_MAINNET_SIGNAL_SERVICE_ADDRESS;
?.VITE_L1_SIGNAL_SERVICE_ADDRESS;

export const L1_CHAIN_ID: ChainID = parseInt(
import.meta.env?.VITE_MAINNET_CHAIN_ID,
);
export const L1_CHAIN_ID: ChainID = parseInt(import.meta.env?.VITE_L1_CHAIN_ID);

export const L1_CHAIN_NAME: string = import.meta.env?.VITE_MAINNET_CHAIN_NAME;
export const L1_CHAIN_NAME: string = import.meta.env?.VITE_L1_CHAIN_NAME;

export const L1_EXPLORER_URL: string = import.meta.env?.VITE_L1_EXPLORER_URL;

export const L2_RPC: string = import.meta.env?.VITE_L2_RPC_URL;

export const L2_TOKEN_VAULT_ADDRESS: Address = import.meta.env
?.VITE_TAIKO_TOKEN_VAULT_ADDRESS;
?.VITE_L2_TOKEN_VAULT_ADDRESS;

export const L2_BRIDGE_ADDRESS: Address = import.meta.env
?.VITE_TAIKO_BRIDGE_ADDRESS;
?.VITE_L2_BRIDGE_ADDRESS;

export const L2_HEADER_SYNC_ADDRESS: Address = import.meta.env
?.VITE_TAIKO_HEADER_SYNC_ADDRESS;
export const L2_CROSS_CHAIN_SYNC_ADDRESS: Address = import.meta.env
?.VITE_L2_CROSS_CHAIN_SYNC_ADDRESS;

export const L2_SIGNAL_SERVICE_ADDRESS: Address = import.meta.env
?.VITE_TAIKO_SIGNAL_SERVICE_ADDRESS;
?.VITE_L2_SIGNAL_SERVICE_ADDRESS;

export const L2_CHAIN_ID: ChainID = parseInt(
import.meta.env?.VITE_TAIKO_CHAIN_ID,
);
export const L2_CHAIN_ID: ChainID = parseInt(import.meta.env?.VITE_L2_CHAIN_ID);

export const L2_CHAIN_NAME: string = import.meta.env?.VITE_TAIKO_CHAIN_NAME;
export const L2_CHAIN_NAME: string = import.meta.env?.VITE_L2_CHAIN_NAME;

export const L2_EXPLORER_URL: string = import.meta.env?.VITE_L2_EXPLORER_URL;

Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-ui/src/domain/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type Chain = {
enabled?: boolean;
icon?: ComponentType;
bridgeAddress: Address;
headerSyncAddress: Address;
crossChainSyncAddress: Address;
explorerUrl: string;
signalServiceAddress: Address;
};
6 changes: 3 additions & 3 deletions packages/bridge-ui/src/domain/proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type GenerateProofOpts = {
sender: string;
srcBridgeAddress: string;
destChain: number;
destHeaderSyncAddress: string;
destCrossChainSyncAddress: string;
srcChain: number;
srcSignalServiceAddress: string;
};
Expand All @@ -28,8 +28,8 @@ export type GenerateReleaseProofOpts = {
sender: string;
destBridgeAddress: string;
destChain: number;
destHeaderSyncAddress: string;
srcHeaderSyncAddress: string;
destCrossChainSyncAddress: string;
srcCrossChainSyncAddress: string;
srcChain: number;
};

Expand Down
Loading

0 comments on commit 801162c

Please sign in to comment.