Skip to content

Instantly share code, notes, and snippets.

View zeuslawyer's full-sized avatar
💭
Ka-Boom!

Zubin zeuslawyer

💭
Ka-Boom!
View GitHub Profile
@zeuslawyer
zeuslawyer / gist:5320fc58949ded8f0ffff54fc363e999
Created December 10, 2018 04:14
adding modal element to react's index.html
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<div id="modal"></div> . //ADD THIS
@zeuslawyer
zeuslawyer / DialogflowApp
Last active May 25, 2019 22:08
Dialogflow App Fulfilment via EXPRESS server on Cloud Functions
const {
dialogflow,
Permission,
Suggestions,
BasicCard
} = require("actions-on-google");
// Instantiate the Dialogflow client.
const app = dialogflow({ debug: true });
@zeuslawyer
zeuslawyer / pushToRemote.sh
Created September 10, 2019 04:17
script that lets you create and then push to remote repo in github. access from inside project root folder <<~/scripts>>/pushToRemote.sh
#!/bin/bash
# Make executable with chmod +x <<filename.sh>>
CURRENTDIR=${pwd}
# step 1: name of the remote repo. Enter a SINGLE WORD ..or...separate with hyphens
echo "What name do you want to give your remote repo?"
read REPO_NAME
echo "Enter a repo description: "
read DESCRIPTION
@zeuslawyer
zeuslawyer / form-with-hooks.jsx
Created September 22, 2019 06:15
react hooks based controlled form
import React , {useState} from "react";
import ReactDOM from "react-dom";
import "./styles.css";
function App() {
const defaultFormState = {
first: '',
second: '',
third: '',
@zeuslawyer
zeuslawyer / buy-item.js
Last active May 17, 2022 02:23
Interaction scripts to interact with the NFT marketplace sample code
/////////////////////
// BUY ITEM //
/////////////////////
const { ethers } = require("hardhat")
const TOKEN_ID = 0 // SET THIS BEFORE RUNNING SCRIPT
async function buyItem() {
const accounts = await ethers.getSigners()
@zeuslawyer
zeuslawyer / .deps...contracts...ConsumerContract.sol
Last active October 11, 2022 04:23
Client Contract for Oracle/Operator contract associated with my test CL Node for External Adapters
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
import "@chainlink/contracts/src/v0.8/ConfirmedOwner.sol";
/**
* THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE.
* DO NOT USE THIS CODE IN PRODUCTION.
*/
@zeuslawyer
zeuslawyer / Node Script-event listener
Last active October 14, 2022 11:43
Ethereum Event Listener
const ethers = require("ethers");
const TetherTokenABI = require("../ABI/TetherToken.json");
const MyContractAbi = require("../ABI/EventEmitter.json");
require("dotenv").config();
const listenToTether = async () => {
const USDT = "0x509Ee0d083DdF8AC028f2a56731412edD63223B9";
const provider1 = new ethers.providers.WebSocketProvider(
@zeuslawyer
zeuslawyer / pricefeedtrackerv1.sol
Created October 29, 2022 23:31
OpenZeppelin + Chainlink Upgradeable Contracts
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract PriceFeedTracker is Initializable {
address private admin;
function initialize(address _admin) public initializer {
@zeuslawyer
zeuslawyer / clearMempool.js
Last active July 19, 2023 08:21
Mempool unblocker
// NOTE THIS IS A HARDHAT SCRIPT. NEEDS A hardhat.config.json file.
const { ethers } = require("hardhat")
async function main() {
const provider = new ethers.providers.JsonRpcProvider(process.env.SEPOLIA_RPC_URL)
const gasPrice = await provider.getGasPrice()
console.log(gasPrice)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "https://github.com/smartcontractkit/functions-hardhat-starter-kit/blob/main/contracts/dev/functions/FunctionsClient.sol";
// import "@chainlink/contracts/src/v0.8/dev/functions/FunctionsClient.sol"; // Once published
import "@chainlink/contracts/src/v0.8/ConfirmedOwner.sol";
/**
* @title Functions Consumer contract
* @notice This contract is a demonstration of using Functions.