Message: ExecuteMsg::Stake
This allows whitelisted users to stake their INJ on the default validator.
Inputs
info.sender
Validation: The stake function verifies that the
info.sender
is a whitelisted address.Impact: This is the address that recieves TruINJ.
info.funds
Validation: The
internal_stake
function verifies that exactly one coin (INJ) was sent.Impact: The amount of assets 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_REWARDS
storage 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 amount of INJ staked is less than the
min_deposit
.