Lachain integration

Lachain is easy to integrate in any dApp

Instruction on integration


"Deposit" initiate transfer from one chain to any chain. Transfer is defined by blockchain ID, resource ID, token amount, receiver address on receiver chain.

For integration it is needed to create handler on external chain with help of bridge contract. When user calls "deposit", certain amount of tokens are locked either burnt on original destination and same amount is released or minted on destination blockchain.


Contract of Lachain ERC20 handler

Execute proposal

"Execute proposal" is called on destination blockchain when corresponding deposit is made. Depending on resource ID, different handlers' "execute proposal" is called. It is the most important function for Lachain integration. Handler allows to use released or minted tokens for its logic. Tokens are stored on ERC-20 handler and need to be transferred from it to the integration handler.

List of actions

1) For integration it is needed to implement "execute proposal" function logic.

Example of "execute proposal"

2) Handler: set up "internalDeposit" function. It will allow to send funds from External chain to Lachain. Sending back ERC-20 tokens to handler is needed before calling function.

3) Set up "depositNativeToken" functions. If native tokens are needed then this function should be called. No value transfer needed for receiving tokens on external chain from Lachain. After resource ID and token amount inputs are entered, handler releases tokens on external chain. Call with value=0 results in transferring wrapped native tokens from bridge to the handler. To transfer native tokens from handler to the bridge call this function with value equal to needed amount of native tokens.

Last updated