Function: unstake(address to, uint256 amount)
This unstakes PDT.
Inputs
to
Control: Completely controlled by the caller.
Constraints: None.
Impact: The address that will receive the unstaked PDT.
amount
Control: Completely controlled by the caller.
Constraints: Cannot be zero or more than the amount staked by
msg.sender
.Impact: The amount of PDT to unstake.
Branches and code coverage
Intended branches
Liquidity is maintained (i.e., sum of all user weights always equals the contract weight).
Amount of unstaked PDT is consistent with user weight.
Negative behavior
Revert if current epoch has ended.
Revert if unstake amount is more than the total amount staked by
msg.sender
.