CREESTL / Genie

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CyberGenie smart-contract

The following information will guide you through the process of building and deploying the contract yourself.

Prerequisites 📃

  • Install Node.js
  • Clone this repository with git clone https://git.sfxdx.ru/nft-audit/nft-audit-sc.git
  • Navigate to the directory with the cloned code
  • Install Hardhat with npm install --save-dev hardhat
  • Install all required dependencies with npm install
  • Create a file called .env in the root of the project with the same contents as .env.example
  • Copy your wallet's private key (see Wallets) to .env file
    PRIVATE_KEY=***your private key***
    
  • Create an account on Etherscan. Go to Account -> API Keys. Create a new API key. Copy it to .env file
    ETHERSCAN_API_KEY=***your etherscan API key***
    
  • Create an account on Polygonscan. Go to Account -> API Keys. Create a new API key. Copy it to .env file
    POLYGONSCAN_API_KEY=***your polygonscan API key***
    
  • Create an account on Infura. Go to Dashboard -> Create new key -> Manage key. Copy API key to .env file
    INFURA_API_KEY=***your infura API key***
    

⚠️DO NOT SHARE YOUR .env FILE IN ANY WAY OR YOU RISK TO LOSE ALL YOUR FUNDS⚠️

Build & Deploy

1. Build

npx hardhat compile

2. Deploy

Start deployment only if build was successful!

Testnets

а) Rinkeby test network
Make sure you have enough RinkebyETH tokens for testnet. You can get it for free from faucet.

npx hardhat run scripts/deploy.js --network rinkeby

b) Mumbai test network
Make sure you have enough MATIC tokens for testnet. You can get it for free from faucet.

npx hardhat run scripts/deploy.js --network mumbai

Mainnets

c) Ethereum main network
Make sure you have enough real ether in your wallet. Deployment to the mainnet costs money!

npx hardhat run scripts/deploy.js --network ethereum

c) Polygon main network
Make sure you have enough real MATIC in your wallet. Deployment to the mainnet costs money!

npx hardhat run scripts/deploy.js --network polygon

Deployment script takes more than 1.5 minutes to complete. Please, be patient!.

After the contracts get deployed you can find their addresses and code verification URLs in the deployOutput.json file. You have to provide these wallets with real/test tokens in order to call contracts' methods from them.

Please note that all deployed contracts are verified on either Etherscan (testnet Ethersan) or Polygonscan (testnet Polygonscan).

Wallets

For deployment you will need to use either your existing wallet or a generated one.

Using existing wallet

If you choose to use your existing wallet, then you will need to be able to export (copy/paste) its private key. For example, you can export private key from your MetaMask wallet.
Wallet's private key should be pasted into the .env file (see Prerequisites).

Creating a new wallet

If you choose to create a fresh wallet for this project, you should use createWallet script from scripts/ directory.

npx hardhat run scripts/createWallet.js

This will generate a single new wallet and show its address and private key. Save them somewhere else!
A new wallet does not hold any tokens. You have to provide it with tokens of your choice.
Wallet's private key should be pasted into the .env file (see Prerequisites).

About


Languages

Language:Solidity 96.1%Language:JavaScript 3.9%