Skip to content

Instantly share code, notes, and snippets.

View joselvelez's full-sized avatar
👋
Learning & Experimenting

Jose L. Velez joselvelez

👋
Learning & Experimenting
View GitHub Profile
import keccak256 from "keccak256";
import { MerkleTree } from "merkletreejs";
import fs from "fs";
const leafValues = [];
let tree;
let root;
/**
* Creates a new file called 'MerkleTree.txt' that contains
@joselvelez
joselvelez / MyEpicNFT.sol
Last active November 21, 2021 21:52 — forked from farzaa/MyEpicNFT.sol
pragma solidity 0.8.0;
// We need some util functions for strings.
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "hardhat/console.sol";
contract MyEpicNFT is ERC721URIStorage {
@joselvelez
joselvelez / PseudoRandom.sol
Created November 21, 2021 20:21
Solidity pseudo random generator, for testing purposes
contract PseudoRandom {
function abiEncode(string memory stringInput) public view returns (bytes memory) {
return abi.encode(stringInput, msg.sender, block.timestamp);
}
function kHash(bytes memory bytesInput) public pure returns (uint) {
return uint(keccak256(bytesInput));
}
function random(string memory input, uint arrayLength) public view returns (uint) {
@joselvelez
joselvelez / App.js
Created October 18, 2021 13:36 — forked from adilanchian/App.js
Section 5: Update UI + deploy to an Ethereum testnet so anyone on the internet can wave at you using their
import React, { useEffect, useState } from "react";
import { ethers } from "ethers";
import './App.css';
import wavePortal from './utils/WavePortal.json';
const App = () => {
const [currentAccount, setCurrentAccount] = useState("");
const [allWaves, setAllWaves] = useState([]);
const contractAddress = "0xd5f08a0ae197482FA808cE84E00E97d940dBD26E";
@joselvelez
joselvelez / typescript_class_readonly_modifier.ts
Created May 23, 2021 16:13
Practicing with TypeScript Class readonly modifier
class TestReadOnly {
readonly testProp: string = "sup man";
constructor(newValue?: string) {
if (newValue !== undefined) {
this.testProp = newValue;
}
}
}
@joselvelez
joselvelez / structs.sol
Created May 11, 2021 16:03
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.0+commit.c7dfd78e.js&optimize=false&runs=200&gist=
contract CarCollection {
struct Car {
string name;
bool owned;
string color;
}
Car[] public cars;