Skip to content

feat: bridge adapter#2

Draft
ankitboghra wants to merge 1 commit intomainfrom
ankit/bridge-adapter
Draft

feat: bridge adapter#2
ankitboghra wants to merge 1 commit intomainfrom
ankit/bridge-adapter

Conversation

@ankitboghra
Copy link
Contributor

No description provided.

@ankitboghra ankitboghra requested a review from Copilot September 8, 2025 10:33
@ankitboghra ankitboghra marked this pull request as draft September 8, 2025 10:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new bridge adapter feature to enable custom ERC20 token bridging functionality. The implementation provides an alternative bridging mechanism through a dedicated bridge adapter contract interface.

Key changes:

  • Adds new BridgeAdapter class with custom ERC20 bridging capabilities
  • Introduces BridgeTokenParams interface for bridge adapter operations
  • Integrates bridge adapter functionality into existing ERC20 class

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/types/bridge.ts Adds BridgeTokenParams interface for bridge adapter parameters
src/lxly/tokens/erc20.ts Integrates bridgeToken method using the new bridge adapter
src/lxly/index.ts Exports the new BridgeAdapter class
src/lxly/bridge/index.ts Creates centralized export point for bridge functionality
src/lxly/bridge/bridge-adapter.ts Implements the main BridgeAdapter class with token bridging logic
src/lxly/bridge/abi/index.ts Centralizes bridge-related ABI exports
src/lxly/bridge/abi/bridge-adapter.ts Defines the bridge adapter contract ABI

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

functionName: 'bridgeToken',
args: [
params.recipient as Address,
BigInt(params.amount),
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The amount parameter is validated as a string but directly converted to BigInt without error handling. Consider adding validation to ensure the string is a valid numeric format before conversion, or handle potential conversion errors.

Suggested change
BigInt(params.amount),
(() => {
// Ensure params.amount is a valid non-negative integer string
if (!/^\d+$/.test(params.amount)) {
throw new Error(`Amount must be a valid non-negative integer string, got: "${params.amount}"`);
}
try {
return BigInt(params.amount);
} catch (e) {
throw new Error(`Failed to convert amount to BigInt: ${e instanceof Error ? e.message : String(e)}`);
}
})(),

Copilot uses AI. Check for mistakes.
inputs: [
{ internalType: 'address', name: 'recipient', type: 'address' },
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
{ internalType: 'uint32', name: 'destinationNetworkId', type: 'uint32' },
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ABI defines destinationNetworkId as uint32 but the TypeScript interface uses number. Consider using a more specific type or adding validation to ensure the number fits within uint32 range (0 to 4,294,967,295).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants