Function: stake(address to, uint256 amount)
This stakes PDT.
Inputs
to
Control: Completely controlled by the caller.
Constraints: None.
Impact: The address that will receive credit for staking.
amount
Control: Completely controlled by the caller.
Constraints: Cannot be zero.
Impact: The amount of PDT to stake.
Branches and code coverage
Intended branches
StakeDetails updated after staking.
Liquidity is maintained (i.e., sum of all user weights always equals the contract weight).
Negative behavior
Revert if current epoch has ended.
Revert if
msg.sender
does not have enough balance or did not set enough allowance for the contract.