Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions snapshots/HybridAllocatorTest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"allocateAndRegister_erc20Token": "187668",
"allocateAndRegister_erc20Token_emptyAmountInput": "188578",
"allocateAndRegister_multipleTokens": "223574",
"allocateAndRegister_nativeToken": "139204",
"allocateAndRegister_nativeToken_emptyAmountInput": "139040",
"allocateAndRegister_multipleTokens": "223592",
"allocateAndRegister_nativeToken": "139222",
"allocateAndRegister_nativeToken_emptyAmountInput": "139058",
"allocateAndRegister_second_erc20Token": "114874",
"allocateAndRegister_second_nativeToken": "104840",
"allocateAndRegister_second_nativeToken": "104858",
"hybrid_execute_single": "174395"
}
4 changes: 4 additions & 0 deletions src/allocators/HybridAllocator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ contract HybridAllocator is IHybridAllocator {
if (AL.splitAllocatorId(idsAndAmounts[0][0]) != ALLOCATOR_ID) {
revert InvalidAllocatorId(AL.splitAllocatorId(idsAndAmounts[0][0]), ALLOCATOR_ID);
}
// If first token is native and no value attached, revert early
if (msg.value == 0) {
revert InvalidValue(0, 1);
}
if (idsAndAmounts[0][1] != 0 && msg.value != idsAndAmounts[0][1]) {
revert InvalidValue(msg.value, idsAndAmounts[0][1]);
}
Expand Down
2 changes: 1 addition & 1 deletion test/HybridAllocator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ contract HybridAllocatorTest is Test, TestHelper {
uint256[2][] memory idsAndAmounts = new uint256[2][](1);
idsAndAmounts[0][0] = _toId(Scope.Multichain, ResetPeriod.TenMinutes, address(allocator), address(0));
idsAndAmounts[0][1] = 0;
vm.expectRevert(abi.encodeWithSelector(ITheCompact.InvalidBatchDepositStructure.selector));
vm.expectRevert(abi.encodeWithSelector(IHybridAllocator.InvalidValue.selector, 0, 1));
allocator.allocateAndRegister(user, idsAndAmounts, arbiter, defaultExpiration, BATCH_COMPACT_TYPEHASH, '');
}

Expand Down