EatTheBlocks Forum

Misunderstanding in the day15-DAO lesson of the DAPP30 training


There is something I don’t understand in the day15-DAO lesson of the DAPP30 training.
It concerns the frontend part.

I don’t understand why we use the admin account (accounts[0]) in the updateShares and in the updateProposals functions.

From my point of view we should use the investors’ accounts (accounts[1], accounts[2] and accounts[3].

Here is the code:
async function updateShares() {

const shares = await contract.methods





async function updateProposals() {

const nextProposalId = parseInt(await contract.methods



const proposals = [];

for(let i = 0; i < nextProposalId; i++) { 

  const [proposal, hasVoted] = await Promise.all([


    contract.methods.votes(accounts[0], i).call()


  proposals.push({...proposal, hasVoted});




Thank you for your help.

Take care


Does someone have an idea?



Hi @Pierre, I thought the same thing, but in this case accounts[0] is the current account selected in MetaMask. When you change accounts in MetaMask, this code will detect the change and update the accounts variable.

window.ethereum.on('accountsChanged', accounts => {

Hope that makes sense

Thank you very much :slight_smile: