Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import networkService from 'services/networkService'
import { createAction } from './createAction'

const getFarmInfoBegin = () => ({
type: 'GET_FARMINFO',
const getEarnInfoBegin = () => ({
type: 'GET_EARNINFO',
})

const getFarmInfoSuccess = (L1PoolInfo, L1UserInfo, L2PoolInfo, L2UserInfo) => ({
type: 'GET_FARMINFO_SUCCESS',
const getEarnInfoSuccess = (L1PoolInfo, L1UserInfo, L2PoolInfo, L2UserInfo) => ({
type: 'GET_EARNINFO_SUCCESS',
payload: { L1PoolInfo, L1UserInfo, L2PoolInfo, L2UserInfo }
})

Expand All @@ -47,13 +47,13 @@ const getFarmInfoSuccess = (L1PoolInfo, L1UserInfo, L2PoolInfo, L2UserInfo) => (
// payload: { totalFeeRate, userRewardFeeRate },
// })

export const getFarmInfo = () => async (dispatch) => {
dispatch(getFarmInfoBegin())
export const getEarnInfo = () => async (dispatch) => {
dispatch(getEarnInfoBegin())
const [L1LPInfo, L2LPInfo] = await Promise.all([
networkService.getL1LPInfo(),
networkService.getL2LPInfo(),
])
dispatch(getFarmInfoSuccess(
dispatch(getEarnInfoSuccess(
L1LPInfo.poolInfo,
L1LPInfo.userInfo,
L2LPInfo.poolInfo,
Expand Down
14 changes: 7 additions & 7 deletions packages/boba/gateway/src/actions/networkAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,26 @@ export function depositErc20ToL1(payload) {
return createAction('DEPOSIT_ALTL1/CREATE', () => networkService.depositErc20ToL1(payload))
}

//FARM
export function farmL1(value_Wei_String, currencyAddress) {
return createAction('FARM/CREATE', () =>
//EARN
export function earnL1(value_Wei_String, currencyAddress) {
return createAction('EARN/CREATE', () =>
networkService.approveERC20_L1LP(value_Wei_String, currencyAddress)
)
}
export function farmL2(value_Wei_String, currencyAddress) {
return createAction('FARM/CREATE', () =>
export function earnL2(value_Wei_String, currencyAddress) {
return createAction('EARN/CREATE', () =>
networkService.approveERC20_L2LP(value_Wei_String, currencyAddress)
)
}
export function getReward(currencyAddress, value_Wei_String, L1orL2Pool) {
return createAction('FARM/HARVEST', () =>
return createAction('EARN/HARVEST', () =>
networkService.getReward(currencyAddress, value_Wei_String, L1orL2Pool)
)
}

export function withdrawLiquidity(currencyAddress, value_Wei_String, L1orL2Pool) {

return createAction('FARM/WITHDRAW', () =>
return createAction('EARN/WITHDRAW', () =>
networkService.withdrawLiquidity(currencyAddress, value_Wei_String, L1orL2Pool)
)
}
Expand Down
53 changes: 0 additions & 53 deletions packages/boba/gateway/src/components/icons/FarmIcon.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { logAmount, powAmount } from 'util/amountConvert';
import { BigNumber } from 'ethers';

import { openAlert, openModal } from 'actions/uiAction';
import { getFarmInfo, updateStakeToken, updateWithdrawToken } from 'actions/farmAction';
import { getEarnInfo, updateStakeToken, updateWithdrawToken } from 'actions/earnAction';

import Button from 'components/button/Button';

Expand All @@ -16,12 +16,12 @@ import networkService from 'services/networkService'
import { getCoinImage } from 'util/coinImage';

import { Box, Typography, Fade, CircularProgress } from '@mui/material';
import * as S from "./ListFarm.styles"
import * as S from "./ListEarn.styles"
import { getAllAddresses, getReward } from 'actions/networkAction';
import Tooltip from 'components/tooltip/Tooltip';
import { HelpOutline } from '@mui/icons-material';

class ListFarm extends React.Component {
class ListEarn extends React.Component {

constructor(props) {

Expand Down Expand Up @@ -93,7 +93,7 @@ class ListFarm extends React.Component {

const { poolInfo, L1orL2Pool, balance } = this.state

const { allAddresses } = this.props.farm
const { allAddresses } = this.props.earn

this.props.dispatch(updateStakeToken({
symbol: poolInfo.symbol,
Expand All @@ -104,14 +104,14 @@ class ListFarm extends React.Component {
decimals: poolInfo.decimals
}))

this.props.dispatch(openModal('farmDepositModal'))
this.props.dispatch(openModal('EarnDepositModal'))
}

async handleWithdrawToken() {

const { poolInfo, L1orL2Pool, balance } = this.state

const { allAddresses } = this.props.farm
const { allAddresses } = this.props.earn

this.props.dispatch(updateWithdrawToken({
symbol: poolInfo.symbol,
Expand All @@ -122,7 +122,7 @@ class ListFarm extends React.Component {
decimals: poolInfo.decimals
}))

this.props.dispatch(openModal('farmWithdrawModal'))
this.props.dispatch(openModal('EarnWithdrawModal'))
}

async handleHarvest() {
Expand All @@ -146,7 +146,7 @@ class ListFarm extends React.Component {

if (getRewardTX) {
this.props.dispatch(openAlert(`${logAmount(userReward, poolInfo.decimals, 2)} ${poolInfo.symbol} was added to your account`))
this.props.dispatch(getFarmInfo())
this.props.dispatch(getEarnInfo())
this.setState({ loading: false })
} else {
this.setState({ loading: false })
Expand Down Expand Up @@ -496,7 +496,7 @@ class ListFarm extends React.Component {
}

const mapStateToProps = state => ({
farm: state.farm,
earn: state.earn,
})

export default connect(mapStateToProps)(ListFarm)
export default connect(mapStateToProps)(ListEarn)
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
import {
selectActiveNetwork,
selectActiveNetworkIcon,
selectActiveNetworkName,
selectActiveNetworkType,
} from 'selectors/networkSelector'
import * as S from './LayerSwitcher.styles.js'
Expand All @@ -56,15 +57,15 @@ import Button from 'components/button/Button.js'
import { L1_ICONS, L2_ICONS } from 'util/network/network.util.js'
import { LAYER } from 'util/constant.js'

function LayerSwitcher({ visisble = true }) {
function LayerSwitcher({ visisble = true, isButton = false }) {
const dispatch = useDispatch()
const accountEnabled = useSelector(selectAccountEnabled())
const baseEnabled = useSelector(selectBaseEnabled())

let layer = useSelector(selectLayer())
const network = useSelector(selectActiveNetwork())
const networkType = useSelector(selectActiveNetworkType())

const networkName = useSelector(selectActiveNetworkName())
const networkIcon = useSelector(selectActiveNetworkIcon())

const L1Icon = L1_ICONS[networkIcon]
Expand Down Expand Up @@ -226,6 +227,21 @@ function LayerSwitcher({ visisble = true }) {
)
}

if (isButton && layer) {
return (
<Button
type="primary"
variant="contained"
size="small"
newStyle
onClick={() => (layer === 'L1') ? dispatch(setConnectBOBA(true)) : dispatch(setConnectETH(true))}
sx={{ fontWeight: '500;' }}
>
Connect to {networkName[ layer === 'L1' ? 'l2': 'l1' ]}
</Button>
)
}

if (isMobile) {
return (
<S.LayerSwitcherWrapperMobile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import React, { useState } from 'react'
import { Typography, Fade, useMediaQuery } from '@mui/material'
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'

import * as S from './ListFarm.styles'
import * as S from './ListEarn.styles'

import { useTheme } from '@emotion/react'

Expand Down
4 changes: 3 additions & 1 deletion packages/boba/gateway/src/containers/connect/Connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const Connect = ({
<Button
type="primary"
variant="contained"
size="large"
size="small"
newStyle
onClick={() => dispatch(setConnect(true))}
sx={{fontWeight: '500;'}}
>
Expand All @@ -51,6 +52,7 @@ const Connect = ({
type="primary"
variant="contained"
size="small"
newStyle
onClick={() => dispatch(setConnectBOBA(true))}
>
Connect to Boba
Expand Down
Loading