This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
ganache: | |
image: 0xorg/ganache-cli:6.5.10 | |
ports: | |
- "8545:8545" | |
postgres: | |
image: postgres:9.6 | |
environment: | |
- POSTGRES_USER=api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cairo programming exercise | |
%builtins output pedersen | |
from starkware.cairo.common.alloc import alloc | |
from starkware.cairo.common.cairo_builtins import HashBuiltin | |
# compute H(x, y) | |
func compute_hash(hash_ptr : HashBuiltin*, x, y) -> ( | |
hash_ptr : HashBuiltin*, z): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plasma Fast Finality Contract with predicate interface | |
# see https://github.com/cryptoeconomicslab/plasma-chamber/wiki/Plasma-Fast-Finality for more description. | |
struct Merchant: | |
tokenAddress: address | |
amount: uint256 | |
expiredAt: uint256 | |
struct Dispute: | |
recipient: address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function oddsCal(bytes52 a) | |
internal | |
pure | |
{ | |
bool r3 = false; | |
uint8 r2 = 0; | |
for (uint i = 0;i < 13;i++) { | |
uint8 r = (a & (0x8004002001 << i)); | |
if (r >= 3) { | |
// 3 card |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const primeNumberList = require('prime-number/list') | |
const BigNumber = require('bignumber.js'); | |
const utils = require('ethereumjs-util'); | |
// const primeNumberList = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]; | |
BigNumber.config({ | |
DECIMAL_PLACES: 2, | |
ROUNDING_MODE: BigNumber.ROUND_FLOOR | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const EC = require('elliptic').ec; | |
const ec = new EC('secp256k1'); | |
/** | |
* @dev MerkleTree | |
*/ | |
class MerkleTree { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add(a, b, c) { | |
return (hash(hash(a) + hash(b)) == hash(c)); | |
} | |
function sub(a, b, c) { | |
return (hash(hash(a) - hash(b)) == hash(c)); | |
} | |
function hash(a) { | |
if(a < 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PlasmaDefinitions -> PlasmaDefinition PlasmaDefinitions | |
PlasmaDefinition -> DepositDefinition | WithdrawDefinition | TxDefinition | |
DepositDefinition -> (root chain assets) TXO | |
WithdrawDefinition -> TXO (root chain assets) | |
TxDefinition -> Transition TxDefinition | |
Transition-> TXO Tx TXO | |
TXO -> status TXO | |
status -> type(expressions) value | |
Tx -> type(params) signers guard | ε | |
guard -> expressions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract StandardToken is ERC20 { | |
using SafeMath for uint256; | |
uint256 private totalSupply_; | |
account[uint256] private balance; | |
account[address] private allowed; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* atomic swap *) | |
[%%version 0.3] | |
type state = | |
| Empty | |
| Initiator | |
| Participant | |
type initiate = { |
NewerOlder