dKargo Docs
dKargo.ioWhitepaper
Docs ENG
Docs ENG
  • Welcome to dKargo
  • Run dKargo Node
    • Chain RPC
    • Installation Guide
    • Types of Chain Node
    • Full Node
    • Archive Full Node
    • Validator Node
  • Wallet Setup
    • Connectiong to MetaMask
    • Creating a wallet
    • Importing a Wallet
    • Adding the dKargo Network
  • Validator Operations
    • Validator Staking
    • Staking
    • Unstaking
    • Claim
  • Deploy Contract
    • How to deploy a contract
    • Deploying a Contract Using Remix-IDE
    • Deploying a Contract Using Hardhat
    • Deploying a Contract Using Foundry
  • ERC-20 BRIDGING
    • ERC-20 Bridging
    • Standard Gateway
    • Generic-custom Gateway
    • Custom Gateway
  • DKA Bridging
    • DKA Bridging
    • DKA Deposit
    • DKA Withdraw
  • Faucet
    • Faucet for Testnet Tokens
    • Claiming Testnet Tokens
  • Chain Snapshot
    • Download the Latest Chain Snapshot
  • Contract Address
    • Contract Address List
  • Bug Bounty
    • Bug Bounty Program
Powered by GitBook
On this page
  • STEP 1 - Approve L2 ERC-20 DKA
  • STEP 2 - Depositing DKA
  • STEP 3 - Checking Deposit Status
  1. DKA Bridging

DKA Deposit

PreviousDKA BridgingNextDKA Withdraw

Last updated 2 months ago

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 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.

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

STEP 3 - Checking Deposit Status

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);

The Inbox Contract transfers the L2 DKA to the .

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

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

bridge contract
bridge contract.
bridge contract
bridge contract