Skip to content

Instantly share code, notes, and snippets.

View gskapka's full-sized avatar

Greg Kapka gskapka

View GitHub Profile

zkSync Integration

There appear to be two main approches to a pTokens integration with zkSync.

Option 1

Use their native token bridge, which can bridge ERC20 assets over to zkSync. See their developer docs here.

Option 2

How To Burn Your pRaven

  1. Find out your pRaven balance using this function here. Connect your wallet to the bscscan interface, then enter your ETH address which holds the pRVN in the function linked. It will return your pRVN balance. This is the maximum amount you'll be able to burn.

  2. Copy your pRVN balance, and paste it into the amount field of this function here. Enter 0x into the data field and press the write button. Sign the transaction with the wallet that you've connected to the bscscan interface.

  3. Take the transaction hash of the transaction you've just signed, and send it to us as proof of your pRVN burn.

How To Burn Your pSafemoon

  1. Find out your pSafemoon balance using this function here. Connect your wallet to the etherscan interface, then enter your ETH address which holds the pSafemoon in the function linked. It will return your pSafemoon balance. This is the maximum amount you'll be able to burn.

  2. Copy your pSafemoon balance, and paste it into the amount field of this function here. Enter 0x into the data field and press the write button. Sign the transaction with the wallet that you've connected to the etherscan interface.

  3. Take the transaction hash of the transaction you've just signed, and post it to us in this telgram channel as proof of your token burn.

const Web3 = require('web3')
const WEB3_ENDPOINT = 'http://localhost:8545'
const CONTRACT_ADDRESS = '0xeb10e80D99655B51E3a981E888a73D0B21e21A6C'
const WEB3 = new Web3(new Web3.providers.HttpProvider(WEB3_ENDPOINT))
const ABI_STRING = '[{"constant":true,"inputs":[{"name":"_address","type":"address"}],"name":"getStakedLocks","outputs":[{"components":[{"name":"lockDate","type":"uint64"},{"name":"duration","type":"uint64"},{"name":"amount","type":"uint256"}],"name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"}]'
const getUTCTimestamp = _ =>
new Date().getTime();
const getContract = (_web3, _abi, _contractAddress) =>
const assert = require('assert')
const HEX_RADIX = 16
const ONE_ETH_IN_WEI = 1e18
const ETH_NUM_DECIMALS = 18
const UINT256_NUM_HEX_CHARS = 64
const PNT_DAO_UNSTAKE_FXN_PREFIX = '2e17de78'
const getXNumZeroesString = _x =>
new Array(_x).fill().reduce(_string => _string + '0' ,'')
@gskapka
gskapka / qubes-template-creation-guide.txt
Last active January 27, 2019 17:14
A copied reddit post describing the process for creating new template vms in Qubes.
Source:
www.reddit.com/r/Qubes/comments/5vzg04/idiots_guide_to_installing_qbuntu_ubuntu_1604/
***
I saw a lot of folks struggling to get Ubuntu running properly on Qubes so I compiled a guide from the many sources out there and tried to make a foolproof installation guide. So far I have gotten GPU passthrough on my switchable graphics notebook (Dell e5570 w/Intel 530 + AMD R7 M370) to work very nicely in Ubuntu, will post that guide along with Win7/Win10 GPU passthrough guide as soon as I get Windoze passthru ironed out. For now, first let's get Ubuntu 16.04 templates installed:
EDIT: If you are prompted during this process to overwrite an existing pulseaudio pulse.conf file, DO NOT overwrite this. Other .conf files are OK to overwrite.
Prepare the environment
Clone your fedora-23 vanilla template into a temporary 'builder' we will use to create Ubuntu templates.
[user@dom0 ~]$ qvm-clone fedora-23 ubuntu-builder
@gskapka
gskapka / attack-start-bet-events
Last active January 9, 2019 10:14
Various functions written when parsing chain data pertaining to the attack on `BigFishRoll` smart-contract
This file has been truncated, but you can view the full file.
{"jsonrpc":"2.0","id":1,"result":[{"address":"0x7e2743451b1f3d2849e44cf67164bfe4538fd0f1","blockHash":"0x39e306596b44d7f04d93e06acd1ff2ddbce254ad42e857c334814fbe6ced2879","blockNumber":"0x6b136e","data":"0x000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000000000000000000032","logIndex":"0x6","removed":false,"topics":["0x549ba5685c330759219f90a8f1d6666dd07f19d5072438dd814076ea8bd7fca5","0x5cb9d67e3ea02d7582f1b90bfaa3671d40df53522683b17ec00b38b12d53be55","0x000000000000000000000000456fcbbf12981ef47e5a06219e3787e559307792"],"transactionHash":"0x410d97a06f567c1956043a2b1c9f260c67086a2a17afede7524149b01e0f29a6","transactionIndex":"0x4a"},{"address":"0x7e2743451b1f3d2849e44cf67164bfe4538fd0f1","blockHash":"0x428319691e2c0343a4d832aa7890cb5579a028f4dd74318fb880dd326ce43c3f","blockNumber":"0x6b1374","data":"0x000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000000000000003200000000000000000000000
@gskapka
gskapka / ecdsa-test.py
Created January 2, 2019 14:34
Testing ECDSA priv -> pubkey conversion
from Crypto.Hash import keccak
from ecdsa import SigningKey, SECP256k1
ENCLAVE_ADDR = "0xdf22b3f1dbb0de0434b889ea7c1c0f0b1763f3ff"
ENCLAVE_SECRET = "8af15acf1a2fd76828a8030772a8f9fe772f9917a77c38c208a83497d189cbde"
ENCLAVE_PUBLIC = "71cf1e495ec34fab1132580f6d2df092ac917c8b629b44fdb0bf9723daf6ddaac42bb83785f5b7c47489f36824a329d141ea9be7f296104ffe3fbce5e9248eb9"
def secretToVerifyingKey(secret):
secret_key = SigningKey.from_string(secret.decode("hex"), curve=SECP256k1)
return secret_key.get_verifying_key()
@gskapka
gskapka / ethereum-storage-scraper-creator.js
Created December 18, 2018 15:54
Create ethereum storage scrapers for private variables, arrays & mappings in solidity smart-contracts.
/**
*
* NOTE:
* Requires Web3, Truffle ^5, Ramda & bn.js installed.
*
* USAGE:
* Provide the arrays as described below. Import the functions into desired
* file & call them providing the contract address. Pluck off that function
* whichever storage getters you need:
*
@gskapka
gskapka / truffle-config.js
Last active January 2, 2019 10:11
A version of the Truffle config file with api & mnemonic error handling.
const fs = require('fs')
const API_PATH = './apikeys.js'
const HDWalletProvider = require('truffle-hdwallet-provider')
const fileExists = _path =>
fs.existsSync(_path)
const getExternalVariable = _variable =>
fileExists(API_PATH)
? require(API_PATH)[_variable]