Skip to content

Commit b842410

Browse files
committed
debug: add logs for easier debugging
1 parent e0a29c2 commit b842410

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

apps/kyberswap-interface/src/pages/CrossChainSwap/adapters/KyberAcrossAdapter.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
})

apps/kyberswap-interface/src/pages/CrossChainSwap/hooks/useCrossChainSwap.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,11 @@ export const CrossChainSwapRegistryProvider = ({ children }: { children: React.R
783783
// Find the corresponding adapter
784784
const adapter = registry.getAdapter(data.provider)
785785

786+
// Debug: Log full KyberAcross response
787+
if (data.provider.toLowerCase() === 'kyberacross') {
788+
console.log('[KyberAcross Debug] Full response:', JSON.stringify(data, null, 2))
789+
}
790+
786791
// Skip if this source is excluded (unless all sources are excluded)
787792
if (
788793
adapter &&

0 commit comments

Comments
 (0)