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 / deploy-lens.sh
Last active October 16, 2022 02:24
Deploying Lens Protocol with Hardhat
git clone [email protected]:lens-protocol/core.git
cd lens-protocol
touch .env
npm install
npm run compile
# in a new terminal window
npx hardhat node
# in the original terminal window
@dabit3
dabit3 / Call.t.sol
Created June 26, 2022 18:47
Testing calling another contract with Foundry / Solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import 'src/Call.sol';
contract AuctionTest is Test {
Call callContract;
TestCall tCallContract;
@dabit3
dabit3 / App.js
Last active February 14, 2023 03:51
Arweave client example with Matic
import { WebBundlr } from "@bundlr-network/client"
import { providers } from "ethers"
/* initialize some local state to store the bundlr instance */
const [bundlrInstance, setBundlrInstance] = useState(null)
/* connect to the user's wallet */
async function connect() {
await window.ethereum.request({ method: 'eth_requestAccounts' })
const provider = new providers.Web3Provider(window.ethereum)
@dabit3
dabit3 / marketplace.sol
Last active November 8, 2024 01:09
NFT Marketplace Smart Contract (V2)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
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";
contract NFTMarketplace is ERC721URIStorage {
@dabit3
dabit3 / ceramic_identity_playground.js
Last active February 26, 2022 17:12
Playing around with Ceramic identity and self.id
import { useState } from 'react'
import Head from 'next/head'
import styles from '../styles/Home.module.css'
import { CeramicClient } from '@ceramicnetwork/http-client'
import { DID } from 'dids'
import { ThreeIdConnect } from '@3id/connect'
const SID = require('@self.id/web')
const { EthereumAuthProvider, SelfID, WebClient } = SID
@dabit3
dabit3 / connectweb3wallet.js
Created December 1, 2021 16:19
Connecting a web3 wallet
import { ethers } from 'ethers'
import Web3Modal from 'web3modal'
import WalletConnectProvider from '@walletconnect/web3-provider'
async function getWeb3Modal() {
const web3Modal = new Web3Modal({
network: 'mainnet',
cacheProvider: false,
providerOptions: {
walletconnect: {
@dabit3
dabit3 / post-test.js
Last active May 8, 2024 10:54
Test for Solana Blog
const anchor = require("@project-serum/anchor");
const assert = require("assert");
const { PublicKey } = anchor.web3;
describe("blog", () => {
anchor.setProvider(anchor.Provider.env());
const program = anchor.workspace.Blog;
const post = anchor.web3.Keypair.generate();
@dabit3
dabit3 / blogpost.rs
Last active December 30, 2024 09:13
Example blog program - Anchor, Solana, and Rust
use anchor_lang::prelude::*;
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod blog {
use super::*;
pub fn create_blog(ctx: Context<CreateBlog>, name: String, bump: u8) -> Result<()> {
ctx.accounts.blog.name = name;
@dabit3
dabit3 / arweaveexample.js
Last active March 24, 2022 21:19
Example of interacting with Arweave using arweave.js and ArConnect
/*
* Arconnect docs: https://arconnect.io/
* arweave.js docs: https://github.com/ArweaveTeam/arweave-js
* Arweave developer docs: https://docs.arweave.org/developers/
*/
import Arweave from 'arweave';
const arweave = Arweave.init({
// host: 'arweave.net'
@dabit3
dabit3 / dockerfile
Last active October 5, 2021 01:40
OpenVSCode Server
# Build locally
# docker build . -t myvscodeapp
# Run locally
# docker run -it -p 3000:3000 myvscodeapp
FROM gitpod/openvscode-server:latest
USER root
ENV NODE_VERSION=14.18.0
RUN apt-get update