hats-finance / Inverter-Network-0xe47e52c4fea05e555920f1dcdcc6fb8eca103eeb

Fork of the Inverter Smart Contracts Repository
GNU Lesser General Public License v3.0
0 stars 3 forks source link

Fixed deposit cap and max supply are problematic in `FM_Rebasing_v1` with some tokens #145

Open hats-bug-reporter[bot] opened 2 weeks ago

hats-bug-reporter[bot] commented 2 weeks ago

Github username: @0xfuje Twitter username: 0xfuje Submission hash (on-chain): 0x33b9aceacdd87f93fe9b7ebd8c2441bd15c25b69562c362f046e8edc94190837 Severity: medium

Description:

Impact

Funding manager's profitability is limited: it will quickly reach max supply and will be highly inefficient

Description

The rebasing funding manager's DEPOSIT CAP is set to 100_000_000e18 & it's MAX_SUPPLY is set to 1_000_000_000e18. The problem with this fixed parameters is that there are tokens which will be practically uncompatible with it (most notably low $ value per wei tokens OR high decimal tokens), because the deposit cap and max supply will be reached very easily.

Unsupported tokens

Here is a short list of a few tokens that might be problematic (this is just to name a few examples, not an all inclusive list)

Proof of Concept

  1. FM_Rebasing_v1 is initialized with an orchestratorToken of Bittorrent
  2. The token has very low $USD value per 1 wei: at current prices deposit cap will be reached with $94 and max supply with $944 worth of tokens
  3. Some people can't deposit due to surpassing the deposit cap and have to try again with multiple of tx's with deposit cap
  4. Max supply will be reached and there is no way to deposit more tokens for users, which will limit the funding manager's profitability
  5. This is problematic for the whole system: e.g.: if payment based modules need funds, they might fail a direct .executeTxFromModule call due to needing more funds than the deposit cap OR the orchestrator admin might have to empty the funding manager (wait for users to deposit to reach max_supply -> send -> repeat) multiple times to send enough funds to these modules

Recommendation

Consider to allow an option to set maxSupply and depositCap parameters in the initialization of rebasing funding manager, if it's not provided the current values can be used. Alternatively, consider to raise these parameters by 1_000: this would make sure only a very very small number of tokens incompatible.

0xfuje commented 2 weeks ago

Forgot to mention that low $ value per wei tokens might be problematic in bonding curve funding manager as well, since BancorFormula has an upper computational limit

PlamenTSV commented 2 weeks ago

Generally upgradability should deal with the deposit caps between different orchestrators. Will leave for second opinion, but seems valid.