Skip to content

Instantly share code, notes, and snippets.

package com.benchmark;
import com.eclipsesource.v8.V8;
import com.eclipsesource.v8.V8Array;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
package com.benchmark;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Engine;
import org.graalvm.polyglot.Source;
import org.graalvm.polyglot.Value;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
0x1185E6742CE406F4F392eF1eA679c957A1E48065
0xE46cf2dD9d0C71C5B1A44A082C46C2cB6802fa85
<!DOCTYPE html>
<html>
<head>
<title>Stock Exchange - Truffle Webpack Demo w/ Frontend</title>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
<script src="./app.js"></script>
</head>
<body>
<h1>Stock Exchange</h1>
<h3>Company Stock Balance - <span class="black"><span id="holdingBalance"></h3>
@karthickpdy
karthickpdy / app.js
Created September 1, 2017 10:03
Interacting with smart contracts
// Import the page's CSS. Webpack will know what to do with it.
import "../stylesheets/app.css";
// Import libraries we need.
import { default as Web3} from 'web3';
import { default as contract } from 'truffle-contract'
// Import our contract artifacts and turn them into usable abstractions.
import stock_exchange_artifacts from '../../build/contracts/StockExchange.json'
@karthickpdy
karthickpdy / StockExchange.sol
Last active September 1, 2017 09:08
Stock Exchange smart contract
pragma solidity ^0.4.2;
contract StockExchange {
mapping (address => uint) balances;
uint holdings;
event Transaction(string _type, address indexed user);
function StockExchange() {
{
"metamask": {
"isInitialized": true,
"isUnlocked": true,
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {
"0x9be184167aaea58025e0cc8179e68149ce59eb80": {
"address": "0x9be184167aaea58025e0cc8179e68149ce59eb80",
"name": "Account 1"
},
@karthickpdy
karthickpdy / greeter.py
Last active July 20, 2017 05:34
Lambda function
def lambda_handler(event, context):
name = event["currentIntent"]["slots"]["Name"].title()
response = {
"dialogAction":
{
"fulfillmentState":"Fulfilled",
"type":"Close","message":
{
"contentType":"PlainText",
"content": "Hi "+name+", good to see you!"