Skip to content

Commit

Permalink
tasks: fix hop bridger task
Browse files Browse the repository at this point in the history
  • Loading branch information
facuspagnuolo committed Sep 24, 2024
1 parent 65c7773 commit 618be66
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 169 deletions.
9 changes: 4 additions & 5 deletions packages/tasks/contracts/bridge/HopBridger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ contract HopBridger is IHopBridger, BaseBridgeTask {
}

/**
* @dev Sets the max deadline
* @dev Sets the max deadline. Only used when bridging to L2.
* @param newMaxDeadline New max deadline to be set
*/
function setMaxDeadline(uint256 newMaxDeadline) external override authP(authParams(newMaxDeadline)) {
Expand Down Expand Up @@ -128,8 +128,8 @@ contract HopBridger is IHopBridger, BaseBridgeTask {
if (amount == 0) amount = getTaskAmount(token);
_beforeHopBridger(token, amount, slippage, fee);

uint256 amountAfterFees = amount - fee;
uint256 minAmountOut = amountAfterFees.mulUp(FixedPoint.ONE - slippage);
uint256 destinationChain = getDestinationChain(token);
uint256 minAmountOut = (amount - fee).mulUp(FixedPoint.ONE - slippage);
bytes memory connectorData = abi.encodeWithSelector(
IHopBridgeConnector.execute.selector,
getDestinationChain(token),
Expand All @@ -138,7 +138,7 @@ contract HopBridger is IHopBridger, BaseBridgeTask {
minAmountOut,
recipient,
tokenHopEntrypoint[token],
block.timestamp + maxDeadline,
destinationChain == 1 ? 0 : (block.timestamp + maxDeadline),
relayer,
fee
);
Expand Down Expand Up @@ -174,7 +174,6 @@ contract HopBridger is IHopBridger, BaseBridgeTask {
* @dev Sets the max deadline
*/
function _setMaxDeadline(uint256 _maxDeadline) internal {
if (_maxDeadline == 0) revert TaskMaxDeadlineZero();
maxDeadline = _maxDeadline;
emit MaxDeadlineSet(_maxDeadline);
}
Expand Down
5 changes: 0 additions & 5 deletions packages/tasks/contracts/interfaces/bridge/IHopBridger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ import './IBaseBridgeTask.sol';
* @dev Hop bridger task interface
*/
interface IHopBridger is IBaseBridgeTask {
/**
* @dev The max deadline is zero
*/
error TaskMaxDeadlineZero();

/**
* @dev The Hop entrypoint is zero
*/
Expand Down
Loading

0 comments on commit 618be66

Please sign in to comment.