Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Feat/cross chain sync2 #1151

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
48d3e2f
feat: add backbone of crosschain sync
alter-eggo Aug 20, 2024
6f2a631
feat: add more logic for cross-chain sync
alter-eggo Aug 21, 2024
b7d67eb
Merge branch 'main' into feat/cross-chain-sync
alter-eggo Aug 25, 2024
db30fa0
feat: new abi (OmniVotingEscrowAbi) and new abi options
alter-eggo Sep 6, 2024
9b67b21
feat: mock managed transactions with mocked txHash (dev only)
alter-eggo Sep 6, 2024
8ac9463
chore: fix typo
alter-eggo Sep 6, 2024
0b13931
feat: add renderContent in TransactionStep
alter-eggo Sep 6, 2024
cafc7a6
feat: CrossChainBoost with sync methods (draft)
alter-eggo Sep 6, 2024
1410b18
Merge branch 'main' into feat/cross-chain-sync
alter-eggo Sep 6, 2024
f9e1470
fix: ts errors
alter-eggo Sep 6, 2024
40ba985
chore: isConnected check
alter-eggo Sep 6, 2024
c907955
chore(env): NEXT_PUBLIC_ALLOW_SKIP_TRANSACTION for transactions skipping
alter-eggo Sep 11, 2024
43b2527
refactor: useLocalStorage instead of localStorage
alter-eggo Sep 11, 2024
abcd3df
refactor: types fixes
alter-eggo Sep 11, 2024
2ca232f
Merge branch 'main' into feat/cross-chain-sync
alter-eggo Sep 23, 2024
9e1eb45
refactor: boosts enabled
alter-eggo Sep 26, 2024
f7d9335
Merge branch 'main' of github.com:balancer/frontend-v3 into feat/cros…
alter-eggo Oct 1, 2024
fb93aab
refactor: cross chain sync hook
alter-eggo Oct 1, 2024
6339e04
fix: build
alter-eggo Oct 2, 2024
e654b44
fix: test
alter-eggo Oct 2, 2024
4d332dd
refactor: mock tx
alter-eggo Oct 3, 2024
76a0495
fix: remove mock tx in erc20 and send tx
alter-eggo Oct 3, 2024
78e5b3f
Merge branch 'main' of github.com:balancer/frontend-v3 into feat/cros…
alter-eggo Oct 3, 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
3 changes: 2 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ PRIVATE_CURRENCYAPI_KEY=xxx
# For integration tests and rpc proxy routes (optional)
NEXT_PRIVATE_DRPC_KEY=xxx


# Allow skip transaction (optional)
NEXT_PUBLIC_ALLOW_SKIP_TRANSACTION=true
9 changes: 8 additions & 1 deletion app/(app)/vebal/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { TokenBalancesProvider } from '@/lib/modules/tokens/TokenBalancesProvide
import { useTokens } from '@/lib/modules/tokens/TokensProvider'
import { DefaultPageContainer } from '@/lib/shared/components/containers/DefaultPageContainer'
import mainnetNetworkConfig from '@/lib/config/networks/mainnet'

import { TransactionStateProvider } from '@/lib/modules/transactions/transaction-steps/TransactionStateProvider'
import { PropsWithChildren } from 'react'
import { CrossChainSyncProvider } from '@/lib/modules/vebal/cross-chain/hooks/useCrossChainSync'

