Skip to content

Instantly share code, notes, and snippets.

@dodikk
dodikk / android-crashlog -hints.md
Last active Apr 2, 2019
Android crashlog hints
View android-crashlog -hints.md
  1. Search by app id
Process: <app id>
E AndroidRuntime: <app id>
E AndroidRuntime: android.runtime.JavaProxyThrowable:
E AndroidRuntime: FATAL EXCEPTION:
  1. --------- beginning of crash
  2. tombstone keyword
@dodikk
dodikk / AdkSplitterForTwo.sol
Created Oct 17, 2018
Embark gas consumption issue
View AdkSplitterForTwo.sol
pragma solidity ^0.4.23;
contract AdkSplitterForTwo
{
event LogBeginSplit();
event LogEndSplit();
event LogSamePersonRevert();
event LogTransferToFirstReceiverBegin();
View objc_kind_of_compile_time_macro.h
#define KINDOF_CAST(arg) ((__kindof typeof(arg))(arg))
// By Scherbinin Anatoly from the cocoa chat ("Какао-чат: Cocoa, Xcode, objective C")
@dodikk
dodikk / main.cpp
Created Oct 3, 2018
Dynamic cast demo c++
View main.cpp
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
View confirmEtherTransaction.js
function confirmEtherTransaction(txHash, confirmations = 10) {
setTimeout(async () => {
// Get current number of confirmations and compare it with sought-for value
const trxConfirmations = await getConfirmations(txHash)
console.log('Transaction with hash ' + txHash + ' has ' + trxConfirmations + ' confirmation(s)')
if (trxConfirmations >= confirmations) {
// Handle confirmation event according to your business logic
View watchTokenTransfers.js
function watchTokenTransfers() {
// Instantiate web3 with WebSocketProvider
const web3 = new Web3(new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws'))
// Instantiate token contract object with JSON ABI and address
const tokenContract = new web3.eth.Contract(
TOKEN_ABI, process.env.TOKEN_CONTRACT_ADDRESS,
(error, result) => { if (error) console.log(error) }
)
@dodikk
dodikk / getConfirmations.js
Created Oct 2, 2018 — forked from dsemenovsky/getConfirmations.js
Get Ethereum transaction confirmations count
View getConfirmations.js
async function getConfirmations(txHash) {
try {
// Instantiate web3 with HttpProvider
const web3 = new Web3('https://rinkeby.infura.io/')
// Get transaction details
const trx = await web3.eth.getTransaction(txHash)
// Get current block number
const currentBlock = await web3.eth.getBlockNumber()
View watchEtherTransfers.js
function watchEtherTransfers() {
// Instantiate web3 with WebSocket provider
const web3 = new Web3(new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws'))
// Instantiate subscription object
const subscription = web3.eth.subscribe('pendingTransactions')
// Subscribe to pending transactions
subscription.subscribe((error, result) => {
if (error) console.log(error)
@dodikk
dodikk / 0 README.md
Created Sep 27, 2018 — forked from chriseth/0 README.md
Formal verification for re-entrant Solidity contracts
View 0 README.md

This gist shows how formal conditions of Solidity smart contracts can be automatically verified even in the presence of potential re-entrant calls from other contracts.

Solidity already supports formal verification of some contracts that do not make calls to other contracts. This of course excludes any contract that transfers Ether or tokens.

The Solidity contract below models a crude crowdfunding contract that can hold Ether and some person can withdraw Ether according to their shares. It is missing the actual access control, but the point that wants to be made

You can’t perform that action at this time.