sherlock-audit / 2024-08-cork-protocol-judging

2 stars 2 forks source link

Fluffy Crepe Platypus - Wrong comment #273

Closed sherlock-admin4 closed 2 months ago

sherlock-admin4 commented 2 months ago

Fluffy Crepe Platypus

Low/Info

Wrong comment

Summary

https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/DsSwapperMathLib.sol#L100

/*

In comment shows following formula S = (E + x - y + sqrt(E^2 + 2E(x + y) + (x - y)^2)) / 2

but the calculation of the code is different. // r2 = -r1 + q = q - r1 uint256 r2 = q - r1;

so the comment need to be following. S = (E - |(x - y)| + sqrt(E^2 + 2E(x + y) + (x - y)^2)) / 2