Skip to content

Commit

Permalink
Merge pull request #4 from Ion-Protocol/carson/crosschain-op
Browse files Browse the repository at this point in the history
Unique bridge Packet ID Tests
  • Loading branch information
junkim012 authored Aug 15, 2024
2 parents 122666b + 2395323 commit ab8958c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/CrossChain/CrossChainOPTellerWithMultiAssetSupport.t.sol
Original file line number Diff line number Diff line change
@@ -88,6 +88,35 @@ contract CrossChainOPTellerWithMultiAssetSupportTest is CrossChainBaseTest {
assertEq(boringVault.balanceOf(address(this)), balBefore - sharesToBridge, "Should have burned shares.");
}

function testUniqueIDs() public virtual {
CrossChainOPTellerWithMultiAssetSupport sourceTeller = CrossChainOPTellerWithMultiAssetSupport(sourceTellerAddr);
CrossChainOPTellerWithMultiAssetSupport destinationTeller =
CrossChainOPTellerWithMultiAssetSupport(destinationTellerAddr);

uint256 sharesToBridge = 12;

// Bridge shares.
address to = vm.addr(1);

BridgeData memory data = BridgeData({
chainSelector: DESTINATION_SELECTOR,
destinationChainReceiver: to,
bridgeFeeToken: WETH,
messageGas: 80_000,
data: ""
});

uint256 quote = 0;

uint256 balBefore = boringVault.balanceOf(address(this));
bytes32 id1 = sourceTeller.bridge{ value: quote }(sharesToBridge, data);

// perform the exact same bridge again and assert the ids are not the same
bytes32 id2 = sourceTeller.bridge{ value: quote }(sharesToBridge, data);

assertNotEq(id1, id2, "Id's must be unique");
}

function testDepositAndBridge(uint256 amount) external {
CrossChainOPTellerWithMultiAssetSupport sourceTeller = CrossChainOPTellerWithMultiAssetSupport(sourceTellerAddr);
CrossChainOPTellerWithMultiAssetSupport destinationTeller =

0 comments on commit ab8958c

Please sign in to comment.