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

feat(bridge-ui): more informative processing fee #13488

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dfe1e6d
ProcessingFee refactoring
jscriptcoder Mar 28, 2023
fa5a504
Store value in localStorage
jscriptcoder Mar 28, 2023
764b008
Fix storing opt-in/out
jscriptcoder Mar 28, 2023
a429c5e
Add Button component
jscriptcoder Mar 28, 2023
2f79c3b
Minor change
jscriptcoder Mar 28, 2023
957d587
wip
jscriptcoder Mar 28, 2023
1345e67
Transaction refactoring
jscriptcoder Mar 28, 2023
d424408
OptInOutTooltip component
jscriptcoder Mar 28, 2023
a64c233
Add opt in/out to claim
jscriptcoder Mar 28, 2023
2faaafd
Minor fix
jscriptcoder Mar 28, 2023
7228cb2
Merge branch 'main' into 13476-featbridge-ui-uiux-suggestion-to-bette…
jscriptcoder Mar 29, 2023
f28032a
Add some comments
jscriptcoder Mar 29, 2023
c4ca359
Improve types
jscriptcoder Mar 29, 2023
8a18590
Correct notice message
jscriptcoder Mar 29, 2023
b17d23a
Rename component
jscriptcoder Mar 29, 2023
f5727b9
Minor changes
jscriptcoder Mar 29, 2023
c9fd206
Revert change on TooltipModal
jscriptcoder Mar 29, 2023
ef02d79
Rename Notice modal
jscriptcoder Mar 29, 2023
a2c901d
Typo
jscriptcoder Mar 29, 2023
4400758
Minor change
jscriptcoder Mar 29, 2023
7404a31
Fix label association
jscriptcoder Mar 29, 2023
a13d16a
Merge branch 'main' into 13476-featbridge-ui-uiux-suggestion-to-bette…
jscriptcoder Mar 29, 2023
8b49ac4
Typo
jscriptcoder Mar 30, 2023
fd94471
Merge branch 'main' into 13476-featbridge-ui-uiux-suggestion-to-bette…
jscriptcoder Mar 30, 2023
e7db765
Fix wrong constant
jscriptcoder Mar 30, 2023
f255e72
Add TODO
jscriptcoder Mar 30, 2023
2ba7871
Fix some eslint warnigs
jscriptcoder Mar 30, 2023
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
1 change: 0 additions & 1 deletion packages/bridge-ui/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
.btn.btn-accent {
background-color: hsla(var(--af) / var(--tw-bg-opacity, 1));
border-color: hsla(var(--af) / var(--tw-bg-opacity, 1));
height: 60px;
}

