Skip to content

Instantly share code, notes, and snippets.

View rezendi's full-sized avatar

Jon Evans rezendi

View GitHub Profile
// Set up web server
const express = require('express');
const helmet = require('helmet');
const app = express();
const port = process.env.PORT || 8801;
app.use(helmet());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
const express_enforces_ssl = require('express-enforces-ssl');
// TODO: uncomment in production!
const express = require('express');
const helmet = require('helmet');
const Web3 = require('web3');
const contractAddress = undefined; // TODO
const abi = [{"constant":false,"inputs":[{"name":"prizeId","type":"uint256"},{"name":"geohash","type":"bytes10"},{"name":"_metadata","type":"string"}],"name":"placePrize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"prizeId","type":"uint256"},{"name":"geohash","type":"bytes10"}],"name":"claimPrize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"prizes","outputs":[{"name":"id","type":"uint256"},{"name":"owner","type":"address"},{"name":"geohash","type":"bytes10"},{"name":"metadata","type":"string"},{"name":"placedAt","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}];
const app = express();
co
var Web3 = require('web3');
var solc = require('solc');
var fs = require('fs');
var tx = require('ethereumjs-tx');
const web3 = new Web3(new Web3.providers.HttpProvider("https://rinkeby.infura.io/"));
deployContract();
// showABI();
pragma solidity ^0.4.18;
import "truffle/Assert.sol";
import "../contracts/MyPrize.sol";
contract TestMyPrize {
MyPrize mp = new MyPrize();
function testMyPrize() public {
mp.placePrize(1, bytes10("abcdefghij"), "http://test.example.com/");
pragma solidity ^0.4.18;
contract MyPrize {
struct Prize {
uint id;
address owner; // current owner
bytes10 geohash; // current unclaimed location
string metadata; // probably a URL pointing to the full metadata
uint placedAt; // block count when it was placed
}
### Keybase proof
I hereby claim:
* I am rezendi on github.
* I am rezendi (https://keybase.io/rezendi) on keybase.
* I have a public key whose fingerprint is 7D2C 1F61 851F 96F9 F538 C410 0A33 9B57 C096 57CF
To claim this, I am signing this object: