Skip to content

Commit

Permalink
Add Tekika Avatars
Browse files Browse the repository at this point in the history
  • Loading branch information
stxphxn committed Aug 29, 2024
1 parent 85da54a commit 29cc194
Show file tree
Hide file tree
Showing 24 changed files with 43 additions and 37 deletions.
1 change: 0 additions & 1 deletion src/components/cards/SwapCard/SwapCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ export default defineComponent({
tokenOutAddress,
tokenOutAmount
);
console.log(swapping);
const { errorMessage } = useValidation(
tokenInAddress,
tokenInAmount,
Expand Down
1 change: 0 additions & 1 deletion src/components/contextual/pages/pool/PoolStatCards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const aprLabel = computed((): string => {
) {
const newApr = { ...poolAPRs };
if (newApr && newApr.min && newApr.max) {
console.log('newApr', newApr);
newApr.min = newApr.swapFees || 0;
newApr.max = newApr.swapFees || 0;
return totalAprLabel(newApr as AprBreakdown, props.pool?.boost);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const props = defineProps<Props>();
const pool = toRef(props, 'pool');
console.log(pool);
/**
* PROVIDERS
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ const stakedPctOfShares = computed(() => {
.toString();
});
console.log('stakedPctOfShares', stakedPctOfShares.value);
const isStakeDisabled = computed(() => {
return (
!!deprecatedDetails(props.pool.id) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ const joinTokensWithBalance = computed<string[]>(() =>
})
);
console.log('joinTokensWithBalance', joinTokensWithBalance.value);
const joinTokensWithoutBalance = computed<string[]>(() =>
poolJoinTokens.value.filter(
address => !includesAddress(tokensWithBalance.value, address)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ const excludedTokens = computed(() => [
]);
const focussedTokenAddress = computed((): string => {
console.log(state.results, state.focussedToken);
const key = Object.keys(tokens.value)[state.focussedToken];
return tokens.value[key].address;
});
Expand Down
8 changes: 7 additions & 1 deletion src/components/navs/AppNav/AppNavSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ function copyAddress() {
<div class="flex mt-1 mb-1">
<div class="flex">
<div class="relative">
<Avatar :iconURI="avatarUri" :address="account" :size="44" />
<Avatar
v-if="avatarUri"
:iconURI="avatarUri"
:address="account"
:size="100"
/>
<Avatar v-else :address="account" :size="44" />
<div class="connector-icon-wrapper">
<img
:src="connectorLogo"
Expand Down
1 change: 0 additions & 1 deletion src/components/navs/AppNav/AppSidebar/SidebarContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const router = useRouter();
*/
const blockIcon = ref<HTMLDivElement>();
console.log('isVeBalSupported', isVeBalSupported);
const navLinks = [
{ label: t('pool'), path: `/${networkSlug}`, goal: Goals.ClickNavPools },
{ label: t('swap'), path: `/${networkSlug}/swap`, goal: Goals.ClickNavSwap },
Expand Down
1 change: 0 additions & 1 deletion src/components/tooltips/APRTooltip/APRTooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const totalLabel = computed((): string => {
) {
const newApr = { ...apr.value };
if (newApr && newApr.min && newApr.max) {
console.log('newApr', newApr);
newApr.min = newApr.swapFees || 0;
newApr.max = newApr.swapFees || 0;
return totalAprLabel(newApr as AprBreakdown, props.pool.boost);
Expand Down
2 changes: 0 additions & 2 deletions src/composables/queries/useTokenPricesQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ export default function useTokenPricesQuery(
const api = getApi();

const queryFn = async () => {
console.log('API: ', api);
if (api) {
// const { prices } = await api.GetCurrentTokenPrices();
let pricesMap = {};
// priceArrayToMap(prices);
pricesMap = injectCustomTokens({}, pricesToInject.value);
console.log('pricesMap: ', pricesMap);
// console.log('Fetching', Object.values(prices).length, 'prices');

return pricesMap;
Expand Down
4 changes: 0 additions & 4 deletions src/composables/queries/useVotingPoolsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default function useVotingPoolsQuery(
const queryFn = async (): Promise<VotingPool[]> => {
try {
let apiVotingPools: ApiVotingPools;
console.log(isMeter.value);
if (isTestnet.value) {
apiVotingPools = testnetVotingPools('GOERLI');
} else if (isMainnet.value) {
Expand All @@ -64,12 +63,9 @@ export default function useVotingPoolsQuery(
apiVotingPools = meterVotingPools('meter');
} else {
const api = getApi();
console.log(api);
const { veBalGetVotingList } = await api.VeBalGetVotingList();
console.log(veBalGetVotingList);
apiVotingPools = veBalGetVotingList;
}
console.log(apiVotingPools);

const batchSize = 5;
const gaugeControllerDecorator = new GaugeControllerDecorator();
Expand Down
1 change: 0 additions & 1 deletion src/composables/swap/useSwapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export default function useSwapping(
);

const swapRoute = computed<SwapRoute>(() => {
console.log(wrapType.value);
if (wrapType.value !== WrapType.NonWrap) {
return 'wrapUnwrap';
} else if (isNativeAssetSwap.value) {
Expand Down
1 change: 0 additions & 1 deletion src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ onBeforeMount(async () => {
: undefined;
symmPrice.value = injectedPriceFor(symm);
console.log(symmPrice.value);
rewardPrice.value = reward ? injectedPriceFor(reward) : 0;
}
const tvl = await fetchTVL();
Expand Down
1 change: 0 additions & 1 deletion src/pages/pool/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const { prices, priceQueryLoading } = useTokens();
const { isWalletReady } = useWeb3();
const _isVeBalPool = isVeBalPool(poolId);
const { pool, isLoadingPool } = usePool();
console.log('pool', pool);
const {
isStableLikePool,
isLiquidityBootstrappingPool,
Expand Down
1 change: 0 additions & 1 deletion src/plugins/router/nav-guards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ function applyNetworkSubdomainRedirect(router: Router): Router {
*/
function applyNetworkPathRedirects(router: Router): Router {
router.beforeEach((to, from, next) => {
console.log(to);
if (redirecting.value) {
next();
} else {
Expand Down
3 changes: 0 additions & 3 deletions src/providers/local/exit-pool.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ export const exitPoolProvider = (

exitPoolService.setExitHandler(exitHandlerType.value);

console.log('exitHandler:', exitHandlerType.value);
try {
await nextTick();
const output = await exitPoolService.queryExit({
Expand Down Expand Up @@ -423,7 +422,6 @@ export const exitPoolProvider = (

exitPoolService.setExitHandler(singleAssetMaxedExitHandler);

console.log('exitHandler:', exitHandlerType.value);
try {
await nextTick();
const output = await exitPoolService.queryExit({
Expand Down Expand Up @@ -458,7 +456,6 @@ export const exitPoolProvider = (
txError.value = '';
exitPoolService.setExitHandler(exitHandlerType.value);

console.log('exitHandler:', exitHandlerType.value);
return exitPoolService.exit({
exitType: exitType.value,
bptIn: _bptIn.value,
Expand Down
3 changes: 0 additions & 3 deletions src/providers/local/join-pool.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ export const joinPoolProvider = (
joinPoolService.setJoinHandler(joinHandlerType.value);
await setApprovalActions();

console.log('joinHandler:', joinHandlerType.value);
if (!validateAmountsIn()) return null;
const output = await joinPoolService.queryJoin({
amountsIn: amountsInWithValue.value,
Expand All @@ -319,7 +318,6 @@ export const joinPoolProvider = (
approvalActions: approvalActions.value,
transactionDeadline: transactionDeadline.value,
});
console.log('to: ', output);
bptOut.value = output.bptOut;
priceImpact.value = output.priceImpact;

Expand All @@ -340,7 +338,6 @@ export const joinPoolProvider = (
joinPoolService.setJoinHandler(joinHandlerType.value);
await setApprovalActions();

console.log('joinHandler:', joinHandlerType.value);
const joinRes = await joinPoolService.join({
amountsIn: amountsInWithValue.value,
tokensIn: tokensIn.value,
Expand Down
2 changes: 0 additions & 2 deletions src/providers/local/pool-staking.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ export const poolStakingProvider = (_poolId?: string) => {
return poolGauges.value?.liquidityGauges?.[0]?.totalSupply || '0';
});

console.log('gaugeTotalSupply', gaugeTotalSupply.value);

// User's staked shares for pool (onchain data).
const stakedShares = computed((): string => {
if (!poolId.value) return '0';
Expand Down
2 changes: 0 additions & 2 deletions src/providers/tokens.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ export const tokensProvider = (
*/
function injectedPriceFor(address: string): number {
try {
console.log(state.injectedPrices);
const price = state.injectedPrices[address]; // const price = selectByAddressFast(prices.value, getAddress(address));
if (!price) {
return 0;
Expand Down Expand Up @@ -518,7 +517,6 @@ export const tokensProvider = (
* Returns true if the token is the native asset or wrapped native asset
*/
function isWethOrEth(tokenAddress: string): boolean {
console.log(wrappedNativeAsset.value);
if (!nativeAsset || !nativeAsset.address || !wrappedNativeAsset.value)
return false;
return (
Expand Down
2 changes: 0 additions & 2 deletions src/services/balancer/gauges/gauge-controller.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ export class GaugeControllerDecorator {
* @summary Fetch total points allocated towards each gauge for this period
*/
private callGaugeWeightThisPeriod(votingGauges: ApiVotingGauge[]) {
console.log(votingGauges);
let thisWeekTimestamp = toUnixTimestamp(
Math.floor(Date.now() / oneWeekInMs) * oneWeekInMs
);
Expand All @@ -134,7 +133,6 @@ export class GaugeControllerDecorator {
// );
// });
// }
console.log(thisWeekTimestamp);
return votingGauges.forEach(gauge => {
this.multicaller.call(
`gauges.${gauge.address}.gaugeWeightThisPeriod`,
Expand Down
1 change: 0 additions & 1 deletion src/services/balancer/gauges/gauges.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ export class GaugesDecorator {
return;

gaugesDataMap[gauge.id].rewardTokens.forEach(rewardToken => {
console.log('called');
if (rewardToken === AddressZero) return;

const params = shouldUseRewardHelper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export class SubgraphFallbackService {
}
try {
const response = await axios.post(this.url.value, payload);
console.log(response);
const errorMessage = response?.data.errors?.message;
if (errorMessage) {
throw new Error(errorMessage);
Expand Down
24 changes: 24 additions & 0 deletions src/services/web3/tekika-avatars.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ethers } from 'ethers';

const nftABI = [
'function tokenURI(uint256 _tokenId) public view returns (string memory)',
'function tokenOfOwnerByIndex(address _owner, uint256 _index) public view returns (uint256)',
];

const nftAddress = '0x5c00D81F7E00188751258a0DA0dd8198681D1fFA';

export const resolveTekikaAvatar = async (
provider: ethers.providers.JsonRpcProvider,
address: string
) => {
const contract = new ethers.Contract(nftAddress, nftABI, provider);

let avatar = '';
try {
const tokenId = await contract.tokenOfOwnerByIndex(address, 0);
avatar = `https://tekika-nfts.s3.amazonaws.com/tokens/${tokenId}/${tokenId}.webp`;
} catch (error) {
console.log('No Tekika found :(');
}
return avatar;
};
14 changes: 12 additions & 2 deletions src/services/web3/wallet.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { TransactionBuilder } from './transactions/transaction.builder';
import { WalletProvider } from '@/dependencies/wallets/Web3Provider';
import { Network } from '@/lib/config/types';
import { resolveTekikaAvatar } from './tekika-avatars';

interface Web3Profile {
ens: string | null;
Expand Down Expand Up @@ -54,11 +55,20 @@ export default class WalletService {
}
}

async getTekikaAvatar(address: string): Promise<string | null> {
try {
return await resolveTekikaAvatar(this.ensProvider, address);
} catch (error) {
return null;
}
}

async getProfile(address: string): Promise<Web3Profile> {
console.log('getProfile', address);
try {
return {
ens: await this.getEnsName(address),
avatar: await this.getEnsAvatar(address),
ens: null,
avatar: await this.getTekikaAvatar(address),
};
} catch (error) {
console.error('Failed to fetch ENS data', error);
Expand Down

0 comments on commit 29cc194

Please sign in to comment.