31390 - [SC - High] Precision Loss in FluxTokensolgetClaimableFlux
Description
Brief/Intro
Vulnerability Details
// @audit Precision loss
function getClaimableFlux(uint256 _amount, address _nft) public view returns (uint256 claimableFlux) {
uint256 bpt = calculateBPT(_amount); // .4 times amount
uint256 veMul = IVotingEscrow(veALCX).MULTIPLIER(); // 2
uint256 veMax = IVotingEscrow(veALCX).MAXTIME(); // 365 days
uint256 fluxPerVe = IVotingEscrow(veALCX).fluxPerVeALCX(); // 5000 or 50%
uint256 fluxMul = IVotingEscrow(veALCX).fluxMultiplier(); //4 or 4x
// Amount of flux earned in 1 yr from _amount assuming it was deposited for maxtime
claimableFlux = (((bpt * veMul) / veMax) * veMax * (fluxPerVe + BPS)) / BPS / fluxMul;
//((( 40*amount * 2) / 31536000) * 31536000 * ( 5000 + 10000 ))/ 10000 / 4
// Claimable flux for alchemechNFT is different than patronNFT
if (_nft == alchemechNFT) {
claimableFlux = (claimableFlux * alchemechMultiplier) / BPS; // flux * 5 /10000 or 0.05% flux
}
}Impact Details
Suggestion / Recommendation
References
Proof of Concept
Previous31388 - [SC - Critical] Vulnerability in the poke function of Voting co...Next31397 - [SC - Critical] In Bribesol _writeVotingCheckpoint isnt called ...
Last updated
Was this helpful?