From 396483bae040318f86cf7d56a4a9151a7fb1ca05 Mon Sep 17 00:00:00 2001 From: Majorfi Date: Wed, 22 Nov 2023 13:08:16 +0100 Subject: [PATCH] feat: add the new_averaged type for v2 vaults --- processes/apr/current.v2.go | 8 +++++++- processes/apr/current.v3.go | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/processes/apr/current.v2.go b/processes/apr/current.v2.go index b8f810de..85b1ebeb 100644 --- a/processes/apr/current.v2.go +++ b/processes/apr/current.v2.go @@ -54,8 +54,14 @@ func computeCurrentV2VaultAPR( ** - The fees (performance and management) ** - The points (PPS evolution over time, for one week, one month and since inception) **********************************************************************************************/ + vaultAPRType := `v2:averaged` + twoWeeksAgoBlockNumber := ethereum.GetBlockNumberXDaysAgo(chainID, 14) + if vault.Activation > twoWeeksAgoBlockNumber { + vaultAPRType = `v2:new_averaged` + } + vaultAPR := TVaultAPR{ - Type: "v2:averaged", + Type: vaultAPRType, NetAPR: netAPR, Fees: TFees{ Performance: vaultPerformanceFee, diff --git a/processes/apr/current.v3.go b/processes/apr/current.v3.go index 8a39dbe6..938c4b77 100644 --- a/processes/apr/current.v3.go +++ b/processes/apr/current.v3.go @@ -54,7 +54,6 @@ func computeCurrentV3VaultAPR( ** - The points (PPS evolution over time, for one week, one month and since inception) **********************************************************************************************/ vaultAPRType := `v3:averaged` - twoWeeksAgoBlockNumber := ethereum.GetBlockNumberXDaysAgo(chainID, 14) if vault.Activation > twoWeeksAgoBlockNumber { vaultAPRType = `v3:new_averaged`