Go-Ethereum

如何使用 geth 檢索 DAO 提案?

  • October 23, 2018

我正在使用帶有 Web3 介面的 Node.JS 到 Go Geth 伺服器。

我正在嘗試在 TESTNET 和 LIVENET 中獲得建議,但我無法:

到目前為止我所做的:

  • 我正在使用 Node.JS
  • 我有 .abi 對theDAO, theDAOInterface, theDAOTokenInterface,theDAOTokentheDAOManagedAccount的定義theDAOManagedAccountInterface

實現proposals()函式的唯一介面是DAO介面。然後使用 abi 定義我做:

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" }];
var theDAOInterface = web3.eth.contract(theDAOInterfaceABI).at(theDAOAddress);
var proposals = theDAOInterface.proposals()

我有什麼:

生活:

DAOInterface.proposals():

["0x0000000000000000000000000000000000000000","0","","0",false,false,"0x0000000000000000000000000000000000000000000000000000000000000000","0",false,"0","0","0x0000000000000000000000000000000000000000"]

DAOInterface.numberOfProposals() 返回 0。

測試網:

DAOInterface.proposals():

["0x0000000000000000000000000000000000000000,0,,0,false,false,0x0000000000000000000000000000000000000000000000000000000000000000,0,false,0,0,0x0000000000000000000000000000000000000000"]

DAOInterface.numberOfProposals() 返回 193。

這些 API 發生了什麼?我是唯一一個嘗試使用這些東西的人嗎?

:這些 API 發生了什麼?我是唯一一個想和這個員工一起工作的人嗎?

您的程式碼可能返回正確的結果。

主網上還沒有關於 The DAO 的提案,因為在 The DAO 的關閉時間過去之前無法創建提案。

來自 The DAO 的原始碼

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;
   }
   ...

從檢查乙太坊錢包 (Mist) 中 DAO 合約的變數

closingTime = 1464426000 // which is Sat, 28 May 2016 09:00:00 GMT
isFueled = true

以下聲明newProposal(...)防止在 The DAO 眾籌期結束之前創建提案,因為該時間小於2016 年 5 月 28 日星期六 09:00:00 GMT ,因此now < closingTime評估為真:now

   if (!isFueled
       || now < closingTime
       || (msg.value < proposalDeposit && !_newCurator)) {

       throw;
   }

Q : 提案數組中的項目是什麼意思?

這是提案結構 - 註釋將有助於解釋提案數組中每個提案記錄的欄位:

// 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;
}

:我的意思是我得到的數組,一個充滿 0x0000、假和無意義欄位的數組。

您的虛擬數組結果是通過以下語句創建的,該語句將一條記錄添加到proposals後續程式碼未初始化的數組中:

proposals.length = 1; // avoids a proposal with ID 0 because it is used

在下面的DAO建構子中:

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;
}

並且只是一個空白/歸零的虛擬記錄:

["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

在測試網上查看 DAO

我執行了以下命令,這些命令返回了 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"]

在主網上查看第一個提案

編輯 29/05/2016 10:31 AEST 第一個提案

我在尋找Slock.it 的提案 #1 - DAO.Security (redux),發現已經創建了 5 個提案。

以下是主網上的命令和結果:

> 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)

這是 EtherScan.io 的The DAO - Proposals頁面。

引用自:https://ethereum.stackexchange.com/questions/4320