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

Create FTs tutorial #165

Merged
merged 2 commits into from
Apr 11, 2024
Merged
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
4 changes: 4 additions & 0 deletions docs/.vitepress/locales/en/components/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ export default [
{text: 'Smart Contract', link: '/build/tutorials/tic-tac-toe-game/smart-contract'}
],
},
{
text: 'Create/Issue Fungible Tokens',
link: '/build/tutorials/create-issue-token/'
},
{
text: 'AtomicAssets Guide',
link: '/build/tutorials/howto_atomicassets/',
Expand Down
558 changes: 285 additions & 273 deletions docs/.vitepress/locales/es/components/sidebar.ts

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions docs/build/tutorials/create-issue-token/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
title: Create and Mint a Fungible Token
order: 10
---

# Create and Mint a Fungible Token Asset

In this tutorial, you will learn how to create and mint a fungible token asset on the WAX mainnet.

## Before You Start

* You will need to complete our [Quick Start with Docker](/build/dapp-development/docker-setup/) (recommended) and use the [WAX Blockchain Development Guide](/build/dapp-development/) to build from source.

* To compile and deploy your smart contract, you will need to use the [WAX Contract Development Toolkit (WAX-CDT)](/build/dapp-development/wax-cdt/).

* To deploy your smart contract on the WAX mainnet or the WAX testnet, you will need to create a self-managed WAX Blockchain Account.

## Clone the Smart Contract from GitHub

1. Clone the fungible asset smart contract from the WAX GitHub repository:

```shell
git clone https://github.com/worldwide-asset-exchange/wax-system-contracts.git
```

2. Navigate to the smart contract directory:

```shell
cd wax-system-contracts/contracts/eosio.token
```

:::warning IMPORTANT
For the actions that we will perform below, it is necessary to unlock the wallet
```shell
cleos wallet unlock
```
:::

:::tip NOTE
Replace these variables with your own values:
- `<TOKEN_ACCOUNT_NAME>`: Name of the fungible asset token account (Will be the owner of the fungible asset token).
- `<OWNER_PUBLIC_KEY>`: Public key of the fungible asset token account.
- `<ACTIVE_PUBLIC_KEY>`: Active public key of the fungible asset token account.
- `<ACTIVE_PRIVATE_KEY>`: Active private key of the fungible asset token account.
- `<MAX_ISSUE>`: Maximum amount of fungible asset tokens to mint.
- `<SYMBOL>`: Symbol of the fungible asset token.
- `<AMOUNT>`: Amount of fungible asset tokens to mint (issue) or to send (transfer). The total of minted tokens cannot exceed the `<MAX_ISSUE>` value.
:::


3. Create an account for the fungible asset token:

```shell
cleos create account eosio <TOKEN_ACCOUNT_NAME> <OWNER_PUBLIC_KEY> <ACTIVE_PUBLIC_KEY>
```

4. Add the fungible asset token account to the wallet:

```shell
cleos wallet import --private-key <ACTIVE_PRIVATE_KEY>
```

5. Compile the smart contract:

```shell
mkdir build
cd build
cmake ..
make
```
6. Deploy the smart contract on the WAX mainnet:

```shell
cleos set contract eosio.token ../ --abi eosio.token.abi -p <TOKEN_ACCOUNT_NAME>@active
```
7. Mint the fungible asset token:

```shell
cleos push action <TOKEN_ACCOUNT_NAME> create '["<TOKEN_ACCOUNT_NAME>", "<MAX_ISSUE> <SYMBOL>"]' -p <TOKEN_ACCOUNT_NAME>@active
```

8. Verify that the fungible asset token has been minted correctly:

```shell
cleos get currency stats <TOKEN_ACCOUNT_NAME> <SYMBOL>
```
9. Mint additional fungible asset tokens:

```shell
cleos push action <TOKEN_ACCOUNT_NAME> issue '["<TOKEN_ACCOUNT_NAME>", "<AMOUNT> <SYMBOL>", "memo"]' -p <TOKEN_ACCOUNT_NAME>@active
```
10. Verify that the additional fungible asset tokens have been minted correctly:

```shell
cleos get currency stats <TOKEN_ACCOUNT_NAME> <SYMBOL>
```

11. Transfer fungible asset tokens to another account:

```shell
cleos push action <TOKEN_ACCOUNT_NAME> transfer '["<TOKEN_ACCOUNT_NAME>", "<RECIPIENT_ACCOUNT_NAME>", "<AMOUNT> <SYMBOL>", "memo"]' -p <TOKEN_ACCOUNT_NAME>@active
```

12. Verify that the fungible asset tokens have been transferred correctly:

```shell
cleos get currency balance <TOKEN_ACCOUNT_NAME> <RECIPIENT_ACCOUNT_NAME> <SYMBOL>
```

Congratulations! You have created and minted a fungible token asset on the WAX mainnet.
2 changes: 1 addition & 1 deletion docs/build/tutorials/tic-tac-toe-game/smart-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ You can see we request the next random number and process the result in **receiv

The game cover a logic when we found the winner, we'll reward him with an amount of TIC token. You can use this logic to issue game's token, let player trade and buy in-game item,...

You can follow the tutorial on eosio issuing new token here: https://developers.eos.io/manuals/eosio.contracts/latest/guides/how-to-create-issue-and-transfer-a-token/.
You can follow the tutorial on Antelope issuing new token here: [Create and Mint a Fungible Token Asset](/build/tutorials/create-issue-token/)

After deploy the token, you'll have to create new token name TIC and issue a predefined amount of token to the game contract. After that, the game can transfer token to the winner.

Expand Down
110 changes: 110 additions & 0 deletions docs/es/build/tutorials/create-issue-token/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
title: Crear y acuñar un token de activo fungible
order: 10
---

# Crear y acuñar un token de activo fungible

En este tutorial, aprenderás cómo crear y acuñar un token de activo fungible en la red principal de WAX.

## Antes de Comenzar

* Necesitarás completar nuestro [Inicio Rápido con Docker](/es/build/dapp-development/docker-setup/) (recomendado) y usar la [Guía de desarrollo para la Blockchain de WAX](/es/build/dapp-development/) para construir desde el código fuente.

* Para compilar y desplegar tu contrato inteligente, necesitarás utilizar el [Kit de Desarrollo de Contratos de WAX (WAX-CDT)](/es/build/dapp-development/wax-cdt/).

* Para desplegar tu contrato inteligente en la red principal de WAX o en la red de pruebas de WAX, necesitarás crear una Cuenta de Blockchain de WAX autogestionada.

## Clonar el Contrato Inteligente desde GitHub

1. Clona el contrato inteligente de activo fungible desde el repositorio de GitHub de WAX:

```shell
git clone https://github.com/worldwide-asset-exchange/wax-system-contracts.git
```

2. Navega al directorio del contrato inteligente:

```shell
cd wax-system-contracts/contracts/eosio.token
```

:::warning IMPORTANTE
Para las acciones que vamos a realizar a continuación es necesario desbloquear la wallet
```shell
cleos wallet unlock
```
:::

:::tip NOTA
Sustituye estas variables por tus propios valores:
- `<TOKEN_ACCOUNT_NAME>`: Nombre de la cuenta del token de activo fungible (Será el propietario del token de activo fungible).
- `<OWNER_PUBLIC_KEY>`: Clave pública de la cuenta del token de activo fungible.
- `<ACTIVE_PUBLIC_KEY>`: Clave pública activa de la cuenta del token de activo fungible.
- `<ACTIVE_PRIVATE_KEY>`: Clave privada activa de la cuenta del token de activo fungible.
- `<MAX_ISSUE>`: Cantidad máxima de tokens de activo fungible a acuñar.
- `<SYMBOL>`: Símbolo del token de activo fungible.
- `<AMOUNT>`: Cantidad de tokens de activo fungible a acuñar (issue) o a enviar (transfer). El total de tokens acuñados no puede exceder el valor de `<MAX_ISSUE>`.
:::


3. Crea una cuenta para el token de activo fungible:

```shell
cleos create account eosio <TOKEN_ACCOUNT_NAME> <OWNER_PUBLIC_KEY> <ACTIVE_PUBLIC_KEY>
```

4. Agrega la cuenta del token de activo fungible a la wallet:

```shell
cleos wallet import --private-key <ACTIVE_PRIVATE_KEY>
```

5. Compila el contrato inteligente:

```shell
mkdir build
cd build
cmake ..
make
```
6. Despliega el contrato inteligente en la red principal de WAX:

```shell
cleos set contract eosio.token ../ --abi eosio.token.abi -p <TOKEN_ACCOUNT_NAME>@active
```
7. Acuña el token de activo fungible:

```shell
cleos push action <TOKEN_ACCOUNT_NAME> create '["<TOKEN_ACCOUNT_NAME>", "<MAX_ISSUE> <SYMBOL>"]' -p <TOKEN_ACCOUNT_NAME>@active
```

8. Verifica que el token de activo fungible se haya acuñado correctamente:

```shell
cleos get currency stats <TOKEN_ACCOUNT_NAME> <SYMBOL>
```
9. Acuñar tokens de activo fungible adicionales:

```shell
cleos push action <TOKEN_ACCOUNT_NAME> issue '["<TOKEN_ACCOUNT_NAME>", "<AMOUNT> <SYMBOL>", "memo"]' -p <TOKEN_ACCOUNT_NAME>@active
```
10. Verifica que los tokens de activo fungible adicionales se hayan acuñado correctamente:

```shell
cleos get currency stats <TOKEN_ACCOUNT_NAME> <SYMBOL>
```

11. Transferir tokens de activo fungible a otra cuenta:

```shell
cleos push action <TOKEN_ACCOUNT_NAME> transfer '["<TOKEN_ACCOUNT_NAME>", "<RECIPIENT_ACCOUNT_NAME>", "<AMOUNT> <SYMBOL>", "memo"]' -p <TOKEN_ACCOUNT_NAME>@active
```

12. Verifica que los tokens de activo fungible se hayan transferido correctamente:

```shell
cleos get currency balance <TOKEN_ACCOUNT_NAME> <RECIPIENT_ACCOUNT_NAME> <SYMBOL>
```

¡Felicidades! Has creado y acuñado un token de activo fungible en la red principal de WAX.
119 changes: 119 additions & 0 deletions docs/es/build/tutorials/tic-tac-toe-game/client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
title: Cliente de Juego
order: 2
---

# Tres en Raya: Cliente de Juego

Este contrato de tres en raya proporciona un ejemplo de cómo construir un juego en WAX, incluyendo el uso seguro de valores aleatorios para determinar los resultados del juego.

[Tutorial de Frontend en github.com](https://github.com/worldwide-asset-exchange/tic-tac-toe-front-end)

Esto te guiará sobre cómo hacer el contrato del juego Tictactoe que se ejecuta en la blockchain de Wax. La lógica del juego de tictactoe sigue el ejemplo de eosio en el tutorial de Tres en Raya de EOS, pero agregaremos más lógica que soporte aleatorizar el primer turno y movimientos de juego aleatorios si juegas contra un bot.


## Cómo Jugar

[Tres en Raya](https://tictactoe.wax.io/) es un juego clásico disfrutado por personas de todas las edades. Es simple de aprender pero puede ser sorprendentemente estratégico. Aquí tienes una guía paso a paso sobre cómo jugar:

1. **Configuración**: Haz clic en `Jugar Juego`
<img src="/assets/images/tutorials/tic-tac-toe/splash.png"/>
Y elige `Nuevo Juego`
<img src="/assets/images/tutorials/tic-tac-toe/new_game.png"/>

2. **Jugadores**: Tres en Raya se juega típicamente por dos jugadores. A un jugador se le asigna "X" y al otro "O".
<img src="/assets/images/tutorials/tic-tac-toe/new_game_popup.png"/>

3. **Objetivo**: El objetivo es ser el primero en crear una fila de tres de tus marcas (X's o O's) ya sea horizontal, vertical o diagonalmente.

4. **Jugabilidad**: Los jugadores se turnan para colocar su marca (X o O) en un cuadrado vacío en la cuadrícula.

5. **Turnos**: Al jugador asignado "X" generalmente va primero, seguido por el jugador asignado "O". Los jugadores continúan tomando turnos hasta que un jugador gana o la cuadrícula está llena (resultando en un empate).
<img src="/assets/images/tutorials/tic-tac-toe/playing_game.png"/>

6. **Ganar**: Un jugador gana el juego si logra crear una fila de tres de sus marcas ya sea horizontal, vertical o diagonalmente. Si un jugador logra esto, declara "¡Tres en Raya!" y es declarado ganador.

7. **Empates**: Si todos los cuadrados están llenos sin que ningún jugador logre tres en fila, el juego termina en un empate.
<img src="/assets/images/tutorials/tic-tac-toe/winner.png"/>

**Notas: El ganador del juego recibirá una recompensa de 10 tokens TIC (el token emitido por el juego)**

8. **Revancha**: Los jugadores pueden fácilmente comenzar un nuevo juego y empezar de nuevo.


## 🛠️ Tecnologías Utilizadas

- **Vite**: Eleva tu flujo de trabajo de desarrollo con Vite, un conjunto de herramientas diseñado para la creación rápida y eficiente de proyectos web.
- **Blockchain WAXP**: Adopta el espíritu descentralizado con la blockchain WAXP, fomentando interacciones de contratos inteligentes seguras y transparentes para experiencias de juego.


## 🚀 Cómo Empezar


Asegúrate de que se cumplan los siguientes requisitos previos antes de embarcarte en tu viaje:

```
Node.js (Versión: 16.16.0) o Yarn (Versión: 1.22.17) & npm (Versión: 9.6.7) instalados en tu máquina.
```

## 📋 Instalación y Configuración

1. **Clonar el Repositorio**:
```
git clone [email protected]:worldwide-asset-exchange/tic-tac-toe-front-end.git
```

2. **Navegar al Directorio del Proyecto**:
```
cd tic-tac-toe-front-end
```

3. **Instalar Dependencias**:
```
npm install
```
**O**
```
yarn
```

4. **Configurar Variables de Entorno**:
Crea un archivo `.env` con la siguiente configuración:
```env
VITE_PUBLIC_URL=http://localhost:5173
```

5. **Iniciar el Servidor de Desarrollo**:
```
npm run dev


```
**O**
```
yarn run dev
```

6. **Acceder y Participar**:
Navega a `http://localhost:5173` y sumérgete en la experiencia de Tres en Raya potenciada por blockchain.


## 🐳 Integración con Docker

Para configurar rápidamente un entorno de desarrollo se utiliza Docker.

### 🛠️ Construir y Lanzar Contenedores

Ejecuta el siguiente comando en tu terminal dentro del directorio del proyecto:
```
docker-compose up --build
```

Accede a tu aplicación en `http://localhost:5173` (o el puerto designado como se especifica en tu [docker-compose.yml](docker-compose.yml)).

### 🛑 Terminar Contenedores

Para detener y remover los contenedores de manera ordenada, ejecuta:
```
docker-compose down
```
19 changes: 19 additions & 0 deletions docs/es/build/tutorials/tic-tac-toe-game/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Desarrollando un Tres en Raya (Tic-Tac-Toe)
order: 1
---
# Construyendo el Tres en Raya en WAX (Tic-Tac-Toe)

Descubre cómo crear un juego de Tres en Raya en la blockchain de WAX con este tutorial sencillo. Perfecto para desarrolladores de todos los niveles de habilidad, esta guía te guía a través del proceso de desarrollar un contrato inteligente y un frontend para el icónico juego, con un giro: usar tecnología blockchain para un juego seguro y recompensas en tokens.

[Visita el juego](https://tictactoe.wax.io/)

![Imagen de vista previa](/assets/images/tutorials/tic-tac-toe/preview_meta_data.png)

## Resumen Rápido
- **Jugabilidad con un Giro Blockchain**
- Aprende a construir el Tres en Raya donde los jugadores pueden ganar tokens, con movimientos y turnos de juego aleatorizados para un giro emocionante.

- **Guías Paso a Paso**:
- [Tutorial de Desarrollo Frontend](/es/build/tutorials/tic-tac-toe-game/client)
- [Tutorial de Desarrollo de Contrato Inteligente](/es/build/tutorials/tic-tac-toe-game/smart-contract)
Loading