Installation
Installation of the Smartcontracts
Prerequirements
Smartcontracts are running inside the Docker container and uses the Hardhat framework.
Therefore, the local computer that wants to install the Smartcontracts has to be with Installed docker and docker-compose.
Once installed, the terminal should show that docker
and docker-compose
commands are available:
Next required Program is a Git Client. I would recommend GitKraken or Fork with a nice GUI.
Upon installation of Git, you can clone the Lighthouse Github repository into your computer:
blocklords/lighthouse-smartcontracts.git
Installation
Open in the terminal the folder of the Lighthouse Smartcontracts: Then create .env file with the following key values:
Here: MOONBEAM_DEPLOYER_ADRESS is Wallet Address of Claim verifier. MOONBEAM_DEPLOYER_KEY is the Wallet's private key that will deploy contracts on the Network. MOONBEAM_REMOTE_HTTP is the HTTPS URL of Moonbeam node.
Or a new privatekey and link to the blockchain node for other networks.
The wallet address, privatekey or remote HTTP nodes could be any wallets or node's url.
For Moonbeam and Moonriver Networks, its recommended to use https://app.onfinality.io/login rather than Official Public RPC nodes.
After installation, you can run the Docker compose to set up the Smartcontracts. The first setup will take some time, as it downloads the dependencies from the network:
Commands
In order to interact with Smartcontracts, please enter into the Container:
This will enter into the Container. As Lighthouse smartcontracts built with Hardhat, the commands to compiling smartcontracts, deploying smartcontracts, testing or running scripts are done via Hardhat command line tool.
Here are the most common commands:
Compile
npx hardhat compile
compiles Solidity files. For more info about compiling at Hardhat Compiling Docs.
Deploy
We run the scripts defined in scripts/
folder. The deployment scripts have deploy-
prefix. Visit the deployment scripts and change the parameters passed to constructors. For example above command deployes LighthouseTier.sol
contract.
Additionally we pass a --network
argument with the network name. To change network settings or toadd another Blockchain networks (Such as Ethereum Mainnet, Ethereum Rinkeby Testnet) you can edit hardhat.config.js
file inside the root folder.
For more info about deploying contracts at Hardhat Deploying Docs.
Deployment on a new network
Deploying on a new network steps:
First deploy the Tier contract: npx hardhat run scripts/deploy/tier.js --network networkName Once the tier is deployed, update the scripts/addresses.js by adding a new script.
Deploy the Tier Wrapper npx hardhat run scripts/deploy/tier-wrapper.js --network networkName, update the addresses.js
Then deploy the scripts/deploy/project.js , then update the addesses.js
Then deploy the scripts/deploy/project-wrapper, then update the addresses.js.
Then deploy the registration contract. scripts/deploy/registration.js, update the addresses.js
Then deploy the prefund contract. scripts/deploy/prefund.js, update the addresses.js
Then deploy the auction contract. scripts/deploy/auction.js, update the addreses.js
Then deploy the burn contract. scripts/deploy/burn.js, update the addresses.js
Finally, deploy the burn contracts on scripts/deploy/burn-tasks.js, update the addresses.js
IMPORTANT, make sure that you check the deployment scripts, before calling them. Some of them are using the handwritten code.
Some of them are automatically detecting the network id by addresses.js. Therefore before deploying the scripts, add the network section to the addresses.js's addresses object.
The project contract and project wrapper contract asks for the kyc verifier. Use for testing purpose the address that deploys the contract
Test
Testing contracts are done via calling npx hardhat test
command by passing test script file. In Lighthouse tests are enumerated with number prefix. For example tests/1-tier.js
is the LighthouseTier.sol
smartcontract's Tests.
For more info about testings using Hardhat visit Hardhat Testing with ethers.js and Waffle Docs.
Last updated