Q: What's happening with these APIs? Am I the only one trying to work with this staff?
Your code is probably returning the correct results.
There are no proposals for The DAO on Mainnet yet as proposals cannot be created until The DAO's closing time has passed.
From The DAO's source code:
function newProposal(
address _recipient,
uint _amount,
string _description,
bytes _transactionData,
uint _debatingPeriod,
bool _newCurator
) onlyTokenholders returns (uint _proposalID) {
// Sanity check
if (_newCurator && (
_amount != 0
|| _transactionData.length != 0
|| _recipient == curator
|| msg.value > 0
|| _debatingPeriod < minSplitDebatePeriod)) {
throw;
} else if (
!_newCurator
&& (!isRecipientAllowed(_recipient) || (_debatingPeriod < minProposalDebatePeriod))
) {
throw;
}
if (_debatingPeriod > 8 weeks)
throw;
if (!isFueled
|| now < closingTime
|| (msg.value < proposalDeposit && !_newCurator)) {
throw;
}
...
From checking the variables for The DAO's contract in Ethereum Wallet (Mist)
closingTime = 1464426000 // which is Sat, 28 May 2016 09:00:00 GMT
isFueled = true
The following statement within newProposal(...) prevents proposals being created before the closing time of the crowdfunding period of The DAO, as now < closingTime evaluates to true since now is less than Sat, 28 May 2016 09:00:00 GMT:
if (!isFueled
|| now < closingTime
|| (msg.value < proposalDeposit && !_newCurator)) {
throw;
}
Q: What do the items in the proposals array mean?
Here is the Proposal structure - the comments will help explain the fields of each Proposal record in the Proposals array:
// A proposal with `newCurator == false` represents a transaction
// to be issued by this DAO
// A proposal with `newCurator == true` represents a DAO split
struct Proposal {
// The address where the `amount` will go to if the proposal is accepted
// or if `newCurator` is true, the proposed Curator of
// the new DAO).
address recipient;
// The amount to transfer to `recipient` if the proposal is accepted.
uint amount;
// A plain text description of the proposal
string description;
// A unix timestamp, denoting the end of the voting period
uint votingDeadline;
// True if the proposal's votes have yet to be counted, otherwise False
bool open;
// True if quorum has been reached, the votes have been counted, and
// the majority said yes
bool proposalPassed;
// A hash to check validity of a proposal
bytes32 proposalHash;
// Deposit in wei the creator added when submitting their proposal. It
// is taken from the msg.value of a newProposal call.
uint proposalDeposit;
// True if this proposal is to assign a new Curator
bool newCurator;
// Data needed for splitting the DAO
SplitData[] splitData;
// Number of Tokens in favor of the proposal
uint yea;
// Number of Tokens opposed to the proposal
uint nay;
// Simple mapping to check if a shareholder has voted for it
mapping (address => bool) votedYes;
// Simple mapping to check if a shareholder has voted against it
mapping (address => bool) votedNo;
// Address of the shareholder who created the proposal
address creator;
}
Q: I mean the array I'm getting, the one full of 0x0000, false, and non-sense fields.
Your dummy array result is created by following statement that adds one record to the proposals array that the subsequent code does not initialise:
proposals.length = 1; // avoids a proposal with ID 0 because it is used
in the the DAO constructor below:
function DAO(
address _curator,
DAO_Creator _daoCreator,
uint _proposalDeposit,
uint _minTokensToCreate,
uint _closingTime,
address _privateCreation
) TokenCreation(_minTokensToCreate, _closingTime, _privateCreation) {
curator = _curator;
daoCreator = _daoCreator;
proposalDeposit = _proposalDeposit;
rewardAccount = new ManagedAccount(address(this), false);
DAOrewardAccount = new ManagedAccount(address(this), false);
if (address(rewardAccount) == 0)
throw;
if (address(DAOrewardAccount) == 0)
throw;
lastTimeMinQuorumMet = now;
minQuorumDivisor = 5; // sets the minimal quorum to 20%
proposals.length = 1; // avoids a proposal with ID 0 because it is used
allowedRecipients[address(this)] = true;
allowedRecipients[curator] = true;
}
and is just a blank/zeroed dummy record:
["0x0000000000000000000000000000000000000000", // address recipient
"0", // uint amount
"", // string description
"0", // uint votingDeadline
false, // bool open
false, // bool proposalPassed
"0x0000000000000000000000000000000000000000000000000000000000000000", // bytes32 proposalHash
"0", // uint proposalDeposit
false, // bool newCurator
// NO SplitData[] splitData
"0", // uint yea
"0", // uint nay
// NO mapping (address => bool) votedYes
// NO mapping (address => bool) votedNo
"0x0000000000000000000000000000000000000000"] // address creator
Checking Out The DAO on Testnet
I ran the following commands that returns the results of some of the proposals on Testnet:
> var theDAOAddress="0xad23d7C443382333543Dd13C3B77b99b2A7e2c6D"
undefined
> var theDAOInterfaceABI = [{ "constant": true, "inputs": [{ "name": "", "type": "uint256" }], "name": "proposals", "outputs": [{ "name": "recipient", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "description", "type": "string" }, { "name": "votingDeadline", "type": "uint256" }, { "name": "open", "type": "bool" }, { "name": "proposalPassed", "type": "bool" }, { "name": "proposalHash", "type": "bytes32" }, { "name": "proposalDeposit", "type": "uint256" }, { "name": "newCurator", "type": "bool" }, { "name": "yea", "type": "uint256" }, { "name": "nay", "type": "uint256" }, { "name": "creator", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [], "name": "rewardAccount", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [], "name": "daoCreator", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_proposalID", "type": "uint256" }, { "name": "_transactionData", "type": "bytes" }], "name": "executeProposal", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [], "name": "unblockMe", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [], "name": "totalRewardToken", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }], "name": "allowedRecipients", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_to", "type": "address" }, { "name": "_amount", "type": "uint256" }], "name": "transferWithoutReward", "outputs": [{ "name": "success", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_recipient", "type": "address" }, { "name": "_amount", "type": "uint256" }, { "name": "_description", "type": "string" }, { "name": "_transactionData", "type": "bytes" }, { "name": "_debatingPeriod", "type": "uint256" }, { "name": "_newCurator", "type": "bool" }], "name": "newProposal", "outputs": [{ "name": "_proposalID", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }], "name": "DAOpaidOut", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "minQuorumDivisor", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_newContract", "type": "address" }], "name": "newContract", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "_recipient", "type": "address" }, { "name": "_allowed", "type": "bool" }], "name": "changeAllowedRecipients", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [], "name": "halveMinQuorum", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }], "name": "paidOut", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_proposalID", "type": "uint256" }, { "name": "_newCurator", "type": "address" }], "name": "splitDAO", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [], "name": "DAOrewardAccount", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [], "name": "proposalDeposit", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "numberOfProposals", "outputs": [{ "name": "_numberOfProposals", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "lastTimeMinQuorumMet", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_toMembers", "type": "bool" }], "name": "retrieveDAOReward", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [], "name": "receiveEther", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "_proposalID", "type": "uint256" }], "name": "getNewDAOAddress", "outputs": [{ "name": "_newDAO", "type": "address" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_proposalID", "type": "uint256" }, { "name": "_supportsProposal", "type": "bool" }], "name": "vote", "outputs": [{ "name": "_voteID", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [], "name": "getMyReward", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }], "name": "rewardToken", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_from", "type": "address" }, { "name": "_to", "type": "address" }, { "name": "_amount", "type": "uint256" }], "name": "transferFromWithoutReward", "outputs": [{ "name": "success", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_proposalDeposit", "type": "uint256" }], "name": "changeProposalDeposit", "outputs": [], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }], "name": "blocked", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "curator", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "_proposalID", "type": "uint256" }, { "name": "_recipient", "type": "address" }, { "name": "_amount", "type": "uint256" }, { "name": "_transactionData", "type": "bytes" }], "name": "checkProposalCode", "outputs": [{ "name": "_codeChecksOut", "type": "bool" }], "type": "function" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "proposalID", "type": "uint256" }, { "indexed": false, "name": "recipient", "type": "address" }, { "indexed": false, "name": "amount", "type": "uint256" }, { "indexed": false, "name": "newCurator", "type": "bool" }, { "indexed": false, "name": "description", "type": "string" }], "name": "ProposalAdded", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "proposalID", "type": "uint256" }, { "indexed": false, "name": "position", "type": "bool" }, { "indexed": true, "name": "voter", "type": "address" }], "name": "Voted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "proposalID", "type": "uint256" }, { "indexed": false, "name": "result", "type": "bool" }, { "indexed": false, "name": "quorum", "type": "uint256" }], "name": "ProposalTallied", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "_newCurator", "type": "address" }], "name": "NewCurator", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "_recipient", "type": "address" }, { "indexed": false, "name": "_allowed", "type": "bool" }], "name": "AllowedRecipientChanged", "type": "event" }];
undefined
> var theDAOInterface = web3.eth.contract(theDAOInterfaceABI).at(theDAOAddress);
undefined
> theDAOInterface.proposals()
["0x0000000000000000000000000000000000000000", 0, "", 0, false, false, "0x0000000000000000000000000000000000000000000000000000000000000000", 0, false, 0, 0, "0x0000000000000000000000000000000000000000"]
> theDAOInterface.proposals(1)
["0x343ca5b0052ea70c6311fdb4bc061c698433d4e3", 0, "test", 1459957706, true, false, "0x9bef2427d88db62a28c0662a9494de97f691ebdd282a6e26cd1caaf2cea5fc41", 0, true, 0, 0, "0x08144824954c65b12f68b75072488e634ac4e67a"]
> theDAOInterface.proposals(2)
["0xd36cd0daab314707cc68300bdb9ba36f098c2784", 0, "test split", 1459958407, true, false, "0x0563d41c2b8a7d3ab5e2118a0fbf9282ab38c3146ec3de19cf86326fa936cd10", 0, true, 0, 0, "0x08144824954c65b12f68b75072488e634ac4e67a"]
> theDAOInterface.proposals(3)
["0xd36cd0daab314707cc68300bdb9ba36f098c2784", 0, "test", 1459959012, true, true, "0x0563d41c2b8a7d3ab5e2118a0fbf9282ab38c3146ec3de19cf86326fa936cd10", 0, true, 1000000000000000000, 0, "0x08144824954c65b12f68b75072488e634ac4e67a"]
Checking Out The First Proposal On Mainnet
**EDIT 29/05/2016 10:31 AEST With First Proposal **
I was looking for Slock.it's Proposal #1 - DAO.Security (redux), and found 5 proposals already created.
Here are the commands and results on Mainnet:
> var theDAOAddress="0xbb9bc244d798123fde783fcc1c72d3bb8c189413"
undefined
> var theDAOInterfaceABI = [{ "constant": true, "inputs": [{ "name": "", "type": "uint256" }], "name": "proposals", "outputs": [{ "name": "recipient", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "description", "type": "string" }, { "name": "votingDeadline", "type": "uint256" }, { "name": "open", "type": "bool" }, { "name": "proposalPassed", "type": "bool" }, { "name": "proposalHash", "type": "bytes32" }, { "name": "proposalDeposit", "type": "uint256" }, { "name": "newCurator", "type": "bool" }, { "name": "yea", "type": "uint256" }, { "name": "nay", "type": "uint256" }, { "name": "creator", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [], "name": "rewardAccount", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [], "name": "daoCreator", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_proposalID", "type": "uint256" }, { "name": "_transactionData", "type": "bytes" }], "name": "executeProposal", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [], "name": "unblockMe", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [], "name": "totalRewardToken", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }], "name": "allowedRecipients", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_to", "type": "address" }, { "name": "_amount", "type": "uint256" }], "name": "transferWithoutReward", "outputs": [{ "name": "success", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_recipient", "type": "address" }, { "name": "_amount", "type": "uint256" }, { "name": "_description", "type": "string" }, { "name": "_transactionData", "type": "bytes" }, { "name": "_debatingPeriod", "type": "uint256" }, { "name": "_newCurator", "type": "bool" }], "name": "newProposal", "outputs": [{ "name": "_proposalID", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }], "name": "DAOpaidOut", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "minQuorumDivisor", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_newContract", "type": "address" }], "name": "newContract", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "_recipient", "type": "address" }, { "name": "_allowed", "type": "bool" }], "name": "changeAllowedRecipients", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [], "name": "halveMinQuorum", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }], "name": "paidOut", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_proposalID", "type": "uint256" }, { "name": "_newCurator", "type": "address" }], "name": "splitDAO", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [], "name": "DAOrewardAccount", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [], "name": "proposalDeposit", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "numberOfProposals", "outputs": [{ "name": "_numberOfProposals", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "lastTimeMinQuorumMet", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_toMembers", "type": "bool" }], "name": "retrieveDAOReward", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [], "name": "receiveEther", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "_proposalID", "type": "uint256" }], "name": "getNewDAOAddress", "outputs": [{ "name": "_newDAO", "type": "address" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_proposalID", "type": "uint256" }, { "name": "_supportsProposal", "type": "bool" }], "name": "vote", "outputs": [{ "name": "_voteID", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [], "name": "getMyReward", "outputs": [{ "name": "_success", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }], "name": "rewardToken", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_from", "type": "address" }, { "name": "_to", "type": "address" }, { "name": "_amount", "type": "uint256" }], "name": "transferFromWithoutReward", "outputs": [{ "name": "success", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_proposalDeposit", "type": "uint256" }], "name": "changeProposalDeposit", "outputs": [], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }], "name": "blocked", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "curator", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "_proposalID", "type": "uint256" }, { "name": "_recipient", "type": "address" }, { "name": "_amount", "type": "uint256" }, { "name": "_transactionData", "type": "bytes" }], "name": "checkProposalCode", "outputs": [{ "name": "_codeChecksOut", "type": "bool" }], "type": "function" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "proposalID", "type": "uint256" }, { "indexed": false, "name": "recipient", "type": "address" }, { "indexed": false, "name": "amount", "type": "uint256" }, { "indexed": false, "name": "newCurator", "type": "bool" }, { "indexed": false, "name": "description", "type": "string" }], "name": "ProposalAdded", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "proposalID", "type": "uint256" }, { "indexed": false, "name": "position", "type": "bool" }, { "indexed": true, "name": "voter", "type": "address" }], "name": "Voted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "proposalID", "type": "uint256" }, { "indexed": false, "name": "result", "type": "bool" }, { "indexed": false, "name": "quorum", "type": "uint256" }], "name": "ProposalTallied", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "_newCurator", "type": "address" }], "name": "NewCurator", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "_recipient", "type": "address" }, { "indexed": false, "name": "_allowed", "type": "bool" }], "name": "AllowedRecipientChanged", "type": "event" }];
undefined
> var theDAOInterface = web3.eth.contract(theDAOInterfaceABI).at(theDAOAddress);
undefined
// Following is the dummy proposal
> theDAOInterface.proposals()
["0x0000000000000000000000000000000000000000", 0, "", 0, false, false, "0x0000000000000000000000000000000000000000000000000000000000000000", 0, false, 0, 0, "0x0000000000000000000000000000000000000000"]
// And following is the first proposal
> theDAOInterface.proposals(1)
["0x13680fa2a60fd551894199f009cca20fb63a3e31", 0, "", 1465049035, true, false, "0xf8fc53d03003f6ba1cf65bcbd73238e12045d5c8c92abe6e551cf186bf483ba2", 0, true, 47001968965517241378, 2.536695416315195657391e+21, "0x13680fa2a60fd551894199f009cca20fb63a3e31"]
> theDAOInterface.proposals(2)
["0xbb9bc244d798123fde783fcc1c72d3bb8c189413", 0, "Do you believe in god?", 1465665517, true, false, "0x08fc31bd95397edcaa43fbfee1f3552b4d55f8125dea525a959527bb81933141", 2000000000000000000, false, 2.263294834581950253541e+21, 4.722686353944849847392e+21, "0x5a8e70f2d75c1468db4a2241fdd70e5a84f028b8"]
> theDAOInterface.proposals(3)
["0xbb9bc244d798123fde783fcc1c72d3bb8c189413", 0, "Should curators only whitelist projects that are related to DAO security for the next 4 weeks?", 1465668580, true, false, "0x08fc31bd95397edcaa43fbfee1f3552b4d55f8125dea525a959527bb81933141", 2000000000000000000, false, 2.30243064182194616977e+21, 6.68352975383731971126e+21, "0x66756ae3ebe94cd4e5e95846fceefcd4f69f8a8d"]
> theDAOInterface.proposals(4)
["0x3d5507b53d1613d8491a606ecf5c9268301095dd", 0, "split", 1465066744, true, false, "0xa4c212a943e73926a115f13aadb145ec1a0c78bda83f72a3f0319a2f9cc78b7b", 0, true, 0, 2.86311518905864295125e+21, "0x3d5507b53d1613d8491a606ecf5c9268301095dd"]
> theDAOInterface.proposals(4)
["0x3d5507b53d1613d8491a606ecf5c9268301095dd", 0, "split", 1465066744, true, false, "0xa4c212a943e73926a115f13aadb145ec1a0c78bda83f72a3f0319a2f9cc78b7b", 0, true, 0, 2.86311518905864295125e+21, "0x3d5507b53d1613d8491a606ecf5c9268301095dd"]
> theDAOInterface.proposals(6)
new BigNumber() not a base 16 number:
at raise (web3.js:14426:29)
And here is EtherScan.io's The DAO - Proposals page.
proposals.length = 1in theDAO()constructor. – BokkyPooBah May 27 '16 at 14:41