Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./VotingToken.sol";
contract Voting {
using SafeMath for uint;
// Array of Poll structs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import React, { Component } from "react";
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
import Button from "@material-ui/core/Button";
import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogContentText from "@material-ui/core/DialogContentText";
import DialogTitle from "@material-ui/core/DialogTitle";
import Input from "@material-ui/core/Input";
import React, { Component } from "react";
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
import Button from "@material-ui/core/Button";
import { Message } from "semantic-ui-react";
import AddMillionaireDialog from "./AddMillionaireDialog";
const engUtils = require("./lib/enigma-utils");
// Specify the signature for the callable and callback functions, make sure there are NO spaces
const CALLABLE = "computeRichest(address[],uint[])";
const CALLBACK = "setRichestAddress(address)";
@apalepu23
apalepu23 / App.js
Last active September 6, 2018 16:05
import React, { Component } from "react";
import getContractInstance from "./utils/getContractInstance";
import EnigmaSetup from "./utils/getEnigmaSetup";
import millionairesProblemFactoryContractDefinition from "./contracts/MillionairesProblemFactory.json";
import millionairesProblemContractDefinition from "./contracts/MillionairesProblem.json";
import { Container, Message } from "semantic-ui-react";
import Header from "./Header";
import MillionairesProblemWrapper from "./MillionairesProblemWrapper";
import Paper from "@material-ui/core/Paper";
import "./App.css";
const http = require("http");
const MillionairesProblemFactory = artifacts.require(
"MillionairesProblemFactory.sol"
);
module.exports = function(deployer) {
return (
deployer
.then(() => {
return new Promise((resolve, reject) => {
pragma solidity ^0.4.17;
import "./MillionairesProblem.sol";
contract MillionairesProblemFactory {
address public enigmaAddress;
// List of addresses for deployed MillionaireProblem instances
address[] public millionairesProblems;
constructor(address _enigmaAddress) public {
pragma solidity ^0.4.17;
contract MillionairesProblem {
// Stores # of millionaires that have joined and stated their net worths
uint public numMillionaires;
// Stores Millionaire structs (defined below)
Millionaire[] millionaires;
// Stores address of richest millionaire; set in callback function below
address public richestMillionaire;