eclypse-labs / eclypse-core

The core contracts of the eclypse protocol
1 stars 0 forks source link

PositionsManager - _liquidatable function #16

Closed gaspardthrl closed 1 year ago

gaspardthrl commented 1 year ago

I don't see the point of this function.

Also, I don't understand its implementation. Why don't it uses the collRatioOf function and just checks if it's smaller than the minCR?

The current implementation: function liquidatable(uint256 _tokenId) public view override returns (bool) { Position memory position = positionFromTokenId[_tokenId]; return _liquidatable(positionValueInETH(_tokenId), debtOfInETH(_tokenId), riskConstantsFromPool[position.poolAddress].minCR); }

Could be replaced (The tests still work) by: function liquidatable(uint256 _tokenId) public view override returns (bool) { Position memory position = positionFromTokenId[_tokenId]; return collRatioOf(_tokenId) < riskConstantsFromPool[position.poolAddress].minCR; }

gaspardthrl commented 1 year ago

If we do gas optimization then we need to take fees into account when computing positionsAmount

gaspardthrl commented 1 year ago

Pushed

devsquaaa commented 1 year ago

ea8e272cb0fe91caf8176decb2a5a16d3a273ea2