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

frontend multi-chain multi-agent support #434

Draft
wants to merge 550 commits into
base: feat/multi-chain-support-middleware
Choose a base branch
from

Conversation

truemiller
Copy link
Collaborator

Proposed changes

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)

@truemiller truemiller changed the title Refactor/multi chain support frontend frontend multi-chain multi-agent support Nov 8, 2024
Comment on lines +26 to +29
[ContractType.StakingActivity]: new MulticallContract(
'0x7Fd1F4b764fA41d19fe3f63C85d12bf64d2bbf68',
STAKING_TOKEN_PROXY_ABI,
),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@truemiller need to move this to activityCheckers config

@@ -7,7 +7,7 @@
"@tanstack/react-query": "^5.29.0",
"adm-zip": "^0.5.12",
"antd": "^5.14.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe a good time to update ant?

Comment on lines 32 to 36
abstract getStakingRewardsInfo: Promise<unknown>;
abstract getAvailableRewardsForEpoch: Promise<unknown>;
abstract getStakingContractInfo: Promise<unknown>;
abstract getStakingContractInfoByServiceIdStakingProgramId: Promise<unknown>;
abstract getStakingContractInfoByStakingProgramId: Promise<unknown>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you think “Details” would be more accurate than “Info”?

Suggested change
abstract getStakingRewardsInfo: Promise<unknown>;
abstract getAvailableRewardsForEpoch: Promise<unknown>;
abstract getStakingContractInfo: Promise<unknown>;
abstract getStakingContractInfoByServiceIdStakingProgramId: Promise<unknown>;
abstract getStakingContractInfoByStakingProgramId: Promise<unknown>;
abstract getStakingRewardsInfo: Promise<unknown>;
abstract getAvailableRewardsForEpoch: Promise<unknown>;
abstract getStakingContractDetails: Promise<unknown>;
abstract getStakingContractDetailsByServiceIdStakingProgramId: Promise<unknown>;
abstract getStakingContractDetailsByStakingProgramId: Promise<unknown>;

];

const [
getOperatorBalanceReponse,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it should be just

Suggested change
getOperatorBalanceReponse,
operatorBalanceResponse,

await OLAS_CONTRACTS[chainId][ContractType.Multicall3].all(contractCalls);

const [bondValue, depositValue, serviceState] = [
parseFloat(ethers.utils.formatUnits(getOperatorBalanceReponse, 18)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if we create a separate utility for formatting these values? That way, if we decide to migrate to “viem,” we only need to update that utility function.

type supportedFormatValues = string | bigint;
const formatToEth = (x: supportedFormatValues) => ethers.utils.formatUnits(x, 18);

* - depositValue
* - serviceState
*/
static getServiceRegistryInfo = async (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
static getServiceRegistryInfo = async (
static getServiceRegistryDetails = async (

static getAvailableRewardsForEpoch = async (
stakingProgramId: StakingProgramId,
chainId: ChainId = ChainId.Gnosis,
): Promise<number | undefined> => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
): Promise<number | undefined> => {
): Promise<number> => {

stakingTokenProxy.minStakingDeposit(),
];

const multicallResponse = await multicallProvider.all(contractCalls);
Copy link
Collaborator

Choose a reason for hiding this comment

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

same, we can add type here for all multicallResponse.

// if (!services?.[0]) return;
// const serviceStatus = await ServicesService.getDeployment(services[0].hash);
// setServiceStatuses(serviceStatus.status);
// }, [services]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

any reason to keep them commented?

/**
* @note This is a mapping of all native tokens on each chain.
*/
export const NATIVE_TOKEN_CONFIG = Object.fromEntries(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really need this now 🤔.

currency: TokenSymbol.XDAI,
middlewareChain: MiddlewareChainId.GNOSIS,
rpc: process.env.GNOSIS_RPC as HttpUrl,
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

and below as well.

Suggested change
};
} as const;

truemiller and others added 27 commits November 20, 2024 12:19
…agentnotrunningbutton

refactor AgentNotRunningButton (useBalance consumer) + small changes to serviceTemplate, createService API, support multi-chain service templates and remove
…ce-section

GasBalanceSection using service-specific balances, update Olas balance component, add safeWallets to useService
truemiller and others added 30 commits November 29, 2024 21:08
…elds

Allow update metadata fields (description)
…dleware' into refactor/multi-chain-support-frontend
…to use selectedAgentConfig for balance calculations
…middleware

Allow multiple services on middleware (Major refactor)
fix zod schema for stakingRewardsDetails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants