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
// 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;
address private oracle;
bytes32 private jobId;
uint256 private fee;
/**
* Network: Kovan
@PatrickAlphaC
PatrickAlphaC / setfulfillmentpermission_script.js
Last active March 24, 2021 05:08
setfulfillmentpermission_script.js
let ethers = require('ethers')
let provider = new ethers.providers.JsonRpcProvider(process.env.KOVAN_RPC_URL)
let oracleAddress = '0xCAB9Ba909AfC195F9B5a4323631cBA2f7D1609EC'
let oracleAbi = [
{
"constant": false,
"inputs": [
{
"name": "_sender",
pragma solidity ^0.6.7;
contract Counter {
uint256 public count;
constructor() public {
count = 0;
}
@PatrickAlphaC
PatrickAlphaC / CrowdFunder.sol
Created February 26, 2021 18:54
Sample CrowdFunder application. Deploy in remix with:
// *** EXAMPLE: A crowdfunding example (broadly similar to Kickstarter) ***
// ** START EXAMPLE **
// CrowdFunder.sol
pragma solidity ^0.6.6;
/// @title CrowdFunder
/// @author nemild
contract CrowdFunder {
// Variables set on create by creator
// First, a simple Bank contract
// Allows deposits, withdrawals, and balance checks
// simple_bank.sol (note .sol extension)
/* **** START EXAMPLE **** */
// Declare the source file compiler version
pragma solidity 0.6.6;
/** 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 "https://raw.githubusercontent.com/smartcontractkit/chainlink/master/evm-contracts/src/v0.6/ChainlinkClient.sol";
@PatrickAlphaC
PatrickAlphaC / Questions.sol
Created January 29, 2021 15:50
mapping_mapping
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
contract Questions {
uint256 public questionIdCounter;
mapping(uint256 => Question) public questions;
struct Question {
/** 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.0;
import "https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/evm-contracts/src/v0.6/ChainlinkClient.sol";
/** 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
@PatrickAlphaC
PatrickAlphaC / sampleContractCall.js
Created November 4, 2020 02:41
Sample contract call and getting gas price from the fastgas chainlink contract
let ethers = require('ethers')
let provider = new ethers.providers.JsonRpcProvider(process.env.KOVAN_RPC_URL)
let address = '0x1510B61ba590751bB5dAa9757Bec1e8A0036E34f'
let abi = [
{
"inputs": [
{
"internalType": "uint256",
"name": "userProvidedSeed",