-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ComposableBridging simulation unit tests (#472)
Signed-off-by: james-a-morris <[email protected]>
- Loading branch information
1 parent
674de8c
commit 1ba4398
Showing
4 changed files
with
184 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.0; | ||
|
||
// This interface is expected to be implemented by any contract | ||
// that expects to receive messages from the SpokePool. | ||
// Retrieved from https://github.com/across-protocol/contracts-v2/blob/master/contracts/SpokePool.sol | ||
interface AcrossMessageHandler { | ||
function handleAcrossMessage( | ||
address tokenSent, | ||
uint256 amount, | ||
bool fillCompleted, | ||
address relayer, | ||
bytes memory message | ||
) external; | ||
} | ||
|
||
contract MockAcrossMessageContract is AcrossMessageHandler { | ||
function handleAcrossMessage(address, uint256, bool, address, bytes memory message) external virtual override { | ||
// For the case that we want to test a revert. | ||
require(keccak256(message) != keccak256(bytes("REVERT")), "MockAcrossMessageContract: revert"); | ||
|
||
// Iterate from 0 to 1000 to simulate a long-running operation. | ||
for (uint256 i = 0; i < 1000; i++) { | ||
// Do a bit of work. | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters