Coder Social home page Coder Social logo

Comments (15)

tcoulter avatar tcoulter commented on May 17, 2024

Sounds like your solidity compiler (or web3) is returning an unexpected object when compiling your contract. Can you run truffle compile --verbose-rpc and give me the output? (it'll be long)

from truffle.

aakilfernandes avatar aakilfernandes commented on May 17, 2024

Sure thing

{
"jsonrpc": "2.0",
"method": "eth_coinbase",
"params": [],
"id": 1
}
Compiling lotto.sol...
{
"jsonrpc": "2.0",
"method": "eth_getCompilers",
"params": [],
"id": 2
}
{
"jsonrpc": "2.0",
"method": "eth_compileSolidity",
"params": [
"contract Lotto {\n \n uint constant public blocksPerRound = 5760;\n \n uint constant public ticketPrice = 100000000000000000;\n \n uint constant public blockReward = 5000000000000000000;\n\n function getBlocksPerRound() constant returns(uint){ return blocksPerRound; }\n function getTicketPrice() constant returns(uint){ return ticketPrice; }\n \n struct Round {\n address[] buyers;\n uint pot;\n uint ticketsCount;\n mapping(uint=>bool) isCashed;\n mapping(address=>uint) ticketsCountByBuyer;\n }\n mapping(uint => Round) rounds;\n \n function getRoundIndex() constant returns (uint){\n \n return block.number/blocksPerRound;\n }\n\n function getIsCashed(uint roundIndex,uint subpotIndex) constant returns (bool){\n \n return rounds[roundIndex].isCashed[subpotIndex];\n }\n\n\n function calculateWinner(uint roundIndex, uint subpotIndex) constant returns(address){\n \n var decisionBlockNumber = getDecisionBlockNumber(roundIndex,subpotIndex);\n \n if(decisionBlockNumber>block.number)\n return;\n \n var decisionBlockHash = getHashOfBlock(decisionBlockNumber);\n var winningTicketIndex = decisionBlockHash%rounds[roundIndex].ticketsCount;\n \n var ticketIndex = uint256(0);\n\n for(var buyerIndex = 0; buyerIndex<rounds[roundIndex].buyers.length; buyerIndex++){\n var buyer = rounds[roundIndex].buyers[buyerIndex];\n ticketIndex+=rounds[roundIndex].ticketsCountByBuyer[buyer];\n\n if(ticketIndex>winningTicketIndex){\n return buyer;\n }\n }\n\n }\n\n function getDecisionBlockNumber(uint roundIndex,uint subpotIndex) constant returns (uint){\n return ((roundIndex+1)*blocksPerRound)+subpotIndex;\n }\n\n function getSubpot(uint roundIndex) constant returns(uint){\n return rounds[roundIndex].pot/getSubpotsCount(roundIndex);\n }\n\n function getSubpotsCount(uint roundIndex) constant returns(uint){\n \n var subpotsCount = rounds[roundIndex].pot/blockReward;\n\n if(rounds[roundIndex].pot%blockReward>0)\n subpotsCount++;\n\n return subpotsCount;\n }\n\n function cash(uint roundIndex, uint subpotIndex){\n \n var subpotsCount = getSubpotsCount(roundIndex);\n\n if(subpotIndex>=subpotsCount)\n return;\n\n var decisionBlockNumber = getDecisionBlockNumber(roundIndex,subpotIndex);\n\n if(decisionBlockNumber>block.number)\n return;\n\n if(rounds[roundIndex].isCashed[subpotIndex])\n return;\n \n var winner = calculateWinner(roundIndex,subpotIndex); \n var subpot = getSubpot(roundIndex);\n\n var isSent = winner.send(subpot);\n\n if(!isSent) return;\n \n rounds[roundIndex].isCashed[subpotIndex] = true;\n }\n\n function getHashOfBlock(uint blockIndex) constant returns(uint){\n var blockhash = block.blockhash(blockIndex);\n return uint(blockhash);\n }\n \n function getBuyers(uint roundIndex,address buyer) constant returns (address[]){\n return rounds[roundIndex].buyers;\n }\n\n function getTicketsCountByBuyer(uint roundIndex,address buyer) constant returns (uint){\n return rounds[roundIndex].ticketsCountByBuyer[buyer];\n }\n\n function getPot(uint roundIndex) constant returns(uint){\n return rounds[roundIndex].pot;\n }\n\n function() {\n \n var roundIndex = getRoundIndex();\n var value = msg.value-(msg.value%ticketPrice);\n\n if(value==0) return;\n\n if(value<msg.value){\n msg.sender.send(msg.value-value);\n }\n \n var ticketsCount = value/ticketPrice;\n \n if(rounds[roundIndex].ticketsCountByBuyer[msg.sender]==0){\n var buyersLength = rounds[roundIndex].buyers.length++;\n rounds[roundIndex].buyers[buyersLength] = msg.sender;\n }\n\n rounds[roundIndex].ticketsCountByBuyer[msg.sender]+=ticketsCount;\n rounds[roundIndex].ticketsCount+=ticketsCount;\n \n rounds[roundIndex].pot+=value;\n \n }\n\n}"
],
"id": 3
}
Fatal error: Cannot read property 'code' of undefined

from truffle.

tcoulter avatar tcoulter commented on May 17, 2024

Hmm, for some reason your output doesn't show what's being returned from web3. You should be getting output like this, where the input to web3 (specified by lines starting with >) is followed by output returned from web3 (lines starting with <). Are you getting this output when you run with --verbose-rpc, but github is clobbering it? Or is it not shown at all?

screen shot 2015-08-28 at 11 11 07 am

from truffle.

aakilfernandes avatar aakilfernandes commented on May 17, 2024

Nope, thats all I'm getting.

from truffle.

tcoulter avatar tcoulter commented on May 17, 2024

That's odd. I can't debug the issue without that output.

Can you tell me what truffle version you're running?

from truffle.

aakilfernandes avatar aakilfernandes commented on May 17, 2024

Truffle v0.0.16

from truffle.

aakilfernandes avatar aakilfernandes commented on May 17, 2024

screen shot 2015-08-28 at 2 52 14 pm

from truffle.

tcoulter avatar tcoulter commented on May 17, 2024

Super weird. What Ethereum client are you using?

from truffle.

tcoulter avatar tcoulter commented on May 17, 2024

Would you mind upgrading to the latest Truffle on master and running the same command?

$ git clone https://github.com/ConsenSys/truffle.git
$ cd truffle
$ npm install -g .
$ cd to/your/project/dir
$ truffle compile --verbose-rpc

I'm assuming it has something to do with your Ethereum client, however, so I wouldn't be surprised if after following the steps above you receive the same error.

from truffle.

aakilfernandes avatar aakilfernandes commented on May 17, 2024

Sure thing.

Here's my geth

 > geth version
 Geth
 Version: 1.1.0
 Protocol Versions: [61 60]
 Network Id: 1
 Go Version: go1.5
 OS: darwin
 GOPATH=
 GOROOT=/usr/local/Cellar/go/1.5/libexec

from truffle.

aakilfernandes avatar aakilfernandes commented on May 17, 2024

Looks like a lot more came back this time =)

