Welcome to our opensourced website! Feel free to have fun looking at our code and don't hesitate to do a pull request if you feel like something deserve to be changed!
Before starting development, it is recommended to:
- install the latest dependencies:
yarn
Before starting the web server, we need to compile and deploy the smart contract locally.
- start a local network node (for smart contract interactions)
yarn local-node
- deploy the current smart contract version to the local node and export the artifacts file for the Frontend.
yarn sm-deploy
Make sure everything is all right by testing it:
yarn test
- spin up a development web server (Gatsby)
yarn develop
You can access the freshly baked website at http://localhost:8000 (for the production build) or http://localhost:8000/?staging=1 (for the staging build)
If you have a problem with Gatsby cache, clean it:
yarn clean
You will need money in your local account to interact with the smart contract:
- Add one of the dev private keys to your Metamask wallet to enjoy those sweet default 10k ETH.
We have 2 metadata folders: one at the root of the project, the second one in the static folder.
The one in the static
folder is used by Gatsby when we deploy the website to update the public
folder.
Beware Gatsby is caching elements in the public folder, beware to clean it before deployinf to ensure the public foler is synced with the static folder
The other one at the root folder is used to ensure a gradual reveal in production. The fake
subfolder can be used for local/preprod, to test the script. The ori
subfolder should contain the original assets.
Before deploying either on testnet or on mainnet, we need to set the owner private key but you will also need to create an account on Alchemy, which will give you an API key for their RPC.
RINKEBY_PRIVATE_KEY=xxxxxx # Your rinkeby wallet private key
MAINNET_PRIVATE_KEY=xxxxxx # Your mainnet wallet private key
RINKEBY_ALCHEMY_API_KEY=xxxxxxx
MAINNET_ALCHEMY_API_KEY=xxxxxxx
Then you can deploy the smart contract to a remote network (we use Rinkeby as a testnet):
NETWORK=<rinkeby|mainnet> yarn sm-deploy
Now that the smart contract is deployed, we can finally deploy the website.
For deploying the website to Github Page, just type:
yarn deploy
It is super important to follow the current steps in order to successfully mint the Lenia and see the results in the LeniaDEX
In order to mint some Lenia for the presale, you will need to flip the isPresaleActive
flag on the smart contract:
yarn sm-start-presale # Local node
NETWORK=rinkeby yarn sm-start-presale # Testnet
In order to mint some Lenia for the public sale, you will need to flip the isSaleActive
flag on the smart contract:
yarn sm-start-sale # Local node
NETWORK=rinkeby yarn sm-start-sale # Testnet
Before minting, please:
- set the baseURI for fetching each NFT metadata.
yarn sm-set-baseuri --baseuri <http://localhost:8000/metadata/|https://lenia.world/metadata/> # Local node
NETWORK=rinkeby yarn sm-set-baseuri --baseuri <http://localhost:800/metadata/|https://lenia.world/metadata/> # Testnet
- run the long running script to upload the metadata to the
static
public folder so that your Lenia can be revealed.
yarn sm-reveal # Local node
NETWORK=rinkeby yarn sm-reveal # Rinkeby
We recommend to use Charles to proxy network requests, here is a good tutorial to set it up.
To access localhost:8000 for example, you would need to access the following URL: http://localhost.charlesproxy.com:8000
First, create an account on coinmarketcap and get your key, then define it in your .env.development
file:
COINMARKETCAP=a317005e-ee9f-4e2a-89df-69ea7ac3dd45
Now you can estimate gas for the smart-contract by running the following command:
yarn sm-estimate-gas