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

feat: agents.fun in celo (UI configs) #647

Merged
merged 23 commits into from
Jan 13, 2025

Conversation

mohandast52
Copy link
Collaborator

@mohandast52 mohandast52 commented Jan 6, 2025

Proposed changes

  • Added configuration for agents.fun (Celo) and disabled it for now, ensuring it’s not visible anywhere. Added TODOs for addresses and other stuff to update later.
  • Removed optimism configurations in a few areas to enforce stricter types and improve type safety.
  • 👇 Celo agent when enabled
Screenshot

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@mohandast52 mohandast52 added the enhancement New feature or request label Jan 6, 2025
@mohandast52 mohandast52 self-assigned this Jan 6, 2025
@mohandast52 mohandast52 changed the title feat: agents.fun in celo feat: agents.fun in celo (UI configs) Jan 7, 2025
@mohandast52 mohandast52 marked this pull request as ready for review January 7, 2025 13:32
@@ -15,11 +15,12 @@ const { Text } = Typography;
* update as needed; check https://app.safe.global/new-safe/create for prefixes
*/
const safeChainPrefix = {
[EvmChainId.Ethereum]: 'eth',
[AllEvmChainId.Ethereum]: 'eth',
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do you think we need two separate sets of evmChainIds? wouldn't that be confusing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is due to the “EvmChainId” type. In several places, we were using EvmChainId | number, which isn’t ideal as it allows any valid number. To make it stricter, we need to limit it to the specific chain IDs we support. AllEvmChainId (possibly a better name could be chosen) could simply act as an enum holding these chain IDs. Personally, I’d prefer to stick to EvmChainId, but for safeChainPrefix, we might require a more generic type. Let me know your thoughts.

frontend/config/activityCheckers.ts Outdated Show resolved Hide resolved
frontend/config/agents.ts Outdated Show resolved Hide resolved
frontend/config/agents.ts Outdated Show resolved Hide resolved
frontend/config/agents.ts Outdated Show resolved Hide resolved
frontend/constants/serviceTemplates.ts Outdated Show resolved Hide resolved
frontend/constants/urls.ts Outdated Show resolved Hide resolved
frontend/public/agent-agents-fun-celo-icon.png Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

I honestly think we can use the same service class for both, we pass chainId anyway to each function. wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I think so too. That’s why I added a TODO to address it later, but I’ll see if I can do something about it now and create a common class.

Copy link
Collaborator

Choose a reason for hiding this comment

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

couldn't we now just simply use frontend/service/agents/base-services/AgentsFun.ts instead of both frontend/service/agents/AgentsFunCelo.ts and frontend/service/agents/AgentsFunBase.ts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could use the same class, but it’s better to have a separate class for each service because it is be easy to understand, keeping it modular and debug going forth (Modularity and Maintainability). Also, this way, we can handle any slight variations in logic without affecting others (Scalability). Hence, I’d prefer keeping two different but similar classes.

import { formatEther } from 'ethers/lib/utils';

import { STAKING_PROGRAMS } from '@/config/stakingPrograms';
import { CELO_STAKING_PROGRAMS } from '@/config/stakingPrograms/celo';
Copy link
Collaborator

Choose a reason for hiding this comment

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

re above, just maybe need to make this abstract and make chainId param required everything instead of falling back to default

Comment on lines 193 to 194
description: 'Memeooorr @twitter_handle', // should be overwritten with twitter username
service_version: 'v0.2.0-alpha16',
Copy link
Collaborator

Choose a reason for hiding this comment

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

still think these two could be in AGENTS_FUN_COMMON_TEMPLATE

frontend/constants/serviceTemplates.ts Outdated Show resolved Hide resolved
}): Promise<StakingRewardsInfo | undefined> => {
if (!chainId) throw new Error('ChainId is required');
Copy link
Collaborator

Choose a reason for hiding this comment

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

wouldn't ts prevent us from passing not a EvmChainId value? so it can't be null/0?
applicable to all similar places below

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TypeScript doesn’t perform runtime checks, so it’s better to include this to ensure reliability. If the line is executing within "chain-specific" classes, I would want the chain ID to always be present.

Copy link
Collaborator

Choose a reason for hiding this comment

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

can we rename the base-services to common? or shared? to me it sounds like related to base chain

Copy link
Collaborator

Choose a reason for hiding this comment

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

couldn't we now just simply use frontend/service/agents/base-services/AgentsFun.ts instead of both frontend/service/agents/AgentsFunCelo.ts and frontend/service/agents/AgentsFunBase.ts?

@mohandast52 mohandast52 merged commit c3f64a1 into fix/meme-staging Jan 13, 2025
5 checks passed
@mohandast52 mohandast52 deleted the mohan/agents-fun-celo branch January 13, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants