Skip to content

Commit

Permalink
Merge pull request #486 from bobanetwork/main
Browse files Browse the repository at this point in the history
Gateway new release Stake Fixes | SEO
  • Loading branch information
sk-enya authored Apr 21, 2024
2 parents 0a31809 + 52acff0 commit 3bf82f9
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 93 deletions.
27 changes: 0 additions & 27 deletions boba-logo.svg

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bobanetwork/gateway",
"version": "0.14.3",
"version": "0.14.4",
"private": true,
"scripts": {
"audit-check": "audit-ci --moderate",
Expand Down
Binary file added public/boba_gateway.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 24 additions & 8 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,35 @@
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, user-scalable=no"
/>
<meta name="theme-color" content="#000000" />
<meta name="description" content="BOBA"/>
<link rel="apple-touch-icon" href="favicon.svg" />

<!-- Light Mode Theme Color -->
<meta name="theme-color" content="#1CD6D1">

<!-- Dark Mode Theme Color -->
<meta name="theme-color-dark" content="#BAE21A">

<title>Boba Network Gateway: Unlock Seamless Token Bridging</title>
<meta name="description" content="Explore Boba Network Gateway, facilitating effortless token bridging between Layer 1 (L1) and Layer 2 (L2) networks, featuring Staking, DAO, and Earn functionalities.">
<meta name="keywords" content="Boba Gateway Network, Boba Network, token bridging, Layer 1, Layer 2, crypto staking, DAO, Earn, cryptocurrency, blockchain">

<meta property="og:title" content="Boba Network Gateway: Unlock Seamless Token Bridging">
<meta property="og:description" content="Explore Boba Network Gateway, empowering seamless bridging of crypto tokens between Layer 1 (L1) and Layer 2 (L2) networks, accompanied by Staking, DAO, and Earn functionalities.">
<meta property="og:image" content="%PUBLIC_URL%/boba_gateway.png">
<meta property="og:url" content="https://gateway.boba.network/">
<meta property="og:type" content="website">

<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Boba Network Gateway: Unlock Seamless Token Bridging">
<meta name="twitter:description" content="Explore Boba Network Gateway, empowering seamless bridging of crypto tokens between Layer 1 (L1) and Layer 2 (L2) networks, accompanied by Staking, DAO, and Earn functionalities.">
<meta name="twitter:image" content="%PUBLIC_URL%/boba_gateway.png">

<link rel="apple-touch-icon" href="%PUBLIC_URL%/favicon.svg" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&display=swap" rel="stylesheet">
<title>Boba Gateway</title>

</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/Header/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const HeaderContainer = styled.div`
align-items: center;
justify-content: flex-start;
backdrop-filter: blur(7.5px);
z-index: 9999;
z-index: 10;
background: ${({ theme: { name, colors } }) =>
name === 'light' ? 'rgba(255, 255, 255, 0.35)' : 'rgba(0, 0, 0, 0.05)'};
Expand Down
15 changes: 2 additions & 13 deletions src/containers/history/History.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,10 @@ const History = () => {
/>
)
}
// @todo @note review and try to refactor as it seems multiple call to same function!

const syncTransactions = async () => {
if (accountEnabled) {
const newTransactions = await transactionService.getTransactions()
if (newTransactions.length === 0) {
setTransactionsFound(false)
} else {
setTransactionsFound(true)
}
if (
new Set(ValidValuesFromArray(transactions)).size !==
new Set(newTransactions).size
) {
dispatch(fetchTransactions())
}
dispatch(fetchTransactions())
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/containers/home/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`Home should match snapshot 1`] = `
class="sc-hGMjit aucDE"
>
<div
class="sc-eldPxv dmoUXT"
class="sc-eldPxv hrjSZe"
id="header"
>
<a
Expand Down
5 changes: 3 additions & 2 deletions src/containers/modals/stake/DepositStake.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react'
import { connect, useDispatch, useSelector } from 'react-redux'
import { useDispatch, useSelector } from 'react-redux'

import { openAlert, closeModal } from 'actions/uiAction'

Expand Down Expand Up @@ -33,6 +33,7 @@ const DepositStake = (props: any) => {
fee: '0',
stakeValue: '0.0',
value_Wei_String: '',
loading: false,
})