Aakils-Mac-mini:truffle aakilfernandes$ truffle compile --verbose-rpc

{
"jsonrpc": "2.0",
"method": "eth_coinbase",
"params": [],
"id": 1
}
< {
< "id": 1,
< "jsonrpc": "2.0",
< "result": "0xb735bf53abc79525a4f585a004a620d08cc66b27"
< }
Compiling lotto.sol...
{
"jsonrpc": "2.0",
"method": "eth_getCompilers",
"params": [],
"id": 2
}
< {
< "id": 2,
< "jsonrpc": "2.0",
< "result": [
< "Solidity"
< ]
< }
{
"jsonrpc": "2.0",
"method": "eth_compileSolidity",
"params": [
"contract Lotto {\n \n uint constant public blocksPerRound = 5760;\n \n uint constant public ticketPrice = 100000000000000000;\n \n uint constant public blockReward = 5000000000000000000;\n\n function getBlocksPerRound() constant returns(uint){ return blocksPerRound; }\n function getTicketPrice() constant returns(uint){ return ticketPrice; }\n \n struct Round {\n address[] buyers;\n uint pot;\n uint ticketsCount;\n mapping(uint=>bool) isCashed;\n mapping(address=>uint) ticketsCountByBuyer;\n }\n mapping(uint => Round) rounds;\n \n function getRoundIndex() constant returns (uint){\n \n return block.number/blocksPerRound;\n }\n\n function getIsCashed(uint roundIndex,uint subpotIndex) constant returns (bool){\n \n return rounds[roundIndex].isCashed[subpotIndex];\n }\n\n\n function calculateWinner(uint roundIndex, uint subpotIndex) constant returns(address){\n \n var decisionBlockNumber = getDecisionBlockNumber(roundIndex,subpotIndex);\n \n if(decisionBlockNumber>block.number)\n return;\n \n var decisionBlockHash = getHashOfBlock(decisionBlockNumber);\n var winningTicketIndex = decisionBlockHash%rounds[roundIndex].ticketsCount;\n \n var ticketIndex = uint256(0);\n\n for(var buyerIndex = 0; buyerIndex<rounds[roundIndex].buyers.length; buyerIndex++){\n var buyer = rounds[roundIndex].buyers[buyerIndex];\n ticketIndex+=rounds[roundIndex].ticketsCountByBuyer[buyer];\n\n if(ticketIndex>winningTicketIndex){\n return buyer;\n }\n }\n\n }\n\n function getDecisionBlockNumber(uint roundIndex,uint subpotIndex) constant returns (uint){\n return ((roundIndex+1)_blocksPerRound)+subpotIndex;\n }\n\n function getSubpot(uint roundIndex) constant returns(uint){\n return rounds[roundIndex].pot/getSubpotsCount(roundIndex);\n }\n\n function getSubpotsCount(uint roundIndex) constant returns(uint){\n \n var subpotsCount = rounds[roundIndex].pot/blockReward;\n\n if(rounds[roundIndex].pot%blockReward>0)\n subpotsCount++;\n\n return subpotsCount;\n }\n\n function cash(uint roundIndex, uint subpotIndex){\n \n var subpotsCount = getSubpotsCount(roundIndex);\n\n if(subpotIndex>=subpotsCount)\n return;\n\n var decisionBlockNumber = getDecisionBlockNumber(roundIndex,subpotIndex);\n\n if(decisionBlockNumber>block.number)\n return;\n\n if(rounds[roundIndex].isCashed[subpotIndex])\n return;\n \n var winner = calculateWinner(roundIndex,subpotIndex); \n var subpot = getSubpot(roundIndex);\n\n var isSent = winner.send(subpot);\n\n if(!isSent) return;\n \n rounds[roundIndex].isCashed[subpotIndex] = true;\n }\n\n function getHashOfBlock(uint blockIndex) constant returns(uint){\n var blockhash = block.blockhash(blockIndex);\n return uint(blockhash);\n }\n \n function getBuyers(uint roundIndex,address buyer) constant returns (address[]){\n return rounds[roundIndex].buyers;\n }\n\n function getTicketsCountByBuyer(uint roundIndex,address buyer) constant returns (uint){\n return rounds[roundIndex].ticketsCountByBuyer[buyer];\n }\n\n function getPot(uint roundIndex) constant returns(uint){\n return rounds[roundIndex].pot;\n }\n\n function() {\n \n var roundIndex = getRoundIndex();\n var value = msg.value-(msg.value%ticketPrice);\n\n if(value==0) return;\n\n if(value<msg.value){\n msg.sender.send(msg.value-value);\n }\n \n var ticketsCount = value/ticketPrice;\n \n if(rounds[roundIndex].ticketsCountByBuyer[msg.sender]==0){\n var buyersLength = rounds[roundIndex].buyers.length++;\n rounds[roundIndex].buyers[buyersLength] = msg.sender;\n }\n\n rounds[roundIndex].ticketsCountByBuyer[msg.sender]+=ticketsCount;\n rounds[roundIndex].ticketsCount+=ticketsCount;\n \n rounds[roundIndex].pot+=value;\n \n }\n\n}"
],
"id": 3
}
< {
< "id": 3,
< "jsonrpc": "2.0",
< "result": {
< "Lotto": {
< "code": "0x6060604052610a7f806100136000396000f300606060405236156100c1576000357c01000000000000000000000000000000000000000000000000000000009004806328d3ad3f14610319578063305a762a14610340578063358d5dc21461036d578063459f93f71461039a57806346a2679a146103fb5780636572ae131461042257806367af1c81146104655780638089d0011461048657806386bb7121146104ad57806387bb7ae0146104ce57806393dafba2146104ef578063ce5566c514610516578063df2f0a4a1461052f576100c1565b6103175b60006000600060006100d5610580565b935067016345785d8a000034063403925060008314156100f457610311565b34831015610132573373ffffffffffffffffffffffffffffffffffffffff166000843403604051809050600060405180830381858888f19350505050505b67016345785d8a00008304915060006000600050600086815260200190815260200160002060005060040160005060003373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000505414156102625760006000506000858152602001908152602001600020600050600001600050805480919060010190908154818355818115116101ff578183600052602060002091820191016101fe91906101e0565b808211156101fa57600081815060009055506001016101e0565b5090565b5b5050509050336000600050600086815260200190815260200160002060005060000160005082815481101561000257906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b816000600050600086815260200190815260200160002060005060040160005060003373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082828250540192505081905550816000600050600086815260200190815260200160002060005060020160008282825054019250508190555082600060005060008681526020019081526020016000206000506001016000828282505401925050819055505b50505050565b005b61032a600480359060200150610a51565b6040518082815260200191505060405180910390f35b6103576004803590602001803590602001506109f8565b6040518082815260200191505060405180910390f35b610384600480359060200180359060200150610591565b6040518082815260200191505060405180910390f35b6103b1600480359060200180359060200150610949565b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b61040c60048035906020015061078a565b6040518082815260200191505060405180910390f35b6104396004803590602001803590602001506105de565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610470600450610580565b6040518082815260200191505060405180910390f35b61049760048035906020015061092f565b6040518082815260200191505060405180910390f35b6104b860045061055c565b6040518082815260200191505060405180910390f35b6104d960045061056b565b6040518082815260200191505060405180910390f35b610500600480359060200150610752565b6040518082815260200191505060405180910390f35b61052d600480359060200180359060200150610803565b005b610546600480359060200180359060200150610739565b6040518082815260200191505060405180910390f35b60006116809050610568565b90565b600067016345785d8a0000905061057d565b90565b60006116804304905061058e565b90565b600060006000506000848152602001908152602001600020600050600301600050600083815260200190815260200160002060009054906101000a900460ff1690506105d8565b92915050565b60006000600060006000600060006105f68989610739565b9550438611156106055761072d565b61060e8661092f565b9450600060005060008a8152602001908152602001600020600050600201600050548506935060009250600091505b600060005060008a8152602001908152602001600020600050600001600050548260ff16101561072c57600060005060008a815260200190815260200160002060005060000160005082815481101561000257906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060005060008a815260200190815260200160002060005060040160005060008273ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050548301925082508383111561071e5780965061072d565b5b818060010192505061063d565b5b50505050505092915050565b600081611680600185010201905061074c565b92915050565b600061075d8261078a565b6000600050600084815260200190815260200160002060005060010160005054049050610785565b919050565b60006000674563918244f4000060006000506000858152602001908152602001600020600050600101600050540490506000674563918244f4000060006000506000868152602001908152602001600020600050600101600050540611156107f55780806001019150505b8091506107fd565b50919050565b600060006000600060006108168761078a565b9450848610151561082657610926565b6108308787610739565b93504384111561083f57610926565b60006000506000888152602001908152602001600020600050600301600050600087815260200190815260200160002060009054906101000a900460ff161561088757610926565b61089187876105de565b925061089c87610752565b91508273ffffffffffffffffffffffffffffffffffffffff16600083604051809050600060405180830381858888f1935050505090508015156108de57610926565b600160006000506000898152602001908152602001600020600050600301600050600088815260200190815260200160002060006101000a81548160ff021916908302179055505b50505050505050565b600060008240905080600190049150610943565b50919050565b6020604051908101604052806000815260200150600060005060008481526020019081526020016000206000506000016000508054806020026020016040519081016040528092919081815260200182805480156109e657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116109b2575b505050505090506109f2565b92915050565b60006000600050600084815260200190815260200160002060005060040160005060008373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050549050610a4b565b92915050565b600060006000506000838152602001908152602001600020600050600101600050549050610a7a565b91905056",
< "info": {
< "source": "contract Lotto {\n \n uint constant public blocksPerRound = 5760;\n \n uint constant public ticketPrice = 100000000000000000;\n \n uint constant public blockReward = 5000000000000000000;\n\n function getBlocksPerRound() constant returns(uint){ return blocksPerRound; }\n function getTicketPrice() constant returns(uint){ return ticketPrice; }\n \n struct Round {\n address[] buyers;\n uint pot;\n uint ticketsCount;\n mapping(uint=>bool) isCashed;\n mapping(address=>uint) ticketsCountByBuyer;\n }\n mapping(uint => Round) rounds;\n \n function getRoundIndex() constant returns (uint){\n \n return block.number/blocksPerRound;\n }\n\n function getIsCashed(uint roundIndex,uint subpotIndex) constant returns (bool){\n \n return rounds[roundIndex].isCashed[subpotIndex];\n }\n\n\n function calculateWinner(uint roundIndex, uint subpotIndex) constant returns(address){\n \n var decisionBlockNumber = getDecisionBlockNumber(roundIndex,subpotIndex);\n \n if(decisionBlockNumber>block.number)\n return;\n \n var decisionBlockHash = getHashOfBlock(decisionBlockNumber);\n var winningTicketIndex = decisionBlockHash%rounds[roundIndex].ticketsCount;\n \n var ticketIndex = uint256(0);\n\n for(var buyerIndex = 0; buyerIndex<rounds[roundIndex].buyers.length; buyerIndex++){\n var buyer = rounds[roundIndex].buyers[buyerIndex];\n ticketIndex+=rounds[roundIndex].ticketsCountByBuyer[buyer];\n\n if(ticketIndex>winningTicketIndex){\n return buyer;\n }\n }\n\n }\n\n function getDecisionBlockNumber(uint roundIndex,uint subpotIndex) constant returns (uint){\n return ((roundIndex+1)_blocksPerRound)+subpotIndex;\n }\n\n function getSubpot(uint roundIndex) constant returns(uint){\n return rounds[roundIndex].pot/getSubpotsCount(roundIndex);\n }\n\n function getSubpotsCount(uint roundIndex) constant returns(uint){\n \n var subpotsCount = rounds[roundIndex].pot/blockReward;\n\n if(rounds[roundIndex].pot%blockReward>0)\n subpotsCount++;\n\n return subpotsCount;\n }\n\n function cash(uint roundIndex, uint subpotIndex){\n \n var subpotsCount = getSubpotsCount(roundIndex);\n\n if(subpotIndex>=subpotsCount)\n return;\n\n var decisionBlockNumber = getDecisionBlockNumber(roundIndex,subpotIndex);\n\n if(decisionBlockNumber>block.number)\n return;\n\n if(rounds[roundIndex].isCashed[subpotIndex])\n return;\n \n var winner = calculateWinner(roundIndex,subpotIndex); \n var subpot = getSubpot(roundIndex);\n\n var isSent = winner.send(subpot);\n\n if(!isSent) return;\n \n rounds[roundIndex].isCashed[subpotIndex] = true;\n }\n\n function getHashOfBlock(uint blockIndex) constant returns(uint){\n var blockhash = block.blockhash(blockIndex);\n return uint(blockhash);\n }\n \n function getBuyers(uint roundIndex,address buyer) constant returns (address[]){\n return rounds[roundIndex].buyers;\n }\n\n function getTicketsCountByBuyer(uint roundIndex,address buyer) constant returns (uint){\n return rounds[roundIndex].ticketsCountByBuyer[buyer];\n }\n\n function getPot(uint roundIndex) constant returns(uint){\n return rounds[roundIndex].pot;\n }\n\n function() {\n \n var roundIndex = getRoundIndex();\n var value = msg.value-(msg.value%ticketPrice);\n\n if(value==0) return;\n\n if(value<msg.value){\n msg.sender.send(msg.value-value);\n }\n \n var ticketsCount = value/ticketPrice;\n \n if(rounds[roundIndex].ticketsCountByBuyer[msg.sender]==0){\n var buyersLength = rounds[roundIndex].buyers.length++;\n rounds[roundIndex].buyers[buyersLength] = msg.sender;\n }\n\n rounds[roundIndex].ticketsCountByBuyer[msg.sender]+=ticketsCount;\n rounds[roundIndex].ticketsCount+=ticketsCount;\n \n rounds[roundIndex].pot+=value;\n \n }\n\n}",
< "language": "Solidity",
< "languageVersion": "0",
< "compilerVersion": "0.1.1",
< "abiDefinition": [
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< }
< ],
< "name": "getPot",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "buyer",
< "type": "address"
< }
< ],
< "name": "getTicketsCountByBuyer",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "subpotIndex",
< "type": "uint256"
< }
< ],
< "name": "getIsCashed",
< "outputs": [
< {
< "name": "",
< "type": "bool"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "buyer",
< "type": "address"
< }
< ],
< "name": "getBuyers",
< "outputs": [
< {
< "name": "",
< "type": "address[]"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< }
< ],
< "name": "getSubpotsCount",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "subpotIndex",
< "type": "uint256"
< }
< ],
< "name": "calculateWinner",
< "outputs": [
< {
< "name": "",
< "type": "address"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [],
< "name": "getRoundIndex",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "blockIndex",
< "type": "uint256"
< }
< ],
< "name": "getHashOfBlock",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [],
< "name": "getBlocksPerRound",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [],
< "name": "getTicketPrice",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< }
< ],
< "name": "getSubpot",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": false,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "subpotIndex",
< "type": "uint256"
< }
< ],
< "name": "cash",
< "outputs": [],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "subpotIndex",
< "type": "uint256"
< }
< ],
< "name": "getDecisionBlockNumber",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< }
< ],
< "userDoc": {
< "methods": {}
< },
< "developerDoc": {
< "methods": {}
< }
< }
< }
< }
< }
/usr/local/lib/node_modules/truffle/lib/contracts.es6:161
contract["binary"] = result[key].code;
^
TypeError: Cannot read property 'code' of undefined
at Object.callback (/usr/local/lib/node_modules/truffle/lib/contracts.es6:161:45)
at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/method.js:165:21
at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:104:9
at /usr/local/lib/node_modules/truffle/lib/config.es6:337:11
at [object Object].request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
at [object Object].dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:572:25)
at setState (/usr/local/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:14)
at IncomingMessage. (/usr/local/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:431:13)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickDomainCallback (node.js:381:11)
at Function.module.exports.loopWhile (/usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:57:21)
at /usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:29:18
at runTask (/usr/local/lib/node_modules/truffle/truffle.es6:41:5)
at Object. (/usr/local/lib/node_modules/truffle/truffle.es6:256:14)
at Module._compile (module.js:460:26)
at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
at Object.require.extensions.(anonymous function) as .es6
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at Object. (/usr/local/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3

from truffle.

tcoulter avatar tcoulter commented on May 17, 2024

Awesome, this is exactly what I needed. Looking into it.

from truffle.

tcoulter avatar tcoulter commented on May 17, 2024

Okay, so I hate to say this, but Truffle makes some assumptions about your contracts and so enforces those assumptions. Truffle can't find the compiled version of your code returned from your client because your contract name Lotto (capital L) is different from your contract's file name lotto.sol (lowercase l). If you rename your file to Lotto.sol, I bet you it'll work just fine.

Thanks for going through all this run around. Can't believe I didn't notice this before.

from truffle.

tcoulter avatar tcoulter commented on May 17, 2024

I could likely detect this case and print a warning message.

from truffle.

aakilfernandes avatar aakilfernandes commented on May 17, 2024

Nice =D. Looks like it works.

No problem glad to help. Thanks for the framework!

from truffle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.