This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0xE4AB3f723690e4697d2E90F94cc65cee55f81A8E |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0xE4AB3f723690e4697d2E90F94cc65cee55f81A8E |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.13; | |
contract Project | |
{ | |
struct Person { | |
address addr; | |
uint funds; | |
} | |
Person[] people; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.13; | |
contract Project | |
{ | |
struct Person { | |
string name; | |
uint funds; | |
} | |
// this is the mapping for which we want the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.13; | |
contract Project | |
{ | |
struct Person { | |
string name; | |
uint funds; | |
} | |
mapping(address => Person) public people; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity 0.4.13; | |
contract Project | |
{ | |
struct Person { | |
string name; | |
uint funds; | |
} | |
mapping(address => Person) people; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.8; | |
contract Auction { | |
// static | |
address public owner; | |
uint public bidIncrement; | |
uint public startBlock; | |
uint public endBlock; | |
string public ipfsHash; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
modifier onlyEndedOrCanceled { | |
if (block.number < endBlock && !canceled) throw; | |
_; | |
} |
NewerOlder