Skip to content

Instantly share code, notes, and snippets.

View martriay's full-sized avatar

Martín Triay martriay

View GitHub Profile
"""contract.cairo test file."""
import os
import pytest
from starkware.starknet.testing.starknet import Starknet
# The path to the contract source code.
CONTRACT_FILE = os.path.join("contracts", "contract.cairo")
# The testing library uses python's asyncio. So the following
# Declare this file as a StarkNet contract and set the required
# builtins.
%lang starknet
%builtins pedersen range_check
from starkware.cairo.common.cairo_builtins import HashBuiltin
# Define a storage variable.
@storage_var
func balance() -> (res : felt):
async def deploy(path):
contract_definition = compile_starknet_files([path], debug_info=True)
starknet = await Starknet.empty()
contract_address = await starknet.deploy(contract_definition=contract_definition)
contract = StarknetContract(
starknet=starknet,
abi=contract_definition.abi,
contract_address=contract_address,
)
@martriay
martriay / getUserStats.ts
Created June 26, 2021 00:00
Get Flashbots' user stats
const fetch = require('node-fetch');
import { ethers } from "ethers";
const sendingAccount = {
privateKey: '...',
address: '...'
};
async function main(): Promise<void> {
const provider = new ethers.providers.JsonRpcProvider();
### Keybase proof
I hereby claim:
* I am martriay on github.
* I am martriay (https://keybase.io/martriay) on keybase.
* I have a public key whose fingerprint is F714 C54B 7F29 8961 0FFD D6FB 140C 0058 62C5 8D28
To claim this, I am signing this object:
@martriay
martriay / whatsapp_phone_enumerator_floated_div.js
Created May 14, 2017 04:55
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses (floated div)
/*
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses
Floated div edition
01-05-2017
(c) 2017 - Loran Kloeze - loran@ralon.nl
This script creates a UI on top of the WhatsApp Web interface. It enumerates certain kinds
of information from a range of phonenumbers. It doesn't matter if these numbers are part
of your contact list. At the end a table is displayed containing phonenumbers, profile pics,
about texts and online statuses. The online statuses are being updated every
@martriay
martriay / blog.js
Last active August 29, 2015 14:11
vanilla.js
var session, form, login, insert, submit, articles
, baseurl = 'http://54.200.215.217/'
;
document.onreadystatechange = function () {
if (document.readyState == 'complete') {
articles = document.getElementById('articles');
form = document.getElementsByTagName('form')[0];
login = document.getElementById('session');
insert = document.getElementById('insert');
@martriay
martriay / datauri.sh
Last active December 13, 2015 18:38 — forked from frangio/datauri.sh
#!/usr/bin/env sh
help() {
cat <<EOF
Synopsis: Convert files to datauri format.
Usage: datauri [options] files
Options: