Skip to content

Commit

Permalink
Merge pull request #180 from bobanetwork/main
Browse files Browse the repository at this point in the history
New Release V0.11.1
  • Loading branch information
sk-enya authored Nov 15, 2023
2 parents 41accbe + 2c4187a commit e36188e
Show file tree
Hide file tree
Showing 88 changed files with 2,121 additions and 1,974 deletions.
10 changes: 1 addition & 9 deletions cypress/e2e/helpers/base/base.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import {
Avalanche,
AvalancheTestnet,
Binance,
BinanceTestnet,
} from './constants'
import { Binance, BinanceTestnet } from './constants'
import { MetamaskNetwork } from './types'

export default class Base {
addSupportedNetwork() {
// Mainnet
this.addNetwork(Binance)
this.addNetwork(Avalanche)
// Avax
this.addNetwork(BinanceTestnet)
this.addNetwork(AvalancheTestnet)
}

visit() {
Expand Down
44 changes: 1 addition & 43 deletions cypress/e2e/helpers/base/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ export const Binance: MetamaskNetwork = {
isTestnet: false,
}

export const Avalanche: MetamaskNetwork = {
networkName: 'Avalanche Mainnet',
rpcUrl: 'https://api.avax.network/ext/bc/C/rpc',
chainId: '43114',
symbol: 'AVAX',
blockExplorer: 'https://snowtrace.io/',
isTestnet: false,
}

export const BinanceTestnet: MetamaskNetwork = {
networkName: 'BNB Testnet',
rpcUrl: 'https://data-seed-prebsc-1-s1.binance.org:8545',
Expand All @@ -27,14 +18,6 @@ export const BinanceTestnet: MetamaskNetwork = {
isTestnet: true,
}

export const AvalancheTestnet: MetamaskNetwork = {
networkName: 'Avalanche Testnet',
rpcUrl: 'https://api.avax-test.network/ext/bc/C/rpc',
chainId: '43113',
symbol: 'AVAX',
blockExplorer: 'https://testnet.snowtrace.io/',
isTestnet: true,
}
export const EthereumInfo: NetworkTestInfo = {
networkName: 'Ethereum',
networkAbbreviation: 'ETHEREUM',
Expand All @@ -46,17 +29,7 @@ export const BinanceInfo: NetworkTestInfo = {
isTestnet: false,
}

export const AvalancheInfo: NetworkTestInfo = {
networkName: 'Avalanche Mainnet C-Chain',
networkAbbreviation: 'AVAX',
isTestnet: false,
}

export const MainnetL1Networks: NetworkTestInfo[] = [
EthereumInfo,
BinanceInfo,
AvalancheInfo,
]
export const MainnetL1Networks: NetworkTestInfo[] = [EthereumInfo, BinanceInfo]

export const MainnetL2Networks: NetworkTestInfo[] = [
{
Expand All @@ -69,11 +42,6 @@ export const MainnetL2Networks: NetworkTestInfo[] = [
networkAbbreviation: 'Boba BNB',
isTestnet: false,
},
{
networkName: 'Boba Avalanche',
networkAbbreviation: 'Boba Avalanche',
isTestnet: false,
},
]

export const EthereumGoerliInfo: NetworkTestInfo = {
Expand All @@ -89,11 +57,6 @@ export const TestnetL1Networks: NetworkTestInfo[] = [
networkAbbreviation: 'BNB',
isTestnet: true,
},
{
networkName: 'Fuji Testnet',
networkAbbreviation: 'AVAX',
isTestnet: true,
},
]

export const TestnetL2Networks: NetworkTestInfo[] = [
Expand All @@ -107,9 +70,4 @@ export const TestnetL2Networks: NetworkTestInfo[] = [
networkAbbreviation: 'Boba BNB',
isTestnet: true,
},
{
networkName: 'Boba Fuji Testnet',
networkAbbreviation: 'Boba Fuji',
isTestnet: true,
},
]
47 changes: 1 addition & 46 deletions cypress/e2e/helpers/base/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class Page extends Base {
cy.get('body').find('wcm-modal').should('exist')
}

setNetworkTo(network: 'BNB' | 'AVAX' | 'ETH', type = 'Mainnet') {
setNetworkTo(network: 'BNB' | 'ETH', type = 'Mainnet') {
const bnbConfig = {
network: 'BNB',
name: {
Expand All @@ -73,17 +73,6 @@ export default class Page extends Base {
networkType: type,
}

const avaxConfig = {
network: 'AVAX',
name: {
l1: 'Avalanche Mainnet C-Chain',
l2: 'Boba Avalanche',
},
networkIcon: 'avax',
chainIds: { L1: '43114', L2: '43288' },
networkType: type,
}

const ethConfig = {
network: 'ETHEREUM',
name: {
Expand All @@ -98,8 +87,6 @@ export default class Page extends Base {
let payload = ethConfig
if (network === 'BNB') {
payload = bnbConfig
} else if (network === 'AVAX') {
payload = avaxConfig
}

cy.window().its('store').invoke('dispatch', {
Expand Down Expand Up @@ -151,31 +138,6 @@ export default class Page extends Base {
})
}

checkNaviagtionListAvalanche() {
this.header
.getNavigationLinks()
.should('not.be.empty')
.and(($p) => {
// should have found 3 elements for Avalanche
expect($p).to.have.length(3)

// // use jquery's map to grab all of their classes
// // jquery's map returns a new jquery object
const links = $p.map((i, el) => {
return Cypress.$(el).attr('href')
})
// call classes.get() to make this a plain array
expect(links.get()).to.deep.eq(['/bridge', '/bridge', '/history'])

// get labels and verify
const labels = $p.map((i, el) => {
return Cypress.$(el).text()
})

expect(labels.get()).to.deep.eq(['', 'Bridge', 'History'])
})
}

checkNavigationListEthereum() {
this.header
.getNavigationLinks()
Expand Down Expand Up @@ -235,7 +197,6 @@ export default class Page extends Base {
.click()
.should('have.text', 'Ethereum (Goerli)')
.should('have.text', 'BNB Testnet')
.should('have.text', 'Fuji Testnet')
}

// check theme switching functionality
Expand Down Expand Up @@ -279,12 +240,6 @@ export default class Page extends Base {
this.allowNetworkSwitch()
this.checkNetworkSwitchSuccessful('BNB')

// switch to AVAX
this.header.switchNetwork('Avalanche Mainnet')
this.handleNetworkSwitchModals('AVAX', false)
this.allowNetworkSwitch()
this.checkNetworkSwitchSuccessful('AVAX')

// switch to Ethereum
this.header.switchNetwork('Ethereum')
this.handleNetworkSwitchModals('ETHEREUM', false)
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/helpers/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ export default class Bridge extends Page {
l2Networks: NetworkTestInfo[],
accountConnected: boolean
) {
for (let i = 0; i < 3; i++) {
for (let i = 0; i < 2; i++) {
this.withinPage().contains(l2Networks[i].networkName).should('exist')

this.openNetworkModal(l1Networks[i].networkName)
const nextNetwork = l1Networks[(i + 1) % 3]
const nextNetwork = l1Networks[(i + 1) % 2]
this.selectNetworkFromModal(nextNetwork.networkName)
if (accountConnected) {
this.handleNetworkSwitchModals(
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/specs/layout.spec.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ describe('Page Layout', () => {
page.checkNavigationListEthereum()
page.setNetworkTo('BNB')
page.checkNaviagtionListBinanace()
page.setNetworkTo('AVAX')
page.checkNaviagtionListAvalanche()
})

it('Theme switcher should work', () => {
Expand Down
91 changes: 0 additions & 91 deletions src/actions/balanceAction.js

This file was deleted.

90 changes: 90 additions & 0 deletions src/actions/balanceAction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
Varna - A Privacy-Preserving Marketplace
Varna uses Fully Homomorphic Encryption to make markets fair.
Copyright (C) 2021 Enya Inc. Palo Alto, CA
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import networkService from 'services/networkService'
import { createAction } from './createAction'

export const fetchL1LPBalance = (address: string) =>
createAction('FETCH/L1LP/BALANCE', () => networkService.L1LPBalance(address))

export const fetchL2LPBalance = (address: string) =>
createAction('FETCH/L2LP/BALANCE', () => networkService.L2LPBalance(address))

export const fetchL1LPPending = (address: string) =>
createAction('FETCH/L1LP/PENDING', () => networkService.L1LPPending(address))

export const fetchL2LPPending = (address: string) =>
createAction('FETCH/L2LP/PENDING', () => networkService.L2LPPending(address))

export const fetchL1LPLiquidity = (address: string) =>
createAction('FETCH/L1LP/LIQUIDITY', () =>
networkService.L1LPLiquidity(address)
)

export const fetchL2LPLiquidity = (address: string) =>
createAction('FETCH/L2LP/LIQUIDITY', () =>
networkService.L2LPLiquidity(address)
)

export const fetchL1TotalFeeRate = () =>
createAction('FETCH/L1TOTALFEERATE', () => {
return networkService.getL1TotalFeeRate()
})
export const fetchL2TotalFeeRate = () =>
createAction('FETCH/L2TOTALFEERATE', () => {
return networkService.getL2TotalFeeRate()
})

export const fetchL1FeeRateN = (tokenAddress: string) =>
createAction('FETCH/L1FEERATE', () => {
return networkService.getL1UserRewardFeeRate(tokenAddress)
})
export const fetchL2FeeRateN = (tokenAddress: string) =>
createAction('FETCH/L2FEERATE', () => {
return networkService.getL2UserRewardFeeRate(tokenAddress)
})

export const fetchFastExitCost = (address: string) =>
createAction('FETCH/FASTEXIT/COST', () =>
networkService.getFastExitCost(address)
)

export const fetchClassicExitCost = (address: string) =>
createAction('FETCH/CLASSICEXIT/COST', () =>
networkService.getExitCost(address)
)

export const fetchFastDepositCost = (address: string) =>
createAction('FETCH/FASTDEPOSIT/COST', () =>
networkService.getFastDepositCost(address)
)

export const fetchL1FeeBalance = () =>
createAction('FETCH/L1FEE/BALANCE', () => networkService.getL1FeeBalance())

export const fetchL2BalanceETH = () =>
createAction('FETCH/L2ETH/BALANCE', () => networkService.getL2BalanceETH())

export const fetchL2BalanceBOBA = () =>
createAction('FETCH/L2BOBA/BALANCE', () => networkService.getL2BalanceBOBA())

export const fetchExitFee = () =>
createAction('FETCH/EXITFEE', () =>
networkService.getExitFeeFromBillingContract()
)
Loading

0 comments on commit e36188e

Please sign in to comment.