diff --git a/contracts/polygon/connectors/hop/events.sol b/contracts/polygon/connectors/hop/events.sol index 5f3f3ed5..9594f4a5 100644 --- a/contracts/polygon/connectors/hop/events.sol +++ b/contracts/polygon/connectors/hop/events.sol @@ -4,7 +4,6 @@ pragma solidity ^0.7.0; contract Events { event LogBridge( address token, - bool isWrapped, uint256 chainId, address recipient, uint256 amount, diff --git a/contracts/polygon/connectors/hop/helpers.sol b/contracts/polygon/connectors/hop/helpers.sol index aaf0ba46..5f3d306a 100644 --- a/contracts/polygon/connectors/hop/helpers.sol +++ b/contracts/polygon/connectors/hop/helpers.sol @@ -18,7 +18,6 @@ contract Helpers is DSMath, Basic { * @param sourceDeadline The deadline for the source chain transaction (Recommended - Date.now() + 604800 (1 week)) * @param destinationAmountOutMin minimum amount of token out for bridge on target chain, zero for L1 bridging * @param destinationDeadline The deadline for the target chain transaction (Recommended - Date.now() + 604800 (1 week)), zero for L1 bridging - * @param isWrapped if the token to transfer if wrapped token of native chain token (ex. WETH) */ struct BridgeParams { address token; @@ -31,31 +30,16 @@ contract Helpers is DSMath, Basic { uint256 sourceDeadline; uint256 destinationAmountOutMin; uint256 destinationDeadline; - bool isWrapped; } function _swapAndSend(BridgeParams memory params, bool isNative) internal { IHopRouter router = IHopRouter(params.router); - if (isNative) { - router.swapAndSend{ value: params.amount }( - params.targetChainId, - params.recipient, - params.amount, - params.bonderFee, - params.sourceAmountOutMin, - params.sourceDeadline, - params.destinationAmountOutMin, - params.destinationDeadline - ); - - return; - } - + uint256 nativeTokenAmt = isNative ? params.amount : 0; TokenInterface tokenContract = TokenInterface(params.token); approve(tokenContract, params.router, params.amount); - router.swapAndSend( + router.swapAndSend{ value: nativeTokenAmt }( params.targetChainId, params.recipient, params.amount, diff --git a/contracts/polygon/connectors/hop/main.sol b/contracts/polygon/connectors/hop/main.sol index 20d9fa16..e1c7ebc6 100644 --- a/contracts/polygon/connectors/hop/main.sol +++ b/contracts/polygon/connectors/hop/main.sol @@ -39,12 +39,8 @@ abstract contract Resolver is Helpers { params.amount = getUint(getId, params.amount); TokenInterface tokenContract = TokenInterface(params.token); - if (params.isWrapped) { - convertWmaticToMatic( - params.isWrapped, - tokenContract, - params.amount - ); + if (params.token == wmaticAddr) { + convertWmaticToMatic(true, tokenContract, params.amount); params.token = maticAddr; } @@ -62,10 +58,9 @@ abstract contract Resolver is Helpers { _swapAndSend(params, isNative); - _eventName = "LogBridge(address,bool,uint256,address,uint256,uint256,uint256,uint256,uint256,uint256,uint256)"; + _eventName = "LogBridge(address,uint256,address,uint256,uint256,uint256,uint256,uint256,uint256,uint256)"; _eventParam = abi.encode( params.token, - params.isWrapped, params.targetChainId, params.recipient, params.amount,