![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
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!
The OmnichainFungibleToken
has two varieties of deployments:
BasedOFT.sol
- The token supply is minted (on deployment) on the base
chain. Other chains deploy with 0 supply initially.OFT.sol
- At deploy time, any quantity of tokens can be minted, regardless of chain.For the BasedOFT
, the initial supply will be minted entirely on the Base Chain
on deployment. All tokens transferred out of the base
chain will be locked in the contract (and minted on destination), and tokens transferred out of other
chains will be burned on that chain. Tokens returning to the base
chain will be unlocked
and transferred to the destination address. This results in the Base chain
being like the home base, hence the name.
In the example deployment below we use BasedOFT
and the base
chain is rinkeby
.
This setting is configured in constants/oftBaseChain.json
.
The OmnichainFungibleToken
deployed on other chains will use this configuration to set their base
chain.
Using the Ethereum network (testnet: rinkeby)
as a base
(really its like the source of truth) is a security decision.
In the event a chain goes rogue, Ethereum will be the final source of truth for OFT tokens.
WARNING: You must perform the setTrustedRemote() (step 2).
rinkeby
is the base
chain. Fuji is the oft for the other chain.npx hardhat --network rinkeby deploy --tags ExampleBasedOFT
npx hardhat --network fuji deploy --tags ExampleOFT
only
one another.npx hardhat --network rinkeby setTrustedRemote --target-network fuji --local-contract ExampleBasedOFT --remote-contract ExampleOFT
npx hardhat --network fuji setTrustedRemote --target-network rinkeby --local-contract ExampleOFT --remote-contract ExampleBasedOFT
npx hardhat --network rinkeby oftSend --target-network fuji --qty 42
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 onftSetTrustedRemote --target-network fuji
npx hardhat --network fuji onftSetTrustedRemote --target-network bsc-testnet
npx hardhat --network bsc-testnet onftMint
npx hardhat --network fuji onftMint
npx hardhat --network bsc-testnet onftOwnerOf --token-id 1
npx hardhat --network fuji onftOwnerOf --token-id 11
npx hardhat --network bsc-testnet onftSend --target-network fuji --token-id 1
npx hardhat --network bsc-testnet onftOwnerOf --token-id 1
npx hardhat --network fuji onftOwnerOf --token-id 1
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 ocSetTrustedRemote --target-network fuji
npx hardhat --network fuji ocSetTrustedRemote --target-network bsc-testnet
bsc-testnet
to fuji
!npx hardhat --network bsc-testnet ocIncrementCounter --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 by running the following command with the correct Contract parameter
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!
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.