Guest User

Untitled

a guest
Jan 22nd, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. function createUser(
  2. address _address,
  3. string memory _name,
  4. string memory _companyName,
  5. int _numYearsExperience,
  6. int _pricePerHour,
  7. string memory _specialisation,
  8. string memory _summary,
  9. int _numAdsViewed,
  10. int _numAdsPurchased
  11. ) public
  12.  
  13. {
  14.  
  15. address _userAddress = _address;
  16.  
  17. // Storage for list of users
  18. User storage user = users[_userAddress];
  19.  
  20.  
  21. // Check that the user did not already exist
  22. require(
  23. !user.set,
  24. "User already exists!"
  25. );
  26.  
  27.  
  28. //Store the user
  29. users[_userAddress] = User({
  30. name: _name,
  31. companyName: _companyName,
  32. numYearsExperience: _numYearsExperience,
  33. pricePerHour: _pricePerHour,
  34. specialisation: _specialisation,
  35. summary: _summary,
  36. set: true,
  37. numAdsViewed: _numAdsViewed,
  38. numAdsPurchased: _numAdsPurchased
  39. });
  40. }
  41.  
  42. var info = data[i]
  43. var name = String(info.name)
  44. var companyName = String(info.companyName)
  45. var pricePerHour = parseInt(info.pricePerHour);
  46. var yearsExperience = parseInt(info.yearsExperience);
  47. var specialisation = String(info.specialisation)
  48. var summary = String(info.summary)
  49. var address = info.address;
  50. var maxCPT = parseInt(info.maxCPT);
  51.  
  52. await sellContract.methods.createUser(address, name, companyName, yearsExperience, pricePerHour, specialisation, summary, 0, 0).send({ from: accounts[0]})
Add Comment
Please, Sign In to add comment