Message: ExecuteMsg::Rebalance
The message could only be used by the address with owner
privileges and is used to rebalance the delegations based on the delegation_goal
.
The parameter that a user can control is min_redelegation
— the minimum value that the delegations should contain after rebalancing.
The message executes the rebalance
function. It calls the compute_redelegations_for_rebalancing
function, which computes the redelegation moves that will make each validator's delegation the targeted amount as per the delegation_goal
. The new_redelegations
returned from the compute_redelegations_for_rebalancing
call are filtered such that any redelegation amount less than min_redelegation
are skipped. Next, the function executes the redelegation message.
The rebalance
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.