Submitted by BenRai, also found by 0x37 and wasm_it
Because the fee for the protocol is not calculated correctly, the split of fees is wrong resulting in less fees for the protocol.
When calling the function flash on a RamsesV3Vault the caller initiates a flash loan. For the amount he flashes he needs to pay a fee. This fee is then divided between the protocol and the liquidity provider of the protocol. The issue arises from the fact how the share of the fees the protocol should get is calculated:
The feeProtocol is a number between 0 and 100 representing the % of fees the protocol should get, which is initially set to 80 meaning 80% of the fees should go to the protocol. With the current calculation and the initial value of 80, the protocol would only get 1/80 of the fees instead of 80% of the fees, contradicting the intended fee distribution and resulting in way less fees for the protocol than intended.
To ensure the right amount of fees are distributed to the protocol when a user initiates a flashloan change the current calculations for token0 and token 1 to the following:
keccakdog (Ramses) commented:
keccakdog (Ramses) confirmed, but disagreed with severity and commented:
gzeon (judge) commented:
For this audit, 3 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by Sathish9098 received the top score from the judge.
The following wardens also submitted reports: MrPotatoMagic and rileyholterhus.
