Skip to content

Commit

Permalink
Gateway: cleanup Moobeam support for Testnet / Mainnet (#955)
Browse files Browse the repository at this point in the history
* fix for mui version and typescript crashes.

* bobabeam / bobabase cleanup

* cleaning up bobabeam, bobabase register address.

* console cleaning

* updated the test cases fixes.
  • Loading branch information
sk-enya authored Jun 15, 2023
1 parent f0ec957 commit c73d476
Show file tree
Hide file tree
Showing 32 changed files with 66 additions and 670 deletions.
9 changes: 0 additions & 9 deletions packages/boba/gateway/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ REACT_APP_DISABLE_VE_DAO=1
# to disable the walletConnect set below flat to 1.
REACT_APP_DISABLE_WALLETCONNECT=1


# to show boba beam Alert, DEPOSIT METHODS
# 1 - TO SHOW ALERT 0 - TO HIDE ALERT
REACT_APP_BOBA_BEAM_STATUS=1

# to show fantom opera Alert, DEPOSIT METHODS
# 1 - TO SHOW ALERT 0 - TO HIDE ALERT
REACT_APP_BOBA_OPERA_STATUS=1=1

# TO remove boba beam features from gateway
# 1 - TO REMOVE moonbeam, boba beam support from gateway.
REACT_APP_DISABLE_BOBA_BEAM=0
2 changes: 1 addition & 1 deletion packages/boba/gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@eth-optimism/contracts": "0.5.11",
"@eth-optimism/core-utils": "0.8.1",
"@ethersproject/units": "^5.5.0",
"@mui/base": "^5.0.0-alpha.67",
"@mui/base": "5.0.0-alpha.72",
"@mui/icons-material": "^5.11.16",
"@mui/material": "^5.12.2",
"@mui/styles": "^5.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/boba/gateway/src/actions/networkAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export function getAllAddresses() {
/********************************/
/**
* @params
* network - ethereum, bnb, fantom, avax, moonbase, moonbeam
* network - ethereum, bnb, fantom, avax
* networkType - MAINNET, TESTNET
*/
export function setNetwork(payload) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,8 @@ const TableRow = styled(Row)`
margin-right: 0px;
}
`
type TableHeaderOptionType = {
name: string
tooltip: string
width: number
}

type TableHeaderType = {
options: TableHeaderOptionType[]
}

export const TableHeader = ({ options }: TableHeaderType) => {
export const TableHeader = ({ options }) => {
return (
<TableHeaderContainer>
{options?.map((option) => {
Expand All @@ -66,18 +57,8 @@ export const TableHeader = ({ options }: TableHeaderType) => {
)
}

type TableContentOptionType = {
content: any
width: number
}

type TableContentType = {
options: TableContentOptionType[]
mobileOptions?: number[]
}

export const TableContent = ({ options, mobileOptions }: TableContentType) => {
const theme = useTheme() as any
export const TableContent = ({ options, mobileOptions }) => {
const theme = useTheme()
const isMobile = useMediaQuery(theme.breakpoints.down('md'))
const currentOptions =
isMobile && mobileOptions ? mobileOptions.map((i) => options[i]) : options
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ interface BannerContent {
}

export const BannerConfig: Record<string, BannerContent> = {
[NETWORK.MOONBEAM]: {
message: `Bobabeam is being wound down & will no longer be available, starting May 25th`,
content: `Bobabeam is being wound down & will no longer be available, starting May 25th. For users of Bobabeam or Bobabeam applications you will need to transfer all your funds to Moonbeam mainnet before May 15th or risk permanently losing access to any assets on Bobabeam.`,
},
[NETWORK.FANTOM]: {
message: `BobaOpera is being wound down & will no longer be available, starting June 25th`,
content: `BobaOpera is being wound down & will no longer be available starting June 25th. For users of BobaOpera or BobaOpera applications you will need to transfer all your funds to Fantom mainnet before June 15th or risk permanently losing access to any assets on BobaOpera.`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,16 @@ const useStyles = makeStyles({
},
})

type PageHeaderType = {
maintenance: boolean
}

const PageHeader = ({ maintenance }: PageHeaderType): JSX.Element => {
const PageHeader = ({ maintenance }) => {
const classes = useStyles()
const [open, setOpen] = useState<boolean>(false)
const [walletOpen, setWalletOpen] = useState<boolean>(false)
const [feeOpen, setFeeOpen] = useState<boolean>(false)
const [open, setOpen] = useState(false)
const [walletOpen, setWalletOpen] = useState(false)
const [feeOpen, setFeeOpen] = useState(false)

const theme = useTheme()
const accountEnabled: boolean = useSelector(selectAccountEnabled())
const layer: 'L1' | 'L2' = useSelector(selectLayer())
const monsterNumber: number = useSelector(selectMonster())
const accountEnabled = useSelector(selectAccountEnabled())
const layer = useSelector(selectLayer())
const monsterNumber = useSelector(selectMonster())
const isMobile = useMediaQuery(theme.breakpoints.down('md'))

const Logo = monsterNumber > 0 ? BobaLogoM : BobaLogo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { Typography, Box, BoxProps } from '@mui/material'
import { Typography, Box } from '@mui/material'
import React from 'react'
import * as S from './PageTitle.styles'

interface PageTitleProps {
title: string
sx?: BoxProps['sx']
}

const PageTitle = ({ title, sx }: PageTitleProps): JSX.Element => {
const PageTitle = ({ title, sx }) => {
return (
<Box sx={{ my: 1 }}>
<S.Wrapper sx={sx}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react'
import { useSelector } from 'react-redux'
import { selectActiveNetwork } from 'selectors'
import styled from 'styled-components'
import { BOBABEAM_STATUS, BOBAOPERA_STATUS } from 'util/constant'
import { BOBAOPERA_STATUS } from 'util/constant'
import { bridgeAlerts } from './alertConfig'

const AlertText = styled(Text)`
Expand All @@ -18,7 +18,7 @@ const BridgeAlert = () => {

const alertCaption = bridgeAlerts[activeNetwork]

if (!!Number(BOBABEAM_STATUS) || !!Number(BOBAOPERA_STATUS)) {
if (!!Number(BOBAOPERA_STATUS)) {
return <AlertText>{alertCaption}</AlertText>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ function InputStepMultiChain({ handleClose, token, isBridge, openTokenPicker })
const options = [
{ value: 'BNB', label: 'BNB', title: 'BNB', image: getImageComponent("BNB") },
{ value: 'Avalanche', label: 'Avalanche', title: 'Avalanche', image: getImageComponent('AVAX') },
{ value: 'Fantom', label: 'Fantom', title: 'Fantom', image: getImageComponent('FTM') },
{ value: 'Moonbeam', label: 'Moonbeam', title: 'Moonbeam', image: getImageComponent('GLMR') },
{ value: 'Fantom', label: 'Fantom', title: 'Fantom', image: getImageComponent('FTM') }
].filter(i => networkService.supportedAltL1Chains.includes(i.value))

const dispatch = useDispatch()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { NETWORK } from 'util/network/network.util'

export const bridgeAlerts = {
[NETWORK.MOONBEAM]: `For users of Bobabeam or Bobabeam applications
you will need to transfer all your funds to Moonbeam mainnet before May
15th or risk permanently losing access to any assets on Bobabeam`,
[NETWORK.FANTOM]: `For users of BobaOpera or BobaOpera applications
you will need to transfer all your funds to Fantom mainnet before June 15th
or risk permanently losing access to any assets on BobaOpera`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`BobaBeamAlert should match the snapshot disabled from env params 1`] = `<DocumentFragment />`;
exports[`BridgeAlert should match the snapshot disabled from env params 1`] = `<DocumentFragment />`;

exports[`BobaBeamAlert should match the snapshot when active network is ethereum 1`] = `
exports[`BridgeAlert should match the snapshot when active network is ethereum 1`] = `
<DocumentFragment>
.c0 {
padding: 0px;
Expand All @@ -25,34 +25,7 @@ exports[`BobaBeamAlert should match the snapshot when active network is ethereum
</DocumentFragment>
`;

exports[`BobaBeamAlert should match the snapshot when active network is moonbeam 1`] = `
<DocumentFragment>
.c0 {
padding: 0px;
margin: 0px;
font-weight: 400;
font-size: 0.9rem;
line-height: 1.25;
}
.c1 {
color: yellow;
font-size: 16px;
font-weight: 700;
margin: 5px 0px;
}
<p
class="c0 c1"
>
For users of Bobabeam or Bobabeam applications
you will need to transfer all your funds to Moonbeam mainnet before May
15th or risk permanently losing access to any assets on Bobabeam
</p>
</DocumentFragment>
`;

exports[`BobaBeamAlert should match the snapshot when active network is opera 1`] = `
exports[`BridgeAlert should match the snapshot when active network is opera 1`] = `
<DocumentFragment>
.c0 {
padding: 0px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { render } from '@testing-library/react'
import Theme from 'themes'
import { Provider } from 'react-redux'
import configureStore from 'redux-mock-store'
import BobaBeamAlert from '../BridgeAlert'
import BridgeAlert from '../BridgeAlert'
import { NETWORK } from 'util/network/network.util'
import * as constants from 'util/constant'

Expand All @@ -20,18 +20,14 @@ const renderComponent = (state: any) => {
})}
>
<Theme>
<BobaBeamAlert />
<BridgeAlert />
</Theme>
</Provider>
)
}

describe('BobaBeamAlert', () => {
describe('BridgeAlert', () => {
test('should match the snapshot when active network is ethereum', () => {
Object.defineProperty(constants, 'BOBABEAM_STATUS', {
value: 1,
writable: true,
})
Object.defineProperty(constants, 'BOBAOPERA_STATUS', {
value: 1,
writable: true,
Expand All @@ -44,28 +40,7 @@ describe('BobaBeamAlert', () => {
expect(asFragment()).toMatchSnapshot()
})

test('should match the snapshot when active network is moonbeam', () => {
Object.defineProperty(constants, 'BOBABEAM_STATUS', {
value: 1,
writable: true,
})
Object.defineProperty(constants, 'BOBAOPERA_STATUS', {
value: 1,
writable: true,
})
const { asFragment } = renderComponent({
network: {
activeNetwork: NETWORK.MOONBEAM,
},
})
expect(asFragment()).toMatchSnapshot()
})

test('should match the snapshot when active network is opera', () => {
Object.defineProperty(constants, 'BOBABEAM_STATUS', {
value: 1,
writable: true,
})
Object.defineProperty(constants, 'BOBAOPERA_STATUS', {
value: 1,
writable: true,
Expand All @@ -79,10 +54,6 @@ describe('BobaBeamAlert', () => {
})

test('should match the snapshot disabled from env params', () => {
Object.defineProperty(constants, 'BOBABEAM_STATUS', {
value: 0,
writable: true,
})
Object.defineProperty(constants, 'BOBAOPERA_STATUS', {
value: 0,
writable: true,
Expand Down
2 changes: 0 additions & 2 deletions packages/boba/gateway/src/containers/wallet/token/Token.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ function TokenPage({
return 'fantom'
} else if (['BNB', 'tBNB'].includes(i.symbolL1)) {
return 'binancecoin'
} else if (['DEV', 'GLMR'].includes(i.symbolL1)) {
return 'moonbeam'
} else {
return i.symbolL1.toLowerCase()
}
Expand Down
1 change: 0 additions & 1 deletion packages/boba/gateway/src/hooks/useNetwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const useNetwork = () => {
networkIcon: icon,
}));
} else if (queryParams.network && queryParams.chain) {
console.log(NETWORK_TYPE)
let type = Object.values(NETWORK_TYPE).includes(queryParams.network) ? queryParams.network : NETWORK_TYPE.MAINNET;
let chain = Object.values(NETWORK).includes(queryParams.chain) ? queryParams.chain : NETWORK.ETHEREUM;

Expand Down
Binary file removed packages/boba/gateway/src/images/moonbase.png
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/boba/gateway/src/reducers/networkReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License. */
import { NETWORK, NETWORK_TYPE } from "util/network/network.util"

/**
* network : ethereum, bnb, fantom, avax, moonbase, moonbeam
* network : ethereum, bnb, fantom, avax
* networkType : mainnet, testnet.
**/

Expand Down
23 changes: 2 additions & 21 deletions packages/boba/gateway/src/services/app.service.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { NETWORK, NETWORK_TYPE } from "util/network/network.util";
// testnet addresss
import addresses_Goerli from "@boba/register/addresses/addressesGoerli_0x6FF9c8FF8F0B6a0763a3030540c21aFC721A9148"
import addresses_BobaBase from "@boba/register/addresses/addressesBobaBase_0xF8d0bF3a1411AC973A606f90B2d1ee0840e5979B"
import addresses_BobaOperaTestnet from "@boba/register/addresses/addressesBobaOperaTestnet_0x12ad9f501149D3FDd703cC10c567F416B7F0af8b"
import addresses_BobaFuji from "@boba/register/addresses/addressBobaFuji_0xcE78de95b85212BC348452e91e0e74c17cf37c79"
import addresses_BobaBnbTestnet from "@boba/register/addresses/addressBobaBnbTestnet_0xAee1fb3f4353a9060aEC3943fE932b6Efe35CdAa"

// mainnet address
import addresses_Mainnet from "@boba/register/addresses/addressesMainnet_0x8376ac6C3f73a25Dd994E0b0669ca7ee0C02F089"
import addresses_BobaBeam from "@boba/register/addresses/addressBobaBeam_0x564c10A60af35a07f0EA8Be3106a4D81014b21a0"
import addresses_BobaAvax from "@boba/register/addresses/addressBobaAvax_0x00220f8ce1c4be8436574e575fE38558d85e2E6b"
import addresses_BobaBnb from "@boba/register/addresses/addressBobaBnb_0xeb989B25597259cfa51Bd396cE1d4B085EC4c753"
import addresses_BobaOpera from "@boba/register/addresses/addressBobaOpera_0x4e7325bcf09e091Bb8119258B885D4ef687B7386"
Expand Down Expand Up @@ -42,12 +40,6 @@ const ADDRESS_CONFIG = {
...layerZeroMainnet.Layer_Zero_Protocol.Avalanche,
layerZeroTargetChainID: layerZeroMainnet.Layer_Zero_Protocol.Mainnet.Layer_Zero_ChainId,
},
[ NETWORK.MOONBEAM ]: {
...addresses_BobaBeam,
...layerZeroMainnet.BOBA_Bridges.Moonbeam,
...layerZeroMainnet.Layer_Zero_Protocol.Moonbeam,
layerZeroTargetChainID: layerZeroMainnet.Layer_Zero_Protocol.Mainnet.Layer_Zero_ChainId,
},
[ NETWORK.BNB ]: {
...addresses_BobaBnb,
...layerZeroMainnet.BOBA_Bridges.BNB,
Expand Down Expand Up @@ -80,8 +72,7 @@ const ADDRESS_CONFIG = {
...layerZeroTestnet.BOBA_Bridges.BNB,
...layerZeroTestnet.Layer_Zero_Protocol.BNB,
layerZeroTargetChainID: layerZeroTestnet.Layer_Zero_Protocol.Fantom.Layer_Zero_ChainId,
},
[ NETWORK.MOONBEAM ]: addresses_BobaBase,
}
}
}

Expand Down Expand Up @@ -129,7 +120,7 @@ const SUPPORTED_ASSETS = {
'L2': '0xf56b164efd3cfc02ba739b719b6526a6fa1ca32a'
}
},
altL1Chains: [ 'Moonbeam', 'BNB', 'Fantom', 'Avalanche' ]
altL1Chains: [ 'BNB', 'Fantom', 'Avalanche' ]
},
[ NETWORK.AVAX ]: {
tokenAddresses: {
Expand All @@ -138,11 +129,6 @@ const SUPPORTED_ASSETS = {
tokens: [ 'BOBA', 'AVAX', 'EVO', 'USDT.e', 'USDt', 'USDC.e', 'BUSD.e', 'BUSD', 'DAI.e' ],
altL1Chains: [ 'Avalanche' ]
},
[ NETWORK.MOONBEAM ]: {
tokenAddresses: {},
tokens: [ 'BOBA', 'GLMR' ],
altL1Chains: [ 'Moonbeam' ]
},
[ NETWORK.BNB ]: {
tokenAddresses: {},
tokens: [ 'BOBA', 'BNB', 'BUSD', 'USDC', 'USDT', 'SUSHI' ],
Expand All @@ -165,11 +151,6 @@ const SUPPORTED_ASSETS = {
tokens: [ 'BOBA', 'AVAX' ],
altL1Chains: [ 'Avalanche' ]
},
[ NETWORK.MOONBEAM ]: {
tokenAddresses: {},
tokens: [ 'BOBA', 'GLMR' ],
altL1Chains: [ 'Moonbase' ]
},
[ NETWORK.BNB ]: {
tokenAddresses: {},
tokens: [ 'BOBA', 'BNB', 'MMT' ],
Expand Down
1 change: 0 additions & 1 deletion packages/boba/gateway/src/services/networkService.js
Original file line number Diff line number Diff line change
Expand Up @@ -4323,7 +4323,6 @@ class NetworkService {
let ALT_L1_BOBA_ADDRESS = this.addresses[`Proxy__EthBridgeTo${type}`];
let PROXY_ETH_L1_BRIDGE_ADDRESS_TO = this.addresses[`${type}_TK_BOBA`];

// Layer zero doesn't support moonbase
// return 0 for those bridges that haven't been implemented yet
if (typeof ALT_L1_BOBA_ADDRESS === 'undefined' || typeof PROXY_ETH_L1_BRIDGE_ADDRESS_TO === 'undefined') {
return {type, fee: '0' }
Expand Down
Loading

0 comments on commit c73d476

Please sign in to comment.