@@ -186,39 +186,13 @@ async function main() {
186186 } ) ;
187187
188188 // ════════════════════════════════════════════════════════════════════
189- // STEP 4: Fund agent — ETH gas on Base
189+ // STEP 4: Verify agent funded (no ETH needed — EIP-3009 = 0 gas)
190190 // ════════════════════════════════════════════════════════════════════
191- const s4 = step ( 'Fund agent: send ETH on Base' , {
192- from : opWallet . address ,
193- to : evmWallet . address ,
194- amount : '0.00005 ETH' ,
195- } ) ;
196-
197- const ethTx = await opWallet . sendTransaction ( { to : evmWallet . address , value : ethers . parseEther ( '0.00005' ) } ) ;
198- console . log ( ` TX submitted: ${ ethTx . hash } ` ) ;
199- const ethRcpt = await ethTx . wait ( 1 ) ;
200- s4 . confirmed = ts ( ) ;
201- s4 . block = ethRcpt . blockNumber ;
202- console . log ( ` Confirmed block ${ ethRcpt . blockNumber } ` ) ;
203-
204- tx ( 'Base — ETH gas funding (operator → agent)' , 'Base' , ethTx . hash , {
205- block : ethRcpt . blockNumber ,
206- from : opWallet . address ,
207- to : evmWallet . address ,
208- amount : '0.00005 ETH' ,
209- } ) ;
210-
211- // ════════════════════════════════════════════════════════════════════
212- // STEP 5: Verify agent funded
213- // ════════════════════════════════════════════════════════════════════
214- const [ aEth , aUsdc ] = await Promise . all ( [
215- provider . getBalance ( evmWallet . address ) ,
216- usdc . balanceOf ( evmWallet . address ) ,
217- ] ) ;
218- balances . postFunding = { usdc : ethers . formatUnits ( aUsdc , 6 ) , eth : ethers . formatEther ( aEth ) } ;
191+ const aUsdc = await usdc . balanceOf ( evmWallet . address ) ;
192+ balances . postFunding = { usdc : ethers . formatUnits ( aUsdc , 6 ) , eth : '0' } ;
219193 step ( 'Verify agent funded' , {
220194 agentUSDC : `${ balances . postFunding . usdc } USDC` ,
221- agentETH : ` ${ balances . postFunding . eth } ETH` ,
195+ agentETH : '0 ETH — agent never needs gas (EIP-3009 = facilitator pays)' ,
222196 agentP2P : '0.00 P2P (fee-granted — no tokens needed)' ,
223197 onChain : 'read-only' ,
224198 } ) ;
@@ -337,16 +311,13 @@ async function main() {
337311 // ════════════════════════════════════════════════════════════════════
338312 // STEP 9: Check post-payment balance on Base
339313 // ════════════════════════════════════════════════════════════════════
340- const [ postEth , postUsdc ] = await Promise . all ( [
341- provider . getBalance ( evmWallet . address ) ,
342- usdc . balanceOf ( evmWallet . address ) ,
343- ] ) ;
344- balances . postPayment = { usdc : ethers . formatUnits ( postUsdc , 6 ) , eth : ethers . formatEther ( postEth ) } ;
314+ const postUsdc = await usdc . balanceOf ( evmWallet . address ) ;
315+ balances . postPayment = { usdc : ethers . formatUnits ( postUsdc , 6 ) } ;
345316 const paid = ( parseFloat ( balances . postFunding . usdc ) - parseFloat ( balances . postPayment . usdc ) ) . toFixed ( 6 ) ;
346317
347318 step ( 'Post-payment agent balance' , {
348319 agentUSDC : `${ balances . postPayment . usdc } USDC (was ${ balances . postFunding . usdc } , paid ${ paid } )` ,
349- agentETH : ` ${ balances . postPayment . eth } ETH (unchanged — EIP-3009 = 0 agent gas)` ,
320+ agentGas : 'ZERO — EIP-3009 means agent never sends a TX on Base' ,
350321 onChain : 'read-only' ,
351322 } ) ;
352323
@@ -553,20 +524,17 @@ async function main() {
553524 // ════════════════════════════════════════════════════════════════════
554525 // STEP 18: Query final balances
555526 // ════════════════════════════════════════════════════════════════════
556- const [ fEth , fUsdc , oEth , oUsdc ] = await Promise . all ( [
557- provider . getBalance ( evmWallet . address ) ,
527+ const [ fUsdc , oUsdc ] = await Promise . all ( [
558528 usdc . balanceOf ( evmWallet . address ) ,
559- provider . getBalance ( opWallet . address ) ,
560529 usdc . balanceOf ( opWallet . address ) ,
561530 ] ) ;
562- balances . final = { usdc : ethers . formatUnits ( fUsdc , 6 ) , eth : ethers . formatEther ( fEth ) } ;
563- balances . operator = { usdc : ethers . formatUnits ( oUsdc , 6 ) , eth : ethers . formatEther ( oEth ) } ;
531+ balances . final = { usdc : ethers . formatUnits ( fUsdc , 6 ) } ;
532+ balances . operator = { usdc : ethers . formatUnits ( oUsdc , 6 ) } ;
564533
565534 step ( 'Final balances' , {
566535 agentUSDC : `${ balances . final . usdc } USDC` ,
567- agentETH : ` ${ balances . final . eth } ETH` ,
536+ agentGas : 'ZERO on both chains (EIP-3009 on Base, fee grant on Sentinel)' ,
568537 operatorUSDC : `${ balances . operator . usdc } USDC` ,
569- operatorETH : `${ balances . operator . eth } ETH` ,
570538 } ) ;
571539
572540 // Cleanup RPC
@@ -684,16 +652,16 @@ function writeResults(testStart, wallets, balances, provision, conn, feeGrantDat
684652 L . push ( HR ) ;
685653 L . push ( '' ) ;
686654 L . push ( 'Agent (Base):' ) ;
687- L . push ( ` After funding: ${ balances . postFunding ?. usdc || '?' } USDC / ${ balances . postFunding ?. eth || '?' } ETH` ) ;
688- L . push ( ` After payment: ${ balances . postPayment ?. usdc || '?' } USDC / ${ balances . postPayment ?. eth || '?' } ETH` ) ;
689- L . push ( ` Final: ${ balances . final ?. usdc || '?' } USDC / ${ balances . final ?. eth || '?' } ETH` ) ;
655+ L . push ( ` After funding: ${ balances . postFunding ?. usdc || '?' } USDC` ) ;
656+ L . push ( ` After x402: ${ balances . postPayment ?. usdc || '?' } USDC` ) ;
657+ L . push ( ` Final: ${ balances . final ?. usdc || '?' } USDC` ) ;
658+ L . push ( ' ETH: 0 — agent never needs gas (EIP-3009 = facilitator pays)' ) ;
690659 L . push ( '' ) ;
691660 L . push ( 'Agent (Sentinel):' ) ;
692661 L . push ( ' P2P: 0.00 (all TXs covered by fee grant)' ) ;
693662 L . push ( '' ) ;
694663 L . push ( 'Operator:' ) ;
695664 L . push ( ` USDC: ${ balances . operator ?. usdc || '?' } ` ) ;
696- L . push ( ` ETH: ${ balances . operator ?. eth || '?' } ` ) ;
697665 L . push ( '' ) ;
698666 L . push ( '' ) ;
699667
0 commit comments