manifoldfinance / mevETH2

mevETH LST Protocol - Repo has migrated see link
https://github.com/MEV-Protocol/meveth
27 stars 2 forks source link

grantExit function needed for validator exit funds to be refunded to MevEth #44

Closed sandybradley closed 1 year ago

sandybradley commented 1 year ago

Problem

In a similar fashion to grantRewards, a function is needed to refund validator exits. This cannot be the same as grantRewards because it should not increase the value of elastic balance based on the value sent and should account for slashing. Related to https://github.com/manifoldfinance/mevETH2/issues/27

Solution

Function or receive acceptance of eth from validator exits. e.g.

    /// @notice grant validator exit funds (32 eth) refunded to contract
    function grantExit() external payable onlyOperator {
        if (msg.value == 0) {
            revert MevEthErrors.ZeroValue();
        }
        if (msg.value < 32 ether) {
            // assume slashed value so reduce elastic balance accordingly
            assetRebase.elastic -= (32 ether - msg.value);
        } else {
            // account for any unclaimed rewards
            assetRebase.elastic += (msg.value - 32 ether);
        }
    }
aldoborrero commented 1 year ago

This is also related to manifoldfinance/mevETH2#22 (ideally these events are necessary for contract observability outside the EVM and probably used by the mevETH-controller repository).