Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMR-1834-WETH-Bridging #12

Merged
merged 17 commits into from
Oct 26, 2023
Merged
Prev Previous commit
Next Next commit
formatting
  • Loading branch information
proletesseract committed Oct 26, 2023
commit 0a6034a9131b6c92cafc1ab12d324314714cca20
7 changes: 3 additions & 4 deletions src/root/RootERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ contract RootERC20Bridge is
// ETH, WETH and IMX do not need to be mapped since it should have been mapped on initialization
// ETH also cannot be transferred since it was received in the payable function call
// WETH is also not transferred here since it was earlier unwrapped to ETH

// TODO We can call _mapToken here, but ordering in the GMP is not guaranteed.
// Therefore, we need to decide how to handle this and it may be a UI decision to wait until map token message is executed on child chain.
// Discuss this, and add this decision to the design doc.
Expand All @@ -250,11 +250,11 @@ contract RootERC20Bridge is
}
}
rootToken.safeTransferFrom(msg.sender, address(this), amount);
}
}

// Deposit sig, root token address, depositor, receiver, amount
bytes memory payload = abi.encode(DEPOSIT_SIG, payloadToken, msg.sender, receiver, amount);

// TODO investigate using delegatecall to keep the axelar message sender as the bridge contract, since adaptor can change.
rootBridgeAdaptor.sendMessage{value: feeAmount}(payload, msg.sender);

Expand All @@ -268,5 +268,4 @@ contract RootERC20Bridge is
emit ERC20Deposit(address(rootToken), childToken, msg.sender, receiver, amount);
}
}

}
4 changes: 1 addition & 3 deletions test/integration/root/RootERC20Bridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,7 @@ contract RootERC20BridgeIntegrationTest is Test, IRootERC20BridgeEvents, IRootAx
vm.expectEmit(address(axelarAdaptor));
emit MapTokenAxelarMessage(CHILD_CHAIN_NAME, childBridgeAdaptorString, predictedPayload);
vm.expectEmit(address(rootBridge));
emit WETHDeposit(
address(WRAPPED_ETH), address(this), address(this), tokenAmount
);
emit WETHDeposit(address(WRAPPED_ETH), address(this), address(this), tokenAmount);
vm.expectCall(
address(axelarAdaptor),
depositFee,
Expand Down