Guest User

Untitled

a guest
Jan 16th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. function getAllLandForSale() external returns(uint256[]){
  2.  
  3. uint[] memory propertiesForSaleArray;
  4.  
  5. // Get the total number of properties created
  6. uint256 totalNumberOfProperties = baseContract.getLandArrayLength();
  7.  
  8. for(uint i = 0; i < totalNumberOfProperties; ++i) {
  9.  
  10. address currentOwner = baseContract.getLandOwner(i);
  11.  
  12. if(currentOwner == address(0)){
  13.  
  14. propertiesForSaleArray.push(i);
  15.  
  16. }
  17.  
  18. }
  19. }
  20.  
  21. uint c = 0; // counter
  22.  
  23. for(uint i = 0; i < totalNumberOfProperties; ++i) {
  24.  
  25. address currentOwner = baseContract.getLandOwner(i);
  26.  
  27. if(currentOwner == address(0)){
  28.  
  29. propertiesForSaleArray[c] = i;
  30.  
  31. c = c + 1;
  32.  
  33. }
  34. }
Add Comment
Please, Sign In to add comment