I have two contracts, Token and Voter. I'd like to initiate a DAO, such that first someone initializes a token and distributes some shares to whoever it wants.
In Vote contract, only the token-holders are allowed to vote for something (e.g. certain project should receive some funding).
I'm using remix IDE to compile my contracts, but I don't know how Vote contract is supposed to call Vote contract. Therefore, I've put both in the same place.
Token contract stores an array of addresses belonging to whoever receives the tokens. Now, Vote contract should be able to get the array and check if the person who votes and calls Vote contract is in the array (kept by Token).
contract Token {
address [] publick voters;
//... some functions that assings values to the array...
}
contract Vote{
// people first vote... Assume they've already done that.
//Below we want to check which of them have tokens.
Token token= new Token();
address valid_voters = token.voters();// Here an error shows up
// then check
}
Question 1: How an array variable in one contract can be accessed by the other one? (e.g. voters in the above example)
Question 2: In remix how one contract can call the other one? and where to put the first one? (e.g. where to put Token contract and how Vote can call it)?