Skip to content

Instantly share code, notes, and snippets.

View kamescg's full-sized avatar
🏗️
Ethereum Applications

Kames Geraghty kamescg

🏗️
Ethereum Applications
View GitHub Profile
@kamescg
kamescg / .sol
Last active December 17, 2020 03:52
Encode Transaction and called MakerDAO DsProxyActions Contract
/* ------------------------ */
// 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 22, 2020 15:31
CREATE2
function deploy(bytes _code, bytes32 _salt) public payable {
assembly {
_contract := create2(
callvalue(),
add(_code, 32),
mload(_code),
_salt)
}
}

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

@kamescg
kamescg / .js
Last active November 24, 2021 05:16
convertMessageTemplateToMessageObject
function filterResources(values: Array<string[]>): Array<string[]> {
return values.filter(value => value[0] !== "Resources" && value[0] !== " https");
}
export interface UnsignedMessage {
domain: string;
address: string;
version: string;
nonce: string;
uri: string;
@kamescg
kamescg / gist:6f84bd5e47ae6fff7f7f5c53933c09e3
Last active April 20, 2022 15:02
graphql-serverless.js
import express from "express";
import {ApolloServer,gql} from "apollo-server-express";
import graphiql from "graphql-playground-middleware-express";
import serverless from "serverless-http";
const typeDefs = gql`
type Prize {
address: String
pick: String
tier: Number
@kamescg
kamescg / EVMModulePoolTogetherUtililites.sol
Created April 7, 2022 13:23
EVMModulePoolTogetherUtililites
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.6;
contract EVMModulePoolTogetherUtililites {
function parseUnits(
uint256 amount,
uint8 decimals
) public pure returns(uint256) {
return amount * (10 ** decimals);
@kamescg
kamescg / set.smartcontract.ERC20Minimal.json
Last active April 8, 2022 15:17
set.smartcontract.ERC20Minimal.json
{
"id":"set-erc20-example-minimal",
"object":"set.smartcontract",
"name":"ERC20 Smart Contract Set Example Minimal",
"description":"Demonstrate set validation using a ERC20 interface",
"timestamp":"2018-11-13T20:20:39+00:00",
"version":{
"major":0,
"minor":1,
"patch":0
@kamescg
kamescg / SmartContract.WETH9.TransferInterface.json
Last active April 8, 2022 10:32
SmartContractWETH9:TransferInterface
{
"id":"erc20-weth-smart-contract",
"name":"ERC20: WETH Smart Contract",
"object":"entity.smartcontract",
"chainId":1,
"address":"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"abi":[
{
"constant":false,
"inputs":[
@kamescg
kamescg / weth.withdraw.transaction.json
Last active April 15, 2022 12:20
Web3 Set | Wrapped Ether: Withdraw
{
"id": "set-smartcontract-weth-withdraw",
"object": "set.smartcontract",
"name": "Wrapped Ether: Withdraw",
"description": "Withdraw a minimum of 1 WETH to any destination address.",
"timestamp": "2018-11-13T20:20:39+00:00",
"version": {
"major": 0,
"minor": 1,
"patch": 0
@kamescg
kamescg / uniswapv2.swapForMinimum1e18Eth.json
Created April 20, 2022 11:47
uniswapv2.swapForMinimum1e18Eth.json
{
"id": "smartcontract-uniswapv2-swapAnyTokenForEth-min-1e18-output",
"name": "UniswapV2: Swap any Token for ETH (Minimum 1e18)",
"description": "Swap any token for minimum 1e18 ETH on Ethereum Mainnet (chainId: 1) using UniswapV2 RouterV2",
"object": "set.smartcontract",
"timestamp": "2020-04-020T00:00:00+00:00",
"version": {
"major": 0,
"minor": 1,
"patch": 0