LayerZero-Labs / LayerZero-v2

Other
495 stars 312 forks source link

Feature: NativeOFT #24

Open H34D opened 4 months ago

H34D commented 4 months ago

We are building a ERC20 <> Native bridge with LayerZero and found this code: https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/token/oft/v2/NativeOFTV2.sol it works with V1 but not V2. Is there a way to get this functionality in V2 as well? Like porting the contract V2?

DanL0 commented 3 months ago

Hello, it's possible to achieve almost exactly the same behaviour using LayerZero V2. We don't have example code we can share at this moment, but definitely it is possible.

For some more advanced stuff like refunds and msg.value native transfers (instead of mandatory deposit calls) you may need to override send method and payNative functions.

You can port test cases from solidity-examples when you work on V2 example to make sure you achieve feature parity with the V1 contract.

0xcuonghx commented 3 months ago

We are building a ERC20 <> Native bridge with LayerZero and found this code: https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/token/oft/v2/NativeOFTV2.sol it works with V1 but not V2. Is there a way to get this functionality in V2 as well? Like porting the contract V2?

I write simple NativeOFT.sol, may help some