How to deploy a contract on Neon Parallel EVM with Hardhat

945G...fRid
13 May 2024
48

Neon tutorials with Hardhat


This directory contains several examples to deploy smart contracts on Neon EVM Devnet or Mainnet.

Install the required dependencies


npm install


Deploy scripts


TestChainlink script


npx hardhat run scripts/TestChainlink/deploy.js --network neondevnet


TestERC20 scripts


  1. Deploy TestERC20.sol
npx hardhat run scripts/TestERC20/deploy.js --network neondevnet


  1. Initiate a transfer from the deployer address to a randomly generated address.
npx hardhat run scripts/TestERC20/transfer.js --network neondevnet


TestERC721 scripts


  1. Deploy TestERC721.sol
npx hardhat run scripts/TestERC721/deploy.js --network neondevnet


  1. Paste the deployed contract address from the above step in the mint.js file and mint some NFTs to the deployer address.
npx hardhat run scripts/TestERC721/mint.js --network neondevnet


TestReadSolanaData scripts


  1. Read Pyth price feeds from Solana
npx hardhat run scripts/TestReadSolanaData/TestReadPythPriceFeed.js --network neondevnet


  1. Read token account data from Solana
npx hardhat run scripts/TestReadSolanaData/TestReadTokenAccountData.js --network neondevnet


Verify smart contracts on NeonScan


npx hardhat verify --network neondevnet <CONTRACT_ADDRESS>


If the smart contract has constructor parameters, then the command to verify is -

npx hardhat verify --network neondevnet <CONTRACT_ADDRESS> <PARAM_1> <PARAM_2>


<CONTRACT_ADDRESS><PARAM_1><PARAM_2> should be replaced with the smart contract address deployed and the constructor parameters for it.
Note: To deploy the smart contracts on Neon EVM Mainnet, --network neondevnet should be replaced by --network neonmainnet while running the hardhat command for running the scripts.

Before starting make sure to create .env file containing the following data ( make a copy of .env.example file and rename it to .env ):


    PRIVATE_KEY_OWNER=XYZ


  • PRIVATE_KEY_OWNER - the private key used to deploy the contracts.


Write & Read to Earn with BULB

Learn More

Enjoy this blog? Subscribe to 666

1 Comment

B
No comments yet.
Most relevant comments are displayed, so some may have been filtered out.