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

Merge latest master into develop #3766

Merged
merged 64 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
7ab0b97
Merge pull request #3714 from balancer/release/1.114.0
garethfuller Jul 17, 2023
8e4773e
fix: Original error recording (#3713)
garethfuller Jul 17, 2023
1fc5d3e
1.114.1
gh-action-bump-version Jul 17, 2023
88b672a
Hotfix: idle/usdc whitelist (#3717)
zekraken-bot Jul 17, 2023
4fdce10
1.114.2
gh-action-bump-version Jul 17, 2023
fed60c1
weekly gauges add (#3722)
zekraken-bot Jul 17, 2023
a05b7c8
1.114.3
gh-action-bump-version Jul 17, 2023
7f0a4fa
chore: Bump SDK version (#3724)
garethfuller Jul 17, 2023
62c68ec
1.114.4
gh-action-bump-version Jul 17, 2023
6c2c341
Hotfix: Add approval check to swap (#3712)
timjrobinson Jul 18, 2023
d46a3a1
1.114.5
gh-action-bump-version Jul 18, 2023
26be39d
hotfix: Extending Error for sentry (#3720)
garethfuller Jul 18, 2023
ce9f80c
1.114.6
gh-action-bump-version Jul 18, 2023
5872b4f
hotfix: Bump WC modal package (#3698)
garethfuller Jul 18, 2023
798938d
1.114.7
gh-action-bump-version Jul 18, 2023
b8b6ced
Hotfix: Re-trigger exit queries on wallet change (#3718)
garethfuller Jul 18, 2023
d070fc2
1.114.8
gh-action-bump-version Jul 18, 2023
9de0f15
hotfix: Add metadata to cowswap errors (#3727)
danielmkm Jul 18, 2023
cdbc4fc
1.114.9
gh-action-bump-version Jul 18, 2023
0130538
hotfix: Add metadata action as tag (#3728)
danielmkm Jul 18, 2023
bf087ff
1.114.10
gh-action-bump-version Jul 18, 2023
4a8d3cf
Adding 80RATE/20WETH pool to weighted allowlist (#3729)
oddaf Jul 18, 2023
0b45ee5
1.114.11
gh-action-bump-version Jul 18, 2023
d571e24
hotfix: Send original error to capture (#3736)
garethfuller Jul 18, 2023
7ce21e5
1.114.12
gh-action-bump-version Jul 18, 2023
8788934
hotfix: Bump SDK (#3738)
garethfuller Jul 18, 2023
07fb0da
1.114.13
gh-action-bump-version Jul 18, 2023
96fedf8
hotfix: zkevm voting gauges (#3739)
mendesfabio Jul 18, 2023
8a1a320
1.114.14
gh-action-bump-version Jul 18, 2023
1f352c1
hotfix: use stack instead of captureStackTrace (#3743)
agualis Jul 18, 2023
547f0b2
1.114.15
gh-action-bump-version Jul 18, 2023
f078223
Change BumpTag Personal Access Token
timjrobinson Jul 19, 2023
c58637c
Merge pull request #3746 from balancer/hotfix/change-bumptag-pat
timjrobinson Jul 19, 2023
d27e3f9
1.114.16
gh-action-bump-version Jul 19, 2023
ba0ab94
Fix: single token exit only allows pool tokens subset when the pool i…
agualis Jul 19, 2023
c915463
1.114.17
gh-action-bump-version Jul 19, 2023
7ae16ec
Undo last master commit
agualis Jul 19, 2023
236ee2b
1.114.18
gh-action-bump-version Jul 19, 2023
dd6630c
hotfix: Don't query exit if invalid amounts out (#3742)
garethfuller Jul 19, 2023
88572cd
1.114.19
gh-action-bump-version Jul 19, 2023
80bbe16
hotfix: single token exit only allows pool tokens subset when the poo…
agualis Jul 19, 2023
a87887e
1.114.20
gh-action-bump-version Jul 19, 2023
ebef421
fix: Block withdraw page access if no BPT
garethfuller Jul 19, 2023
3d8c27d
Hotfix: Improve user rejected check (#3753)
garethfuller Jul 19, 2023
868e728
1.114.21
gh-action-bump-version Jul 19, 2023
0bebc83
chore: Ignore user rpc issues
garethfuller Jul 19, 2023
15c1988
Hotfix: Update pools.ts (#3756)
FireBotDev Jul 19, 2023
62a8a28
1.114.22
gh-action-bump-version Jul 19, 2023
efaeedb
Update SDK to fix fetchPools errors
timjrobinson Jul 20, 2023
98db73f
Merge pull request #3759 from balancer/hotfix/update-sdk
timjrobinson Jul 20, 2023
a29eb4a
1.114.23
gh-action-bump-version Jul 20, 2023
8c68f80
remove bnum parse, creates an issue with small number 1e-7 or smaller
danielmkm Jul 20, 2023
d125f64
Merge pull request #3762 from balancer/hf/oldbnum-decimal-issue
timjrobinson Jul 20, 2023
cefee87
1.114.24
gh-action-bump-version Jul 20, 2023
c932585
Merge pull request #3752 from balancer/hf/ensure-no-withdraw-access-w…
timjrobinson Jul 20, 2023
b4edc2e
1.114.25
gh-action-bump-version Jul 20, 2023
ea237b0
Merge pull request #3755 from balancer/hf/ignore-user-rpc-issues
timjrobinson Jul 20, 2023
c972790
1.114.26
gh-action-bump-version Jul 20, 2023
24f517e
Add more checks for user errors
timjrobinson Jul 20, 2023
051b2b5
add dusd to whitelist (#3758)
zekraken-bot Jul 20, 2023
54b02c9
1.114.27
gh-action-bump-version Jul 20, 2023
bb3acf3
Merge pull request #3764 from balancer/hotfix/ignore-more-user-errors
timjrobinson Jul 20, 2023
2f9f028
1.114.28
gh-action-bump-version Jul 20, 2023
1212d94
Merge remote-tracking branch 'origin/master' into merge-master
timjrobinson Jul 20, 2023
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
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@balancer/frontend-v2",
"version": "1.114.20",
"version": "1.114.28",
"engines": {
"node": "=16",
"npm": ">=8"
Expand Down Expand Up @@ -42,7 +42,7 @@
"devDependencies": {
"@aave/protocol-js": "^4.3.0",
"@balancer-labs/assets": "github:balancer-labs/assets#master",
"@balancer-labs/sdk": "^1.1.3-beta.13",
"@balancer-labs/sdk": "^1.1.3-beta.14",
"@balancer-labs/typechain": "^1.0.0",
"@balancer-labs/v2-deployments": "^3.2.0",
"@cowprotocol/contracts": "^1.3.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/contextual/pages/claim/LegacyClaims.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ async function claimAvailableRewards() {
});

txListener(tx, {
onTxConfirmed: () => {
onTxConfirmed: async () => {
isClaiming.value = false;
userClaimsQuery.refetch();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async function handleTransaction(
});

txListener(tx, {
onTxConfirmed: () => {
onTxConfirmed: async () => {
setSyncTxHashes(network, tx.hash);
},
onTxFailed: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from '@/composables/usePoolHelpers';
import { useI18n } from 'vue-i18n';
import { Pool } from '@/services/pool/types';
import useNetwork from '@/composables/useNetwork';

type Props = {
pool: Pool;
Expand All @@ -37,7 +38,8 @@ const showPreview = ref(false);
const { t } = useI18n();
const { veBalTokenInfo } = useVeBal();
const { wrappedNativeAsset, nativeAsset } = useTokens();

const router = useRouter();
const { networkSlug } = useNetwork();
const { isWalletReady, startConnectWithInjectedProvider, isMismatchedNetwork } =
useWeb3();
const {
Expand All @@ -52,6 +54,7 @@ const {
hasAcceptedHighPriceImpact,
hasAmountsOut,
validAmounts,
hasBpt,
} = useExitPool();

const { isWrappedNativeAssetPool } = usePoolHelpers(pool);
Expand Down Expand Up @@ -90,6 +93,10 @@ const excludedTokens = computed((): string[] => {
* CALLBACKS
*/
onBeforeMount(() => {
// If user has no BPT when mounting this component, redirect back to pool page
if (!hasBpt.value)
router.push({ name: 'pool', params: { networkSlug, id: props.pool.id } });

singleAmountOut.address = isPreMintedBptType(pool.value.poolType)
? wrappedNativeAsset.value.address
: pool.value.tokensList[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const withdrawalConfirmed = ref(false);
const { t } = useI18n();
const { getToken } = useTokens();
const { networkSlug } = useNetwork();
const router = useRouter();

const {
bptIn,
Expand All @@ -52,6 +53,7 @@ const {
fiatAmountsOut,
isSingleAssetExit,
shouldExitViaInternalBalance,
hasBpt,
} = useExitPool();

/**
Expand Down Expand Up @@ -106,7 +108,13 @@ const amountsOutMap = computed((): AmountMap => {
* METHODS
*/
function handleClose(): void {
emit('close');
// If user has withdrawn everything, send back to pool page. Else, close
// modal.
if (!hasBpt.value) {
router.push({ name: 'pool', params: { networkSlug, id: props.pool.id } });
} else {
emit('close');
}
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/composables/approvals/useRelayerApprovalTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default function useRelayerApprovalTx(
});

approved.value = await txListener(tx, {
onTxConfirmed: () => {
onTxConfirmed: async () => {
approving.value = false;
relayerApproval.refetch();
},
Expand Down
2 changes: 1 addition & 1 deletion src/composables/approvals/useTokenApproval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function useTokenApproval(
});

txListener(tx, {
onTxConfirmed: () => {
onTxConfirmed: async () => {
approving.value = false;
approved.value = true;
},
Expand Down
2 changes: 1 addition & 1 deletion src/composables/swap/useJoinExit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export default function useJoinExit({
}

await txListener(tx, {
onTxConfirmed: () => {
onTxConfirmed: async () => {
confirming.value = false;
relayerApprovalQuery.refetch();
},
Expand Down
4 changes: 1 addition & 3 deletions src/composables/swap/useSor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,6 @@ export default function useSor({
return;
}

amount = bnum(amount).toString();

const tokenInAddress = tokenInAddressInput.value;
const tokenOutAddress = tokenOutAddressInput.value;

Expand Down Expand Up @@ -591,7 +589,7 @@ export default function useSor({
toFiat(tokenInAmountInput.value, tokenInAddressInput.value) || '0';

txListener(tx, {
onTxConfirmed: () => {
onTxConfirmed: async () => {
trackGoal(Goals.Swapped, bnum(swapUSDValue).times(100).toNumber() || 0);
swapping.value = false;
latestTxHash.value = tx.hash;
Expand Down
12 changes: 5 additions & 7 deletions src/composables/useEthers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@ import {
} from '@/lib/utils/promise';
import { rpcProviderService } from '@/services/rpc-provider/rpc-provider.service';

import useBlocknative from './useBlocknative';
import { toJsTimestamp } from './useTime';
import { useTokens } from '@/providers/tokens.provider';
import useTransactions from './useTransactions';
import { captureBalancerException } from '@/lib/utils/errors';

type ConfirmedTxCallback = (receipt: TransactionReceipt) => void;
type ConfirmedTxCallback = (receipt: TransactionReceipt) => Promise<void>;
type FailedTxCallback = (txData: TransactionResponse) => void;

// keep a record of processed txs
export const processedTxs = ref<Set<string>>(new Set(''));

export default function useEthers() {
const { finalizeTransaction, updateTransaction } = useTransactions();
const { supportsBlocknative } = useBlocknative();
const { refetchBalances } = useTokens();

async function getTxConfirmedAt(receipt: TransactionReceipt): Promise<Date> {
Expand All @@ -50,7 +48,7 @@ export default function useEthers() {
txListener(
tx,
{
onTxConfirmed: () => {
onTxConfirmed: async () => {
resolve(true);
},
onTxFailed: () => {
Expand Down Expand Up @@ -106,9 +104,9 @@ export default function useEthers() {
if (receipt != null) {
finalizeTransaction(txHash, 'tx', receipt);
}
callbacks.onTxConfirmed(receipt);
if (shouldRefetchBalances && !supportsBlocknative.value) {
refetchBalances();
await callbacks.onTxConfirmed(receipt);
if (shouldRefetchBalances) {
await refetchBalances();
}
confirmed = true;
} catch (error) {
Expand Down
1 change: 1 addition & 0 deletions src/lib/config/arbitrum/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const pools: Pools = {
'0xbe0f30217be1e981add883848d0773a86d2d2cd4000000000000000000000471', // rETH-bb-a-WETH
'0x45c4d1376943ab28802b995acffc04903eb5223f000000000000000000000470', // wstETH-bb-a-WETH
'0xc6eee8cb7643ec2f05f46d569e9ec8ef8b41b389000000000000000000000475', // bb-a-USD
'0x3fd4954a851ead144c2ff72b1f5a38ea5976bd54000000000000000000000480', // ankreth/wsteth
],
},
Investment: {
Expand Down
8 changes: 8 additions & 0 deletions src/lib/config/mainnet/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const pools: Pools = {
'0x3fa8c89704e5d07565444009e5d9e624b40be813000000000000000000000599', // gho/lusd
'0x9a172e1cb0e99f7e6dcc4c52e4655e8f337d5c0000000000000000000000059a', // gho/mai
'0xc2b021133d1b0cf07dba696fd5dd89338428225b000000000000000000000598', // gho/bb-a-usd
'0xe2d16b0a39f3fbb4389a0e8f1efcbecfb3d1e6e10000000000000000000005a7', // dusd-bb-a-usd
],
},
Investment: {
Expand Down Expand Up @@ -505,6 +506,12 @@ const pools: Pools = {
boosted: true,
boostedProtocols: [BoostedProtocol.Aave],
},
'0xe2d16b0a39f3fbb4389a0e8f1efcbecfb3d1e6e10000000000000000000005a7': {
name: 'DUSD/Boosted Aave v3 USD',
hasIcon: false,
boosted: true,
boostedProtocols: [BoostedProtocol.Aave],
},
},
Deep: [
'0x7b50775383d3d6f0215a8f290f2c9e2eebbeceb20000000000000000000000fe', // bb-a-USD1 (mainnet)
Expand Down Expand Up @@ -548,6 +555,7 @@ const pools: Pools = {
'0x41503c9d499ddbd1dcdf818a1b05e9774203bf46000000000000000000000594', // wstETH-bb-a-WETH-BPT
'0xd7edb56f63b2a0191742aea32df1f98ca81ed9c600000000000000000000058e', // B-wstETH/bb-ma3-weth
'0xc2b021133d1b0cf07dba696fd5dd89338428225b000000000000000000000598', // gho/bb-a-usd
'0xe2d16b0a39f3fbb4389a0e8f1efcbecfb3d1e6e10000000000000000000005a7', // dusd-bb-a-usd
],
BoostedApr: [
'0x7b50775383d3d6f0215a8f290f2c9e2eebbeceb2', // bb-a-USD1 (mainnet)
Expand Down
1 change: 1 addition & 0 deletions src/lib/config/polygon/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ const pools: Pools = {
'0x2814a9f16d7b5b5826df47f702f16279ccd799c8000200000000000000000bd1', // 50wMatic-50stMatic
'0xa874e67a1b203819bce84f161eba4b4eb3f4359b000200000000000000000bcc', // 50USDC-50TRYB
'0xa5a935833f6a5312715f182733eab088452335d7000100000000000000000bee', // 30WBTC-20stMATIC-bb-a-WMATIC
'0xaaf737aeb1e5f1dc9429de4a639fe16c42fa1fe3000200000000000000000bf9', // 50fireEP-50FBX
],
},
Factories: {
Expand Down
23 changes: 23 additions & 0 deletions src/lib/utils/errors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ describe('useTransactionErrors', () => {
expect(isUserError(new Error('Transaction was rejected'))).toBe(true);
});

it('Should return true for common bad wallet config issues', () => {
expect(isUserError(new Error('invalid rpc url'))).toBe(true);
expect(isUserError(new Error('nonce has already been used'))).toBe(true);
});

it('Should return true if the error message is in the cause', () => {
const rejectionError = new Error('Something went wrong');
rejectionError.cause = new Error('User rejected the transaction');
Expand Down Expand Up @@ -50,6 +55,15 @@ describe('useTransactionErrors', () => {
expect(isUserError(rejectionError)).toBe(true);
});

// See https://balancer-labs.sentry.io/issues/4327549689/events/0c8872a3076a4843bd7b836474160a44/
it('Should return true if the not enough gas error is in russian', () => {
const rejectionError = {
message:
'Комиссия за газ обновлена, и вам необходимо больше 0.00007039 ETH для завершения этой транзакции.',
};
expect(isUserError(rejectionError)).toBe(true);
});

// See https://balancer-labs.sentry.io/issues/4199718124/events/57d26b71647046f2be3620f3c0165714/
it('Should return true if its a user error as an object', () => {
const rejectionError = {
Expand All @@ -58,5 +72,14 @@ describe('useTransactionErrors', () => {
};
expect(isUserError(rejectionError)).toBe(true);
});

// See https://balancer-labs.sentry.io/issues/4327541491/events/9f490b42607646eb9065ebdd630226d2/
it('Should return true if the cowswap fee has changed since the user received their quote', () => {
const rejectionError = {
message:
"Error: The signed fee is insufficient. It's possible that is higher now due to a change in the gas price, ether price, or the sell token price. Please try again to get an updated fee quote.",
};
expect(isUserError(rejectionError)).toBe(true);
});
});
});
25 changes: 22 additions & 3 deletions src/lib/utils/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,25 @@ function isUserRejected(error): boolean {
}

/**
* Checks if error is caused by user not having enough gas.
* Checks if error is caused by user not having enough gas or setting gas too low.
*/
function isUserNotEnoughGas(error): boolean {
const messages = [/insufficient funds for gas/];
const messages = [
/insufficient funds for gas/,
/the signed fee is insufficient/,
/EffectivePriorityFeePerGas too low/,
/Комиссия за газ обновлена/i,
/insufficient eth to pay the network fees/,
];

return isErrorOfType(error, messages);
}

/**
* Checks if error is caused by user's wallet having bad config / state
*/
function isWalletConfigError(error): boolean {
const messages = [/invalid rpc url/, /nonce has already been used/];

return isErrorOfType(error, messages);
}
Expand Down Expand Up @@ -289,7 +304,11 @@ function isBotError(error): boolean {
* Checks if error is caused by the user or the state of their wallet.
*/
export function isUserError(error): boolean {
return isUserRejected(error) || isUserNotEnoughGas(error);
return (
isUserRejected(error) ||
isUserNotEnoughGas(error) ||
isWalletConfigError(error)
);
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/pages/pool/withdraw.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { usePoolHelpers } from '@/composables/usePoolHelpers';
import { oneSecondInMs } from '@/composables/useTime';
import { useIntervalFn } from '@vueuse/core';
import { computed } from 'vue';
import { hasFetchedPoolsForSor } from '@/lib/balancer.sdk';
import WithdrawPage from '@/components/contextual/pages/pool/withdraw/WithdrawPage.vue';
import { useTokens } from '@/providers/tokens.provider';
Expand Down