Interactions
↝ EVM Interactions
Initiating a Bridging Transaction (From EVM User):
// User initiates a bridging transaction on the EVM chain
function bridgeTokens(tokenAddress, amount, recipientAddress) {
// 1. User interacts with a Laika bridge contract deployed on the EVM chain.
bridgeContract.initiateBridge(tokenAddress, amount, recipientAddress);
// 2. The bridge contract on the EVM chain:
// 2.1. Locks the user's tokens on the EVM chain using locking mechanism .
// 2.2. Creates a bridge transaction record with details like sender, recipient, amount, and intended chain (Laika).
// 2.3. Broadcasts the bridge transaction record to the Laika bridge network.
}
Relaying and Validating on the Laika Bridge Network:
// Bridge node (one of many) on the Laika network receives the bridge transaction record.
function processBridgeTransaction(transactionRecord) {
// 1. Verify the bridge transaction record:
// 1.1. Authenticate the EVM bridge contract address using a pre-defined registry and verification methods.
// 1.2. Validate the transaction details (amount, recipient) against the locked tokens on the EVM chain.
// 2. If valid:
// 2.1. Forward the transaction record to a configurable number of other bridge nodes for additional validation.
// 2.2. Upon receiving enough valid confirmations from other bridge nodes, proceed with finalization.
// 3. If invalid:
// 3.1. Log the error and reject the transaction.
// 3.2. Penalty mechanisms or dispute resolution logic .
}
Finalizing the Bridge Transaction (On Laika):
// Laika bridge contract (on L2) receives the validated bridge transaction record.
function finalizeBridgeTransaction(transactionRecord) {
// 1. Verify if the transaction has already been finalized (idempotence check).
// 2. If not finalized:
// 2.1. Mint the equivalent amount of bridged tokens (e.g., wrapped tokens) on the Laika L2 network for the recipient address.
// 2.2. Update the bridge contract state to reflect the completed transaction.
}