To run the app in development environment with local chain, navigate to harvest-flow
and run the following commands:
- Initialize the project:
npm run initialize
- Start the local chain:
npm run chain:start
- Deploy the factory contract and Nft template:
npm run chain:deploy
- Deploy test project to the local chain:
npm run chain:deploy:localhost
While referencing values found in harvest-flow/contracts/ignition/deployments/{chainId}/deployed_addresses.json
- Set the following environment variables in
.env.localhost
:TOKTOK_NFT_FACTORY_CONTRACT_ADDRESS
- address of the factory contractPAYMENT_TOKEN_CONTRACT_ADDRESS
- address of the NFT template
While using the data obtained from https://ops.cloud-gms.com/operation/ in the user information section
- Set the following envs in your
.env.localhost
- GMS_CLOUD_CLIENT_ID
- GMS_CLOUD_CLIENT_SECRET
- In the root folder
extensions.yml
change everycontractAddress
to the address of the deployed factory contract address - Follow the Paima Engine backend setup steps: docs
- Start the frontend: navigate to
harvest-flow/frontend
and runnpm run start
First run npm run initialize
if you haven't already.
To deploy the smart contracts to the testnet, make a copy of .env.localhost
and name it .env.testnet
. Set the following environment variables:
- All variables in the CHAIN Data section
- DEPLOYER_PRIVATE_KEY
- Navigate to
harvest-flow
- Set the network you want to use (ex:
export NETWORK=testnet
) - Run
npm run chain:deploy
That will deploy the factory contract and NFT template to the testnet. The addresses of the deployed contracts addresses will be saved inharvest-flow/contracts/ignition/deployments/{chainId}/deployed_addresses.json
When you have the factory contract address,
- Set it to the
.env.testnet
file asTOKTOK_NFT_FACTORY_CONTRACT_ADDRESS
. - Set this address in the
extensions.yml
file in the root folder as contractAddress.
- Set the
factoryContractAddress
value in harvest-flow/contracts/ignition/modules/deploy_testnet_projects.ts to the address of the deployed factory contract address from the previous step. - If you have a test token on the testnet, set the
paymentTokenContractAddress
value in harvest-flow/contracts/ignition/modules/deploy_testnet_projects.ts to the address of the test token. - If you don't have a test token, you can deploy one if you leave the
paymentTokenContractAddress
value as undefined. - If you deploy a test token and want to send an initial amount to a test account, set the
testAccountAddress
value too. - Set the
initParameters1
value to the desired value for the test project. - If everything is set up, run the following command: `npm run chain:deploy:testnet
- Get a Polyscan api key here
- Place your API key as
POLYGONSCAN_API_KEY
in the corresponding.env
(ex:.env.testnet
for Polygon Amoy) - Run
npx hardhat ignition verify chain-80002
after deploying the contracts (wherechain-${id}
is the network whose contracts you're verifying)