๐ŸšงDeploying EVM Contracts

Using solidity

Deploying EVM Contracts

Follow the steps below to contribute to Genadrop

  1. create a .env file and add the rpc url for the respective chain you want to deploy to.

  2. Make sure Hardhat is installed, checkout the scripts under the Scripts folder

  3. In your console, run yarn hardhat run --network (network-name) (script-name) i.e yarn hardhat run --network avax scripts/deployMarket.js to deploy on avax network(check the hardhatconfig.js file to see the various network tags)

  4. The script runs and returns the Deployed Contract address

Solidity Contracts

The GenaDrop solidity contracts can be found here

https://github.com/codingshot/genadrop/tree/main/contracts

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract SoulBound is ERC721, ERC721URIStorage, ERC721Burnable {
    using Counters for Counters.Counter;

    Counters.Counter private _tokenIdCounter;

    constructor() ERC721("GenadropSoulBound", "GSB") {}

    function safeMint(address to, string memory uri) public {
        uint256 tokenId = _tokenIdCounter.current();
        _tokenIdCounter.increment();
        _safeMint(to, tokenId);
        _setTokenURI(tokenId, uri);
    }

    function _beforeTokenTransfer(
        address _from,
        address _to,
        uint256 _tokenId
    ) internal virtual override {
        require(
            _from == address(0) || _to == address(0),
            "Soulbound tokens can not be transferred, they can only be burned."
        );
        super._beforeTokenTransfer(_from, _to, _tokenId);
    }

    // The following functions are overrides required by Solidity.

    function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
        super._burn(tokenId);
    }

    function tokenURI(uint256 tokenId)
        public
        view
        override(ERC721, ERC721URIStorage)
        returns (string memory)
    {
        return super.tokenURI(tokenId);
    }
}so

Last updated