Closed rajatbeladiya closed 1 year ago
BorrowingVault.sol
https://github.com/Fujicracy/fuji-v2/blob/50fd0b74ccee1a73a459118e50e044a2bcfacd10/packages/protocol/src/vaults/borrowing/BorrowingVault.sol#L419
The _convertDebtToShares() function in the BorrowingVault contract returns debt as shares when the debtSharesSupply is 0. This results in the first borrower receiving all the shares and subsequent borrower getting fewer shares than they should.
_convertDebtToShares()
BorrowingVault
debtSharesSupply is 0
Scenario:
this will be loss for the first borrower because he will get more shares of debt. he needs to repay more in terms of other users.
High
Uniswap solves this problem by sending 1000 tokens to zero address. similarly you should send some amount of initial shares to zero address.
The inflation attack was resolved in pull request #541.
Affected Contract
BorrowingVault.sol
https://github.com/Fujicracy/fuji-v2/blob/50fd0b74ccee1a73a459118e50e044a2bcfacd10/packages/protocol/src/vaults/borrowing/BorrowingVault.sol#L419
Description
The
_convertDebtToShares()
function in theBorrowingVault
contract returns debt as shares when thedebtSharesSupply is 0
. This results in the first borrower receiving all the shares and subsequent borrower getting fewer shares than they should.https://github.com/Fujicracy/fuji-v2/blob/50fd0b74ccee1a73a459118e50e044a2bcfacd10/packages/protocol/src/vaults/borrowing/BorrowingVault.sol#L419
Scenario:
Impact:
this will be loss for the first borrower because he will get more shares of debt. he needs to repay more in terms of other users.
Severity:
High
Recommendation:
Uniswap solves this problem by sending 1000 tokens to zero address. similarly you should send some amount of initial shares to zero address.