Skip to content

Instantly share code, notes, and snippets.

View akshar07's full-sized avatar

Akshar Takle akshar07

View GitHub Profile
var Ratings = artifacts.require("./Rating.sol");
module.exports = function(deployer) {
deployer.deploy(Ratings,['Star Wars', 'Avatar', 'Inception'], {gas: 6700000});
};
module.exports = {
networks:{
development:{
host:"localhost",
port:8545,
network_id:'*'
}
}
};
import Web3 from 'web3';
const web3=new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
let ratingABI=[{"constant":true,"inputs":[{"name":"movie","type":"bytes32"}],"name":"totalVotesFor","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"ratingsReceived","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"movie","type":"bytes32"}],"name":"voteForMovie","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"movieList","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"movieNames","type":"bytes32[]"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]
let ratingAddress='0x42b9991505950cc5ac38a6557d8efcdc40235de6';
web3.eth.de
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { ratingContract } from "./EthereumSetup";
import {ShowMovies } from "./ShowMovies";
class App extends Component {
constructor(props){
super(props)
this.state={
import React, { Component } from 'react';
import './ShowMovies.css'
export class ShowMovies extends Component{
handleChange=(movie)=>{
let _movie=movie;
this.props.vote(_movie)
}
render(){
table, th, td {
border: 1px solid #ccc;
margin: 0 auto;
padding:3px;
}
{
"name": "invitation",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"axios": "^0.17.1",
"body-parser": "^1.18.2",
"cookie-session": "^2.0.0-beta.3",
"ejs": "^2.5.7",
const express = require("express");
const app = express();
var session = require("express-session");
const path = require("path");
var passport = require("passport");
var shortid = require("shortid");
const FacebookStrategy = require("passport-facebook").Strategy;
const bodyParser = require("body-parser");
var nodemailer = require("nodemailer");
//set our client folder and view
const { Client } = require("pg");
const client = new Client({
connectionString: process.env.DATABASE_URL,
ssl: true
});
//connection query and creation of tables
client.connect();
const db_creation_string = `CREATE TABLE IF NOT EXISTS invitations(id SERIAL PRIMARY KEY, created_at TIMESTAMP,
updated_at TIMESTAMP, link TEXT, senderId TEXT, sendermsg TEXT, senderName TEXT,
receiverId TEXT);
app.use(passport.initialize());
app.use(passport.session());
passport.serializeUser((user, done) => done(null, user));
// Deserialize user from the sessions
passport.deserializeUser((user, done) => done(null, user));
//passport middleware
passport.use(
new FacebookStrategy(
{