Skip to content

Instantly share code, notes, and snippets.

View gigamesh's full-sized avatar

Matt Masurka gigamesh

View GitHub Profile
@gigamesh
gigamesh / computeAddress.ts
Last active April 21, 2024 04:44
Uniswap PoolAddress.computeAddress implemented in typescript
// Ethers version 6.12.0
import {
solidityPackedKeccak256,
getAddress,
keccak256,
AbiCoder,
} from "ethers";
import { contractAddresses } from "./processor";
contract ArtistV6 {
struct Shareholder {
address account;
uint32 percentAllocation;
}
// Mapping of edition id to descriptive data.
mapping(uint256 => Edition) public editions;
// Balances for collectors captable
mapping(uint256 => mapping(address => uint32)) collectorBalances;
@gigamesh
gigamesh / config.ts
Created July 24, 2021 02:31
redux toolkit config
import { TypedUseSelectorHook, useDispatch as useReduxDispatch, useSelector as useReduxSelector } from 'react-redux';
import { configureStore } from '@reduxjs/toolkit';
import { save, load } from 'redux-localstorage-simple';
import { coingeckoApi } from '../api-services';
import connectionReducer from './connection';
import currencyReducer from './currency';
import { useConnectionHandlers } from './connection/hooks';
import { useCurrencyHandlers } from './currency/hooks';
const PERSISTED_KEYS: string[] = ['currency'];
const processSentMessage = (
sentTx: Transaction,
layer: number,
relayedTxs: { msgHash: string; txHash: string; timestamp: number }[]
) => {
const tx = { ...sentTx };
const xDomainInterface = new ethers.utils.Interface(abis.xDomainMessenger);
const sentMsgHash = ethers.utils.solidityKeccak256(['bytes'], [tx.message]);
const relayedTx = relayedTxs.find(msg => msg.msgHash === sentMsgHash);
import React from 'react';
import moment from 'moment';
import {
LineChart,
Line,
XAxis,
YAxis,
CartesianGrid,
Tooltip,
Legend,
import { BigInt } from '@graphprotocol/graph-ts';
import { WithdrawalInitiated as WithdrawalInitiatedEvent } from '../generated/SynthetixBridgeToBase/SynthetixBridgeToBase';
import {
SentMessage as SentMessageEvent,
RelayedMessage as RelayedMessageEvent,
} from '../generated/OVM_CrossDomainMessenger/OVM_CrossDomainMessenger';
import { Withdrawal, SentMessage, RelayedMessage, Stats } from '../generated/schema';
// OVM cross domain messenger
export function handleMessageRelayed(event: RelayedMessageEvent): void {

CHADSWAP

A token-gated dashboard of pump analytics

The dashboard will display aggregated data from crypto influencer accounts (twitter, youtube, etc): mentions of tickers, # of likes & retweets, rate of change, etc. The social media data will be algorithmically compared to price feeds to identify when coins are most likely on the verge of a pump.

CHAD tokenomics

To access the dashboard, the user's wallet must be holding 1 CHAD at token launch. This number will linearly increase at the rate of 0.1 per month (e.g., at the beginning of the 3rd month, 1.3 CHAD tokens will be required).

Distribution

pragma solidity 0.4.24;
contract NostrodamusI {
function prophecise(bytes32 exact, bytes32 braggingRights) public;
function theWord() public view returns (bytes32 exact);
}
contract NostradamusCaller {
event LogDepositReceived(address sender, uint256 value);
@gigamesh
gigamesh / machine.js
Created June 29, 2020 17:20
Generated by XState Viz: https://xstate.js.org/viz
const not = fn => (...args) => !fn.apply(null, args);
const isZero = (context, event) => event.key === 0;
const isNotZero = not(isZero);
const isMinus = (context, event) => event.operator === "-";
const isNotMinus = not(isMinus);
const divideByZero = (context, event) =>
context.operand2 === "0." && context.operator === "/";
const notDivideByZero = not(divideByZero);
function doMath(operand1, operand2, operator) {