Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add LP tokens to add liquidity form (dm) #5184

Merged
merged 54 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
456b77d
Merge pull request #5130 from balancer/release/1.140.0
garethfuller Jan 22, 2024
26bb32a
chore: Add 50BAL-50USDbC pool to base allowlist (#5136)
github-actions[bot] Jan 23, 2024
49028b5
1.140.1
gh-action-bump-version Jan 23, 2024
b4e15ea
chore: Add 50BAL-50USDbC pool to base allowlist (#5135)
github-actions[bot] Jan 23, 2024
ba5c5f6
1.140.2
gh-action-bump-version Jan 23, 2024
40e9287
chore: Add 50BALD-50USDC pool to base allowlist (#5134)
github-actions[bot] Jan 23, 2024
d701d5b
1.140.3
gh-action-bump-version Jan 23, 2024
af2a570
add stakable pools
zekraken-bot Jan 23, 2024
ac19820
Merge pull request #5138 from balancer/zekraken-bot-patch-3
Zen-Maxi Jan 23, 2024
658131d
1.140.4
gh-action-bump-version Jan 23, 2024
f858365
chore: Add 50DAI-50USDbC pool to base allowlist (#5139)
github-actions[bot] Jan 23, 2024
333a847
1.140.5
gh-action-bump-version Jan 23, 2024
0291993
chore: Add wstETH/cbETH pool to arbitrum allowlist (#5143)
github-actions[bot] Jan 24, 2024
d7d141d
1.140.6
gh-action-bump-version Jan 24, 2024
c323f98
chore: Add wstETH/sfrxETH pool to arbitrum allowlist (#5142)
github-actions[bot] Jan 24, 2024
097a31b
1.140.7
gh-action-bump-version Jan 24, 2024
9f2e91c
chore: Add B-KAI-WETH-WEIGHTED pool to ethereum allowlist (#5141)
github-actions[bot] Jan 24, 2024
7e4eda5
1.140.8
gh-action-bump-version Jan 24, 2024
27b33d7
chore: Add 50BAL-50USDC pool to base allowlist (#5137)
github-actions[bot] Jan 24, 2024
5092d54
1.140.9
gh-action-bump-version Jan 24, 2024
1d4763b
chore: Add rsETH / ETHx pool to ethereum allowlist (#5144)
github-actions[bot] Jan 24, 2024
6664e63
1.140.10
gh-action-bump-version Jan 24, 2024
125a4c8
Added 80SYNO-20WETH pool to allowlist (#5148)
krzysztof-cywinski Jan 24, 2024
43c6471
1.140.11
gh-action-bump-version Jan 24, 2024
7b48aa7
chore: Add B-kaiAURA-AURA-WEIGHTED pool to ethereum allowlist (#5149)
github-actions[bot] Jan 26, 2024
0d0fa75
1.140.12
gh-action-bump-version Jan 26, 2024
9e22807
chore: Add 50WETH-50USDbC pool to base allowlist (#5151)
github-actions[bot] Jan 26, 2024
cda6e26
1.140.13
gh-action-bump-version Jan 26, 2024
1650706
chore: Add 15WMATIC-15oRETRO-20SP-30STARV3-20STARV3-M/V-EV3.1/StarSee…
github-actions[bot] Jan 26, 2024
f977e40
1.140.14
gh-action-bump-version Jan 26, 2024
cbf10bb
chore: Add 50USDT-50WXDAI pool to gnosis-chain allowlist (#5155)
github-actions[bot] Jan 26, 2024
88b2767
1.140.15
gh-action-bump-version Jan 26, 2024
8210093
chore: Add 50WETH-50USDbC pool to base allowlist (#5154)
github-actions[bot] Jan 26, 2024
fa185cb
1.140.16
gh-action-bump-version Jan 26, 2024
bd99deb
chore: Add 50BAL-50USDbC pool to base allowlist (#5150)
github-actions[bot] Jan 26, 2024
6754e51
1.140.17
gh-action-bump-version Jan 26, 2024
73624fc
chore: Add 15WMATIC-20SP-15WETH-30STARV3-20STARV3-M/V-EV3.1/StarSeeds…
github-actions[bot] Jan 26, 2024
5c4e982
1.140.18
gh-action-bump-version Jan 26, 2024
c4b70d5
chore: Add 15WMATIC-15WBTC-20SP-30STARV3-20STARV3-M/V-EV3.1/StarSeeds…
github-actions[bot] Jan 26, 2024
30fa9e9
1.140.19
gh-action-bump-version Jan 26, 2024
5f9f91f
chore: Add 10WMATIC-20WBTC-10USDC-60STARV3-M/V-C8/StarSeeds_Protocol …
github-actions[bot] Jan 26, 2024
518daae
1.140.20
gh-action-bump-version Jan 26, 2024
5157e86
chore: Add 50WETH-50USDbC pool to base allowlist (#5152)
github-actions[bot] Jan 26, 2024
a763cc2
1.140.21
gh-action-bump-version Jan 26, 2024
726b1ec
chore: Add 50WETH-50USDbC pool to base allowlist (#5153)
github-actions[bot] Jan 26, 2024
092ad25
1.140.22
gh-action-bump-version Jan 26, 2024
f47e28b
chore: Add branded redirects for gyro pools on ARB (#5163)
garethfuller Jan 26, 2024
51a4e40
1.140.23
gh-action-bump-version Jan 26, 2024
e51ca90
chore: init (#5133)
garethfuller Jan 26, 2024
383f98e
1.140.24
gh-action-bump-version Jan 26, 2024
59da1e5
chore: Add vETH/wstETH pool to ethereum allowlist (#5170)
github-actions[bot] Jan 28, 2024
a3d2b50
1.140.25
gh-action-bump-version Jan 28, 2024
a2a3a5e
chore: Init
garethfuller Jan 29, 2024
5f6c191
Merge branch 'develop' into feat/add-lp-tokens-add-liquidity
garethfuller Jan 31, 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import StakePreviewModal from '@/components/contextual/pages/pool/staking/StakeP
import TokenInput from '@/components/inputs/TokenInput/TokenInput.vue';
import { tokenWeight, usePoolHelpers } from '@/composables/usePoolHelpers';
import { LOW_LIQUIDITY_THRESHOLD } from '@/constants/poolLiquidity';
import { bnum, includesAddress, isSameAddress } from '@/lib/utils';
import { bnum, includesAddress } from '@/lib/utils';
import { isRequired } from '@/lib/utils/validations';
import { Pool } from '@/services/pool/types';
import useWeb3 from '@/services/web3/useWeb3';
Expand All @@ -15,11 +15,9 @@ import useVeBal from '@/composables/useVeBAL';
import AddLiquidityPreview from './components/AddLiquidityPreview/AddLiquidityPreview.vue';
import AddLiquidityTotals from './components/AddLiquidityTotals.vue';

import MissingPoolTokensAlert from './components/MissingPoolTokensAlert.vue';
import { useTokens } from '@/providers/tokens.provider';
import { isEqual } from 'lodash';
import { useJoinPool } from '@/providers/local/join-pool.provider';
import { useUserTokens } from '@/providers/local/user-tokens.provider';

/**
* TYPES
Expand All @@ -42,12 +40,9 @@ const showStakeModal = ref(false);
/**
* COMPOSABLES
*/
const {
managedPoolWithSwappingHalted,
isDeepPool,
isPreMintedBptPool,
poolJoinTokens,
} = usePoolHelpers(toRef(props, 'pool'));
const { managedPoolWithSwappingHalted, poolJoinTokens } = usePoolHelpers(
toRef(props, 'pool')
);
const { veBalTokenInfo } = useVeBal();
const { isWalletReady, startConnectWithInjectedProvider, isMismatchedNetwork } =
useWeb3();
Expand All @@ -64,8 +59,6 @@ const {
setTokensIn,
} = useJoinPool();

const { tokensWithBalance } = useUserTokens();

/**
* COMPUTED
*/
Expand All @@ -85,28 +78,14 @@ const excludedTokens = computed((): string[] => {
return tokens;
});

const joinTokensWithBalance = computed<string[]>(() =>
poolJoinTokens.value.filter(
address =>
includesAddress(tokensWithBalance.value, address) ||
isSameAddress(address, wrappedNativeAsset.value.address)
)
);

const joinTokensWithoutBalance = computed<string[]>(() =>
poolJoinTokens.value.filter(
address => !includesAddress(tokensWithBalance.value, address)
)
);

async function initializeTokensForm(isSingleAssetJoin: boolean) {
if (isSingleAssetJoin) {
// Single asset joins are only relevant for Composable pools where swap
// joins are possible. In this case we want to default to the wrapped native
// asset.
setTokensIn([wrappedNativeAsset.value.address]);
} else {
setTokensIn(joinTokensWithBalance.value);
setTokensIn(poolJoinTokens.value);
}
}

Expand Down Expand Up @@ -150,19 +129,13 @@ onBeforeMount(() => {
* WATCHERS
*/
watch(
[isSingleAssetJoin, joinTokensWithBalance],
(
[isSingleAsset, newJoinTokensWithBalance],
[prevIsSingleAsset, prevJoinTokensWithBalance]
) => {
[isSingleAssetJoin, poolJoinTokens],
([isSingleAsset, newJoinTokens], [prevIsSingleAsset, prevJoinToken]) => {
// Initialize token form if token balances change (ie. After investing, transaction confirmed or when account changes)
// only if preview modal is not open
if (!showPreview.value) {
const hasTabChanged = prevIsSingleAsset !== isSingleAsset;
const hasUserTokensChanged = !isEqual(
prevJoinTokensWithBalance,
newJoinTokensWithBalance
);
const hasUserTokensChanged = !isEqual(prevJoinToken, newJoinTokens);
if (hasUserTokensChanged || hasTabChanged) {
initializeTokensForm(isSingleAsset);
}
Expand Down Expand Up @@ -207,13 +180,6 @@ watch(
@update:address="onTokenChange"
/>

<MissingPoolTokensAlert
v-if="!isSingleAssetJoin"
:showSingleTokenSuggestion="isDeepPool && isPreMintedBptPool"
:poolTokensWithBalance="joinTokensWithBalance"
:poolTokensWithoutBalance="joinTokensWithoutBalance"
/>

<AddLiquidityTotals :pool="pool" />

<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useJoinPool } from '@/providers/local/join-pool.provider';
import { Pool } from '@/services/pool/types';
import useWeb3 from '@/services/web3/useWeb3';
import { useAddLiquidityTotals } from '../composables/useAddLiquidityTotals';
import { useUserSettings } from '@/providers/user-settings.provider';

type Props = {
pool: Pool;
Expand All @@ -17,13 +18,15 @@ const props = defineProps<Props>();
*/
const { fNum } = useNumbers();
const { isWalletReady } = useWeb3();
const { slippage } = useUserSettings();

const {
highPriceImpact,
isLoadingQuery,
priceImpact,
supportsProportionalOptimization,
fiatValueIn,
bptOut,
} = useJoinPool();

const {
Expand Down Expand Up @@ -60,7 +63,31 @@ const {
</div>
</div>
</div>
<div :class="['data-table-row price-impact-row', priceImpactClasses]">
<div :class="['data-table-row secondary-row']">
<div class="p-2">LP tokens</div>
<div class="data-table-number-col">
<div class="flex">
<span v-if="!isLoadingQuery">
{{ fNum(bptOut, FNumFormats.token) }}
</span>
<BalLoadingBlock v-else class="w-10" />

<BalTooltip
:text="`LP tokens you are expected to recieve, not
including possible slippage (${fNum(slippage, FNumFormats.percent)})`"
>
<template #activator>
<BalIcon
name="info"
size="xs"
class="-mb-px ml-1 text-gray-400"
/>
</template>
</BalTooltip>
</div>
</div>
</div>
<div :class="['data-table-row secondary-row', priceImpactClasses]">
<div class="p-2">
{{ $t('priceImpact') }}
</div>
Expand Down Expand Up @@ -134,7 +161,7 @@ const {
@apply text-lg font-bold dark:bg-gray-800;
}

.price-impact-row {
.secondary-row {
@apply text-sm rounded-b-lg;
}
</style>
Loading