Assessment reports>Silo Staking>Threat Model>Message: ExecuteMsg::Harvest

Message: ExecuteMsg::Harvest

The message could be used by anyone. It calls the harvest function, which withdraws the delegation rewards and restakes these rewards.

The parameters that a user can control are the following:

validators — The list of validators from which delegation rewards are to be withdrawn for redelegation. withdrawals — A vector of a tuple containing WithdrawType and DenomType. A custom withdrawals vector could only be sent by the operator; therefore, addresses without access control could not provide a custom withdrawals vector. stages — A vector of a tuple containing StageType, DenomType, and Option<Decimal> for price and Option<Uint128> for max amount. A custom stages vector could only be sent by the operator; therefore, addresses without access control could not provide a custom stages vector.

The message executes the harvest function, which first withdraws the delegation rewards from the provided validators. If validators are not provided, all the validators are used. Next, there is an optional callback to withdraw LPs and then to swap these tokens to the required utokens. The function also stores the current snapshot of the balance, which is passed to the CallbackMsg::CheckReceivedCoin message, and the newly received coins are added to the unlocked_coins during the callback.

After updating the unlocked_coins, the function sends a callback message CallbackMsg::Reinvest to this contract, which will reinvest the received tokens stored in unlocked_coins.

Zellic © 2024Back to top ↑