Skip to content

Instantly share code, notes, and snippets.

View brynbellomy's full-sized avatar

Bryn Bellomy brynbellomy

  • Texas, Republic of
View GitHub Profile
0xE4AB3f723690e4697d2E90F94cc65cee55f81A8E
@brynbellomy
brynbellomy / rinkeby-addr
Last active August 1, 2017 00:57
rinkeby-addr
0xE4AB3f723690e4697d2E90F94cc65cee55f81A8E
@brynbellomy
brynbellomy / medium-return-struct-public-func-4.js
Last active July 11, 2017 22:09
medium-return-struct-public-func-4.js
const Project = artifacts.require('./Project.sol')
const project = await Project.deployed()
const people = await project.getPeople([ 2, 5 ], { from: accounts[0] })
console.log('people =', people)
// this will print something like:
// people = [ ['0xdeadbeef', '0xabcdeff'], [123, 789] ]
//
// as you can see, we get back an array. each element of this array
@brynbellomy
brynbellomy / medium-return-struct-public-func-4.sol
Created July 11, 2017 21:47
medium-return-struct-public-func-4.sol
pragma solidity ^0.4.13;
contract Project
{
struct Person {
address addr;
uint funds;
}
Person[] people;
@brynbellomy
brynbellomy / medium-return-struct-public-func-3.sol
Last active July 11, 2017 21:39
medium-return-struct-public-func-3.sol
pragma solidity ^0.4.13;
contract Project
{
struct Person {
string name;
uint funds;
}
// this is the mapping for which we want the
@brynbellomy
brynbellomy / medium-return-struct-public-func-2.js
Created July 11, 2017 21:02
medium-return-struct-public-func-2.js
// we're assuming we have a typical Truffle setup here
const Project = artifacts.require('./Project.sol');
const project = await Project.deployed()
const person = await project.people('0xdeadbeef')
console.log('person =', person);
// this should print something like this:
// person = [ 'Bryn', 123 ]
@brynbellomy
brynbellomy / medium-return-struct-public-func-2.sol
Created July 11, 2017 20:57
medium-return-struct-public-func-2.sol
pragma solidity ^0.4.13;
contract Project
{
struct Person {
string name;
uint funds;
}
mapping(address => Person) public people;
@brynbellomy
brynbellomy / medium-return-struct-public-func-1.sol
Last active July 11, 2017 20:56
medium-return-struct-public-func-1.sol
pragma solidity 0.4.13;
contract Project
{
struct Person {
string name;
uint funds;
}
mapping(address => Person) people;
@brynbellomy
brynbellomy / medium-auction.sol
Created June 29, 2017 23:25
medium-auction.sol
pragma solidity ^0.4.8;
contract Auction {
// static
address public owner;
uint public bidIncrement;
uint public startBlock;
uint public endBlock;
string public ipfsHash;
@brynbellomy
brynbellomy / medium-auction-contract-onlyEndedOrCanceled.sol
Created June 29, 2017 21:37
medium-auction-contract-onlyEndedOrCanceled.sol
modifier onlyEndedOrCanceled {
if (block.number < endBlock && !canceled) throw;
_;
}