Skip to content

Commit

Permalink
Hotfix/1.12.5 (#654)
Browse files Browse the repository at this point in the history
* fix: add a network key to addressmap to make sure that addressmap pulls tokens for the appropraite nwtwork

* update: tick version
  • Loading branch information
arb000r authored Aug 10, 2021
1 parent 9baeaba commit bd873fc
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 20 deletions.
7 changes: 2 additions & 5 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@balancer-labs/frontend-v2",
"version": "1.12.4",
"version": "1.12.5",
"engines": {
"node": "14.x",
"npm": ">=7"
Expand Down
4 changes: 3 additions & 1 deletion src/components/cards/TradeCard/GasReimbursement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export default defineComponent({
const ethPrice = priceFor(appNetworkConfig.nativeAsset.address);
const balPrice = priceFor(
coingeckoService.prices.addressMapOut(TOKENS.AddressMap.BAL)
coingeckoService.prices.addressMapOut(
TOKENS.AddressMap[appNetworkConfig.key].BAL
)
);
const gasPrice = store.state.market.gasPrice || 0;
Expand Down
4 changes: 3 additions & 1 deletion src/components/cards/TradeCardGP/TradeCardGP.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ import TradeSettingsPopover, {
import { configService } from '@/services/config/config.service';
import TradePairGP from './TradePairGP.vue';
import useWeb3 from '@/services/web3/useWeb3';
const { nativeAsset } = configService.network;
Expand All @@ -130,6 +131,7 @@ export default defineComponent({
const { t } = useI18n();
const { bp } = useBreakpoints();
const { fNum } = useNumbers();
const { appNetworkConfig } = useWeb3();
// DATA
const exactIn = ref(true);
Expand Down Expand Up @@ -311,7 +313,7 @@ export default defineComponent({
}
function switchToWETH() {
tokenInAddress.value = TOKENS.AddressMap.WETH;
tokenInAddress.value = TOKENS.AddressMap[appNetworkConfig.key].WETH;
}
// INIT
Expand Down
5 changes: 3 additions & 2 deletions src/components/forms/pool_actions/InvestForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
:to="{
name: 'trade',
params: {
assetIn: TOKENS.AddressMap.ETH,
assetOut: TOKENS.AddressMap.WETH
assetIn: TOKENS.AddressMap[appNetworkConfig.key].ETH,
assetOut: TOKENS.AddressMap[appNetworkConfig.key].WETH
}
}"
class="text-xs text-gray-500 underline"
Expand Down Expand Up @@ -679,6 +679,7 @@ export default defineComponent({
TOKENS,
// computed
tokens,
appNetworkConfig,
hasValidInputs,
hasAmounts,
approving,
Expand Down
4 changes: 2 additions & 2 deletions src/components/inputs/TokenSearchInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default defineComponent({
* COMPOSABLES
*/
const { tokens, balances, dynamicDataLoading } = useTokens();
const { account } = useWeb3();
const { account, appNetworkConfig } = useWeb3();
/**
* COMPUTED
Expand Down Expand Up @@ -122,7 +122,7 @@ export default defineComponent({
// special case for ETH where we want it to filter as WETH regardless
// as ETH is the native asset
if (getAddress(token) === NATIVE_ASSET_ADDRESS) {
_token = TOKENS.AddressMap.WETH;
_token = TOKENS.AddressMap[appNetworkConfig.key].WETH;
}
// const newSelected = [...props.modelValue, _token];
emit('add', _token);
Expand Down
6 changes: 5 additions & 1 deletion src/components/navs/AppNav/AppNavClaimBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ export default defineComponent({
const { priceFor } = useTokens();
const balPrice = computed(() =>
priceFor(coingeckoService.prices.addressMapOut(TOKENS.AddressMap.BAL))
priceFor(
coingeckoService.prices.addressMapOut(
TOKENS.AddressMap[appNetworkConfig.key].BAL
)
)
);
// COMPUTED
Expand Down
8 changes: 5 additions & 3 deletions src/composables/usePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
PoolType
} from '@/services/balancer/subgraph/types';
import { TOKENS } from '@/constants/tokens';
import useWeb3 from '@/services/web3/useWeb3';

type AnyPool = Pool | FullPool | DecoratedPoolWithShares;

Expand All @@ -17,14 +18,15 @@ export function isWeighted(pool: AnyPool): boolean {
return pool.poolType === PoolType.Weighted;
}

export function isWeth(pool: AnyPool): boolean {
return pool.tokenAddresses.includes(TOKENS.AddressMap.WETH);
export function isWeth(pool: AnyPool, networkId: string): boolean {
return pool.tokenAddresses.includes(TOKENS.AddressMap[networkId].WETH);
}

export function usePool(pool: Ref<AnyPool>) {
const { appNetworkConfig } = useWeb3();
const isStablePool = computed(() => isStable(pool.value));
const isWeightedPool = computed(() => isWeighted(pool.value));
const isWethPool = computed(() => isWeth(pool.value));
const isWethPool = computed(() => isWeth(pool.value, appNetworkConfig.key));

return {
// computed
Expand Down
12 changes: 9 additions & 3 deletions src/constants/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ export const TOKENS = {
Symbols: ['WBTC', 'DAI', 'USDC', 'BAL', 'AAVE', 'WETH']
},
AddressMap: {
ETH: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
BAL: '0xba100000625a3754423978a60c9317c58a424e3d'
'1': {
ETH: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
BAL: '0xba100000625a3754423978a60c9317c58a424e3d'
},
'137': {
WETH: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',
BAL: '0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3'
}
},
Prices: {
ChainMap: {
Expand Down
3 changes: 2 additions & 1 deletion src/services/claim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ export async function getCurrentRewardsEstimate(
incentive =>
incentive.token_address ==
coingeckoService.prices
.addressMapOut(TOKENS.AddressMap.BAL)
.addressMapOut(TOKENS.AddressMap[String(network)].BAL)
.toLowerCase()
);

const rewards = liquidityProviders
.reduce(
(total, { current_estimate }) => total.plus(current_estimate),
Expand Down

3 comments on commit bd873fc

@vercel
Copy link

@vercel vercel bot commented on bd873fc Aug 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on bd873fc Aug 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

app – ./

app-balancer.vercel.app
pm2.vercel.app
app-git-master-balancer.vercel.app
app.balancer.fi

@vercel
Copy link

@vercel vercel bot commented on bd873fc Aug 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.