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

Update URLs to learn.vyperlang.org #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
*/.DS_Store
**/node_modules
.DS_Store
*/.DS_Store
**/node_modules
.idea
2 changes: 1 addition & 1 deletion 1/contract_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ one contract.

Vyper supports a version pragma to ensure that a contract is only
compiled by the intended compiler version, or range of versions. Version
strings use [NPM](https://docs.npmjs.com/misc/semver) style syntax.
strings use [NPM](https://docs.npmjs.com/about-semantic-versioning) style syntax.

For the scope of this tutorial, we'll want to compile our smart contracts with any compiler version in the range of `0.2.0` (inclusive) to `0.3.0` (exclusive). It looks like this:

Expand Down
2 changes: 1 addition & 1 deletion 1/state_vars_and_ints.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ State variables are permanently stored in contract storage. This means they're w
storedData: int128
```

In this example contract, we created a [`int128`](https://vyper.readthedocs.io/en/stable/types.html#signed-integer-128-bit) called `storedData` which holds a _default_ value of `1`.
In this example contract, we created a [`int128`](https://docs.vyperlang.org/en/stable/types.html#signed-integer-n-bit) called `storedData` which holds a _default_ value of `1`.

## Unsigned Integers: `uint256`

Expand Down
2 changes: 1 addition & 1 deletion 2/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ To select a specific `Pokemon` of a trainer we need 2 things:

- A `uint256` index that will choose a specific pokemon of the trainer.

You may recall from [Chapter 2](/#/2/msg-sender) that you can get the address of the contract caller using `msg.sender`.
You may recall from [Chapter 2](/2/msg-sender) that you can get the address of the contract caller using `msg.sender`.

1. Create an `external` function named `battleWildPokemon` which takes a single parameter: `pokemonIndex` of `uint256` type.

Expand Down
6 changes: 3 additions & 3 deletions 2/calling_a_contract.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Chapter 10: Calling a Contract

In [Chapter 8](/#/2/interfaces), we added `WildPokemons` interface in the trainer contract. In this chapter, we will call the `battle` function of the `WildPokemon` interface.
In [Chapter 8](/2/interfaces), we added `WildPokemons` interface in the trainer contract. In this chapter, we will call the `battle` function of the `WildPokemon` interface.

If you recall from [Chapter 8](/#/2/interfaces), we need a contract address to interact with `WildPokemons`.
If you recall from [Chapter 8](/2/interfaces), we need a contract address to interact with `WildPokemons`.

We will learn how to deploy a contract to Ethereum blockchain and get the contract address in future lessons. For the purpose of this chapter, I have deployed the [`WildPokemons` contract to the Rinkeby Testnet](https://rinkeby.etherscan.io/address/0x66f4804E06007630e1aF0a7B0b279e6F27A3FdE5)

Here is the contract address: [0x66f4804E06007630e1aF0a7B0b279e6F27A3FdE5](https://rinkeby.etherscan.io/address/0x66f4804E06007630e1aF0a7B0b279e6F27A3FdE5)

Using the contract address and the interface, you can make external calls to the interface functions (which was discussed in depth in [Chapter 8](/#/2/interfaces)):
Using the contract address and the interface, you can make external calls to the interface functions (which was discussed in depth in [Chapter 8](/2/interfaces)):

```vyper
interface Car:
Expand Down
4 changes: 2 additions & 2 deletions 2/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ So, for our use-case, we need to create an interface for the pokemon battle cont

### Using Interfaces

Interfaces can be added to contracts either through inline definition or by [importing them from a separate file](https://vyper.readthedocs.io/en/stable/interfaces.html?highlight=import#imports-via-import).
Interfaces can be added to contracts either through inline definition or by [importing them from a separate file](https://docs.vyperlang.org/en/stable/interfaces.html?highlight=import#imports-via-import).

The `interface` keyword is used to define an inline external interface:

Expand Down Expand Up @@ -65,7 +65,7 @@ def test(some_address: address):

## Put it to the test

As the coding area can only have one file at a time, we have removed the pokemon battle contract and added the trainer contract. You can check out the pokemon battle contract [here](https://github.com/vyperlang/vyper.fun/blob/chapter1/assets/2/2.7-finished-code.vy).
As the coding area can only have one file at a time, we have removed the pokemon battle contract and added the trainer contract. You can check out the pokemon battle contract [here](https://github.com/vyperlang/learn/blob/chapter1/assets/2/2.7-finished-code.vy).

1. The pokemon battle contract only has 1 external function: `battle`

Expand Down
2 changes: 1 addition & 1 deletion 2/msg-sender.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In order to do this, we need to use something called `msg.sender`.

## msg.sender

In Vyper, there are certain global variables that are available to all functions. One of these is `msg.sender`, which refers to the address of the person (or smart contract) who called the current function.
In Vyper, there are certain [global variables](https://docs.vyperlang.org/en/stable/constants-and-vars.html#environment-variables) that are available to all functions. One of these is `msg.sender`, which refers to the address of the person (or smart contract) who called the current function.

> Note: In Vyper, function execution always needs to start with an external caller. A contract will just sit on the blockchain doing nothing until someone calls one of its functions. So there will always be a `msg.sender`.

Expand Down
4 changes: 2 additions & 2 deletions 2/wild_pokemons.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ We will re-use some parts of our previous contract. Now, let's add some state va
4. Make following changes to the `_generateRandomDNA` function:

- Remove the `_name` input parameter so that `_generateRandomDNA` accepts no parameter.
- In the `_generateRandomDNA` body, replace `_name` with `battleCount`. Now, you may remember from [Lesson 1, Chapter 11](/#/1/keccak256-and-typecasting), that `keccak256` expects a single parameter of type `bytes32`, `Bytes` or `String`. So, we need to use `convert` to typecast `battleCount` to `bytes32`.
- You may remember from [Lesson 1, Chapter 10](/#/1/more_on_functions) that we add `@pure` decorator to a function which does not read contract state or environment variables. But now as `_generateRandomDNA` is accessing `battleCount` (a state variable), it is no longer a `@pure` function. So, remove the `@pure` function decorator.
- In the `_generateRandomDNA` body, replace `_name` with `battleCount`. Now, you may remember from [Lesson 1, Chapter 11](/1/keccak256-and-typecasting), that `keccak256` expects a single parameter of type `bytes32`, `Bytes` or `String`. So, we need to use `convert` to typecast `battleCount` to `bytes32`.
- You may remember from [Lesson 1, Chapter 10](/1/more_on_functions) that we add `@pure` decorator to a function which does not read contract state or environment variables. But now as `_generateRandomDNA` is accessing `battleCount` (a state variable), it is no longer a `@pure` function. So, remove the `@pure` function decorator.

<!-- tabs:start -->

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Click the "pencil" icon on the top right to edit the file.

![Pencil icon can be used to edit a file](https://files.gitter.im/5f4e9bc8d73408ce4fedc7e3/S901/hack-3.png)

In the first line of the file, you will find a link. In this case you will find the following link: https://vyper.fun/#/1/contract_structure
In the first line of the file, you will find a link. In this case you will find the following link: https://learn.vyperlang.org/#/1/contract_structure

![Post link in the file comment](https://files.gitter.im/5f4e9bc8d73408ce4fedc7e3/wwcQ/hack-4.png)

Expand All @@ -66,6 +66,6 @@ In the next page, you can add a description about the chapter and the translatio

Keep an on this page. I will review your edits and if there is something wrong, I will let you know in the comments section of the page.

If everything is ok, then your pull request will be merged! You will be listed as a contributor on the [contributors wall](https://github.com/vyperfun/vyper.fun#contributors)!
If everything is ok, then your pull request will be merged! You will be listed as a contributor on the [contributors wall](https://github.com/vyperlang/learn#contributors)!

![Contributors wall](https://files.gitter.im/5f4e9bc8d73408ce4fedc7e3/GNjO/hack-11.png)
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,22 @@

## What is this?

This is an [interactive tutorial website]( https://learn.vyperlang.org/#/) for learning Vyper while building games using smart contracts, similar to Cryptozombies.
This is an [interactive tutorial website](https://learn.vyperlang.org/) for learning Vyper while building games using smart contracts, similar to Cryptozombies.

## Running tutorials locally

1. Clone the repo:

```bash
git clone https://github.com/vyperlang/vyper.fun
git clone https://github.com/vyperlang/learn
```

2. Download and Install [Node.js](https://nodejs.org/).

3. Install `docsify` globally.
3. Run the tutorial locally.

```bash
// you may need to use sudo
npm i docsify-cli -g
```

4. Run the tutorial locally.

```bash
docsify serve .
npx docsify-cli serve .
```

## Contribution Guide
Expand All @@ -37,7 +30,7 @@ Given that Vyper.fun is a global project, we believe it's critical that Vyper.fu

### How to get involved

Check out [contribution guide](https://github.com/vyperlang/vyper.fun/blob/master/CONTRIBUTION.md) for instructions on how to get started as a translator. Don't see your language listed? Please comment [here](https://github.com/vyperlang/vyper.fun/issues/6) & we'll help get you set up.
Check out [contribution guide](https://github.com/vyperlang/learn/blob/master/CONTRIBUTION.md) for instructions on how to get started as a translator. Don't see your language listed? Please comment [here](https://github.com/vyperlang/learn/issues/6) & we'll help get you set up.

Join our [Discord server](https://discord.gg/Svaav43) for collaboration & support.

Expand Down
2 changes: 1 addition & 1 deletion WELCOME.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

## What is this?

This is an [interactive tutorial website](https://vyper.fun) for learning Vyper while building games using smart contracts, similar to Cryptozombies.
This is an [interactive tutorial website](https://learn.vyperlang.org) for learning Vyper while building games using smart contracts, similar to Cryptozombies.
4 changes: 2 additions & 2 deletions _coverpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
> Learn Vyper by building a Pokémon Game!

[Get Started](/lessons.html)
[Empezar](https://vyper.fun/en-lessons.html)
[GitHub](https://github.com/vyperlang/vyper.fun)
[Empezar](/es-lessons.html)
[GitHub](https://github.com/vyperlang/learn)

<!-- [开始吧](zh-cn/WELCOME.md)
[はじめる](ja-jp/WELCOME.md)
Expand Down
2 changes: 1 addition & 1 deletion _sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
- [Putting It Together](2/putting_it_together.md)

- [Gitcoin Grant](https://gitcoin.co/grants/1122/vyperfun)
- [Report an Issue](https://github.com/vyperlang/vyper.fun/issues)
- [Report an Issue](https://github.com/vyperlang/learn/issues)
2 changes: 1 addition & 1 deletion ar-sa/1/contract_structure.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/contract_structure
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/contract_structure
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/events.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/events
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/events
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/external_internal_functions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/external_internal_functions
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/external_internal_functions
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/function_declarations.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/function_declarations
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/function_declarations
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/introduction.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/introduction
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/introduction
Do NOT change the code below. The below code runs the code editor -->
2 changes: 1 addition & 1 deletion ar-sa/1/keccak256-and-typecasting.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/keccak256-and-typecasting
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/keccak256-and-typecasting
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/mappings.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/mappings
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/mappings
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/math_operations.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/math_operations
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/math_operations
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/more_on_functions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/more_on_functions
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/more_on_functions
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/public_vars.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/public_vars
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/public_vars
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/putting_it_together.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/putting_it_together
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/putting_it_together
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/state_vars_and_ints.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/state_vars_and_ints
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/state_vars_and_ints
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/structs.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/structs
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/structs
Do NOT change the code below. The below code runs the code editor -->

#### ** Template **
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/1/working_with_structs.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/working_with_structs
<!-- Add translation for the following page: https://learn.vyperlang.org/#/1/working_with_structs
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/2/addresses.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/addresses
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/addresses
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/2/assert.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/assert
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/assert
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/2/calling_a_contract.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/calling_a_contract
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/calling_a_contract
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/2/comparison_operator.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/comparison_operator
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/comparison_operator
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/2/empty.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/empty
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/empty
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/2/init.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/init
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/init
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/2/interfaces.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/interfaces
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/interfaces
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/2/introduction.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/introduction
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/introduction
Do NOT change the code below. The below code runs the code editor -->
2 changes: 1 addition & 1 deletion ar-sa/2/msg-sender.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/msg-sender
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/msg-sender
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/2/putting_it_together.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/putting_it_together
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/putting_it_together
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/2/random_wild_pokemon.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/random_wild_pokemon
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/random_wild_pokemon
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/2/wild_pokemons.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Add translation for the following page: https://vyper.fun/#/2/wild_pokemons
<!-- Add translation for the following page: https://learn.vyperlang.org/#/2/wild_pokemons
Do NOT change the code below. The below code runs the code editor -->

<!-- tabs:start -->
Expand Down
2 changes: 1 addition & 1 deletion ar-sa/WELCOME.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

## What is this?

This is an [interactive tutorial website](https://vyper.fun) for learning Vyper while building games using smart contracts, similar to Cryptozombies.
This is an [interactive tutorial website](https://learn.vyperlang.org) for learning Vyper while building games using smart contracts, similar to Cryptozombies.
2 changes: 1 addition & 1 deletion ar-sa/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
- [Putting It Together](2/putting_it_together.md)

- [Gitcoin Grant](https://gitcoin.co/grants/1122/vyperfun)
- [Report an Issue](https://github.com/vyperlang/vyper.fun/issues)
- [Report an Issue](https://github.com/vyperlang/learn/issues)
2 changes: 1 addition & 1 deletion assets/1/wildPokemons.vy
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def battle(pokemon: Pokemon) -> (bool, String[32], uint256, uint256):

self.battleCount += 1

if(pokemon.HP > randomHP):
if pokemon.HP > randomHP:
return True, randomName, randomDNA, randomHP
else:
return False, empty(String[32]), empty(uint256), empty(uint256)
8 changes: 4 additions & 4 deletions assets/2/2.11-finished-code.vy
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def battleWildPokemon(pokemonIndex: uint256):

battleResult, newPokemonName, newPokemonDNA, newPokemonHP = WildPokemons(WILD_POKEMON).battle(self.trainerToPokemon[msg.sender][pokemonIndex])

if(battleResult):
self.trainerToPokemon[msg.sender][pokemonIndex].matches +=1
self.trainerToPokemon[msg.sender][pokemonIndex].wins +=1
if battleResult:
self.trainerToPokemon[msg.sender][pokemonIndex].matches += 1
self.trainerToPokemon[msg.sender][pokemonIndex].wins += 1

newPokemon: Pokemon = Pokemon({
name: newPokemonName,
Expand All @@ -65,7 +65,7 @@ def battleWildPokemon(pokemonIndex: uint256):
log NewPokemonCreated(newPokemonName, newPokemonDNA, newPokemonHP)

else:
self.trainerToPokemon[msg.sender][pokemonIndex].matches +=1
self.trainerToPokemon[msg.sender][pokemonIndex].matches += 1

@pure
@internal
Expand Down
2 changes: 1 addition & 1 deletion assets/2/2.6-finished-code.vy
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ def battle(pokemon: Pokemon) -> (bool, String[32], uint256, uint256):

self.battleCount += 1

if(pokemon.HP > randomHP):
if pokemon.HP > randomHP:
return True, randomName, randomDNA, randomHP
Loading