Skip to content

Commit

Permalink
Challenge gelopfalcon#1 is solved
Browse files Browse the repository at this point in the history
  • Loading branch information
UchihaCFC committed Jul 26, 2022
1 parent 68435cc commit 63878e8
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions PokemonFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ pragma solidity >=0.7.0 <0.9.0;

contract PokemonFactory {

struct Pokemon {
uint id;
string name;
}
struct Pokemon {
uint id;
string name;
}

Pokemon[] private pokemons;

mapping (uint => address) public pokemonToOwner;
mapping (address => uint) ownerPokemonCount;

function createPokemon (string memory _name, uint _id) public {
pokemons.push(Pokemon(_id, _name));
pokemonToOwner[_id] = msg.sender;
ownerPokemonCount[msg.sender]++;
event eventNewPokemon(
uint id,
string name
);

function createPokemon (string memory _name, uint _id) public {
pokemons.push(Pokemon(_id, _name));
pokemonToOwner[_id] = msg.sender;
ownerPokemonCount[msg.sender]++;
emit eventNewPokemon(_id, _name);
}

function getAllPokemons() public view returns (Pokemon[] memory) {
Expand All @@ -26,10 +32,10 @@ contract PokemonFactory {


function getResult() public pure returns(uint product, uint sum){
uint a = 1;
uint a = 1;
uint b = 2;
product = a * b;
sum = a + b;
sum = a + b;
}

}

0 comments on commit 63878e8

Please sign in to comment.