Guest User

Untitled

a guest
Aug 16th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. pragma solidity ^0.4.2;
  2.  
  3. contract DonationContract
  4. {
  5. address owner;
  6.  
  7. struct Applicant
  8. {
  9. address Org;
  10. string Name;
  11. string OrgType;
  12. string Number;
  13. string Email;
  14. uint256 Wallet;
  15. uint256 DonationFunds;
  16. bool approved;
  17. }
  18.  
  19. constructor() public
  20. {
  21. owner = msg.sender;
  22. facilitators[msg.sender] = true;
  23. }
  24.  
  25. mapping (address => Applicant) public applicants;
  26.  
  27. mapping(address => bool) facilitators;
  28.  
  29. modifier Owner()
  30. {
  31. require(msg.sender == owner);
  32. _;
  33. }
  34.  
  35. modifier OnlyFacilitator()
  36. {
  37. require(facilitators[msg.sender] == true);
  38. _;
  39. }
  40.  
  41. modifier Approved(address Org)
  42. {
  43. require(applicants[Org].approved == true);
  44. _;
  45. }
  46.  
  47. function approve(address Org) OnlyFacilitator public
  48. {
  49. applicants[Org].approved = true;
  50. }
  51.  
  52. function Donate(uint256 amount, address Org) Approved(Org) public
  53. {
  54. if(Org==0)
  55. {
  56. //Split donation amount amongst all applicants donationfunds
  57. }
  58. else
  59. applicants[Org].DonationFunds += amount;
  60.  
  61. if(applicants[Org].DonationFunds >= 10000)
  62. {
  63. applicants[Org].DonationFunds -=10000;
  64. applicants[Org].Wallet += 10000;
  65. }
  66. }
  67.  
  68. function addFacilitator(address _addr) Owner public
  69. {
  70. facilitators[_addr] = true;
  71. }
  72. }
Add Comment
Please, Sign In to add comment