EatTheBlocks Forum

Misunderstanding in the day15-DAO lesson of the DAPP30 training

Hello,

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

  .shares(accounts[0])

  .call();

setShares(shares);

}

async function updateProposals() {

const nextProposalId = parseInt(await contract.methods

  .nextProposalId()

  .call());

const proposals = [];

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

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

    contract.methods.proposals(i).call(),

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

  ]);

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

}

setProposals(proposals);

}

Thank you for your help.

Take care

Pierre