export default function VebalLayout({ children }: PropsWithChildren) {
const { getTokensByChain } = useTokens()
Expand All @@ -19,7 +22,11 @@ export default function VebalLayout({ children }: PropsWithChildren) {

return (
<TokenBalancesProvider initTokens={[vebalBptToken]}>
<DefaultPageContainer minH="100vh">{children}</DefaultPageContainer>
<CrossChainSyncProvider>
<TransactionStateProvider>
<DefaultPageContainer minH="100vh">{children}</DefaultPageContainer>
</TransactionStateProvider>
</CrossChainSyncProvider>
</TokenBalancesProvider>
)
}
2 changes: 2 additions & 0 deletions app/(app)/vebal/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import { VebalInfo } from '@/lib/modules/vebal/VebalInfo'
import { Stack } from '@chakra-ui/react'
import { CrossChainBoost } from '@/lib/modules/vebal/cross-chain/CrossChainBoost'

export default function VebalPage() {
return (
<Stack gap="lg">
<VebalInfo />
<CrossChainBoost />
</Stack>
)
}
2 changes: 2 additions & 0 deletions lib/config/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const isDev = process.env.NEXT_PUBLIC_APP_ENV === 'dev'
export const isProd = process.env.NEXT_PUBLIC_APP_ENV === 'prod'
export const isStaging = process.env.NEXT_PUBLIC_APP_ENV === 'staging'

export const allowSkipTransaction = process.env.NEXT_PUBLIC_ALLOW_SKIP_TRANSACTION === 'true'

const networksByChainId = keyBy(config.networks, 'chainId')

/**
Expand Down
5 changes: 5 additions & 0 deletions lib/config/config.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ export interface ContractsConfig {
veDelegationProxy?: Address
veBAL?: Address
permit2?: Address
omniVotingEscrow?: Address
gaugeWorkingBalanceHelper?: Address
}
export interface PoolsConfig {
issues: Partial<Record<PoolIssue, string[]>>
allowNestedActions?: string[] // pool ids
boostsEnabled?: boolean
}

export interface BlockExplorerConfig {
Expand All @@ -69,6 +72,8 @@ export interface NetworkConfig {
contracts: ContractsConfig
minConfirmations?: number
pools: PoolsConfig
layerZeroChainId?: number
supportsVeBalSync?: boolean
}

export interface Config {
Expand Down
3 changes: 3 additions & 0 deletions lib/config/networks/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ const networkConfig: NetworkConfig = {
],
[PoolIssue.CspPoolVulnWarning]: CSP_ISSUE_POOL_IDS[GqlChain.Arbitrum],
},
boostsEnabled: true,
}),
layerZeroChainId: 110,
supportsVeBalSync: true,
}

export default networkConfig
3 changes: 3 additions & 0 deletions lib/config/networks/avalanche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ const networkConfig: NetworkConfig = {
'0xad0e5e0778cac28f1ff459602b31351871b5754a000200000000000000000029',
],
},
boostsEnabled: true,
}),
layerZeroChainId: 106,
supportsVeBalSync: true,
}

export default networkConfig
4 changes: 3 additions & 1 deletion lib/config/networks/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ const networkConfig: NetworkConfig = {
},
veDelegationProxy: '0xD87F44Df0159DC78029AB9CA7D7e57E7249F5ACD',
},
pools: convertHexToLowerCase({ issues: {} }),
pools: convertHexToLowerCase({ issues: {}, boostsEnabled: true }),
layerZeroChainId: 184,
supportsVeBalSync: true,
}

export default networkConfig
3 changes: 3 additions & 0 deletions lib/config/networks/fraxtal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ const networkConfig: NetworkConfig = {
issues: {
[PoolIssue.CspPoolVulnWarning]: CSP_ISSUE_POOL_IDS[GqlChain.Fraxtal],
},
boostsEnabled: true,
}),
layerZeroChainId: 255,
supportsVeBalSync: true,
}

export default networkConfig
3 changes: 3 additions & 0 deletions lib/config/networks/gnosis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ const networkConfig: NetworkConfig = {
pools: convertHexToLowerCase({
issues: { [PoolIssue.CspPoolVulnWarning]: CSP_ISSUE_POOL_IDS[GqlChain.Gnosis] },
allowNestedActions: ['0x66888e4f35063ad8bb11506a6fde5024fb4f1db0000100000000000000000053'],
boostsEnabled: true,
}),
layerZeroChainId: 145,
supportsVeBalSync: true,
}

export default networkConfig
4 changes: 3 additions & 1 deletion lib/config/networks/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NetworkConfig } from '../config.types'
import { CSP_ISSUE_POOL_IDS } from '../../shared/data/csp-issue'
import { SupportedWrapHandler } from '@/lib/modules/swap/swap.types'

const networkConfig = {
const networkConfig: NetworkConfig = {
chainId: 1,
name: 'Ethereum Mainnet',
shortName: 'Ethereum',
Expand Down Expand Up @@ -80,6 +80,7 @@ const networkConfig = {
feeDistributor: '0xD3cf852898b21fc233251427c2DC93d3d604F3BB',
veDelegationProxy: '0x6f5a2eE11E7a772AeB5114A20d0D7c0ff61EB8A0',
veBAL: '0xC128a9954e6c874eA3d62ce62B468bA073093F25',
omniVotingEscrow: '0x96484f2aBF5e58b15176dbF1A799627B53F13B6d',
},

pools: convertHexToLowerCase({
Expand Down Expand Up @@ -126,6 +127,7 @@ const networkConfig = {
allowNestedActions: [
'0x08775ccb6674d6bdceb0797c364c2653ed84f3840002000000000000000004f0', // B-80BAL-20WETH
],
boostsEnabled: true,
}),
} as const satisfies NetworkConfig

Expand Down
3 changes: 3 additions & 0 deletions lib/config/networks/mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ const networkConfig: NetworkConfig = {
issues: {
[PoolIssue.CspPoolVulnWarning]: CSP_ISSUE_POOL_IDS[GqlChain.Mode],
},
boostsEnabled: true,
}),
layerZeroChainId: 260,
supportsVeBalSync: true,
}

export default networkConfig
3 changes: 3 additions & 0 deletions lib/config/networks/optimism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ const networkConfig: NetworkConfig = {
issues: {
[PoolIssue.CspPoolVulnWarning]: CSP_ISSUE_POOL_IDS[GqlChain.Optimism],
},
boostsEnabled: true,
}),
layerZeroChainId: 111,
supportsVeBalSync: true,
}

export default networkConfig
3 changes: 3 additions & 0 deletions lib/config/networks/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ const networkConfig: NetworkConfig = {
'0xfd24afa5416c8de94fdbaf344840f524155a4dd00002000000000000000008db',
],
},
boostsEnabled: true,
}),
layerZeroChainId: 109,
supportsVeBalSync: true,
}

export default networkConfig
2 changes: 2 additions & 0 deletions lib/config/networks/sepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const networkConfig: NetworkConfig = {
},
pools: convertHexToLowerCase({
issues: {},
boostsEnabled: true,
}),
layerZeroChainId: 10161,
}

export default networkConfig
2 changes: 2 additions & 0 deletions lib/config/networks/zkevm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const networkConfig: NetworkConfig = {
pools: convertHexToLowerCase({
issues: { [PoolIssue.CspPoolVulnWarning]: CSP_ISSUE_POOL_IDS[GqlChain.Zkevm] },
}),
layerZeroChainId: 158,
supportsVeBalSync: true,
}

export default networkConfig
4 changes: 4 additions & 0 deletions lib/modules/local-storage/local-storage.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ export const LS_KEYS = {
AcceptedPolicies: 'userSettings.AcceptedPolicies',
AllowSounds: 'userSettings.AllowSounds',
},
CrossChainSync: {
TempSyncingNetworks: 'сrossChainSync.tempSyncingNetworks',
SyncTxHashes: 'сrossChainSync.syncTxHashes',
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { BalAlert } from '@/lib/shared/components/alerts/BalAlert'
import { StakingOptions } from './StakingOptions'
import { isVebalPool } from '../../../pool.helpers'
import { VebalRedirectModal } from '@/lib/modules/vebal/VebalRedirectModal'
import { AnimateHeightChange } from '@/lib/shared/components/modals/AnimatedModalBody'
import { AnimatedModalBody } from '@/lib/shared/components/modals/AnimatedModalBody'
import { CardPopAnim } from '@/lib/shared/components/animations/CardPopAnim'
import { useMemo } from 'react'

Expand Down Expand Up @@ -70,7 +70,7 @@ export function AddLiquiditySummary({
}

return (
<AnimateHeightChange spacing="sm">
<AnimatedModalBody spacing="sm">
{isMobile && hasQuoteContext && (
<MobileStepTracker chain={pool.chain} transactionSteps={transactionSteps} />
)}
Expand Down Expand Up @@ -131,6 +131,6 @@ export function AddLiquiditySummary({
</Card>
</CardPopAnim>
) : null}
</AnimateHeightChange>
</AnimatedModalBody>
)
}
6 changes: 3 additions & 3 deletions lib/modules/pool/actions/claim/ClaimModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { useEffect, useMemo, useState } from 'react'
import { GqlChain } from '@/lib/shared/services/api/generated/graphql'
import { useResetStepIndexOnOpen } from '../useResetStepIndexOnOpen'
import { useRouter } from 'next/navigation'
import { AnimateHeightChange } from '@/lib/shared/components/modals/AnimatedModalBody'
import { AnimatedModalBody } from '@/lib/shared/components/modals/AnimatedModalBody'

type Props = {
isOpen: boolean
Expand Down Expand Up @@ -87,7 +87,7 @@ export function ClaimModal({
<TransactionModalHeader label="Claim incentives" txHash={claimTxHash} chain={chain} />
<ModalCloseButton />
<ModalBody>
<AnimateHeightChange spacing="sm">
<AnimatedModalBody spacing="sm">
{isMobile && <MobileStepTracker transactionSteps={transactionSteps} chain={chain} />}
{isLoading ? (
<Text>Loading data...</Text>
Expand All @@ -103,7 +103,7 @@ export function ClaimModal({
/>
</Card>
)}
</AnimateHeightChange>
</AnimatedModalBody>
</ModalBody>

<ActionModalFooter
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/pool/actions/migrateStake/MigrateStakeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { TransactionModalHeader } from '@/lib/shared/components/modals/Transacti
import { ActionModalFooter } from '@/lib/shared/components/modals/ActionModalFooter'
import { usePoolRedirect } from '../../pool.hooks'
import { useResetStepIndexOnOpen } from '../useResetStepIndexOnOpen'
import { AnimateHeightChange } from '@/lib/shared/components/modals/AnimatedModalBody'
import { AnimatedModalBody } from '@/lib/shared/components/modals/AnimatedModalBody'

type Props = {
isOpen: boolean
Expand Down Expand Up @@ -60,12 +60,12 @@ export function MigrateStakeModal({
/>
<ModalCloseButton />
<ModalBody>
<AnimateHeightChange spacing="sm" w="full">
<AnimatedModalBody spacing="sm" w="full">
{isMobile && (
<MobileStepTracker chain={pool.chain} transactionSteps={transactionSteps} />
)}
<MigrateStakePreview />
</AnimateHeightChange>
</AnimatedModalBody>
</ModalBody>
<ActionModalFooter
isSuccess={!!restakeTxHash}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { parseUnits } from 'viem'
import { BptRow } from '@/lib/modules/tokens/TokenRow/BptRow'
import { TokenRowGroup } from '@/lib/modules/tokens/TokenRow/TokenRowGroup'
import { bn } from '@/lib/shared/utils/numbers'
import { AnimateHeightChange } from '@/lib/shared/components/modals/AnimatedModalBody'
import { AnimatedModalBody } from '@/lib/shared/components/modals/AnimatedModalBody'
import { useUserAccount } from '@/lib/modules/web3/UserAccountProvider'
import { RemoveLiquidityReceiptResult } from '@/lib/modules/transactions/transaction-steps/receipts/receipt.hooks'
import { BalAlert } from '@/lib/shared/components/alerts/BalAlert'
Expand Down Expand Up @@ -58,7 +58,7 @@ export function RemoveLiquiditySummary({
}

return (
<AnimateHeightChange spacing="sm">
<AnimatedModalBody spacing="sm">
{isMobile && hasQuoteContext && (
<MobileStepTracker transactionSteps={transactionSteps} chain={pool.chain} />
)}
Expand Down Expand Up @@ -96,6 +96,6 @@ export function RemoveLiquiditySummary({
</Card>
</CardPopAnim>
)}
</AnimateHeightChange>
</AnimatedModalBody>
)
}
6 changes: 3 additions & 3 deletions lib/modules/pool/actions/stake/StakeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ActionModalFooter } from '@/lib/shared/components/modals/ActionModalFoo
import { TransactionModalHeader } from '@/lib/shared/components/modals/TransactionModalHeader'
import { usePoolRedirect } from '../../pool.hooks'
import { useResetStepIndexOnOpen } from '../useResetStepIndexOnOpen'
import { AnimateHeightChange } from '@/lib/shared/components/modals/AnimatedModalBody'
import { AnimatedModalBody } from '@/lib/shared/components/modals/AnimatedModalBody'

type Props = {
isOpen: boolean
Expand Down Expand Up @@ -56,12 +56,12 @@ export function StakeModal({
<TransactionModalHeader label="Stake LP tokens" txHash={stakeTxHash} chain={pool.chain} />
<ModalCloseButton />
<ModalBody>
<AnimateHeightChange spacing="sm">
<AnimatedModalBody spacing="sm">
{isMobile && (
<MobileStepTracker chain={pool.chain} transactionSteps={transactionSteps} />
)}
<StakePreview />
</AnimateHeightChange>
</AnimatedModalBody>
</ModalBody>
<ActionModalFooter
isSuccess={!!stakeTxHash}
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/pool/actions/unstake/UnstakeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { TransactionModalHeader } from '@/lib/shared/components/modals/Transacti
import { ActionModalFooter } from '@/lib/shared/components/modals/ActionModalFooter'
import { usePoolRedirect } from '../../pool.hooks'
import { useResetStepIndexOnOpen } from '../useResetStepIndexOnOpen'
import { AnimateHeightChange } from '@/lib/shared/components/modals/AnimatedModalBody'
import { AnimatedModalBody } from '@/lib/shared/components/modals/AnimatedModalBody'

type Props = {
isOpen: boolean
Expand Down Expand Up @@ -60,12 +60,12 @@ export function UnstakeModal({
/>
<ModalCloseButton />
<ModalBody>
<AnimateHeightChange spacing="sm" w="full">
<AnimatedModalBody spacing="sm" w="full">
{isMobile && (
<MobileStepTracker chain={pool.chain} transactionSteps={transactionSteps} />
)}
<UnstakePreview />
</AnimateHeightChange>
</AnimatedModalBody>
</ModalBody>
<ActionModalFooter
isSuccess={!!unstakeTxHash}
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/swap/modal/SwapSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useUserAccount } from '../../web3/UserAccountProvider'
import { BalAlert } from '@/lib/shared/components/alerts/BalAlert'
import { HumanAmount } from '@balancer/sdk'
import { slippageDiffLabel } from '@/lib/shared/utils/slippage'
import { AnimateHeightChange } from '@/lib/shared/components/modals/AnimatedModalBody'
import { AnimatedModalBody } from '@/lib/shared/components/modals/AnimatedModalBody'
import { CardPopAnim } from '@/lib/shared/components/animations/CardPopAnim'

export function SwapSummary({
Expand Down Expand Up @@ -62,7 +62,7 @@ export function SwapSummary({
}

return (
<AnimateHeightChange spacing="sm" w="full">
<AnimatedModalBody spacing="sm" w="full">
{isMobile && <MobileStepTracker transactionSteps={transactionSteps} chain={selectedChain} />}

<Card variant="modalSubSection">
Expand Down Expand Up @@ -107,6 +107,6 @@ export function SwapSummary({
</CardPopAnim>
</>
)}
</AnimateHeightChange>
</AnimatedModalBody>
)
}
Loading
Loading