Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@layerzerolabs/solidity-examples
Advanced tools
yarn install
npx hardhat test
/contracts
folder demonstrates LayerZero behaviours.NonblockingLzApp
is a great contract to extend. Take a look at how OmniCounter
overrides _nonblockingLzReceive
and _LzReceive
to easily handle messaging. There are also example for OFT
and ONFT
which illustrate erc20 and erc721 cross chain functionality.testnet
before going to mainnet 🙏The examples below use two chains, however you could substitute any LayerZero supported chain!
NOTE: the OFTV2 uses uint64 to encode value transfer for compatability of aptos and solana.
The deployer is expected to set a lower decimal points like 6 or 8.
If the decimal point is 18, then uint64 can only represent approximately 18 tokens (uint64.max ~= 18 * 10^18).
WARNING: You must perform the setTrustedRemote() (step 2).
npx hardhat --network goerli deploy --tags ExampleOFTV2
npx hardhat --network fuji deploy --tags ExampleOFTV2
only
one another.npx hardhat --network goerli setTrustedRemote --target-network fuji --contract ExampleOFTV2
npx hardhat --network fuji setTrustedRemote --target-network goerli --contract ExampleOFTV2
npx hardhat --network goerli oftv2Send --target-network fuji --qty 42 --contract ExampleOFTV2
Pro-tip: Check the ERC20 transactions tab of the destination chain block explorer and await your tokens!
This ONFT contract allows minting of nftId
s on separate chains. To ensure two chains can not mint the same nfId
each contract on each chain is only allowed to mintnftIds
in certain ranges.
Check constants/onftArgs.json
for the specific test configuration used in this demo.
WARNING: You must perform the setTrustedRemote() (step 2).
npx hardhat --network bsc-testnet deploy --tags ExampleUniversalONFT721
npx hardhat --network fuji deploy --tags ExampleUniversalONFT721
only
one another.npx hardhat --network bsc-testnet setTrustedRemote --target-network fuji --contract ExampleUniversalONFT721
npx hardhat --network fuji setTrustedRemote --target-network bsc-testnet --contract ExampleUniversalONFT721
npx hardhat --network bsc-testnet setMinDstGas --target-network fuji --contract ExampleUniversalONFT721 --packet-type 1 --min-gas 100000
npx hardhat --network fuji setMinDstGas --target-network bsc-testnet --contract ExampleUniversalONFT721 --packet-type 1 --min-gas 100000
npx hardhat --network bsc-testnet onftMint --contract ExampleUniversalONFT721
npx hardhat --network fuji onftMint --contract ExampleUniversalONFT721
npx hardhat --network bsc-testnet ownerOf --token-id 1 --contract ExampleUniversalONFT721
npx hardhat --network fuji ownerOf --token-id 11 --contract ExampleUniversalONFT721
npx hardhat --network bsc-testnet onftSend --target-network fuji --token-id 1 --contract ExampleUniversalONFT721
npx hardhat --network fuji onftSend --target-network bsc-testnet --token-id 11 --contract ExampleUniversalONFT721
npx hardhat --network bsc-testnet ownerOf --token-id 1 --contract ExampleUniversalONFT721
npx hardhat --network fuji ownerOf --token-id 1 --contract ExampleUniversalONFT721
OmniCounter is a simple contract with a counter. You can only remotely increment the counter!
npx hardhat --network bsc-testnet deploy --tags OmniCounter
npx hardhat --network fuji deploy --tags OmniCounter
npx hardhat --network bsc-testnet setTrustedRemote --target-network fuji --contract OmniCounter
npx hardhat --network fuji setTrustedRemote --target-network bsc-testnet --contract OmniCounter
bsc-testnet
to fuji
!npx hardhat --network bsc-testnet incrementCounter --target-network fuji
Optionally use this command in a separate terminal to watch the counter increment in real-time.
npx hardhat --network fuji ocPoll
Just use our checkWireUpAll task to check if your contracts are wired up correctly. You can use it on the example contracts deployed above.
npx hardhat checkWireUpAll --e testnet --contract ExampleOFT --proxy-contract ExampleBasedOFT --proxy-chain goerli
npx hardhat checkWireUpAll --e testnet --contract ExampleUniversalONFT721
npx hardhat checkWireUpAll --e testnet --contract OmniCounter
/contracts
🙌Many of the example contracts make use of LayerZeroEndpointMock.sol which is a nice way to test LayerZero locally!
https://github.com/LayerZero-Labs/set-trusted-remotes https://layerzero.gitbook.io/docs/technical-reference/testnet/testnet-addresses https://layerzero.gitbook.io/docs/technical-reference/mainnet/supported-chain-ids
16.13.1
FAQs
example contracts
The npm package @layerzerolabs/solidity-examples receives a total of 3,390 weekly downloads. As such, @layerzerolabs/solidity-examples popularity was classified as popular.
We found that @layerzerolabs/solidity-examples demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 30 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.