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
;; "Hello World" in Brainf* compiled to eWASM using https://github.com/axic/bf-compiler-webassembly/tree/ewasm | |
(module | |
(func $callDataCopy (import "ethereum" "callDataCopy") (param i32 i32 i32)) | |
(func $return (import "ethereum" "return") (param i32 i32)) | |
(global $writeptr (mut i32) (i32.const 1)) | |
(global $readptr (mut i32) (i32.const 0)) | |
(func $getchar | |
(result i32) |
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
0061736d0100000001170560017e006000017f60037f7f7f0060027f7f0060000002580408657468657265756d06757365476173000008657468657265756d0f67657443616c6c4461746153697a65000108657468657265756d0c63616c6c44617461436f7079000208657468657265756d0672657475726e0003030201040503010001071102066d656d6f72790200046d61696e00040a25012301017f1001210042ba022000ad7e42e40080100041004100200010024100200010030b |
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
pragma solidity ^0.4.19; | |
interface ShenzhenKitties { | |
function transferKittie(address to, string name) external; | |
function kittieOwner(string name) external view returns (address); | |
} | |
contract KittieEscrow { | |
ShenzhenKitties constant kittieRegistry = ShenzhenKitties(0x59f710ab6e0D4bafc20B3B86dC1bcC196d5ae16F); | |
address public beneficiary; |
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
pragma solidity ^0.4.19; | |
pragma experimental ABIEncoderV2; | |
contract ShenzhenKitties { | |
event Registered(string name, address owner); | |
event Transferred(string name, address from, address to); | |
mapping (bytes32 => address) kitties; | |
string[] public kittieNames; | |
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
// | |
// Needs web3.js from https://github.com/axic/web3.js/tree/swarm | |
// | |
var Web3 = require('web3') | |
var url = require('url') | |
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')) | |
try { | |
web3.eth.defaultAccount = web3.eth.coinbase |
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
pragma solidity ^0.4.6; | |
contract MemcpyTest { | |
function test(string input) returns (string output) { | |
uint len = bytes(input).length; | |
output = new string(len); | |
uint _input; | |
uint _output; | |
assembly { |
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
// the Hypervisor starts an manages "containers" | |
class PrimeaContainer { | |
// the constructor is given an instance of the kernel | |
// https://github.com/primea/js-primea-hypervisor/blob/master/docs/kernel.md | |
constructor (kernel) { | |
this.kernel = kernel | |
} | |
// this method runs once when the container is initially created. It is given | |
// a message with a single port, which is a channel to its parent with the |
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
{ | |
let cur_block_number := number() | |
jumpi(system_sender, eq(caller(), 0xfffffffffffffffffffffffffffffffffffffffe)) | |
// Sender is a regular account - Getting a block | |
{ | |
let block_number := calldataload(0) | |
// Abort if block is in future |
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
{ | |
// Reject incoming value transfers | |
jumpi(unpaid, iszero(callvalue())) | |
invalid | |
unpaid: | |
let cur_block_number := number() | |
jumpi(system_sender, eq(caller(), 0xfffffffffffffffffffffffffffffffffffffffe)) |
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
main() { | |
char buf[4096] = { 0 }; | |
unsigned long long x = 1; | |
printf("hello %lld", x); | |
} |