Merge pull request 'fix: Stake.sol: exitPosition guard order (owner check before existence) (#307)' (#336) from fix/issue-307 into master
This commit is contained in:
commit
8c336ae0f5
1 changed files with 3 additions and 3 deletions
|
|
@ -323,12 +323,12 @@ contract Stake {
|
|||
/// @dev Pays the due taxes based on the TAX_FLOOR_DURATION and returns the remaining assets to the position owner.
|
||||
function exitPosition(uint256 positionId) external {
|
||||
StakingPosition storage pos = positions[positionId];
|
||||
if (pos.owner != msg.sender) {
|
||||
revert NoPermission(msg.sender, pos.owner);
|
||||
}
|
||||
if (pos.creationTime == 0) {
|
||||
revert PositionNotFound(positionId, msg.sender);
|
||||
}
|
||||
if (pos.owner != msg.sender) {
|
||||
revert NoPermission(msg.sender, pos.owner);
|
||||
}
|
||||
// to prevent snatch-and-exit grieving attack, pay TAX_FLOOR_DURATION
|
||||
_payTax(positionId, pos, TAX_FLOOR_DURATION);
|
||||
_exitPosition(positionId, pos);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue