Closed Zena-park closed 2 weeks ago
I think there is no issue here
@nguyenzung Thank you for your reply.
Can you provide me some test codes to send and receive a native token using l2CrossDomainMessenger.sendMessage and ton.transferFrom?
@nguyenzung Thank you for your help.
const sendTx = await (
await l2CrossDomainMessengerContract
.connect(l2Wallet)
.sendMessage(l1Wallet.address, '0x', 200000, { value: amount })
).wait()
After executing, finalizing,
ton.transferFrom( l1CrossDomainMessenger, l1Wallet.address,amount)
The TON was successfully transferred from L2 to L1.
When sending a native token in sendMessage of L2CrossDomainMessage, If the sender is not L2 Standard Bridge, all sent a native token will be locked in the L1CrossDomainMessage contract.
There is no way to move TON(native token) from L1's L1CrossDomainMessage when the sender is not L2 Standard Bridge, We need to add 'require' statement if msg.value is greater than 0 in the L2CrossDomainMessage.sendMessage function.
https://github.com/tokamak-network/tokamak-thanos/blob/5ad9baac98217a0c1533969b00076d9a4443edba/packages/tokamak/contracts-bedrock/src/L2/L2CrossDomainMessenger.sol#L41-L45