Function: stakeToken(uint256 amount, address token)
This function emits the Stake
event and transfers supported tokens from the caller to the rabbitx
.
Inputs
amount
Control: Fully controlled by the caller.
Constraints: The value must not be smaller than
minStakes[token]
, and the caller must have enough tokens to transfer.Impact: The amount to transfer.
token
Control: Fully controlled by the caller.
Constraints: The token must be supported by this contract.
Impact: The token to transfer.
Branches and code coverage
Intended branches
Transfer the supported tokens from the caller to the
rabbitx
.Increase the
nextStakeNum
by one when the transfer succeeds.
Negative behavior
Revert when the token is not supported.
Revert when the amount is smaller than
minStakes[token]
.Revert when the transfer fails.