Skip to content

Instantly share code, notes, and snippets.

Avatar
🏗️
Ethereum Applications

Kames Geraghty kamescg

🏗️
Ethereum Applications
  • New York
View GitHub Profile
View shortcuts.md

Multi-Cursor (Select Multiple Words) Mac: Shift + Cmd + L

View .sol
function deploy(bytes _code, bytes32 _salt) public payable {
assembly {
_contract := create2(
callvalue(),
add(_code, 32),
mload(_code),
_salt)
}
}
@kamescg
kamescg / .sol
Last active Dec 17, 2020
Encode Transaction and called MakerDAO DsProxyActions Contract
View .sol
/* ------------------------ */
// Call Vault Manager (DsProxyActions.sol)
/* ------------------------ */
function callVaultManager (bytes memory _data) public payable {
IDSProxy proxy = IDSProxy(dss_proxy);
proxy.execute.value(msg.value)(vault_manager, _data);
}
function callVaultManager (uint256 _amount, bytes memory _data) public {
IDSProxy proxy = IDSProxy(dss_proxy);
@kamescg
kamescg / .sol
Created May 19, 2020
Encode openLockETHAndDraw MakerDAO method
View .sol
function openLockETHAndDraw(
address manager,
address jug,
address ethJoin,
address daiJoin,
bytes32 ilk,
uint wadD
) public pure returns (bytes memory) {
return abi.encodeWithSignature("openLockETHAndDraw(address,address,address,address,bytes32,uint256)", manager, jug, ethJoin, daiJoin, ilk, wadD);
}
@kamescg
kamescg / .md
Created Apr 27, 2020
Docker Cheatsheet
View .md

Docker Cheatsheet

Cleanup

$ docker images -aq -f 'dangling=true' | xargs docker rmi

docker volume ls -q -f 'dangling=true' | xargs docker volume rm

@kamescg
kamescg / .md
Created Apr 23, 2020
Gatsby Information & Resources
View .md
@kamescg
kamescg / .js
Created Apr 12, 2020
React Component Validation/Rendering
View .js
export function isClassComponent(component) {
return (
typeof component === 'export function' &&
!!component.prototype.isReactComponent
) ? true : false
}
export function isInlineFunctionComponent(component) {
return (
typeof component === 'function' &&
@kamescg
kamescg / .js
Created Mar 30, 2020
useContractSendTransaction.js
View .js
/**
* @function useContractSendTransaction
*/
/* --- Global --- */
import { useEffect, useReducer } from "react";
import { selectors } from "@ethers-react/system";
/* --- Module --- */
import withEthers from "../withContext";