Skip to content

Commit

Permalink
feat: update zevm connector to accept zeta in onreceive (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresaiello authored Apr 22, 2024
1 parent 4be6fd4 commit 211e1d1
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 36 deletions.
7 changes: 5 additions & 2 deletions contracts/zevm/ZetaConnectorZEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ contract ZetaConnectorZEVM {
error WZETATransferFailed();
error OnlyFungibleModule();
error FailedZetaSent();
error WrongValue();

/// @notice Fungible module address.
address public constant FUNGIBLE_MODULE_ADDRESS = payable(0x735b14BB79463307AAcBED86DAf3322B1e6226aB);
Expand Down Expand Up @@ -162,7 +163,8 @@ contract ZetaConnectorZEVM {
uint256 zetaValue,
bytes calldata message,
bytes32 internalSendHash
) external onlyFungibleModule {
) external payable onlyFungibleModule {
if (msg.value != zetaValue) revert WrongValue();
IWETH9(wzeta).deposit{value: zetaValue}();
if (!IWETH9(wzeta).transferFrom(address(this), destinationAddress, zetaValue)) revert WZETATransferFailed();

Expand All @@ -188,7 +190,8 @@ contract ZetaConnectorZEVM {
uint256 remainingZetaValue,
bytes calldata message,
bytes32 internalSendHash
) external onlyFungibleModule {
) external payable onlyFungibleModule {
if (msg.value != remainingZetaValue) revert WrongValue();
IWETH9(wzeta).deposit{value: remainingZetaValue}();
if (!IWETH9(wzeta).transferFrom(address(this), zetaTxSenderAddress, remainingZetaValue))
revert WZETATransferFailed();
Expand Down
Loading

0 comments on commit 211e1d1

Please sign in to comment.