diff --git a/apps/operate/components/Contracts/hooks.ts b/apps/operate/components/Contracts/hooks.ts index 4674e2f8..5ec63eed 100644 --- a/apps/operate/components/Contracts/hooks.ts +++ b/apps/operate/components/Contracts/hooks.ts @@ -16,10 +16,14 @@ const AVAILABLE_ON: Record
= { '0x0000000000000000000000005344b7dd311e5d3dddd46a4f71481bd7b05aaa3e': 'quickstart', }; -const getApy = (rewardsPerSecond: bigint, minStakingDeposit: bigint) => { +const getApy = ( + rewardsPerSecond: bigint, + minStakingDeposit: bigint, + maxNumAgentInstances: bigint, +) => { const rewardsPerYear = rewardsPerSecond * BigInt(ONE_YEAR); const apy = (rewardsPerYear * BigInt(100)) / minStakingDeposit; - return (Number(apy) / 100).toFixed(2); + return Number(apy) / (1 + Number(maxNumAgentInstances)); }; const getStakeRequired = (minStakingDeposit: bigint, numAgentInstances: bigint) => { @@ -103,7 +107,7 @@ export const useStakingContractsList = () => { const minStakingDeposit = minStakingDepositList[index] as bigint; const numAgentInstances = numAgentInstancesList[index] as bigint; - const apy = getApy(rewardsPerSecond, minStakingDeposit); + const apy = getApy(rewardsPerSecond, minStakingDeposit, numAgentInstances); const stakeRequired = getStakeRequired(minStakingDeposit, numAgentInstances); return { diff --git a/apps/operate/types/index.ts b/apps/operate/types/index.ts index 2b44b8bf..1a52a8cf 100644 --- a/apps/operate/types/index.ts +++ b/apps/operate/types/index.ts @@ -12,7 +12,7 @@ export type StakingContract = { metadata: Metadata; availableSlots: number; maxSlots: number; - apy: string; + apy: number; stakeRequired: string; availableOn: 'pearl' | 'quickstart' | null; };