Skip to content

Instantly share code, notes, and snippets.

View PatrickAlphaC's full-sized avatar
💭
Enabling web3 developers at scale

Patrick Collins PatrickAlphaC

💭
Enabling web3 developers at scale
View GitHub Profile
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
/**
* @notice DO NOT USE THIS CODE IN PRODUCTION. This is an example contract.
*
* The job spec for this node is located here:
* https://gist.github.com/PatrickAlphaC/53848768b3ca6c747cf1166ccb2f65ec
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
/**
* @notice DO NOT USE THIS CODE IN PRODUCTION. This is an example contract.
*/
contract GenericBigWord is ChainlinkClient {
using Chainlink for Chainlink.Request;
@PatrickAlphaC
PatrickAlphaC / multiword.json
Created July 29, 2021 17:48
Multi-word Job Spec
{
"name": "multi-word",
"initiators": [
{
"id": 139,
"jobSpecId": "bcf76dc2-7fd4-484f-ab68-1d3f239cd2c3",
"type": "runlog",
"params": {
"address": "0x7eb318734142a6375787379de2fa202e4058d03f"
}
@PatrickAlphaC
PatrickAlphaC / getDataPreCoordinator.sol
Created May 10, 2020 20:07
Get data using the precoordinator tool
pragma solidity ^0.6.0;
import "github.com/smartcontractkit/chainlink/evm-contracts/src/v0.6/ChainlinkClient.sol";
// MyContract inherits the ChainlinkClient contract to gain the
// functionality of creating Chainlink requests
contract ChainlinkExample is ChainlinkClient {
// Stores the answer from the Chainlink oracle
uint256 public currentPrice;
address public owner;
@PatrickAlphaC
PatrickAlphaC / VRFD20.sol
Last active June 23, 2021 12:25 — forked from alexroan/VRFD20.sol
Game of Thrones 20 Sided Dice
// SPDX-License-Identifier: MIT
pragma solidity 0.6.6;
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
import "@chainlink/contracts/src/v0.6/Owned.sol";
/**
* @notice A Chainlink VRF consumer which uses randomness to mimic the rolling
* of a 20 sided die
* @dev This is only an example implementation and not necessarily suitable for mainnet.
@PatrickAlphaC
PatrickAlphaC / RandomNumberConsumer.sol
Last active June 23, 2021 12:12 — forked from alexroan/RandomNumberConsumer.sol
Random Number Generator. Use this gist as a way to generate a random number in solidity or your EVM compatible smart contracts. If you'd like to deploy it to remix, try this: url: https://remix.ethereum.org/#version=soljson-v0.6.6+commit.6c089d02.js&optimize=false&evmVersion=null&gist=f47e4eae5f2ffa7868ef4ecd5bda9044
/** This example code is designed to quickly deploy an example contract using Remix.
* If you have never used Remix, try our example walkthrough: https://docs.chain.link/docs/example-walkthrough
* You will need testnet ETH and LINK.
* - Kovan ETH faucet: https://faucet.kovan.network/
* - Kovan LINK faucet: https://kovan.chain.link/
*/
pragma solidity 0.6.6;
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
@PatrickAlphaC
PatrickAlphaC / APIConsumer.sol
Created June 23, 2021 12:10 — forked from alexroan/APIConsumer.sol
APIConsumer.sol
// This example code is designed to quickly deploy an example contract using Remix.
pragma solidity ^0.6.0;
import "https://raw.githubusercontent.com/smartcontractkit/chainlink/master/evm-contracts/src/v0.6/ChainlinkClient.sol";
contract APIConsumer is ChainlinkClient {
uint256 public volume;
pragma solidity 0.6.6;
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
/**
* THIS IS AN EXAMPLE CONTRACT WHICH USES HARDCODED VALUES FOR CLARITY.
* PLEASE DO NOT USE THIS CODE IN PRODUCTION.
*/
contract RandomNumberConsumer is VRFConsumerBase {
/** This example code is designed to quickly deploy an example contract using Remix.
* If you have never used Remix, try our example walkthrough: https://docs.chain.link/docs/example-walkthrough
* You will need testnet ETH and LINK.
* - Kovan ETH faucet: https://faucet.kovan.network/
* - Kovan LINK faucet: https://kovan.chain.link/
*/
// VRF Coordinator 0xdD3782915140c8f3b190B5D67eAc6dc5760C46E9
// Key Hash 0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract A {
uint public num;
address public sender;
uint public value;
function setVars(uint _num) public payable {