Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong variable assignment makes TOB::exitPosition() never check for expiry #247

Open
0xRektora opened this issue Aug 20, 2024 · 1 comment
Labels
bug Something isn't working to be reviewed

Comments

@0xRektora
Copy link
Contributor

Context
In TOB::exitPosition() we check for the time of expiry using

            if (!isSGLInRescueMode) {
                if (block.timestamp < lock.lockTime + lock.lockDuration) {
                    revert LockNotExpired();
                }
            }

However, on the V2 change, we added a new check on the user's BB debt

        // Check if debt ratio is below threshold, if so bypass lock expiration
        if (tOLP.canLockWithDebt(oTAP.ownerOf(_oTAPTokenID), uint256(lock.sglAssetID), uint256(lock.ybShares))) {
            // If SGL is in rescue, bypass the lock expiration
            isSGLInRescueMode = true;
            if (!isSGLInRescueMode) {
                if (block.timestamp < lock.lockTime + lock.lockDuration) {
                    revert LockNotExpired();
                }
            }
        }

The new addition

+             isSGLInRescueMode = true;

makes so the expiry check is never reached, and it should be removed.

@0xRektora
Copy link
Contributor Author

@0xRektora 0xRektora added the bug Something isn't working label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working to be reviewed
Projects
None yet
Development

No branches or pull requests

1 participant