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
{
"name": "Money Market Set",
"timestamp": "2023-09-08T19:28:15.497Z",
"version": {
"major": 1,
"minor": 0,
"patch": 0
},
"tags": {},
"logoURI": "ipfs://QmNa8mQkrNKp1WEEeGjFezDmDeodkWRevGFN8JCV7b4Xir",
@kamescg
kamescg / NonceManager.sol
Created September 19, 2023 11:54
NonceManager Experiment
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19;
/**
* The NonceManager contract is used to handle replay protection for multiple nonce types.
* It packs 3 different types of nonces into a single bytes32 value.
* The first byte is used to identify the nonce type.
* The remaining bytes are used to store the nonce value.
*
* Below are the 3 different types of nonces in struct form:
@kamescg
kamescg / enable-safe-intent-module.tsx
Created September 14, 2023 22:44
Enable Safe Module
import { cn } from "../utils";
import {
safeABI,
usePrepareSafeExecTransaction,
useSafeGetTransactionHash,
useSafeNonce,
} from "@/blockchain";
import { useGetIntentifyModuleAddress } from "@/hooks/use-get-intentify-module-address";
import { constants } from "ethers";
import { _TypedDataEncoder } from "ethers/lib/utils";
@kamescg
kamescg / impact-network-generic-credential.json
Created April 28, 2023 15:19
Impact Network Generic Verifiable Credential
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/credentials/impact-network-education-credential.json",
"title": "Generic Impact Network Credential",
"description": "Verifiable credential for education category in the Impact Network",
"type": "object",
"properties": {
"@context": {
"type": "string",
"format": "uri"
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/metameta-protocol/metametasets-schema/src/set.smartcontract.schema.json",
"title": "Web3 Smart Contract Entity Set Schema",
"description": "A smart contract set schema for Web3 Set Theory protocol.",
"type": "object",
"additionalProperties": true,
"required": ["id", "name", "object", "createdAt", "version", "conditions", "entities", "rules"],
"properties": {
"id": {
@kamescg
kamescg / verifyDiscoCredential.ts
Created April 19, 2023 09:57
Validate Disconaut Credential
import { getResolver } from '@ceramicnetwork/3id-did-resolver';
import { Caip10Link } from '@ceramicnetwork/stream-caip10-link';
import {
recoverTypedSignature,
SignTypedDataVersion,
} from '@metamask/eth-sig-util';
import { decodeJWT, verifyJWS } from 'did-jwt';
import { Resolver } from 'did-resolver';
import {
@kamescg
kamescg / .sol
Created March 16, 2023 21:40
DistrictUniswapV3TwapAboveEnforcer.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import "@district-labs/uniswap-oracle/contracts/interfaces/IDistrictUniswapV3Oracle.sol";
import { BytesLib } from "@delegatable/delegatable-sol/contracts/libraries/BytesLib.sol";
import { CaveatEnforcer, Transaction } from "@delegatable/delegatable-sol/contracts/CaveatEnforcer.sol";
contract DistrictUniswapV3TwapAboveEnforcer is CaveatEnforcer {
IDistrictUniswapV3Oracle public immutable oracle;
I am attesting that this GitHub handle KamesCG is linked to the Ethereum Address 0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31
0xaba9401f7b2dd4bf5be4cd7eb979f2193550c697c45a59123901845d5f2bf9b61699c2b3a4364c8a72d1e4f18f74cb080e855dac5430acd89c3085f8adab96d41b
@kamescg
kamescg / sol
Created February 10, 2023 00:25
DistrictERC20StreamPaymentsEnforcer.sol
contract DistrictERC20StreamPaymentsEnforcer is
CaveatEnforcer,
Delegatable("DistrictERC20PermitStreamingPaymentsEnforcer", "1")
{
using BytesLib for bytes;
mapping(bytes32 => bool) public isCanceled;
mapping(bytes32 => uint256) public totalWithdrawals;
function enforceCaveat(
bytes calldata terms,
I am attesting that this GitHub handle KamesCG is linked to the Ethereum Address 0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31
0xaba9401f7b2dd4bf5be4cd7eb979f2193550c697c45a59123901845d5f2bf9b61699c2b3a4364c8a72d1e4f18f74cb080e855dac5430acd89c3085f8adab96d41b