hats-finance / Possum-Labs--Portals--0xed8965d49b8aeca763447d56e6da7f4e0506b2d3

GNU General Public License v2.0
0 stars 2 forks source link

portal doesn't consider principal token price #50

Open hats-bug-reporter[bot] opened 10 months ago

hats-bug-reporter[bot] commented 10 months ago

Github username: @0xmahdirostami Twitter username: 0xmahdirostami Submission hash (on-chain): 0xebec665eb9822b2ea49df386822c2e9e49aa15c767e34dea384a261f682a2f74 Severity: high

Description: Description\

The current implementation of the portal gives the same energy for staking the same amount of tokens, regardless of their prices. This means users receive the same amount of energy even if they choose a portal with a more expensive token. The portal should consider the price of the principal token when calculating energy to ensure a fair distribution of yield.

Imagine two portals—one with HLP tokens and the other with WETH tokens. Right now, both portals give the same energy for staking the same amount of tokens, regardless of their prices. For example, if User A puts 1e18 tokens in the HLP portal, and User B puts the same amount in the WETH portal, both get the same energy. This energy can be converted to PSM tokens.

Impact\ The current implementation can result in users receiving less profit if they choose a portal with a more expensive token.

Attachments\

  1. Proof of Concept (PoC) File

  2. Revised Code File (Optional)

    It's recommended to adjust the portal energy calculation to consider the price of the principal token. This ensures that users receive energy based on the actual value of their staked tokens, providing a fair distribution of yield.

0xmahdirostami commented 10 months ago

@PossumLabsCrypto Sorry for this submission, this issue is invalid, by changing _FUNDING_EXCHANGE_RATIO value, the portal could consider the principal token price.