Skip to content

Instantly share code, notes, and snippets.

View austintgriffith's full-sized avatar
💭
:bowtie:

Austin Griffith austintgriffith

💭
:bowtie:
View GitHub Profile
@austintgriffith
austintgriffith / YourContract.sol
Last active February 26, 2023 22:48
a simple contract to let people check in and out and keep a count going
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
// Useful for debugging. Remove when deploying to a live network.
//import "hardhat/console.sol";
// Use openzeppelin to inherit battle-tested implementations (ERC20, ERC721, etc)
// import "@openzeppelin/contracts/access/Ownable.sol";
/**
* A smart contract that allows changing a state variable of the contract and tracking the changes

0x0acb799a01e250a6a46bc361f07ccca41d9c512168cf48e6613272ed1e427be5

I contributed to the clr.fund Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: qvt32
Contributor # 117
Hash: 4706209d 798aa8d9 b307094d 815740b3
50e3800a c6b77c35 537cf6a6 a6c84282
c3931d3c 1a11b335 e7a853fe 815122e2
d2a91f3a d998b83e fa524202 aebcf307
0. (Probably already done right?) Install MetaMask in chrome and fund your wallet with ETH.
deliverable) post your address in the channel or screenshot
1. Swap ETH to DAI using uniswap.io and your MetaMask
deliverable) etherscan.io transaction link to the token transfer
bonus) can you explain the difference between ETH and DAI?
@austintgriffith
austintgriffith / deploy.js
Last active May 20, 2020 23:19
Buidler Deploy Script - any .json artifact in the contracts folder will get deployed
const fs = require('fs');
const chalk = require('chalk');
async function main() {
let contractList = fs.readdirSync("./artifacts")
for(let c in contractList){
if(contractList[c].indexOf(".json")>=0){
const name = contractList[c].replace(".json","")
const contractArtifacts = artifacts.require(name);
const contract = await contractArtifacts.new()
console.log(chalk.cyan(name),"deployed to:", chalk.magenta(contract.address));
@austintgriffith
austintgriffith / buidler.config.js
Last active April 20, 2020 15:47
My Buidler Scripts
const { usePlugin } = require('@nomiclabs/buidler/config')
usePlugin("@nomiclabs/buidler-truffle5");
const DEBUG = true
task("accounts", "Prints the list of accounts", async () => {
const accounts = await web3.eth.getAccounts();
for (const account of accounts) {
console.log(account);
}
@austintgriffith
austintgriffith / create.js
Last active February 24, 2020 20:47
create an ethereum account and store it in account.json
const fs = require('fs');
const Web3 = require('web3');
const web3 = new Web3("http://localhost:8545");
const filename = "account.json"
if (fs.existsSync(filename)) {
console.log(filename+" already exists (delete it to create a new account)")
}else{
let account = web3.eth.accounts.create();
console.log(filename,account)
#!/bin/bash
sudo apt install golang-go -y
chmod 0777 /home/nuc/*.log
sudo apt-get install -y build-essential
cd /home/nuc/go-ethereum; git pull > /home/nuc/pull.log; make geth > /home/nuc/make.log
/home/nuc/go-ethereum/build/bin/geth version > /home/nuc/geth.log 2>&1
/home/nuc/go-ethereum/build/bin/geth --allow-insecure-unlock --cache=4096 --maxpeers=50 --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*" --rpcapi="db,eth,net,web3,personal,admin,debug,miner,txpool" >> /home/nuc/geth.log 2>&1 &
bash <(curl https://get.parity.io -Lk)
cd /home/nuc/;su - nuc -c 'parity --chain poa-chain-spec/spec.json --reserved-peers poa-chain-spec/bootnodes.txt --ports-shift=10 --jsonrpc-hosts=all --jsonrpc-interface=all --jsonrpc-cors=all --no-warp' >> /home/nuc/parity-xdai.log 2>&1 &
let messageBuffer = {}
module.exports = (web3)=>{
let burnerWeb3 = web3
var iframe = document.createElement('iframe')
iframe.style.opacity = 0.9
iframe.style.position = "absolute"
iframe.style.width = "300px"
@austintgriffith
austintgriffith / predictivedeployment.js
Last active November 17, 2018 18:46
simple script to create a predictive deployment of a smart contract
var ethers = require('ethers');
var fs = require('fs');
var Wallet = ethers.Wallet;
//usage: node craft.js ABI_FILE BYTECODE_FILE GAS_LIMIT GAS_PRICE [...CONSTRUCTOR ARGUMENTS]
//node craft.js "../Sweeper/Sweeper.abi" "../Sweeper/Sweeper.bytecode" 250000 100000000000 (cat ../Loan/Loan.address) (cat ../SomeCoin/SomeCoin.address) 1
const wallet = ethers.Wallet.createRandom();
let httpProvider = new ethers.providers.JsonRpcProvider();
let abi = fs.readFileSync(process.argv[2]).toString()
let bytecode = fs.readFileSync(process.argv[3]).toString()
let factory = new ethers.ContractFactory(abi, bytecode, wallet);