Skip to content

Commit

Permalink
gelopfalcon#3 require before create a new pokemon
Browse files Browse the repository at this point in the history
  • Loading branch information
albbeltran committed Jul 20, 2022
1 parent d5e3842 commit e91a6e8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions contracts/PokemonFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ contract PokemonFactory {
mapping(address => mapping(uint256 => Pokemon)) ownedPokemons;

function createPokemon(string memory _name) public {
require(bytes(_name).length > 2, "The name must have at least 2 characters.");
uint256 id = pokemons.length;
pokemons.push(Pokemon(id, _name));
pokemonToOwner[id] = msg.sender;
Expand Down

0 comments on commit e91a6e8

Please sign in to comment.