DKA Deposit

The deposit process refers to transferring ERC-20 DKA from Arbitrum Chain (L2) to dKargo Chain (L3).

This process is executed in multiple steps through the collaboration of the bridge contract deployed on Arbitrum and the dKargo sequencer.

STEP 1 - Approve L2 ERC-20 DKA

Before transferring ERC-20 DKA from L2 to L3, the Inbox Contract must be granted approval to access the user's DKA tokens.

const depositAmount = parseEther('1');
const res = await dkaBridge.approveGasToken({
  parentSigner,
  amount:depositAmount
});
const receipt = await res.wait();
console.log(`approve DKA token to Inbox Contract tx hash: ${receipt.transactionHash}`)

const allowance = await dkaBridge.allowanceGasTokenToInbox(
  parentSigner.address,
  parentProvider
);

console.log(`allowance amount: ${allowance}`

If nullis entered instead of depositAmount, the maximum available amount will be approved.

Normally, an approval is required each time a deposit is made through the bridge. However, by setting it this way, a one-time approval is sufficient, eliminating the need for additional approvals in future transactions.

STEP 2 - Depositing DKA

Once approval is complete, the depositEth() method of the Inbox Contract is called to initiate the deposit.

The Inbox Contract transfers the L2 DKA to the bridge contract..

const res = await dkaBridge.deposit({
  parentSigner,
  amount: depositAmount,
});
const receipt = await res.wait();
console.log(`deposit DKA L2 tx hash: ${receipt.transactionHash}`)

The deposited DKA is then locked in the bridge contract deployed on Arbitrum.

STEP 3 - Checking Deposit Status

Transferring L2 DKA to the bridge contract does not result in an immediate deposit on L3.

The deposit status will initially be marked as "Pending". After approximately 10 minutes, the DKA balance will be finalized and transferred to the user's account on dKargo Chain (L3).

// Wait until the message is executed on the dKargo chain.
await receipt.waitForChildTransactionReceipt(childProvider);

Last updated