Message: ExecuteMsg::StakeToSpecificValidator
This allows whitelisted users to stake their INJ on the provided validator.
Inputs
info.senderValidation: The stake function verifies that the
info.senderis a whitelisted address.Impact: This is the address that receives TruINJ.
info.fundsValidation: The
internal_stakefunction verifies that exactly one coin (INJ) was sent.Impact: The amount of assets to stake.
validator_addrValidation: The
internal_stakefunction verifies that the validator is whitelisted.Impact: The validator on which the user wants to stake.
Branches and code coverage (including function calls)
Intended branches
Calculates the exchange rate as per the total INJ staked, calculates the rewards and the contract rewards available, and mints shares to the user based on that exchange rate.
The rewards from the validator are increased in the
CONTRACT_REWARDSstorage to be used later.The treasury is minted some fee (TruINJ) as a percentage of the validator rewards.
Negative behavior
The transaction should revert if the caller is not whitelisted.
The transaction should revert if the contract is paused.
The transaction should revert if the validator is not whitelisted.
The transaction should revert if the amount of INJ staked is less than the
min_deposit.