shapeshift / web

ShapeShift Web
https://app.shapeshift.com
MIT License
157 stars 180 forks source link

fix: opportunities with only undelegations do not display #6783

Closed gomesalexandre closed 2 weeks ago

gomesalexandre commented 2 weeks ago

Description

This does what it says on the box - currently, we do not consider opportunities with only undelegations to be active in selectAggregatedEarnUserStakingOpportunitiesIncludeEmpty. This accidentally "works" on prod currently as most users would either have a staking balance or rewards for most opportunities, but e.g unstaking FOXy with delayed 14 days unstake, and not having a staking balance anymore will currently rug the opportunity, which will not display.

Pull Request Type

Issue (if applicable)

closes https://github.com/shapeshift/web/issues/6776

Risk

High Risk PRs Require 2 approvals

What protocols, transaction types or contract interactions might be affected by this PR?

None

Testing

  1. Either test with a user that has an unstaking balance but no staking one for FOXy or
  2. Get the address of any user that has FOXy unstaking (regardless of whether or not they have a balance) and revert the revert of the monkey patch in 602d0cb9c566a63f134092d6e2b2d3fc5d533799. Max's 0x55 address can be used if going the second route

Engineering

Operations

Screenshots (if applicable)

Screenshot 2024-04-30 at 21 48 34 image
kaladinlight commented 2 weeks ago

with hacks to force stakedAmountCryptoBaseUnit = 0 and undelegationAmountCryptoBaseUnit = >0, I am seeing the opportunity as described: image