Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haque Farazul - Pet Park Assignment #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hfarazul
Copy link

No description provided.

enum animalType {None, Fish, Cat, Dog, Rabbit, Parrot}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommended to have enum names start with capital letters

gender _gender;
uint age;
address memberAddress;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storage is costly in solidity. You don't need to store this address since you are already have the address as key in members mapping

}

function animalCounts(animalType _animalType) public view returns (uint) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since solidity public mappings are automatically exposed as functions, you can just make animalCounts as a public mapping


function add (animalType _animalType, uint _count) public{
require (owner == msg.sender, "Not an owner");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to use a modifier here for checking owner as it provides better code readability



function borrow (uint _age, gender _gender, animalType _animalType) public{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be marked external since it is not being called anywhere internally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants