Skip to content

Instantly share code, notes, and snippets.

View dabit3's full-sized avatar
🎡
probably nothing

Nader Dabit dabit3

🎡
probably nothing
View GitHub Profile
@dabit3
dabit3 / index.js
Last active February 17, 2022 00:46
Metaverse Marketplace pages/index.js
/* pages/index.js */
import { ethers } from 'ethers'
import { useEffect, useState } from 'react'
import axios from 'axios'
import Web3Modal from "web3modal"
import {
nftaddress, nftmarketaddress
} from '../config'
@dabit3
dabit3 / _app.js
Last active September 20, 2021 02:24
Metaverse Marketplace pages/_app.js
/* pages/_app.js */
import '../styles/globals.css'
import Link from 'next/link'
function Marketplace({ Component, pageProps }) {
return (
<div>
<nav className="border-b p-6">
<p className="text-4xl font-bold">Metaverse Marketplace</p>
<div className="flex mt-4">
@dabit3
dabit3 / sample-test.js
Last active April 30, 2022 22:58
Testing the Metaverse Marketplace contract
/* test/sample-test.js */
describe("NFTMarket", function() {
it("Should create and execute market sales", async function() {
/* deploy the marketplace */
const Market = await ethers.getContractFactory("NFTMarket")
const market = await Market.deploy()
await market.deployed()
const marketAddress = market.address
/* deploy the NFT contract */
@dabit3
dabit3 / hardhat.config.js
Last active November 8, 2024 01:09
Initial hardhat configuration - Polygon tutorial
/* hardhat.config.js */
require("@nomiclabs/hardhat-waffle")
module.exports = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 1337
},
// mumbai: {
@dabit3
dabit3 / Market.sol
Last active May 18, 2022 21:06
Metaverse Marketplace Smart Contract
// contracts/Market.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "hardhat/console.sol";
@dabit3
dabit3 / NFT.sol
Last active March 6, 2022 22:44
Basic NFT Smart Contract
// contracts/NFT.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "hardhat/console.sol";
@dabit3
dabit3 / basicmarket.sol
Last active January 9, 2024 08:54
Basic NFT marketplace
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract NFT is ERC721URIStorage {
using Counters for Counters.Counter;
@dabit3
dabit3 / next-graph-nfts.js
Last active August 11, 2023 06:49
StackBlitz, GraphQL, The Graph, Zora, & Next.js
import React from 'react'
import { createClient } from 'urql'
const client = createClient({
url: 'https://api.thegraph.com/subgraphs/name/dabit3/zoranftsubgraph'
})
const query = `
query {
tokens(
@dabit3
dabit3 / subgraph.yml
Created April 23, 2021 16:54
Example subgraph with two contract data sources
specVersion: 0.0.2
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Token
network: mainnet
source:
address: "0xabEFBc9fD2F806065b4f3C237d4b59D9A97Bcac7"
abi: Token
@dabit3
dabit3 / react-web3-example.js
Last active March 22, 2022 01:48
Example of connecting to an Ethereum wallet using React & Web3
import { useState, useEffect } from 'react'
import Web3 from 'web3'
const [account, setAccount] = useState(null)
let [web3, setWeb3] = useState(null)
useEffect(() => {
checkAccount()
}, [])
// invoke to connect to wallet account