@@ -459,7 +459,7 @@ contract ERC7683Allocator_openFor is GaslessCrossChainOrderData {
459
459
erc7683Allocator.openFor (gaslessCrossChainOrder_, sponsorSignature, '' );
460
460
}
461
461
462
- function test_successful () public {
462
+ function test_successful_userHimself () public {
463
463
// Deposit tokens
464
464
vm.startPrank (user);
465
465
usdc.mint (user, defaultAmount);
@@ -514,6 +514,61 @@ contract ERC7683Allocator_openFor is GaslessCrossChainOrderData {
514
514
erc7683Allocator.openFor (gaslessCrossChainOrder_, sponsorSignature, '' );
515
515
}
516
516
517
+ function test_successful_relayed () public {
518
+ // Deposit tokens
519
+ vm.startPrank (user);
520
+ usdc.mint (user, defaultAmount);
521
+ usdc.approve (address (compactContract), defaultAmount);
522
+ compactContract.deposit (
523
+ address (usdc), address (erc7683Allocator), defaultResetPeriod, defaultScope, defaultAmount, user
524
+ );
525
+ vm.stopPrank ();
526
+
527
+ (IOriginSettler.GaslessCrossChainOrder memory gaslessCrossChainOrder_ , bytes memory sponsorSignature ) =
528
+ _getGaslessCrossChainOrder ();
529
+ IOriginSettler.Output[] memory maxSpent = new IOriginSettler.Output [](1 );
530
+ IOriginSettler.Output[] memory minReceived = new IOriginSettler.Output [](1 );
531
+ IOriginSettler.FillInstruction[] memory fillInstructions = new IOriginSettler.FillInstruction [](1 );
532
+ maxSpent[0 ] = IOriginSettler.Output ({
533
+ token: bytes32 (uint256 (uint160 (defaultOutputToken))),
534
+ amount: type (uint256 ).max,
535
+ recipient: bytes32 (uint256 (uint160 (user))),
536
+ chainId: defaultOutputChainId
537
+ });
538
+ minReceived[0 ] = IOriginSettler.Output ({
539
+ token: bytes32 (uint256 (uint160 (address (usdc)))),
540
+ amount: defaultAmount,
541
+ recipient: '' ,
542
+ chainId: block .chainid
543
+ });
544
+ Claim memory claim = Claim ({
545
+ chainId: block .chainid ,
546
+ compact: _getCompact (),
547
+ sponsorSignature: sponsorSignature,
548
+ allocatorSignature: ''
549
+ });
550
+ fillInstructions[0 ] = IOriginSettler.FillInstruction ({
551
+ destinationChainId: defaultOutputChainId,
552
+ destinationSettler: bytes32 (uint256 (uint160 (tribunal))),
553
+ originData: abi.encode (claim, _getMandate ())
554
+ });
555
+
556
+ IOriginSettler.ResolvedCrossChainOrder memory resolvedCrossChainOrder = IOriginSettler.ResolvedCrossChainOrder ({
557
+ user: user,
558
+ originChainId: block .chainid ,
559
+ openDeadline: uint32 (_getClaimExpiration ()),
560
+ fillDeadline: uint32 (_getFillExpiration ()),
561
+ orderId: bytes32 (defaultNonce),
562
+ maxSpent: maxSpent,
563
+ minReceived: minReceived,
564
+ fillInstructions: fillInstructions
565
+ });
566
+ vm.prank (makeAddr ('filler ' ));
567
+ vm.expectEmit (true , false , false , true , address (erc7683Allocator));
568
+ emit IOriginSettler.Open (bytes32 (defaultNonce), resolvedCrossChainOrder);
569
+ erc7683Allocator.openFor (gaslessCrossChainOrder_, sponsorSignature, '' );
570
+ }
571
+
517
572
function test_revert_NonceAlreadyInUse () public {
518
573
// Nonce is already used
519
574
0 commit comments