Skip to content

Commit

Permalink
refactor: remove unused fund requirements and operating thresholds fr…
Browse files Browse the repository at this point in the history
…om agent configurations
  • Loading branch information
mohandast52 committed Jan 8, 2025
1 parent 9b3c02e commit bf2fa76
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 90 deletions.
78 changes: 1 addition & 77 deletions frontend/config/agents.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
import { ethers } from 'ethers';
import { formatUnits } from 'ethers/lib/utils';

import { MiddlewareChain } from '@/client';
import {
MEMEOOORR_BASE_TEMPLATE,
MODIUS_SERVICE_TEMPLATE,
PREDICT_SERVICE_TEMPLATE,
} from '@/constants/serviceTemplates';
import { MODIUS_SERVICE_TEMPLATE } from '@/constants/serviceTemplates';
import { AgentType } from '@/enums/Agent';
import { EvmChainId } from '@/enums/Chain';
import { TokenSymbol } from '@/enums/Token';
import { WalletOwnerType, WalletType } from '@/enums/Wallet';
import { MemeooorBaseService } from '@/service/agents/Memeooor';
import { ModiusService } from '@/service/agents/Modius';
import { PredictTraderService } from '@/service/agents/PredictTrader';
import { AgentConfig } from '@/types/Agent';
import { formatEther } from '@/utils/numberFormatters';

import { MODE_TOKEN_CONFIG } from './tokens';

const traderFundRequirements =
PREDICT_SERVICE_TEMPLATE.configurations[MiddlewareChain.GNOSIS]
.fund_requirements[ethers.constants.AddressZero];

const memeooorrRequirements =
MEMEOOORR_BASE_TEMPLATE.configurations[MiddlewareChain.BASE]
.fund_requirements[ethers.constants.AddressZero];

const modiusFundRequirements =
MODIUS_SERVICE_TEMPLATE.configurations[MiddlewareChain.MODE]
.fund_requirements;
Expand All @@ -39,25 +24,6 @@ export const AGENT_CONFIG: {
evmHomeChainId: EvmChainId.Gnosis,
middlewareHomeChainId: MiddlewareChain.GNOSIS,
requiresAgentSafesOn: [EvmChainId.Gnosis],
operatingThresholds: {
[WalletOwnerType.Master]: {
[WalletType.Safe]: {
[TokenSymbol.XDAI]: Number(
formatEther(`${traderFundRequirements.safe}`),
),
},
[WalletType.EOA]: {
[TokenSymbol.XDAI]: 0.1, // TODO: should come from the template
},
},
[WalletOwnerType.Agent]: {
[WalletType.Safe]: {
[TokenSymbol.XDAI]: Number(
formatEther(`${traderFundRequirements.agent}`),
),
},
},
},
requiresMasterSafesOn: [EvmChainId.Gnosis],
serviceApi: PredictTraderService,
displayName: 'Prediction agent',
Expand All @@ -69,25 +35,6 @@ export const AGENT_CONFIG: {
evmHomeChainId: EvmChainId.Base,
middlewareHomeChainId: MiddlewareChain.BASE,
requiresAgentSafesOn: [EvmChainId.Base],
operatingThresholds: {
[WalletOwnerType.Master]: {
[WalletType.Safe]: {
[TokenSymbol.ETH]: Number(
formatEther(`${memeooorrRequirements.safe}`),
),
},
[WalletType.EOA]: {
[TokenSymbol.ETH]: 0.0125, // TODO: should come from the template
},
},
[WalletOwnerType.Agent]: {
[WalletType.Safe]: {
[TokenSymbol.ETH]: Number(
formatEther(`${memeooorrRequirements.agent}`),
),
},
},
},
requiresMasterSafesOn: [EvmChainId.Base],
serviceApi: MemeooorBaseService,
displayName: 'Agents.fun agent',
Expand All @@ -112,29 +59,6 @@ export const AGENT_CONFIG: {
),
},
},
operatingThresholds: {
[WalletOwnerType.Master]: {
[WalletType.Safe]: {
[TokenSymbol.ETH]: Number(
formatEther(
`${modiusFundRequirements[ethers.constants.AddressZero].agent}`, // TODO: should be 0.0055, temp fix to avoid low balance alerts until the refund is fixed in the middleware
),
),
},
[WalletType.EOA]: {
[TokenSymbol.ETH]: 0.0002,
},
},
[WalletOwnerType.Agent]: {
[WalletType.Safe]: {
[TokenSymbol.ETH]: Number(
formatEther(
`${modiusFundRequirements[ethers.constants.AddressZero].agent}`,
),
),
},
},
},
requiresMasterSafesOn: [EvmChainId.Mode],
serviceApi: ModiusService,
displayName: 'Modius agent',
Expand Down
13 changes: 0 additions & 13 deletions frontend/types/Agent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { MiddlewareChain } from '@/client';
import { EvmChainId } from '@/enums/Chain';
import { TokenSymbol } from '@/enums/Token';
import { WalletOwnerType, WalletType } from '@/enums/Wallet';
import { PredictTraderService } from '@/service/agents/PredictTrader';

export type AgentSupportedEvmChainId =
Expand All @@ -26,18 +25,6 @@ export type AgentConfig = {
* (For example, the agent may require a minimum balance of 0.1 xDAI to continue running)
*/
isAgentEnabled: boolean;
operatingThresholds: {
[WalletOwnerType.Master]: {
[walletType in WalletType.EOA | WalletType.Safe]: {
[tokenSymbol: string | TokenSymbol]: number;
};
};
[WalletOwnerType.Agent]: {
[WalletType.Safe]: {
[tokenSymbol: string | TokenSymbol]: number;
};
};
};
};

export type AgentHealthCheck = {
Expand Down

0 comments on commit bf2fa76

Please sign in to comment.