Skip to content

Instantly share code, notes, and snippets.

Avatar
👋
Learning & Experimenting

Jose L. Velez joselvelez

👋
Learning & Experimenting
View GitHub Profile
View gist:2e2ebd7bd5f95d3641f0c71f3b279036
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
View 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 Nov 21, 2021
Solidity pseudo random generator, for testing purposes
View PseudoRandom.sol
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 Oct 18, 2021 — 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
View App.js
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
Practicing with TypeScript Class readonly modifier
View typescript_class_readonly_modifier.ts
class TestReadOnly {
readonly testProp: string = "sup man";
constructor(newValue?: string) {
if (newValue !== undefined) {
this.testProp = newValue;
}
}
}
@joselvelez
joselvelez / structs.sol
Created May 11, 2021
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=
View structs.sol
contract CarCollection {
struct Car {
string name;
bool owned;
string color;
}
Car[] public cars;