Skip to content

Instantly share code, notes, and snippets.

View JTraversa's full-sized avatar

Julian Traversa JTraversa

View GitHub Profile
import requests
import json
import math
from web3 import Web3
_cache = dict()
infura = "https://mainnet.infura.io/v3/b58baa11e019484890eff1543c3dc78f"
polygon = "https://polygon-mainnet.infura.io/v3/150d34e9b0294313991d57ac8200160a"
web3 = Web3(Web3.HTTPProvider(infura))
@JTraversa
JTraversa / SWIV.json
Last active February 14, 2022 09:13
SWIV.json
# SUBJECT TO DILUTION AS ADDITIONAL ADDRESSES ARE ADDED. THIS JSON PROVIDES NO GAURANTEE OF A CLAIM TO SWIV TOKENS, AND ANY ADDRESSES FOUND TO BE IN VIOLATION OF OFAC RESTRICTIONS WILL BE REMOVED.
{
"0xbB5cF2A9f62fee113b16b351d79e80414ed25499": "2164502164502164300000",
"0x005f3B2bf4E071C0814B84312cbeda304a6ABd97": "2164502164502164300000",
"0x41cd412117D5D72e954606dF5C389A19D0688376": "2164502164502164300000",
"0xcaFd650401708ca4f65a22340D07f78E18f8C332": "2164502164502164300000",
"0xbD992D49e212661623A571c307E5564461F43a82": "2164502164502164300000",
"0x12B25E23F35A3FA9540270a2641d946153feAd38": "2164502164502164300000",
@JTraversa
JTraversa / SWIV.json
Last active June 19, 2024 10:57
SWIV Retroactive Distribution
{
"0xe14c894FFA7404d493217Cd97Cdca415979f750D": "2000000000000000000000",
"0x68251b5f3889b1B98349f8aF8dbC1FAc75Ab4Ce9": "2000000000000000000000",
"0xC7D2c67bC38b0E8b15B632c19Ef629022FD56543": "4000000000000000000000",
"0x5517968D4289e068aA74b4Aa9450aa18eE2d14A3": "4000000000000000000000",
"0x01628A344a6E8Db2aa3E0954BC2C2D1e26444f9D": "5937007874015748300000",
"0x7eb6d04f63521a2e993F5D74F5e18a3e99085BB7": "2000000000000000000000",
"0x087Eae3a20901197F68bAb6fAD5966254c8Dd52e": "2000000000000000000000",
"0xF72F3240728C65F04948bC28a7F6772B590cb56F": "5937007874015748300000",
"0x5DdA68A8990038a13f8B4937e01Be1236c36C018": "4000000000000000000000",
{
"name": "Swivel Launch Key"
"description": "This key gives access to Swivel Finance's Mainnet Launch!"
"image": "https://gateway.pinata.cloud/ipfs/QmVs6zzNk1LKGMmf9Hh64ViTtqkHMyUFMV8v33cSpxvJ5j",
}
from time import sleep
from sys import exit
import time
import datetime
import math
import swivel-py
def truncate(number, digits) -> float:
stepper = 10.0 ** digits
return math.trunc(stepper * number) / stepper
@JTraversa
JTraversa / Loopring KlineChart
Created March 17, 2021 21:50
Loopring KlineChart
import { connect } from "react-redux";
import { dispose, init } from "klinecharts";
import { withUserPreferences } from "components/UserPreferenceContext";
import React, { PureComponent } from "react";
import config from "lightcone/config";
import styled, { withTheme } from "styled-components";
import "./KlineChart.less";
import { getData } from "./utils";
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
contract Swivel {
struct RPCSig{
uint8 v;
bytes32 r;
bytes32 s;
}
@JTraversa
JTraversa / gist:87f7006d6a887c3a10f130eba4322873
Last active February 18, 2021 15:25
Manual EIP 712 Hashing
function EIP712Hash(typedData) {
const types = typedData.types;
function abiEncode (types, values) {
var output = []
var data = []
var headLength = 0
async function signOrder() {
const currentAddress = `0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C`;
const testOrderHash = web3.sha3(currentAddress);
const msgParams = {
domain: {
name: 'Swivel',
version: '1',
chainId: 5,
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
},
import { ethers } from "ethers";
const provider = new ethers.providers.Web3Provider(window.ethereum)
const signer = provider.getSigner()
const zeroExAddress = '0x61935cbdd02287b511119ddb11aeb42f1593b7ef'
const zeroExContract = new ethers.Contract(zeroExAddress, exchangeABI, provider);
function takeOrder() {
const order = {