Skip to content

Commit

Permalink
Rays protocol boost net value cond
Browse files Browse the repository at this point in the history
  • Loading branch information
piekczyk committed Jun 20, 2024
1 parent 8e964cb commit c6cbc43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions features/omni-kit/helpers/getOmniSidebarRaysBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export const getOmniSidebarRaysBanner = ({
const swapBoost = getSwapBoost(positionRaysMultipliersData)

if (isOpening) {
const simulatedBaseRaysPerYear =
simulation && 'netValue' in simulation ? getPointsPerYear(simulation.netValue.toNumber()) : 0
const netValue = simulation && 'netValue' in simulation ? simulation.netValue.toNumber() : 0
const simulatedBaseRaysPerYear = getPointsPerYear(netValue)

if (simulatedBaseRaysPerYear === 0) {
return null
Expand All @@ -66,7 +66,7 @@ export const getOmniSidebarRaysBanner = ({
// if user already have position on currently used protocol, use current protocol boost
const raysPerYear = positionRaysMultipliersData.allUserProtocols.includes(protocol)
? simulatedBaseRaysPerYear * protocolBoost
: simulatedBaseRaysPerYear * getRaysNextProtocolBonus(protocolBoost)
: simulatedBaseRaysPerYear * getRaysNextProtocolBonus(protocolBoost, netValue)

let rays

Expand Down
9 changes: 8 additions & 1 deletion features/rays/getRaysNextProtocolBonus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
* This method is simplified since next protocol bonus depends not only on current user protocols
* (i.e. if user has position on maker, and morpho, and he opens new one on morpho, next protocol bonus shouldn't be applied)
* but also on position net value of each position needs to be above 5k USD net to be eligible for protocol bonus
* This method verifies only whether new position net value is > 5k USD
*
* @param currentMultiplier - current protocol boost
* @param netValue - net value USD of position being created
*
* @returns simplified next protocol bonus which doesn't take into account net value of existing positions on different protocols (TBD)
*/

export const getRaysNextProtocolBonus = (currentMultiplier: number) => {
export const getRaysNextProtocolBonus = (currentMultiplier: number, netValue: number) => {
if (netValue < 5000) {
return currentMultiplier
}

switch (true) {
case currentMultiplier >= 2:
return 3
Expand Down

0 comments on commit c6cbc43

Please sign in to comment.