.btn.btn-accent:hover {
Expand Down
17 changes: 8 additions & 9 deletions packages/bridge-ui/src/bridge/ERC20Bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@ export class ERC20Bridge implements Bridge {

if (messageStatus === MessageStatus.New) {
const proof = await this.prover.generateProof({
srcChain: opts.message.srcChainId.toNumber(),
srcChain: opts.message.srcChainId,
msgHash: opts.msgHash,
sender: opts.srcBridgeAddress,
srcBridgeAddress: opts.srcBridgeAddress,
destChain: opts.message.destChainId.toNumber(),
destChain: opts.message.destChainId,
destHeaderSyncAddress:
chains[opts.message.destChainId.toNumber()].headerSyncAddress,
chains[opts.message.destChainId].headerSyncAddress,
srcSignalServiceAddress:
chains[opts.message.srcChainId.toNumber()].signalServiceAddress,
chains[opts.message.srcChainId].signalServiceAddress,
});

if (opts.message.gasLimit.gt(BigNumber.from(2500000))) {
Expand Down Expand Up @@ -234,15 +234,14 @@ export class ERC20Bridge implements Bridge {

if (messageStatus === MessageStatus.Failed) {
const proofOpts = {
srcChain: opts.message.srcChainId.toNumber(),
srcChain: opts.message.srcChainId,
msgHash: opts.msgHash,
sender: opts.srcBridgeAddress,
destBridgeAddress: opts.destBridgeAddress,
destChain: opts.message.destChainId.toNumber(),
destChain: opts.message.destChainId,
destHeaderSyncAddress:
chains[opts.message.destChainId.toNumber()].headerSyncAddress,
srcHeaderSyncAddress:
chains[opts.message.srcChainId.toNumber()].headerSyncAddress,
chains[opts.message.destChainId].headerSyncAddress,
srcHeaderSyncAddress: chains[opts.message.srcChainId].headerSyncAddress,
};

const proof = await this.prover.generateReleaseProof(proofOpts);
Expand Down
24 changes: 11 additions & 13 deletions packages/bridge-ui/src/bridge/ETHBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import type {
ClaimOpts,
ReleaseOpts,
} from '../domain/bridge';
import TokenVault from '../constants/abi/TokenVault';
import type { Prover } from '../domain/proof';
import { MessageStatus } from '../domain/message';
import BridgeABI from '../constants/abi/Bridge';
import { chains } from '../chain/chains';
import { type Message, MessageStatus } from '../domain/message';

export class ETHBridge implements Bridge {
private readonly prover: Prover;
Expand All @@ -22,15 +21,15 @@ export class ETHBridge implements Bridge {

static async prepareTransaction(
opts: BridgeOpts,
): Promise<{ contract: Contract; message: any; owner: string }> {
): Promise<{ contract: Contract; message: Message; owner: string }> {
const contract: Contract = new Contract(
opts.bridgeAddress,
BridgeABI,
opts.signer,
);

const owner = await opts.signer.getAddress();
const message = {
const message: Message = {
sender: owner,
srcChainId: opts.fromChainId,
destChainId: opts.toChainId,
Expand Down Expand Up @@ -113,15 +112,15 @@ export class ETHBridge implements Bridge {

if (messageStatus === MessageStatus.New) {
const proofOpts = {
srcChain: opts.message.srcChainId.toNumber(),
srcChain: opts.message.srcChainId,
msgHash: opts.msgHash,
sender: opts.srcBridgeAddress,
srcBridgeAddress: opts.srcBridgeAddress,
destChain: opts.message.destChainId.toNumber(),
destChain: opts.message.destChainId,
destHeaderSyncAddress:
chains[opts.message.destChainId.toNumber()].headerSyncAddress,
chains[opts.message.destChainId].headerSyncAddress,
srcSignalServiceAddress:
chains[opts.message.srcChainId.toNumber()].signalServiceAddress,
chains[opts.message.srcChainId].signalServiceAddress,
};

const proof = await this.prover.generateProof(proofOpts);
Expand Down Expand Up @@ -169,15 +168,14 @@ export class ETHBridge implements Bridge {

if (messageStatus === MessageStatus.Failed) {
const proofOpts = {
srcChain: opts.message.srcChainId.toNumber(),
srcChain: opts.message.srcChainId,
msgHash: opts.msgHash,
sender: opts.srcBridgeAddress,
destBridgeAddress: opts.destBridgeAddress,
destChain: opts.message.destChainId.toNumber(),
destChain: opts.message.destChainId,
destHeaderSyncAddress:
chains[opts.message.destChainId.toNumber()].headerSyncAddress,
srcHeaderSyncAddress:
chains[opts.message.srcChainId.toNumber()].headerSyncAddress,
chains[opts.message.destChainId].headerSyncAddress,
srcHeaderSyncAddress: chains[opts.message.srcChainId].headerSyncAddress,
};

const proof = await this.prover.generateReleaseProof(proofOpts);
Expand Down
1 change: 0 additions & 1 deletion packages/bridge-ui/src/components/ChainDropdown.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import { _ } from 'svelte-i18n';
import { fromChain, toChain } from '../store/chain';
import type { Chain } from '../domain/chain';
import { ethers } from 'ethers';
Expand Down
1 change: 0 additions & 1 deletion packages/bridge-ui/src/components/TaikoBanner.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script>
import { _ } from 'svelte-i18n';
import SelectChain from './form/SelectChain.svelte';
</script>

Expand Down
58 changes: 0 additions & 58 deletions packages/bridge-ui/src/components/Transactions.svelte

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import TooltipModal from './modals/TooltipModal.svelte';
import TooltipModal from '../modals/TooltipModal.svelte';

export let show: boolean;
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import TooltipModal from './modals/TooltipModal.svelte';
import { L1_CHAIN_NAME, L2_CHAIN_NAME } from '../../constants/envVars';
import TooltipModal from '../modals/TooltipModal.svelte';

export let show: boolean;
</script>
Expand All @@ -12,14 +13,9 @@
<ul class="list-disc ml-4">
<li class="mb-2">
<strong>Pending</strong>: Your asset is not ready to be bridged. Taiko
A2 => {import.meta.env
? import.meta.env.VITE_MAINNET_CHAIN_NAME
: 'Ethereum A2'} bridging can take several hours before being ready.
{import.meta.env
? import.meta.env.VITE_MAINNET_CHAIN_NAME
: 'Ethereum A2'} => {import.meta.env
? import.meta.env.VITE_TAIKO_CHAIN_NAME
: 'Taiko A2'} should be available to claim within minutes.
A2 => {L2_CHAIN_NAME} bridging can take several hours before being ready.
{L1_CHAIN_NAME} => {L2_CHAIN_NAME} should be available to claim within
minutes.
</li>
<li class="mb-2">
<strong>Claim</strong>: Your asset is ready to be claimed on the
Expand Down
Loading