@@ -2556,15 +2556,36 @@ pub fn encode_usdc_paymaster_data(
2556
2556
let mut data = Vec :: new ( ) ;
2557
2557
data. extend_from_slice ( paymaster. as_slice ( ) ) ;
2558
2558
2559
- // Add paymaster-specific data
2560
- // For Circle's paymaster on Base, we only include the token address
2561
- // The paymaster will calculate the gas cost internally
2559
+ // Add paymaster-specific data for Circle's TokenPaymaster v0.8
2560
+ // Format: encodePacked([uint8, address, uint256, bytes])
2561
+ // - uint8: mode (0 for permit mode)
2562
+ // - address: USDC token address
2563
+ // - uint256: permit amount
2564
+ // - bytes: permit signature (empty for now, needs EIP-2612 implementation)
2565
+
2566
+ // Mode byte (0 for permit mode)
2567
+ data. push ( 0u8 ) ;
2562
2568
2563
2569
// Token address (USDC)
2564
2570
data. extend_from_slice ( token_address. as_slice ( ) ) ;
2565
2571
2566
- // Note: Circle's paymaster may expect additional data, but based on
2567
- // the error we're getting, let's try with just the token address
2568
-
2572
+ // Permit amount - use a reasonable amount for gas payment (10 USDC worth)
2573
+ let permit_amount = U256 :: from ( 10_000_000u64 ) ; // 10 USDC (6 decimals)
2574
+ data. extend_from_slice ( & permit_amount. to_be_bytes :: < 32 > ( ) ) ;
2575
+
2576
+ // TODO: Implement EIP-2612 permit signature
2577
+ // For now, we'll try with an empty signature to see if that changes the error
2578
+ // In production, this would need to be a valid permit signature allowing
2579
+ // the paymaster to spend USDC on behalf of the TBA
2580
+
2581
+ // Note: The permit signature would typically be generated by signing:
2582
+ // - owner: TBA address
2583
+ // - spender: paymaster address
2584
+ // - value: permit_amount
2585
+ // - nonce: current permit nonce from USDC contract
2586
+ // - deadline: future timestamp
2587
+
2588
+ // For testing, let's try without the signature first to see if we get a different error
2589
+
2569
2590
data
2570
2591
}
0 commit comments