Skip to content

Instantly share code, notes, and snippets.

💭
^_________^

Juuso Takalainen jtakalai

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am jtakalai on github.
  • I am jtakalai (https://keybase.io/jtakalai) on keybase.
  • I have a public key ASCYwPWgIZ_Gw3zmcKlAwRsXrr_rfp5AqI55eziLhyghLAo

To claim this, I am signing this object:

@jtakalai
jtakalai / Testing.sol
Created Nov 19, 2018
Testing "continue" keyword to replicate whas was reported fixed in https://solidity.readthedocs.io/en/latest/050-breaking-changes.html
View Testing.sol
pragma solidity ^0.4.22;
/** @dev herp derp */
contract Testing {
event Show(bytes s);
bytes32[] derp;
function continueTest() public {
derp.push(0x123);
derp.push(0x0);
@jtakalai
jtakalai / SimpleToken.sol
Created Sep 17, 2018
A simple token (not ERC20 compliant)
View SimpleToken.sol
pragma solidity ^0.4.24;
contract SimpleToken {
string public constant name = "My Simple Token";
string public constant symbol = "TEST";
uint8 public constant decimals = 18; // same as ether
mapping (address => uint256) public balanceOf;
event Transfer(address indexed from, address indexed to, uint tokens);
@jtakalai
jtakalai / startConsole.js
Created Apr 3, 2018
Homegrown Ethereum console
View startConsole.js
// Helper functions for an "ethereum console", similar to geth --attach
var _ = require("lodash")
var Table = require("cli-table")
var BN = require("bignumber.js")
var Web3 = require("web3")
var web3 = new Web3()
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'))
@jtakalai
jtakalai / ponzicoin_profits.txt
Created Jan 29, 2018
PonziCoin profit calculation
View ponzicoin_profits.txt
calculation in browser console:
var fyffe = 0, velka = 0, tokenit = 0, p = 1; for (var i = 1; i < 10; i++) { fyffe += p * 100; tokenit += 100; velka = p * tokenit / 4; console.log("Fyffe: " + fyffe + ", tokenit: " + tokenit + ", velka: " + velka + ", profit: " + (fyffe - velka)); p = p * 2; }
console output:
Fyffe: 100, tokenit: 100, velka: 25, profit: 75
Fyffe: 300, tokenit: 200, velka: 100, profit: 200
Fyffe: 700, tokenit: 300, velka: 300, profit: 400
Fyffe: 1500, tokenit: 400, velka: 800, profit: 700
Fyffe: 3100, tokenit: 500, velka: 2000, profit: 1100
Fyffe: 6300, tokenit: 600, velka: 4800, profit: 1500
@jtakalai
jtakalai / UbiToken.sol
Last active Sep 18, 2018
ERC20 compatible token with an added feature
View UbiToken.sol
pragma solidity ^0.4.24;
// Token standard interface
contract ERC20 {
// Basic token features: book of balances and transfer
uint public totalSupply = 0;
mapping (address => uint256) public balanceOf;
function transfer(address to, uint tokens) public returns (bool success);
// Advanced features: An account can approve another account to spend its funds
@jtakalai
jtakalai / Puzzle.sol
Last active Nov 8, 2018
What does this contract do? Can you spot a bug?
View Puzzle.sol
pragma solidity ^0.4.0;
contract Puzzle {
address _a;
address _b;
constructor(address a, address b) public {
_a = a;
_b = b;
}
@jtakalai
jtakalai / TestToken.sol
Last active Sep 18, 2018
Fully ERC20 compliant Ethereum token
View TestToken.sol
pragma solidity ^0.4.24;
// Token standard interface
contract ERC20 {
// Basic token features: book of balances and transfer
uint public totalSupply = 0;
mapping (address => uint256) public balanceOf;
function transfer(address to, uint tokens) public returns (bool success);
// Advanced features: An account can approve another account to spend its funds
@jtakalai
jtakalai / run_mist.sh
Created Apr 25, 2017
Run mist (after git clone)
View run_mist.sh
#!/bin/sh
cd interface
meteor &
sleep 3
cd -
electron . --rpc ~/Library/Ethereum/testnet/geth.ipc
You can’t perform that action at this time.