This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "name", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "string" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Holds images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////// | |
// BUY ITEM // | |
///////////////////// | |
const { ethers } = require("hardhat") | |
const TOKEN_ID = 0 // SET THIS BEFORE RUNNING SCRIPT | |
async function buyItem() { | |
const accounts = await ethers.getSigners() |
NewerOlder