Skip to content

Commit

Permalink
Merge pull request #587 from valory-xyz/fix/misc-text-low-balance
Browse files Browse the repository at this point in the history
Rename memeooorr display text to agents.fun, fix master safe low native balance check
  • Loading branch information
mohandast52 authored Dec 13, 2024
2 parents 23c63be + 9c7a4ef commit 64809a1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions frontend/components/MainPage/sections/GasBalanceSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const BalanceStatus = () => {
if (!storeState?.isInitialFunded) return;

if (isMasterSafeLowOnNativeGas && !isLowBalanceNotificationShown) {
showNotification('Trading balance is too low.');
showNotification('Operating balance is too low.');
setIsLowBalanceNotificationShown(true);
}

Expand Down Expand Up @@ -141,12 +141,12 @@ export const GasBalanceSection = () => {
padding="16px 24px"
>
<Text type="secondary">
Trading balance&nbsp;
Operating balance&nbsp;
{masterSafe && (
<Tooltip
title={
<TooltipContent>
Your agent uses this balance to fund trading activity on-chain.
Your agent uses this balance to fund on-chain activity.
<br />
{activityLink}
</TooltipContent>
Expand Down
4 changes: 2 additions & 2 deletions frontend/config/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const AGENT_CONFIG: {
// serviceApi: OptimusService,
// },
[AgentType.Memeooorr]: {
name: 'Memeooorr agent',
name: 'Agents.fun agent',
evmHomeChainId: EvmChainId.Base,
middlewareHomeChainId: MiddlewareChain.BASE,
requiresAgentSafesOn: [EvmChainId.Base],
Expand All @@ -86,7 +86,7 @@ export const AGENT_CONFIG: {
},
requiresMasterSafesOn: [EvmChainId.Base],
serviceApi: MemeooorBaseService,
displayName: 'Memeooorr agent',
displayName: 'Agents.fun agent',
description:
'Autonomously post to Twitter, create and trade memecoins, and interact with other agents.',
},
Expand Down
14 changes: 8 additions & 6 deletions frontend/hooks/useBalanceContext.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { isNil } from 'lodash';
import { useContext, useMemo } from 'react';

import { CHAIN_CONFIG } from '@/config/chains';
import { BalanceContext, WalletBalanceResult } from '@/context/BalanceProvider';
import { WalletOwnerType, WalletType } from '@/enums/Wallet';
import { Optional } from '@/types/Util';

import { useService } from './useService';
Expand Down Expand Up @@ -146,14 +148,14 @@ export const useMasterBalances = () => {
if (!masterSafeNative) return;
if (!homeChainNativeToken?.symbol) return;

const agentNativeGasRequirement =
selectedAgentConfig.agentSafeFundingRequirements?.[
selectedAgentConfig.evmHomeChainId
];
const nativeGasRequirement =
selectedAgentConfig.operatingThresholds[WalletOwnerType.Master][
WalletType.Safe
][homeChainNativeToken.symbol];

if (!agentNativeGasRequirement) return;
if (isNil(nativeGasRequirement)) return;

return masterSafeNative.balance < agentNativeGasRequirement;
return masterSafeNative.balance < nativeGasRequirement;
}, [masterSafeNative, homeChainNativeToken, selectedAgentConfig]);

const masterEoaNative = useMemo(() => {
Expand Down

0 comments on commit 64809a1

Please sign in to comment.