-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ryan Goulding <[email protected]>
- Loading branch information
1 parent
30c4bae
commit 0995096
Showing
6 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.22; | ||
|
||
import { ONFT721Adapter } from "@layerzerolabs/onft-evm/contracts/onft721/ONFT721Adapter.sol"; | ||
|
||
contract MyONFT721Adapter is ONFT721Adapter { | ||
constructor( | ||
address _token, | ||
address _lzEndpoint, | ||
address _delegate | ||
) ONFT721Adapter(_token, _lzEndpoint, _delegate) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import assert from 'assert' | ||
|
||
import { type DeployFunction } from 'hardhat-deploy/types' | ||
|
||
const contractName = 'MyONFT721Adapter' | ||
|
||
const deploy: DeployFunction = async (hre) => { | ||
const { getNamedAccounts, deployments } = hre | ||
|
||
const { deploy } = deployments | ||
const { deployer } = await getNamedAccounts() | ||
|
||
assert(deployer, 'Missing named deployer account') | ||
|
||
console.log(`Network: ${hre.network.name}`) | ||
console.log(`Deployer: ${deployer}`) | ||
|
||
// This is an external deployment pulled in from @layerzerolabs/lz-evm-sdk-v2 | ||
// | ||
// @layerzerolabs/toolbox-hardhat takes care of plugging in the external deployments | ||
// from @layerzerolabs packages based on the configuration in your hardhat config | ||
// | ||
// For this to work correctly, your network config must define an eid property | ||
// set to `EndpointId` as defined in @layerzerolabs/lz-definitions | ||
// | ||
// For example: | ||
// | ||
// networks: { | ||
// fuji: { | ||
// ... | ||
// eid: EndpointId.AVALANCHE_V2_TESTNET | ||
// } | ||
// } | ||
const endpointV2Deployment = await hre.deployments.get('EndpointV2') | ||
|
||
// The token address must be defined in hardhat.config.ts | ||
// If the token address is not defined, the deployment will log a warning and skip the deployment | ||
if (hre.network.config.onft721Adapter == null) { | ||
console.warn(`onft721Adapter not configured on network config, skipping ONFT721 deployment`) | ||
return | ||
} | ||
|
||
const { address } = await deploy(contractName, { | ||
from: deployer, | ||
args: [ | ||
hre.network.config.onft721Adapter.tokenAddress, // existing ERC721 address | ||
endpointV2Deployment.address, // LayerZero's EndpointV2 address | ||
deployer, // owner | ||
], | ||
log: true, | ||
skipIfAlreadyDeployed: false, | ||
}) | ||
|
||
console.log(`Deployed contract: ${contractName}, network: ${hre.network.name}, address: ${address}`) | ||
} | ||
|
||
deploy.tags = [contractName] | ||
|
||
export default deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'hardhat/types/config' | ||
|
||
interface Onft721AdapterConfig { | ||
tokenAddress: string | ||
} | ||
|
||
declare module 'hardhat/types/config' { | ||
interface HardhatNetworkUserConfig { | ||
onft721Adapter?: never | ||
} | ||
|
||
interface HardhatNetworkConfig { | ||
onft721Adapter?: never | ||
} | ||
|
||
interface HttpNetworkUserConfig { | ||
onft721Adapter?: Onft721AdapterConfig | ||
} | ||
|
||
interface HttpNetworkConfig { | ||
onft721Adapter?: Onft721AdapterConfig | ||
} | ||
} |