DKA 출금

출금(Withdraw)은 디카르고 체인(L3)에 보유 중인 DKA를 아비트럼 체인(L2)으로 전송하는 과정을 의미합니다.

이 과정은 아비트럼에 배포된 브릿지 컨트랙트와 디카르고 시퀀서가 협력하여 단계적으로 수행됩니다.

STEP 1 - Withdraw DKA

DKA 출금은 ArbSys 프리컴파일의 withdrawEth() 메서드를 사용하여 수행할 수 있습니다.

출금 요청된 디카르고 체인의 DKA는 소각되며, L2 브릿지 컨트랙트에 보관된 L2 DKA는 이후 단계를 거쳐 사용자에게 반환됩니다.

const res = await dkaBridge.withdraw({
  childSigner,
  amount,
  destinationAddress: parentSigner.address,
  from: childSigner.address,
});

const receipt = await res.wait();
console.log(`withdraw DKA L3 tx hash: ${receipt.transactionHash}`)

STEP 2: Withdraw Status

출금 요청 후 L2에서 DKA를 수령하려면 약 6.4일의 분쟁 기간이 경과해야 하며, 그 기간 동안은 대기 상태로 유지됩니다.

const timeToWaitMs = 1000 * 60
const message = await receipt.getChildToParentMessages(parentProvider);

// 6.4일의 분쟁 기간 지날때 까지 대기합니다.
await message[0].waitUntilReadyToExecute(childProvider, timeToWaitMs);

출금 상태는 디스캐너 (dScanner)의 L3 ➔ L2 Transactions 페이지에서 확인할 수 있습니다.

STEP 3: Claim DKA

대기 기간이 종료되면, 사용자는 브릿지 컨트랙트에서 출금을 요청한 DKA를 청구할 수 있는 자격을 얻게 됩니다.

이후, 사용자는 아웃박스 (outbox)컨트랙트를 통해 출금 요청한 DKA를 청구할 수 있습니다.

const message = await receipt.getChildToParentMessages(parentSigner);
const res = await message[0].execute(childProvider);
const executeReceipt = await res.wait();
console.log(`claim DKA L2 tx hash: ${executeReceipt.transactionHash}`)

Last updated