useEffect(() => {
Expand Down Expand Up @@ -199,7 +200,7 @@ const DepositStake = (props: any) => {
{netLayer === 'L2' && (
<Button
onClick={() => handleConfirm()}
loading={props.loading}
loading={state.loading}
disabled={!accountEnabled}
label="Stake"
/>
Expand Down
3 changes: 3 additions & 0 deletions src/containers/save/Save.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import useInterval from 'hooks/useInterval'
import { selectBalance, selectFixed, selectLayer, selectSetup } from 'selectors'
import styled from 'styled-components'
import { POLL_INTERVAL } from 'util/constant'
import { fetchBalances } from 'actions/networkAction'

export const OutputLabel = styled(Typography).attrs({
variant: 'title',
Expand Down Expand Up @@ -79,13 +80,15 @@ const Save = () => {
dispatch(getFS_Saves())
dispatch(getFS_Info())
getMaxTransferValue()
dispatch(fetchBalances())
}
}, [accountEnabled])

useInterval(() => {
if (accountEnabled) {
dispatch(getFS_Info())
dispatch(getFS_Saves())
dispatch(fetchBalances())
}
}, POLL_INTERVAL)

Expand Down
8 changes: 0 additions & 8 deletions src/hooks/useBridgeAlerts/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ describe('useBridgeAlerts', () => {
},
type: 'BRIDGE/ALERT/CLEAR',
})
expect(actions).toContainEqual({
payload: {
meta: 'TELEPORTATION_NO_UNCONVENTIONAL_WALLETS',
text: "This bridge doesn't support smart-contract wallets that use a costly fallback method.",
type: 'info',
},
type: 'BRIDGE/ALERT/SET',
})
expect(actions).toContainEqual({
payload: { keys: ['OMG_INFO'] },
type: 'BRIDGE/ALERT/CLEAR',
Expand Down
51 changes: 30 additions & 21 deletions src/hooks/useBridgeAlerts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const useBridgeAlerts = () => {
const layer = useSelector(selectLayer())
const bridgeType = useSelector(selectBridgeType())
const token = useSelector(selectTokenToBridge())
const amountToBridge = useSelector(selectAmountToBridge())
let amountToBridge = useSelector(selectAmountToBridge())
// network
const activeNetwork = useSelector(selectActiveNetwork())
const tokenForTeleportationSupported: ITeleportationTokenSupport =
Expand All @@ -87,6 +87,8 @@ const useBridgeAlerts = () => {
const LPLiquidity = useSelector(selectL1LPLiquidity)

useEffect(() => {
amountToBridge = Number(amountToBridge)

if (bridgeType === BRIDGE_TYPE.LIGHT) {
if (!tokenForTeleportationSupported.supported) {
dispatch(
Expand Down Expand Up @@ -115,6 +117,28 @@ const useBridgeAlerts = () => {
],
})
)

const maxDepositAmount = Number(
ethers.utils.formatEther(
tokenForTeleportationSupported.maxDepositAmount
)
)
const minDepositAmount = Number(
ethers.utils.formatEther(
tokenForTeleportationSupported.minDepositAmount
)
)
const transferredAmount = Number(
ethers.utils.formatEther(
tokenForTeleportationSupported.transferredAmount
)
)
const maxTransferAmount = Number(
ethers.utils.formatEther(
tokenForTeleportationSupported.maxTransferAmountPerDay
)
)

dispatch(
setBridgeAlert({
meta: ALERT_KEYS.TELEPORTATION_NO_UNCONVENTIONAL_WALLETS,
Expand All @@ -124,6 +148,7 @@ const useBridgeAlerts = () => {
)

if (
amountToBridge > 0 &&
(tokenForTeleportationSupported.transferredAmount as BigNumber).eq(
tokenForTeleportationSupported.maxTransferAmountPerDay
)
Expand All @@ -136,13 +161,8 @@ const useBridgeAlerts = () => {
})
)
} else if (
ethers.utils.formatEther(
tokenForTeleportationSupported.transferredAmount
) +
amountToBridge >
ethers.utils.formatEther(
tokenForTeleportationSupported.maxTransferAmountPerDay
)
amountToBridge > 0 &&
transferredAmount + amountToBridge > maxTransferAmount
) {
const maxAmount =
tokenForTeleportationSupported.maxTransferAmountPerDay as BigNumber
Expand All @@ -159,13 +179,7 @@ const useBridgeAlerts = () => {
)
}

if (
amountToBridge &&
amountToBridge <
ethers.utils.formatEther(
tokenForTeleportationSupported.minDepositAmount
)
) {
if (amountToBridge && amountToBridge < minDepositAmount) {
dispatch(
setBridgeAlert({
meta: ALERT_KEYS.VALUE_LESS_THAN_MIN_BRIDGE_CONFIG_AMOUNT,
Expand All @@ -175,12 +189,7 @@ const useBridgeAlerts = () => {
)}.`,
})
)
} else if (
amountToBridge >
ethers.utils.formatEther(
tokenForTeleportationSupported.maxDepositAmount
)
) {
} else if (amountToBridge > maxDepositAmount) {
dispatch(
setBridgeAlert({
meta: ALERT_KEYS.VALUE_GREATER_THAN_MAX_BRIDGE_CONFIG_AMOUNT,
Expand Down
7 changes: 0 additions & 7 deletions src/services/networkService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,6 @@ class NetworkService {
from: this.gasEstimateAccount,
})
approvalCost_BN = approvalGas_BN.mul(gasPrice)
console.log('Approve cost in ETH:', utils.formatEther(approvalCost_BN))
}

const DiscretionaryExitFeeContract = new ethers.Contract(
Expand Down Expand Up @@ -2367,7 +2366,6 @@ class NetworkService {
from: this.gasEstimateAccount,
})
approvalCost_BN = approvalGas_BN.mul(gasPrice)
console.log('Approve cost in ETH:', utils.formatEther(approvalCost_BN))
}

const L2BillingContract = new ethers.Contract(
Expand Down Expand Up @@ -2444,7 +2442,6 @@ class NetworkService {

const approvalGas_BN = await this.L1Provider!.estimateGas(tx)
approvalCost_BN = approvalGas_BN.mul(gasPrice)
console.log('Approve cost in ETH:', utils.formatEther(approvalCost_BN))
}

//in some cases zero not allowed
Expand Down Expand Up @@ -2949,7 +2946,6 @@ class NetworkService {
const allowance_BN = await this.BobaContract!.connect(
this.provider!
).allowance(this.gasEstimateAccount, this.addresses.BobaFixedSavings)
console.log('benchmarkAllowance_BN', allowance_BN.toString())

// second, we need the approval cost
const tx1 = await this.BobaContract!.connect(
Expand All @@ -2961,7 +2957,6 @@ class NetworkService {

const approvalGas_BN = await this.provider!.estimateGas(tx1)
approvalCost_BN = approvalGas_BN.mul(gasPrice_BN)
console.log('Approve cost in ETH:', utils.formatEther(approvalCost_BN))

// third, we need the stake cost
const FixedSavings = new ethers.Contract(
Expand All @@ -2976,10 +2971,8 @@ class NetworkService {
)
const stakeGas_BN = await this.provider!.estimateGas(tx2)
stakeCost_BN = stakeGas_BN.mul(gasPrice_BN)
console.log('Stake cost in ETH:', utils.formatEther(stakeCost_BN))

const safety_margin_BN = BigNumber.from('1000000000000')
console.log('Stake safety margin:', utils.formatEther(safety_margin_BN))

return approvalCost_BN.add(stakeCost_BN).add(safety_margin_BN)
} catch (error) {
Expand Down
11 changes: 7 additions & 4 deletions src/services/transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,10 @@ class TransactionService {
toHash: undefined,
}

let status = txReceipt?.status
? TRANSACTION_STATUS.Pending
: TRANSACTION_STATUS.Failed
let status =
txReceipt && txReceipt?.status
? TRANSACTION_STATUS.Pending
: TRANSACTION_STATUS.Failed
if (disburseEvent && status === TRANSACTION_STATUS.Pending) {
const rpc = new providers.JsonRpcProvider(
getRpcUrlByChainId(sendEvent.toChainId)
Expand All @@ -267,7 +268,7 @@ class TransactionService {
disburseEvent.transactionHash_
)
status =
disburseTxReceipt.status === 1
disburseTxReceipt && disburseTxReceipt.status === 1
? TRANSACTION_STATUS.Succeeded
: TRANSACTION_STATUS.Failed
if (
Expand Down Expand Up @@ -422,6 +423,8 @@ class TransactionService {
return [
[42161, 288],
[10, 288],
[288, 56288],
[56288, 288],
].map((p) => ({
L1: {
chainId: p[0],
Expand Down

0 comments on commit 3bf82f9

Please sign in to comment.