Skip to content

Commit a13e1f5

Browse files
authored
feat: added Ethereum bridge (#1448)
* feat: sepolia ccip logic * feat: updated UI to add query parameters for ccip * feat: updated Bridge page UI for CCIP * feat: updated UI * feat: updated bridge enable variables * feat: updated baloon logic * fix: updated ETH white logo * feat: updated logos * feat: updated ccip bridge logo * feat: updated UI for rate limits * feat: added ethereum contracts * feat: updated bridge time * fix: refactor * fix: refactor (2) * feat: updated transfer time
1 parent a5efc68 commit a13e1f5

30 files changed

+3580
-161
lines changed
+8
Loading
+14
Loading
+8
Loading

src/assets/img/chain/soneium-blue.svg

+4
Loading
+3-3
Loading

src/components/assets/EvmNativeToken.vue

+95-33
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</div>
3333
</div>
3434

35-
<div class="row__actions">
35+
<div class="row__actions-evm">
3636
<router-link :to="buildTransferPageLink(nativeTokenSymbol)">
3737
<button class="btn btn--icon">
3838
<astar-icon-transfer />
@@ -46,8 +46,8 @@
4646
<div class="box--ccip">
4747
<custom-router-link
4848
v-if="isShibuyaEvm || isAstarEvm"
49-
:to="buildCcipBridgePageLink()"
50-
:is-disabled="!isEnableCcipBridge"
49+
:to="ccipSoneiumLink"
50+
:is-disabled="!isEnableSoneiumCcipBridge"
5151
>
5252
<button
5353
v-if="width >= screenSize.sm"
@@ -60,7 +60,7 @@
6060
:src="
6161
isSoneiumButtonHover
6262
? require('src/assets/img/chain/soneium-white.svg')
63-
: require('src/assets/img/chain/soneium-color.svg')
63+
: require('src/assets/img/chain/soneium-blue.svg')
6464
"
6565
alt="soneium"
6666
/>
@@ -77,13 +77,49 @@
7777
<span class="text--tooltip">{{ $t('assets.bridgeToSoneium') }}</span>
7878
</q-tooltip>
7979
</custom-router-link>
80+
</div>
81+
82+
<div class="box--ccip">
83+
<custom-router-link
84+
v-if="isShibuyaEvm || isAstarEvm"
85+
:to="ccipEthereumLink"
86+
:is-disabled="!isEnableEthereumCcipBridge"
87+
>
88+
<button
89+
v-if="width >= screenSize.sm"
90+
class="btn btn--icon"
91+
@mouseover="isEthereumButtonHover = true"
92+
@mouseleave="isEthereumButtonHover = false"
93+
>
94+
<img
95+
class="img--logo-soneium"
96+
:src="
97+
isEthereumButtonHover
98+
? require('src/assets/img/chain/ethereum-white.svg')
99+
: require('src/assets/img/chain/ethereum-blue.svg')
100+
"
101+
alt="ethereum"
102+
/>
103+
</button>
104+
<button v-else class="btn btn--icon">
105+
<img
106+
class="img--logo-soneium"
107+
:src="require('src/assets/img/chain/ethereum-white.svg')"
108+
alt="ethereum"
109+
/>
110+
</button>
111+
<span class="text--mobile-menu">{{ $t('assets.bridgeToEthereum') }}</span>
112+
<q-tooltip>
113+
<span class="text--tooltip">{{ $t('assets.bridgeToEthereum') }}</span>
114+
</q-tooltip>
115+
</custom-router-link>
80116
<balloon
81117
class="balloon--ccip"
82118
direction="top"
83-
:is-balloon="isCcipBalloon"
119+
:is-balloon="isCcipEthereumBalloon"
84120
:is-balloon-closing="isBalloonClosing"
85-
:handle-close-balloon="closeCcipBalloon"
86-
:text="$t('assets.bridgeToSoneium')"
121+
:handle-close-balloon="closeCcipEthereumBalloon"
122+
:text="$t('assets.bridgeToEthereum')"
87123
:title="$t('new')"
88124
/>
89125
</div>
@@ -161,10 +197,9 @@ import ModalFaucet from 'src/components/assets/modals/ModalFaucet.vue';
161197
import Balloon from 'src/components/common/Balloon.vue';
162198
import { LOCAL_STORAGE } from 'src/config/localStorage';
163199
import {
164-
ccipMinatoBridgeEnabled,
165200
layerZeroBridgeEnabled,
166201
nativeBridgeEnabled,
167-
ccipSoneiumBridgeEnabled,
202+
checkIsCcipBridgeEnabled,
168203
} from 'src/features';
169204
import { useAccount, useBreakpoints, useFaucet, useNetworkInfo } from 'src/hooks';
170205
import { faucetSethLink } from 'src/links';
@@ -179,6 +214,7 @@ import { useStore } from 'src/store';
179214
import { computed, defineComponent, ref, watch, watchEffect } from 'vue';
180215
181216
import CustomRouterLink from '../common/CustomRouterLink.vue';
217+
import { CcipNetworkName, CcipNetworkParam } from 'src/modules/ccip-bridge';
182218
183219
export default defineComponent({
184220
components: { ModalFaucet, CustomRouterLink, Balloon },
@@ -197,15 +233,29 @@ export default defineComponent({
197233
const isFaucet = ref<boolean>(false);
198234
const isModalFaucet = ref<boolean>(false);
199235
200-
const isCcipBalloon = ref<boolean>(false);
236+
const isCcipSoneiumBalloon = ref<boolean>(false);
237+
const isCcipEthereumBalloon = ref<boolean>(false);
201238
const isBalloonClosing = ref<boolean>(false);
202239
const isSoneiumButtonHover = ref<boolean>(false);
240+
const isEthereumButtonHover = ref<boolean>(false);
203241
204-
const { currentNetworkName, nativeTokenSymbol, isZkEvm, isAstar, isShibuyaEvm, isAstarEvm } =
205-
useNetworkInfo();
242+
const {
243+
currentNetworkName,
244+
nativeTokenSymbol,
245+
isZkEvm,
246+
isAstar,
247+
isShibuyaEvm,
248+
isAstarEvm,
249+
ccipSoneiumLink,
250+
ccipEthereumLink,
251+
} = useNetworkInfo();
252+
253+
const closeCcipSoneiumBalloon = () => {
254+
isCcipSoneiumBalloon.value = false;
255+
};
206256
207-
const closeCcipBalloon = () => {
208-
isCcipBalloon.value = false;
257+
const closeCcipEthereumBalloon = () => {
258+
isCcipEthereumBalloon.value = false;
209259
};
210260
211261
const { currentAccount } = useAccount();
@@ -252,33 +302,39 @@ export default defineComponent({
252302
253303
const isTruncate = !nativeTokenSymbol.value.toUpperCase().includes('BTC');
254304
255-
const isEnableCcipBridge = computed<boolean>(() => {
256-
return (
257-
(isShibuyaEvm.value && ccipMinatoBridgeEnabled) ||
258-
(isAstarEvm.value && ccipSoneiumBridgeEnabled)
259-
);
305+
const isEnableSoneiumCcipBridge = computed<boolean>(() => {
306+
const from = isShibuyaEvm.value ? CcipNetworkName.ShibuyaEvm : CcipNetworkName.AstarEvm;
307+
const to = isShibuyaEvm.value ? CcipNetworkName.SoneiumMinato : CcipNetworkName.Soneium;
308+
return checkIsCcipBridgeEnabled({ from, to });
309+
});
310+
311+
const isEnableEthereumCcipBridge = computed<boolean>(() => {
312+
const from = isShibuyaEvm.value ? CcipNetworkName.ShibuyaEvm : CcipNetworkName.AstarEvm;
313+
const to = isShibuyaEvm.value ? CcipNetworkName.Sepolia : CcipNetworkName.Ethereum;
314+
return checkIsCcipBridgeEnabled({ from, to });
260315
});
261316
262317
// Memo: display the balloon animation
263318
watch(
264319
[isShibuyaEvm, isAstarEvm],
265320
async () => {
266-
const isBallonShibuyaDisplayed = Boolean(
267-
localStorage.getItem(LOCAL_STORAGE.BALLOON_CCIP_SHIBUYA)
321+
const isBallonSepoliaCcipDisplayed = Boolean(
322+
localStorage.getItem(LOCAL_STORAGE.BALLOON_CCIP_SEPOLIA)
268323
);
269-
const isBallonAstarDisplayed = Boolean(
270-
localStorage.getItem(LOCAL_STORAGE.BALLOON_CCIP_ASTAR)
324+
const isBallonEthreumCcipDisplayed = Boolean(
325+
localStorage.getItem(LOCAL_STORAGE.BALLOON_CCIP_ETHEREUM)
271326
);
272-
if (isShibuyaEvm.value && !isBallonShibuyaDisplayed) {
327+
328+
if (isShibuyaEvm.value && !isBallonSepoliaCcipDisplayed) {
273329
await wait(1000);
274-
isCcipBalloon.value = true;
275-
localStorage.setItem(LOCAL_STORAGE.BALLOON_CCIP_SHIBUYA, 'true');
330+
isCcipEthereumBalloon.value = true;
331+
localStorage.setItem(LOCAL_STORAGE.BALLOON_CCIP_SEPOLIA, 'true');
276332
}
277333
278-
if (isAstarEvm.value && !isBallonAstarDisplayed) {
334+
if (isAstarEvm.value && !isBallonEthreumCcipDisplayed) {
279335
await wait(1000);
280-
isCcipBalloon.value = true;
281-
localStorage.setItem(LOCAL_STORAGE.BALLOON_CCIP_ASTAR, 'true');
336+
isCcipEthereumBalloon.value = true;
337+
localStorage.setItem(LOCAL_STORAGE.BALLOON_CCIP_ETHEREUM, 'true');
282338
}
283339
},
284340
{ immediate: true }
@@ -302,18 +358,24 @@ export default defineComponent({
302358
nativeBridgeEnabled,
303359
layerZeroBridgeEnabled,
304360
isShibuyaEvm,
305-
isEnableCcipBridge,
306-
isCcipBalloon,
361+
isEnableSoneiumCcipBridge,
362+
isEnableEthereumCcipBridge,
363+
isCcipSoneiumBalloon,
307364
isBalloonClosing,
308365
isAstarEvm,
309366
isSoneiumButtonHover,
310-
closeCcipBalloon,
311-
buildCcipBridgePageLink,
367+
isEthereumButtonHover,
368+
ccipSoneiumLink,
369+
ccipEthereumLink,
370+
isCcipEthereumBalloon,
371+
closeCcipEthereumBalloon,
372+
closeCcipSoneiumBalloon,
312373
truncate,
313374
handleModalFaucet,
314375
buildTransferPageLink,
315376
buildEthereumBridgePageLink,
316377
buildLzBridgePageLink,
378+
checkIsCcipBridgeEnabled,
317379
};
318380
},
319381
});

src/components/assets/styles/asset-list.scss

+14-1
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,19 @@
420420
}
421421
}
422422

423+
.row__actions-evm {
424+
display: flex;
425+
justify-content: center;
426+
width: 100%;
427+
padding-top: 32px;
428+
@media (min-width: $sm) {
429+
gap: 20px;
430+
width: 50%;
431+
justify-content: flex-end;
432+
padding-top: 0;
433+
}
434+
}
435+
423436
.row__actions-multi {
424437
display: flex;
425438
justify-content: center;
@@ -828,7 +841,7 @@
828841
}
829842

830843
.img--logo-soneium {
831-
height: 24px;
844+
height: 30px;
832845
}
833846

834847
.box--ccip {

0 commit comments

Comments
 (0)