Skip to content

Instantly share code, notes, and snippets.

View pi0neerpat's full-sized avatar
🤠

Patrick Gallagher pi0neerpat

🤠
View GitHub Profile
@pi0neerpat
pi0neerpat / redwood-rest.md
Last active February 28, 2021 18:02
5 minute REST API example in Redwood

Add to /api/db/schema.prisma

model Request {
  id        String   @id @default(uuid())
  createdAt DateTime @default(now())
  data String
  origin String
}
@pi0neerpat
pi0neerpat / Deploy.js
Created February 23, 2021 04:07
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.3+commit.9bfce1f6.js&optimize=false&runs=200&gist=
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner()
async function deployAndLog(name, args = []) {
const rawData = await remix.call('fileManager', 'getFile', `browser/artifacts/${name}.json`)
const metadata = JSON.parse(rawData)
const bytecode = metadata.data.bytecode.object
console.log(`Deploying ${name}, bytecode length: ${bytecode.length}, isHexString: ${ethers.utils.isHexString("0x"+bytecode)}`)
// const factory = new ethers.ContractFactory(metadata.abi, `0x${metadata.data.bytecode.object}`, signer)
const factory = new ethers.ContractFactory(metadata.abi, bytecode, signer)
const newContract = await factory.deploy(...args);
@pi0neerpat
pi0neerpat / Deploy.js
Last active February 23, 2021 01:47
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.3+commit.9bfce1f6.js&optimize=false&runs=200&gist=
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner()
async function deployAndLog(name, args = []) {
const rawData = await remix.call('fileManager', 'getFile', `browser/artifacts/${name}.json`)
const metadata = JSON.parse(rawData)
const bytecode = metadata.data.bytecode.object
console.log(`Deploying ${name}, bytecode length: ${bytecode.length}, isHexString: ${ethers.utils.isHexString("0x"+bytecode)}`)
// const factory = new ethers.ContractFactory(metadata.abi, `0x${metadata.data.bytecode.object}`, signer)
const factory = new ethers.ContractFactory(metadata.abi, bytecode, signer)
const newContract = await factory.deploy(...args);
@pi0neerpat
pi0neerpat / RedirectAll.sol
Last active May 10, 2021 17:19
Superfluid App Example: tradeable-cashflow
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import {
ISuperfluid,
ISuperToken,
ISuperApp,
ISuperAgreement,
SuperAppDefinitions
@pi0neerpat
pi0neerpat / templateComment.md
Created January 4, 2021 22:31
Public comment for Financial Crimes Enforcement Network: Requirements for Certain Transactions Involving Convertible Virtual Currency or Digital Assets

These proposed rules seek to eliminate privacy and autonomy, which are core components to the virtual currency / finance tech industry. This sends a message that the US is not open for financial innovation, and encourages financial tech companies to seek incorporation elsewhere. Further, the methods proposed are ineffective for combating illicit activity such as money laundering. Instead, the proposed rule will generate an unnecessary amount of financial surveillance for ordinary citizens, which will become a honeypot of personal data for attackers.

If these proposed rules are enacted, many useful and innovative financial tools, both now and in the future, will not be available to US citizens. These tools enable all people, regardless of economic status, gender, or race, the ability to improve their financial situation. These tools offer better alternatives for individuals in the areas of micro-finance, savings accounts, and responsible investment. Without these tools, US citizens will be "left in the dark"

@pi0neerpat
pi0neerpat / browser.js
Created December 17, 2020 20:52
Handling terrible metamask ux
import { Web3Provider } from "@ethersproject/providers";
import {
isWeb3EnabledBrowser,
getErrorResponse,
isMobile,
WALLET_LINK_ID,
METAMASK_ID
} from "../general";
did:key:z6MkrhLBfwRkSedFLwQyJtyFB1ypBD557eq5k4hVvLvADREh
did:key:z6MkhDfYts7uX9t5z8tbuXsUAqVeQFaqdhP1CC3Eu9WWXFQ2
did:key:z6MkrhLBfwRkSedFLwQyJtyFB1ypBD557eq5k4hVvLvADREh
did:key:z6MkkyAkqY9bPr8gyQGuJTwQvzk8nsfywHCH4jyM1CgTq4KA