@@ -627,14 +627,31 @@ export class KyberAcrossAdapter extends BaseSwapAdapter {
627627 // Prepare the swapAndBridge args with updated nonce
628628 const swapAndBridgeArgs = { ...swapAndDepositData , nonce : BigInt ( nonce ) }
629629
630+ // Encode calldata for Tenderly simulation
631+ const calldata = encodeFunctionData ( {
632+ abi : spokePoolPeripheryAbi ,
633+ functionName : 'swapAndBridge' ,
634+ args : [ { ...swapAndBridgeArgs } ] as any ,
635+ } )
636+ const dataSuffix = getIntegratorDataSuffix ( KYBERSWAP_INTEGRATOR_ID )
637+ const fullCalldata = `${ calldata } ${ dataSuffix . slice ( 2 ) } ` as Hex // Remove 0x from suffix before concatenating
638+
639+ // Log for Tenderly simulation
640+ console . log ( '🔵 🔵 🔵 🔵 🔵 🔵 🔵' )
641+ console . log ( 'Contract Address:' , spokePoolPeripheryAddress )
642+ console . log ( 'Sender (from):' , userAddress )
643+ console . log ( 'Value (wei):' , isNative ? swapAndDepositData . swapTokenAmount . toString ( ) : '0' )
644+ console . log ( 'Calldata:' , fullCalldata )
645+ console . log ( 'Chain ID:' , originChain . id )
646+
630647 // Simulate the transaction to catch revert errors with proper decoding
631648 // and get the request object for execution
632649 const { request : txRequest } = await originClient . simulateContract ( {
633650 address : spokePoolPeripheryAddress ,
634651 abi : spokePoolPeripheryAbi ,
635652 functionName : 'swapAndBridge' ,
636653 args : [ { ...swapAndBridgeArgs } ] as any ,
637- account : userAddress ,
654+ account : walletClient . account ,
638655 value : isNative ? swapAndDepositData . swapTokenAmount : undefined ,
639656 dataSuffix : getIntegratorDataSuffix ( KYBERSWAP_INTEGRATOR_ID ) ,
640657 } )
0 commit comments