You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method _collectRentAction contains the following code:
...
} else if (!_foreclosed && _limitHit && _marketLocked) {
// CASE 4
// didn't foreclose AND
// did hit time limit AND
// did lock market
// THEN refund rent between the earliest event and now
if (_cardTimeLimitTimestamp < marketLockingTime) {
// time limit hit before market locked
_timeOfThisCollection = _cardTimeLimitTimestamp;
_newOwner = true;
_refundTime = block.timestamp - _cardTimeLimitTimestamp;
} else {
// market locked before time limit hit
_timeOfThisCollection = marketLockingTime;
_newOwner = false;
_refundTime = block.timestamp - marketLockingTime;
}
} else if (_foreclosed && !_limitHit && !_marketLocked) {
// CASE 5
// did foreclose AND
// didn't hit time limit AND
// didn't lock market
// THEN rent OK, find new owner
_timeOfThisCollection = _timeUserForeclosed;
_newOwner = true;
_refundTime = 0;
} else if (_foreclosed && !_limitHit && _marketLocked) {
// CASE 6
// did foreclose AND
// didn't hit time limit AND
// did lock market
// THEN if foreclosed first rent ok, otherwise refund after locking
if (_timeUserForeclosed < marketLockingTime) {
// user foreclosed before market locked
_timeOfThisCollection = _timeUserForeclosed;
_newOwner = true;
_refundTime = 0;
} else {
// market locked before user foreclosed
_timeOfThisCollection = marketLockingTime;
_newOwner = false;
_refundTime = block.timestamp - marketLockingTime;
}
} else if (_foreclosed && _limitHit && !_marketLocked) {
// CASE 7
// did foreclose AND
// did hit time limit AND
// didn't lock market
// THEN if foreclosed first rent ok, otherwise refund after limit
if (_timeUserForeclosed < _cardTimeLimitTimestamp) {
// user foreclosed before time limit
_timeOfThisCollection = _timeUserForeclosed;
_newOwner = true;
_refundTime = 0;
} else {
// time limit hit before user foreclosed
_timeOfThisCollection = _cardTimeLimitTimestamp;
_newOwner = true;
_refundTime = _timeUserForeclosed - _cardTimeLimitTimestamp;
}
} else {
// CASE 8
// did foreclose AND
// did hit time limit AND
// did lock market
// THEN (╯°益°)╯彡┻━┻
if (
_timeUserForeclosed <= _cardTimeLimitTimestamp &&
_timeUserForeclosed < marketLockingTime
) {
// user foreclosed first (or at same time as time limit)
_timeOfThisCollection = _timeUserForeclosed;
_newOwner = true;
_refundTime = 0;
} else if (
_cardTimeLimitTimestamp < _timeUserForeclosed &&
_cardTimeLimitTimestamp < marketLockingTime
) {
// time limit hit first
_timeOfThisCollection = _cardTimeLimitTimestamp;
_newOwner = true;
_refundTime = _timeUserForeclosed - _cardTimeLimitTimestamp;
} else {
// market locked first
_timeOfThisCollection = marketLockingTime;
_newOwner = false;
_refundTime = _timeUserForeclosed - marketLockingTime;
}
...
On the case 6, instead of doing _refundTime = _timeUserForeclosed - marketLockingTime; like the following cases, is doing _refundTime = block.timestamp - marketLockingTime;.
This could lead to funds being drained by the miscalculation.
The text was updated successfully, but these errors were encountered:
Handle
a_delamo
Vulnerability details
Impact
The method
_collectRentAction
contains the following code:On the case 6, instead of doing
_refundTime = _timeUserForeclosed - marketLockingTime;
like the following cases, is doing_refundTime = block.timestamp - marketLockingTime;
.This could lead to funds being drained by the miscalculation.
The text was updated successfully, but these errors were encountered: