Skip to content

Instantly share code, notes, and snippets.

Avatar

Jim McDonald mcdee

View GitHub Profile
View gist:adbb2e9b7753c8c770335bd6afc248bb
pragma solidity ^0.4.23;
pragma experimental ABIEncoderV2;
contract Test {
function test(string[] _words) public pure returns (string) {
return _words[0];
}
}
View gist:333d7dc2f7a721fe029c2bd48716f933
// Copyright © 2018 Weald Technology Trading
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
View peers
[{
caps: ["eth/62", "eth/63", "par/1", "par/2", "pip/1"],
id: "153d9a27ff1bd58d8bc030388d78c433f80577bf8ec06d083eaf2ea42208449fffc160b38b7523d925d89ef598d259822e040f299ecf8ac482e6c9b91fef3e5a",
name: "Parity/v1.8.2-beta-1b6588c-20171025/x86_64-linux-gnu/rustc1.21.0",
network: {
localAddress: "10.0.0.128:44074",
remoteAddress: "85.214.235.45:30303"
},
protocols: {
eth: {
View gist:247af7de6344c5ffc5fd67732b58abfa
#!/bin/bash
echo "var input=`solc node_modules=node_modules --optimize --combined-json abi,bin,interface contracts/DomainSale.sol`" > contract.js
# First address is the ENS registry
geth attach ipc:/home/jgm/.ethereum/testnet/geth.ipc <<EOGETH
loadScript('contract.js');
var contract = web3.eth.contract(JSON.parse(input.contracts["contracts/DomainSale.sol:DomainSale"].abi));
personal.unlockAccount(eth.accounts[1], "throwaway");
var partial = contract.new('0x112234455c3a32fd11230c42e7bccd4a84e02010', { from: eth.accounts[1], data: "0x" + input.contracts["contracts/DomainSale.sol:DomainSale"].bin, gas: 4700000, gasPrice: web3.toWei(105, 'gwei')});
View gist:8e4d34f1e997d3ad1860312c901ecfc9
'use strict';
const Reservation = artifacts.require('./Reservation.sol');
contract('Reservation', accounts => {
var instance;
it('works', async function() {
instance = await Reservation.new(1564555780, 1, 2, 1600000000, 200000000);
var fee = await instance.amountPerGuest();
View BadSender.sol
contract BadSender {
// Forward funds to the splitter contract
function forward(address other) payable {
// This is the address of the splitter contract
address splitterContract = 0xAe3aE77F5ab2490C46958D0b05f766871c17cA5e;
BadSplitter splitter = BadSplitter(splitterContract);
splitter.deposit.gas(200000).value(msg.value)(other);
}
// Purely malevolent fallback
View BadSplitter.sol
contract BadSplitter {
uint256 funds;
address sender;
address recipient;
// Deposit some funds in to the contract
function deposit(address other) payable {
funds = msg.value;
sender = msg.sender;
recipient = other;
View gist:f46612adaff3a9409eb4fae293937aff
SELECT lab_name, COUNT(*)
FROM (
SELECT (record ->> 'scientist_id')::BIGINT AS scientist_id
FROM measurements
WHERE
record @> '{"value_1":0}' AND
record @> '{"value_2":0}' AND
record @> '{"value_3":0}'
) m
JOIN scientist_labs AS s
You can’t perform that action at this time.