Skip to content

Commit

Permalink
fix: useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Jun 28, 2023
1 parent 17ea3c6 commit e5c0c63
Showing 1 changed file with 0 additions and 46 deletions.
46 changes: 0 additions & 46 deletions internal/vaults/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/yearn/ydaemon/common/bigNumber"
"github.com/yearn/ydaemon/common/helpers"
"github.com/yearn/ydaemon/common/logs"
"github.com/yearn/ydaemon/common/store"
"github.com/yearn/ydaemon/internal/meta"
"github.com/yearn/ydaemon/internal/models"
"github.com/yearn/ydaemon/internal/strategies"
Expand Down Expand Up @@ -102,51 +101,6 @@ func BuildMigration(t models.TVault) models.TMigration {

func BuildAPY(t models.TVault, aggregatedVault *models.TAggregatedVault, hasLegacyAPY bool) models.TAPY {
vaultFromMeta, okMeta := meta.GetMetaVault(t.ChainID, t.Address)
newAPY := models.TNewAPY{}
ppsPerTime, _ := store.ListPricePerShare(t.ChainID, t.Address)

ppsInception := bigNumber.NewFloat(1)
ppsNow := helpers.GetToday(ppsPerTime, t.Decimals)
ppsWeekAgo := helpers.GetLastWeek(ppsPerTime, t.Decimals)
ppsMonthAgo := helpers.GetLastMonth(ppsPerTime, t.Decimals)
ppsYearAgo := helpers.GetLastYear(ppsPerTime, t.Decimals)

inceptionAPR := bigNumber.NewFloat(0).Div(
bigNumber.NewFloat(0).Sub(ppsNow, ppsInception),
bigNumber.NewFloat(1),
)
weekAgoAPR := bigNumber.NewFloat(0).Mul(
bigNumber.NewFloat(0).Sub(ppsNow, ppsWeekAgo),
bigNumber.NewFloat(0).SetFloat64(52.1428571429), // 365/7
)
monthAgoAPR := bigNumber.NewFloat(0).Mul(
bigNumber.NewFloat(0).Sub(ppsNow, ppsMonthAgo),
bigNumber.NewFloat(0).SetFloat64(12.1666666667), // 365/30
)
yearAgoAPR := bigNumber.NewFloat(0).Mul(
bigNumber.NewFloat(0).Sub(ppsNow, ppsYearAgo),
bigNumber.NewFloat(0).SetFloat64(365),
)
newAPY.PricePerShare = ppsNow
newAPY.WeekAPR = weekAgoAPR
newAPY.MonthAPR = monthAgoAPR
newAPY.YearAPR = yearAgoAPR
newAPY.InceptionAPR = inceptionAPR

newAPY.Points.WeekAgo = bigNumber.NewFloat(0).Sub(ppsNow, ppsWeekAgo)
newAPY.Points.MonthAgo = bigNumber.NewFloat(0).Sub(ppsNow, ppsMonthAgo)
newAPY.Points.YearAgo = bigNumber.NewFloat(0).Sub(ppsNow, ppsYearAgo)

newAPY.Fees.PerformanceFee = t.PerformanceFee
newAPY.Fees.ManagementFee = t.ManagementFee

// logs.Pretty(newAPY)

// "pps": 1038602519758314717
// "week_ago": 0.1583208466449797,
// "month_ago": 0.046975837400312415,
// "inception": 0.020668132598748556

apy := models.TAPY{}
if hasLegacyAPY {
apy = models.TAPY{
Expand Down

1 comment on commit e5c0c63

@vercel
Copy link

@vercel vercel bot commented on e5c0c63 Jun 28, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

ydaemon – ./docs

ydaemon.yearn.farm
ydaemon-git-main.yearn.farm

Please sign in to comment.