Node Version:v12.13.1+
Harmony Faucet using solidity contract. Claim testnet faucet tokens using harmony faucet. https://onefaucet.ibriz.ai
-
Add
.envfile corresponding to.env.sampleinfaucet-contractfolder -
Add the network in which the contract is to be deployed
mainnet: {
network_id: '1',
provider: () => {
const truffleProvider = new TruffleProvider(
'https://api.s0.t.hmny.io/',
{ menmonic: process.env.MAINNET_MNEMONIC },
{ shardID: 0, chainId: 1 },
{ gasLimit: gasLimit, gasPrice: gasPrice},
);
const newAcc = truffleProvider.addByPrivateKey(process.env.MAINNET_PRIVATE_KEY);
truffleProvider.setSigner(newAcc);
return truffleProvider;
},
}Enter the required environment variables in the .env file. For the above config it would be MAINNET_MNEMONIC and MAINNET_PRIVATE_KEY.
$ npx oz deploy
Nothing to compile, all contracts are up to date.
? Choose the kind of deployment regular
? Pick a network lrtn_testnet
? Pick a contract to deploy HarmonyFaucet
✓ Deployed instance of HarmonyFaucet
0x4B203bB02fDBd702610b4d2564beAd3af82bd7d2- Convert the obtained address to bech32 format.
- Transfer amount to the address.
- Add
.envfile corresponding to.env.samplein the faucet-backend folder - Add
config.jsonfile corresponding to theconfig-sample.jsoninfaucet-backend/configfolder. - Use the above obtained address of faucet contract in the
config.jsonfile. - Run
npm run copyfrom the root folder. This will copy theHarmonyFaucet.jsonfromfaucet-contract/build/contractsfolder tofaucet-backend/config
- Add
.envfile corresponding to.env.samplein root of faucet-frontend
Be in the root of the repo:
- Install Node Modules:
npm install // installs all dependencies for project-
Setup contract configurations and deploy the contract
-
Setup backend and copy the HarmonyFaucet.json artifact of contract
npm run copy-
Setup frontend
-
Starting development server
npm start // starts frontend server at port:3000 and backend server to provided port - default 5000