code-423n4 / 2023-09-goodentry-mitigation-findings

0 stars 0 forks source link

`getActiveTickIndex` returns wrong index #53

Closed c4-submissions closed 12 months ago

c4-submissions commented 1 year ago

Lines of code

https://github.com/GoodEntry-io/ge/blob/3b80be0e86e1c01cd85906e9892e06540e12a842/contracts/GeVault.sol#L452

Vulnerability details

To find a tick that's above price (ie its only underlying is the base token), getActiveTickIndex should not

  if( (baseTokenIsToken0 && amt0 == 0) || (!baseTokenIsToken0 && amt0 == 0) ) return tickIndex;

it should

  if( (baseTokenIsToken0 && amt1 == 0) || (!baseTokenIsToken0 && amt0 == 0) ) return tickIndex;

Assessed type

Context

c4-judge commented 12 months ago

gzeon-c4 marked the issue as duplicate of #43

c4-judge commented 12 months ago

gzeon-c4 changed the severity to 2 (Med Risk)

c4-judge commented 12 months ago

gzeon-c4 marked the issue as satisfactory