Skip to content

Commit 4658f09

Browse files
committed
wip
1 parent 12843be commit 4658f09

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

src/wallet.rs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,15 +2556,36 @@ pub fn encode_usdc_paymaster_data(
25562556
let mut data = Vec::new();
25572557
data.extend_from_slice(paymaster.as_slice());
25582558

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);
25622568

25632569
// Token address (USDC)
25642570
data.extend_from_slice(token_address.as_slice());
25652571

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+
25692590
data
25702591
}

0 commit comments

Comments
 (0)