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 / bad-data-erc20.json
Last active March 15, 2024 04:48
hextool gists
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
@zeuslawyer
zeuslawyer / source.js
Created November 9, 2023 07:20
Functions-OpenAI
const gptPrompt = args[0];
const postData = {
model: "gpt-3.5-turbo",
messages: [{ role: "user", content: gptPrompt }],
temperature: 0,
};
const openAIResponse = await Functions.makeHttpRequest({
url: "https://api.openai.com/v1/chat/completions",
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {FunctionsClient} from "@chainlink/contracts/src/v0.8/functions/dev/v1_0_0/FunctionsClient.sol";
import {ConfirmedOwner} from "@chainlink/contracts/src/v0.8/shared/access/ConfirmedOwner.sol";
import {FunctionsRequest} from "@chainlink/contracts/src/v0.8/functions/dev/v1_0_0/libraries/FunctionsRequest.sol";
/**
* @title Chainlink Functions example on-demand consumer contract example
*/
@zeuslawyer
zeuslawyer / IMAGES FOR READMES
Last active November 13, 2023 02:33
Images for Functions-Twilio-Spotify
Holds images
// 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.
@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)
@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 / 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 / .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 / 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()