I am looking at this repo, which is contracts for a decentralized pegged asset issuance system backed by liquid staking tokens like rETH. Specifically, I have a question about the functions unstake in contracts/bridges/BridgeRETH.sol and unstakeETH in contracts/facets/BridgeRouterFacet.sol, which allow you to remove your rETH from the system and get ETH back. unstakeEth calls unstake

My question is, where in these functions does it specify that ETH should actually be sent to the wallet that called them? I know when you, say, call a deposit function, you include the ETH with your call, basically, so you want see something in the code that says ETH is being transferred. But here we start with rETH.

Here is a link to the repo

1 Answer 1


The BridgeRouterFacet contract's unstakeETH() function:

 function unstakeEth(address bridge, uint88 zethAmount)
        if (zethAmount == 0) revert Errors.ParameterIsZero();

        uint88 fee = zethAmount.mulU88(bridge.unstakeFee());

        uint256 vault;
        if (bridge == rethBridge || bridge == stethBridge) {
            vault = Vault.CARBON;
        } else {
            vault = s.bridge[bridge].vault;

        if (fee > 0) {
            zethAmount -= fee;
            s.vaultUser[vault][address(this)].ethEscrowed += fee;
        uint88 ethAmount = _ethConversion(vault, zethAmount);
        vault.removeZeth(zethAmount, fee);
        IBridge(bridge).unstake(msg.sender, ethAmount);
        emit Events.UnstakeEth(bridge, msg.sender, zethAmount, fee);

Like you pointed out, this function calls unstake() with msg.sender here:

IBridge(bridge).unstake(msg.sender, ethAmount);

And then in the BridgeRETH contract's unstake function:

 function unstake(address to, uint256 amount) external onlyDiamond {
        IRocketTokenRETH rocketETHToken = _getRethContract();
        uint256 rethValue = rocketETHToken.getRethValue(amount);
        uint256 originalBalance = address(this).balance;
        uint256 netBalance = address(this).balance - originalBalance;
        if (netBalance == 0) revert NetBalanceZero();
        (bool sent,) = to.call{value: netBalance}("");

You can see the ETH being transferred in this line:

(bool sent,) = to.call{value: netBalance}("");

call is a global method in Solidity that allows you to interact with other addresses by sending data and/or ETH.

You can learn more about call here, here, and here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.