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: wrap MNT to WMNT and unwrap WETH to ETH when deposit #85

Merged
merged 42 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b802cec
update for auto wrap MNT to WMNT when depost
MickWang Apr 8, 2024
4d9cd13
unwrap weth when deposit
MickWang Apr 8, 2024
e965cb9
add weth contracts
MickWang Apr 9, 2024
bbb9ed3
fix conflicts
MickWang Apr 9, 2024
26e0260
fix lint issues
MickWang Apr 10, 2024
593cea3
fix lint issues
MickWang Apr 10, 2024
f4721ea
Merge branch 'main' into feat/wrap_mnt
MickWang Apr 12, 2024
1f27cb1
update feature.yml
MickWang Apr 12, 2024
626ff91
fix lint error
MickWang Apr 12, 2024
143b496
Merge branch 'main' into feat/wrap_mnt
MickWang Apr 12, 2024
a0245aa
Merge pull request #104 from zkLinkProtocol/feat/open_withdraw
zkLeonardo Apr 14, 2024
b935e75
Merge pull request #105 from zkLinkProtocol/feat/open_withdraw
zkLeonardo Apr 14, 2024
5a4ed69
Merge pull request #106 from zkLinkProtocol/feat/open_withdraw
zkLeonardo Apr 14, 2024
d0b3978
Merge pull request #109 from zkLinkProtocol/feat/not_withdraw_merge
zkLeonardo Apr 14, 2024
5b8a9f9
support merege token withraw
MickWang Apr 15, 2024
acc4c7a
update ui fir withdraw merge token
MickWang Apr 15, 2024
b9068ff
update estimate withdraw left time
MickWang Apr 15, 2024
1ed296b
update approve for merge token
MickWang Apr 16, 2024
6dd4166
update ui for withdraw merge token
MickWang Apr 16, 2024
1e6ed2c
Merge pull request #113 from zkLinkProtocol/feat/binance-banner
MickWang Apr 16, 2024
fa1f963
Merge pull request #115 from zkLinkProtocol/feat/withdraw_merge
zkLeonardo Apr 16, 2024
456cdce
update ui for merge token allowance
MickWang Apr 16, 2024
1f6ff86
update ui for merge token allowance
MickWang Apr 16, 2024
79f24f6
Merge pull request #116 from zkLinkProtocol/feat/withdraw_merge
zkLeonardo Apr 16, 2024
fc37521
fix: Fixing the issue of incorrect chain display in the withdraw feature
haymond-ZK Apr 16, 2024
f99860e
Merge pull request #117 from zkLinkProtocol/feature-withdraw
MickWang Apr 16, 2024
ce7e4bf
update switch chain for binance
MickWang Apr 16, 2024
7a3ad9e
Merge pull request #119 from zkLinkProtocol/feat/withdraw_merge
zkLeonardo Apr 16, 2024
20e6316
add selected token check
MickWang Apr 16, 2024
be7a084
update binnace wallet display name
MickWang Apr 16, 2024
3068782
Merge pull request #120 from zkLinkProtocol/feat/withdraw_merge
zkLeonardo Apr 16, 2024
f3c6922
fix change network text issue
MickWang Apr 17, 2024
43ea917
Merge pull request #125 from zkLinkProtocol/feat/withdraw_merge
zkLeonardo Apr 17, 2024
ecef897
remove debugger
MickWang Apr 17, 2024
4c0d7d4
Merge pull request #126 from zkLinkProtocol/feat/withdraw_merge
zkLeonardo Apr 17, 2024
4aaa20b
feat:wrap MNT and unwrap WETH
Apr 17, 2024
a1fb928
fix text error
MickWang Apr 17, 2024
b58afc1
Merge pull request #129 from zkLinkProtocol/feat/withdraw_merge
zkLeonardo Apr 17, 2024
65f7328
Merge branch 'main' into feat/wrap_mnt
MickWang Apr 17, 2024
2c9e54d
fix conflicts
MickWang Apr 17, 2024
f9c9a76
Merge branch 'preview' into feat/wrap_mnt
MickWang Apr 18, 2024
e5a5646
fix:mantle weth and icon url
zkcarl Apr 18, 2024
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
13 changes: 10 additions & 3 deletions components/common/Timer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const props = defineProps({
type: String,
default: "hh:mm:ss", // 'hh:mm:ss' for "00:00:00", 'human-readable' for "1 hour 30 minutes"
},
onlyDays: {
type: Boolean,
default: false,
},
});
const emit = defineEmits<{
(eventName: "finish"): void;
Expand All @@ -37,13 +41,16 @@ watch(

let intervalId: ReturnType<typeof setInterval> | undefined = undefined;

const formatTimeDiff = (diff: number): string => {
const formatTimeDiff = (diff: number, onlyDays = false): string => {
const day = Math.floor(diff / (1000 * 60 * 60 * 24));
const hours = Math.floor(diff % (1000 * 60 * 60 * 24) / (1000 * 60 * 60));
const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((diff % (1000 * 60)) / 1000);

if (props.format === "human-readable") {
if (onlyDays) {
return `~ ${day} day${day !== 1 ? "s" : ""}`
}
let formattedString = "";
if (hours > 0) formattedString += `${day} day ${hours} hour${hours > 1 ? "s" : ""} `;
if (minutes > 0) formattedString += `${minutes} minute${minutes > 1 ? "s" : ""} `;
Expand All @@ -61,7 +68,7 @@ const updateTimer = () => {
const currentTime = new Date().getTime();
const targetTime = new Date(props.futureDate).getTime();
diff.value = Math.max(targetTime - currentTime, 0);
timer.value = formatTimeDiff(diff.value);
timer.value = formatTimeDiff(diff.value, props.onlyDays);

if (diff.value === 0) {
clearInterval(intervalId);
Expand Down
8 changes: 4 additions & 4 deletions components/common/button/Dropdown.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<CommonButton class="dropdown-button" :class="noChevron?'noClick':''">
<CommonButton class="dropdown-button" :class="noChevron ? 'noClick' : ''">
<div v-if="$slots['left-icon']" class="left-icon-container">
<slot name="left-icon" />
</div>
Expand Down Expand Up @@ -46,10 +46,10 @@ defineProps({
}
}

.noClick{
background: transparent !important;
:hover{
.noClick {
background: transparent !important;
:hover {
background: transparent !important;
}
}
</style>
Expand Down
16 changes: 11 additions & 5 deletions components/common/input/TransactionSend.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,17 @@ import { computed, ref, watch } from "vue";
import { LockClosedIcon } from "@heroicons/vue/24/outline";
import { BigNumber } from "ethers";

import useNetworks from "@/composables/useNetworks";

import type { Token, TokenAmount } from "@/types";
import type { BigNumberish } from "ethers";
import type { PropType } from "vue";
import { useNetworkStore } from "@/store/network";

import { decimalToBigNumber, formatTokenPrice, parseTokenAmount, removeSmallAmountPretty } from "@/utils/formatters";
import { ETH_ADDRESS, L2_ETH_TOKEN_ADDRESS } from "~/zksync-web3-nova/src/utils";
import useNetworks from "@/composables/useNetworks";
const { zkSyncNetworks,isCustomNode,defaultNetwork } = useNetworks();
const { zkSyncNetworks } = useNetworks();
// const { selectedNetwork } = storeToRefs(useNetworkStore());
const selectedNetwork = zkSyncNetworks.filter((i:any)=>i.key === "primary")[0];
const selectedNetwork = zkSyncNetworks.filter((i) => i.key === "primary")[0];
const props = defineProps({
modelValue: {
type: String,
Expand Down Expand Up @@ -161,7 +162,12 @@ const selectedTokenAddress = computed({
});
const selectedToken = computed(() => {
const tokens = props.balances.length ? props.balances : props.tokens;
return tokens.filter((e)=> selectedNetwork.isEthGasToken || (e.address !== ETH_ADDRESS && e.address.toLowerCase() !== L2_ETH_TOKEN_ADDRESS)).find((e) => e.address === props.tokenAddress);
return tokens
.filter(
(e) =>
selectedNetwork.isEthGasToken || (e.address !== ETH_ADDRESS && e.address.toLowerCase() !== L2_ETH_TOKEN_ADDRESS)
)
.find((e) => e.address === props.tokenAddress);
});
const tokenBalance = computed(() => {
if (!props.balances.length || !selectedToken.value) {
Expand Down
26 changes: 22 additions & 4 deletions components/common/input/TransactionWithdraw.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
<template v-else-if="amountError === 'exceeds_merge_limit'">
Input amount exceeds the merge limit.
</template>
<template v-else-if="amountError === 'exceeds_merge_withdrawal_limit'">
The input amount exceeds the {{ selectedToken.symbol }}.{{ selectedNetwork.l1Network?.name }} amount locked in the <a :href="MergeTokenContractUrl" target="_blank" class="underline underline-offset-2">merge token contract.</a> Consider withdrawing to another network or reducing the input.
</template>
<template v-else-if="amountError === 'exceeds_max_amount' || amountError === 'exceeds_balance'">
Max amount is
<button
Expand All @@ -69,7 +72,6 @@
<template v-else-if="amountError === 'exceeds_decimals'">
Max decimal length for {{ selectedToken?.symbol }} is {{ selectedToken?.decimals }}
</template>

</CommonInputErrorMessage>
<CommonButtonLabel v-else-if="inputted" as="div" variant="light" class="-mb-6 mt-1 text-right text-sm">
{{ totalAmountPrice }}
Expand Down Expand Up @@ -105,13 +107,16 @@ import { computed, ref, watch } from "vue";

import { LockClosedIcon } from "@heroicons/vue/24/outline";
import { BigNumber } from "ethers";
import { storeToRefs } from "pinia";

import type { Token, TokenAmount } from "@/types";
import type { BigNumberish } from "ethers";
import type { PropType } from "vue";

import { useNetworkStore } from "@/store/network";
import { decimalToBigNumber, formatTokenPrice, parseTokenAmount, removeSmallAmountPretty } from "@/utils/formatters";
import { ETH_ADDRESS, L2_ETH_TOKEN_ADDRESS } from "~/zksync-web3-nova/src/utils";
import { MergeTokenContractUrl } from '@/utils/constants'
const { selectedNetwork } = storeToRefs(useNetworkStore());
const props = defineProps({
modelValue: {
Expand Down Expand Up @@ -151,6 +156,10 @@ const props = defineProps({
mergeLimitExceeds: {
type: Boolean,
default: false
},
mergeWithdrawalLimitExceeds: {
type: Boolean,
default: false
}
});

Expand All @@ -166,7 +175,13 @@ const selectedTokenAddress = computed({
});
const selectedToken = computed(() => {
const tokens = props.balances.length ? props.balances : props.tokens;
return tokens.filter((e)=> selectedNetwork.value.isEthGasToken || (e.address !== ETH_ADDRESS && e.address.toLowerCase() !== L2_ETH_TOKEN_ADDRESS)).find((e) => e.address === props.tokenAddress);
return tokens
.filter(
(e) =>
selectedNetwork.value.isEthGasToken ||
(e.address !== ETH_ADDRESS && e.address.toLowerCase() !== L2_ETH_TOKEN_ADDRESS)
)
.find((e) => e.address === props.tokenAddress);
});
const tokenBalance = computed(() => {
if (!props.balances.length || !selectedToken.value) {
Expand Down Expand Up @@ -223,8 +238,11 @@ const setMaxAmount = () => {
};

const amountError = computed(() => {
if(props.mergeLimitExceeds) {
return 'exceeds_merge_limit'
if (props.mergeLimitExceeds) {
return "exceeds_merge_limit";
}
if(props.mergeWithdrawalLimitExceeds) {
return 'exceeds_merge_withdrawal_limit'
}
if (!selectedToken.value) return;
if (tokenBalance.value && totalComputeAmount.value.gt(tokenBalance.value.amount)) {
Expand Down
14 changes: 10 additions & 4 deletions components/destination/DestinationItem.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<template>
<CommonButtonLineWithImg :as="as" :icon="icon" class="destination-item" :class="{ 'disable': disabled }" v-tooltip="disabled&&'Withdrawal from Nova will be enable in April.'">
<CommonButtonLineWithImg
:as="as"
:icon="icon"
class="destination-item"
:class="{ disable: disabled }"
v-tooltip="disabled && 'Withdrawal from Nova will be enable in April.'"
>
<template #image>
<slot name="image">
<CommonImageLoader class="destination-item-icon" :src="iconUrl" />
Expand Down Expand Up @@ -50,18 +56,18 @@ defineProps({
disabled: {
type: Boolean,
default: false,
}
},
});
</script>

<style lang="scss">
.marginLeft{
.marginLeft {
display: inline-block;
position: absolute;
right: 10px;
color: #999a9c;
}
.disable{
.disable {
background: #252628 !important;
color: #999a9c !important;
position: relative;
Expand Down
8 changes: 1 addition & 7 deletions components/header/AccountDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ import { computed, ref, watch } from "vue";
import { useTippy } from "vue-tippy";

import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue";
import {
ArrowTopRightOnSquareIcon,
DocumentDuplicateIcon,
ExclamationCircleIcon,
PowerIcon,
Squares2X2Icon,
} from "@heroicons/vue/24/outline";
import { ArrowTopRightOnSquareIcon, DocumentDuplicateIcon, PowerIcon, Squares2X2Icon } from "@heroicons/vue/24/outline";
import { storeToRefs } from "pinia";

import useCopy from "@/composables/useCopy";
Expand Down
2 changes: 1 addition & 1 deletion components/header/AccountDropdownButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ import { storeToRefs } from "pinia";
import { useOnboardStore } from "@/store/onboard";

const onboardStore = useOnboardStore();
const { account,walletName } = storeToRefs(onboardStore);
const { account, walletName } = storeToRefs(onboardStore);
</script>
13 changes: 5 additions & 8 deletions components/header/Banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,15 @@
</div>
</template>
<script>
// Import Swiper Vue.js components
import { Swiper, SwiperSlide } from "swiper/vue";

// Import Swiper styles
import "swiper/css";

// import "swiper/css/pagination";
// import "swiper/css/navigation";

// import required modules
import { Autoplay, Pagination, Navigation } from "swiper/modules";

import { Autoplay, Navigation, Pagination } from "swiper/modules";
// Import Swiper Vue.js components
import { Swiper, SwiperSlide } from "swiper/vue";
// Import Swiper styles
import "swiper/css";
export default {
components: {
Swiper,
Expand Down
6 changes: 4 additions & 2 deletions components/header/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@

<script lang="ts" setup>
import { ref } from "vue";
import { computed } from "vue";

import {
ArrowsRightLeftIcon,
Expand All @@ -124,13 +125,14 @@ import {
} from "@heroicons/vue/24/outline";
import { storeToRefs } from "pinia";

import Banner from "./Banner.vue";

import useColorMode from "@/composables/useColorMode";
import useNetworks from "@/composables/useNetworks";

import { useRoute } from "#imports";
import { useOnboardStore } from "@/store/onboard";
import { useZkSyncWithdrawalsStore } from "@/store/zksync/withdrawals";
import useNetworks from "@/composables/useNetworks";
import Banner from "./Banner.vue";
const { defaultNetwork, isMainnet } = useNetworks();

const route = useRoute();
Expand Down
5 changes: 4 additions & 1 deletion components/header/MobileMainNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,22 @@
</template>
<script lang="ts" setup>
import { computed, ref, watch } from "vue";

import {
ArrowsRightLeftIcon,
ArrowsUpDownIcon,
CheckIcon,
ChevronRightIcon,
MoonIcon,
SunIcon,
WalletIcon,
} from "@heroicons/vue/24/outline";
import { storeToRefs } from "pinia";

import useColorMode from "@/composables/useColorMode";
import useNetworks from "@/composables/useNetworks";

import type { ZkSyncNetwork } from "@/data/networks";

import { useRoute } from "#imports";
import { useNetworkStore } from "@/store/network";
import { useZkSyncWithdrawalsStore } from "@/store/zksync/withdrawals";
Expand Down
4 changes: 2 additions & 2 deletions components/header/NetworkDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<CommonButtonDropdown :toggled="open">
<template #left-icon>
<!-- <IconsEra /> -->
<img class="image-loader-image loaded" :src="selectedNetwork.logoUrl">
<img class="image-loader-image loaded" :src="selectedNetwork.logoUrl" />
</template>
<span>{{ selectedNetwork.l1Network?.name }}</span>
</CommonButtonDropdown>
Expand All @@ -27,7 +27,7 @@
>
<template #left-icon>
<!-- <IconsEra /> -->
<img class="image-loader-image loaded" :src="item.logoUrl">
<img class="image-loader-image loaded" :src="item.logoUrl" />
</template>
<span>{{ item.l1Network?.name }}</span>
<template #right-icon>
Expand Down
Loading
Loading