Exchange Rate
Last updated
Last updated
In the MilkyWay protocol, it is important to maintain an accurate milkBABY: BABY exchange rate. Exchange rate is based on the following formula:
TotalNativeToken = Staked BABY + accrued staking rewards. TotalLiquidStakedToken = milkBABY minted
It will initially start at a 1:1 ratio and will be dynamically updated based on the accrued staking rewards. To understand how this works, let’s consider an example:
Alice is MilkyWay’s first user and she stakes 100 BABY, she then receives 100 milkBABY in return.
Let’s assume that time has passed and 10 rewards were accrued. Now, the new exchange rate would be:
If Alice decides to withdraw her BABY, she receives 110 BABY for 100 milkBABY based on the new exchange rate.
Please note that this is an illustrative example of how the exchange rate works and did not account for the validator’s commission and the MilkyWay DAO fee.
During the delegation process, the deposited BABY is transferred to Babylon to stake on behalf of the MilkyWay users. Once it is staked, Babylon protocol begins to accrue staking rewards every block. To update the exchange rate on the staking contract on MilkyWay, it's the responsibility of operators to regularly claim rewards and send them back to the staking contract, thereby updating the exchange rate. In MilkyWay, it leverages the authz module to grant limited authorization to withdraw staking rewards to the grantee account from the staker multisig account and the grantee account has limited authorization to IBC transfer from the rewards collector multisig account.
Here’s a step-by-step breakdown of what happens in the background:
IBC transfer the withdrawn staking rewards to the staking contract on Babylon.
Upon the staking rewards arriving on Babylon, the staking contract updates the exchange rate. This increases the value of milkBABY
over time.
The coordinator periodically monitors the accrued staking rewards of the delegations from the Staker multisig account and signs and MsgTransfer
in a transaction and broadcast it to Babylon.