This directory contains all the files necessary to deploy simplest ERC20-like contract using Neon onto the Solana blockchain.
To use this project, Foundry must be installed on the machine.
curl -L https://foundry.paradigm.xyz | bash
foundryup
Run command
git clone https://github.com/neonlabsorg/neon-foundry-tutorials.git
cd neon-foundry-tutorials
forge install foundry-rs/forge-std
forge install openzeppelin/openzeppelin-contracts
- Go to Chainlist and add the Neon EVM Devnet and Neon EVM Mainnet networks to your Metamask wallet.
- Airdrop at most 100 NEONs to the created account #1 from here
- Copy your Metamask account's private key (Account Details >> Export Private Key) and insert them into .env NOTE! Add 0x prefix at the beginning
cp .env.example .env
Replace XYZ
with the private key of your Metamask account in the .env file.
Then run this -
source .env
- Compiling contract
forge build
- Running tests
forge test
forge script script/TestERC20/DeployTestERC20.s.sol:DeployTestERC20Script --broadcast --rpc-url $RPC_URL_DEVNET --skip-simulation
Mint tokens to the deployer account and transfer tokens from the deployer account to another account
Replace testERC20Address
with the deployed TestERC20 contract from the previous step.
forge script script/TestERC20/MintTestERC20.s.sol:MintTestERC20Script --broadcast --rpc-url $RPC_URL_DEVNET --skip-simulation
⚠️ Important:--skip-simulation
flag is mandatory for theforge script
commands because on-chain simulation doesn't work on Neon EVM Devnet or Mainnet.
NOTE: The native token displayed above can be considered as NEON instead of ETH and the unit can be considered as Galan instead of gwei (It is not possible to customize the display).
forge create --rpc-url $RPC_URL_DEVNET --private-key $PRIVATE_KEY src/TestERC20/TestERC20.sol:TestERC20 --broadcast --constructor-args "Test ERC20 Token" "TERC20" "<deployer_address>"
cast send <contract_address> --rpc-url $RPC_URL_DEVNET --private-key $PRIVATE_KEY "mint(address,uint256)" "<deployer_address>" 20000000000000000000
cast call <contract_address> --rpc-url $RPC_URL_DEVNET "balanceOf(address) (uint256)" "<account_address>"
cast send <contract_address> --rpc-url $RPC_URL_DEVNET --private-key $PRIVATE_KEY "transfer(address,uint256)" "<receiver_address>" 100000000000000000
forge verify-contract --chain-id $CHAIN_ID_DEVNET <contract_address> src/TestERC20/TestERC20.sol:TestERC20 --verifier-url $VERIFIER_URL_BLOCKSCOUT --verifier blockscout
⚠️ Important: Fork testing won't work in the situations where there needs to be an interaction with the custom precompiles on Neon EVM Devnet and Mainnet because they are not supported in the forked environment.