Guest User

Untitled

a guest
Dec 3rd, 2019
93
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pragma solidity ^0.5.13;
  2.  
  3. contract libIDEC {
  4. address payable internal owner;
  5.  
  6. modifier onlyOwner {
  7. require(msg.sender == owner);
  8. _;
  9. }
  10.  
  11. function whoAmI () public view returns (address) {
  12. return msg.sender;
  13. }
  14.  
  15. function getMyEther () public view returns (uint256) {
  16. return msg.sender.balance;
  17. }
  18.  
  19. function getOwner () public view returns (address) {
  20. return owner;
  21. }
  22.  
  23. function kill() public onlyOwner {
  24. selfdestruct(owner);
  25. }
  26. }
  27.  
  28. contract bazarIDE is libIDEC {
  29.  
  30. uint256 internal decimal = 2;
  31. uint256 internal total_supply = 1000 * 10**2 ;
  32.  
  33. struct peniagaDB {
  34. string nama;
  35. string noTel;
  36. uint256 noTapak;
  37. uint256 kupon;
  38. }
  39.  
  40. struct penganjurDB {
  41. string nama;
  42. string noTel;
  43. uint256 kupon;
  44. }
  45.  
  46. mapping(address => peniagaDB) internal pDB;
  47.  
  48. constructor () public {
  49. owner = msg.sender;
  50. }
  51.  
  52. function setMaklumatPeniaga(address _noAkaun, string memory _nama, string memory _noTel, uint256 _noTapak, uint256 _kupon) public onlyOwner {
  53. pDB[_noAkaun].nama = _nama;
  54. pDB[_noAkaun].noTel = _noTel;
  55. pDB[_noAkaun].noTapak = _noTapak;
  56. pDB[_noAkaun].kupon = _kupon;
  57. }
  58.  
  59. function getMaklumatPeniaga(address _noAkaun) public view returns (string memory, string memory, uint256, uint256) {
  60. return (pDB[_noAkaun].nama, pDB[_noAkaun].noTel, pDB[_noAkaun].noTapak,pDB[_noAkaun].kupon);
  61. }
  62. }
RAW Paste Data