Skip to content

Instantly share code, notes, and snippets.

@EdsonAlcala
Forked from anonymous/Microfinance.sol
Created December 12, 2017 17:05
Show Gist options
  • Save EdsonAlcala/17488f2cf8de83954f878f98b1e30c03 to your computer and use it in GitHub Desktop.
Save EdsonAlcala/17488f2cf8de83954f878f98b1e30c03 to your computer and use it in GitHub Desktop.
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.19+commit.c4cbbb05.js&optimize=undefined&gist=
pragma solidity ^0.4.0;
contract Microfinance {
address owner;
mapping(address => Member) members;
struct Member {
string name;
string nationalId;
//address account;
}
//create a Microfinance contract and set owner
function Microfinance() public {
owner = msg.sender;
}
modifier onlyOwner {
if(owner != msg.sender){
_; // todo: terminar este contrato, no se que onda?
}
}
//only owner can add members
function addMember(string name, string nationalId) public onlyOwner{
//add the member to the DAO
//validar que ya exista o no?
Member storage member = members[msg.sender];
member.nationalId = nationalId;
member.name = name;
}
function getMembers() public returns([address] members) {
}
// /// Give $(toVoter) the right to vote on this ballot.
// /// May only be called by $(chairperson).
// function giveRightToVote(address toVoter) public {
// if (msg.sender != chairperson || voters[toVoter].voted) return;
// voters[toVoter].weight = 1;
// }
/// Give a single vote to proposal $(toProposal).
// function vote(uint8 toProposal) public {
// Voter storage sender = voters[msg.sender];
// if (sender.voted || toProposal >= proposals.length) return;
// sender.voted = true;
// sender.vote = toProposal;
// proposals[toProposal].voteCount += sender.weight;
// }
// function winningProposal() public constant returns (uint8 _winningProposal) {
// uint256 winningVoteCount = 0;
// for (uint8 prop = 0; prop < proposals.length; prop++)
// if (proposals[prop].voteCount > winningVoteCount) {
// winningVoteCount = proposals[prop].voteCount;
// _winningProposal = prop;
// }
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment