NexusMutual / smart-contracts

GNU General Public License v3.0
170 stars 62 forks source link

feat: Batch NXM withdrawals #1201

Closed roxdanila closed 3 months ago

roxdanila commented 3 months ago

Context

Closes https://github.com/NexusMutual/smart-contracts/issues/1173

Add TokenController.withdrawNXM to withdraw all NXM from the platform. The caller must do the checks if the NXM is withdrawable and modify params accordingly to skip / include specific NXM withdrawals.

Changes proposed in this pull request

Test plan

Checklist

Review

When reviewing a PR, please indicate intention in comments using the following emojis:

rackstar commented 3 months ago

There is an edge case where the user might be prevented from withdrawing available rewards. If user has expired stake / claimable rewards for a tranche but has locked NXM for governance.

https://github.com/NexusMutual/smart-contracts/blob/release-candidate/contracts/modules/staking/StakingPool.sol#L554

Screenshot 2024-08-09 at 16 23 49

I guess, waiting for gov lock to expire is not a big deal. but wanted to flag this scenario in any case

@shark0der @roxdanila @MilGard91

rackstar commented 3 months ago

marking as draft so it won't be accidentally merged while on audit