The AfEth ratio between the collaterals can be modified but there is no direct way to balance the assets to follow the new ratio.
The AfEth contract contains a configurable parameter ratio
that indicates the intended balance between the two collaterals, SafEth and the Votium strategy. For example, a value of 3e17
means that 30% of the TVL should go to SafEth, and 70% should go to Votium.
This ratio is followed when new deposits are made. The deposited ETH is splitted according to the ratio and channeled in proportion to each collateral. The ratio is also checked when rewards are deposited to direct them to the proper collateral.
The ratio can also be modified by the admins of the protocol using the setRatio()
function.
https://github.com/code-423n4/2023-09-asymmetry/blob/main/contracts/AfEth.sol#L90-L92
90: function setRatio(uint256 _newRatio) public onlyOwner {
91: ratio = _newRatio;
92: }
However, there is no way to balance the assets once a new ratio is defined. The implementation will need to rely on new deposits and reward compounding to slowly correct the offset, which may take a lot of time and may be impractical for most cases.
Let's assume the protocol is deployed with a ratio of 3e17
.
- Deposits follow the configured ratio and split the TVL in 30% for SafEth and 70% for Votium.
- At some point, the protocol decides to switch to 50%-50% and sets a new ratio of
5e17
. - New deposits will follow the new ratio and split 50% for each collateral, but these have potentially accumulated a large amount of TVL with the previous split. The existing difference will continue, new deposits can't correct this offset.
Similar to how it is done in SafEth, the AfEth contract could have a rebalancing function which withdraws the proper amount from one collateral and deposits it in the other collateral, in order to correct the offset and target the new configured ratio. This function should be admin controlled, and support slippage control to correctly handle potentially large amounts of swaps.
An alternative could be to also correct a potential deviation in the ratio using new deposits. This could help speed up the correction by not only relying on rewards, but will also endure a delay in the convergence.