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 tamagotchi-shop/homework.md #100

Merged
merged 2 commits into from
Jul 14, 2023
Merged
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
16 changes: 7 additions & 9 deletions docs/15-tamagotchi-shop/homework.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ sidebar_position: 2
hide_table_of_contents: true
---

In this lesson, our Tamagotchi will be interacting with 2 other contracts: `tamagotchi-store` and `fungible-token`. Reference these contracts from your Tamagotchi `Cargo.toml` like this:
In this assignment, our Tamagotchi will be interacting with 2 other contracts: `tamagotchi-store` and `fungible-token`.

Reference these contracts from your Tamagotchi `Cargo.toml` as shown below:

```toml title="Cargo.toml"
# ...
Expand All @@ -19,7 +21,7 @@ store-io = { git = "https://github.com/gear-foundation/dapps-smart-contract-acad
# ...
```

Add a field to the Tamagotchi contract that stores the address of the fungible token. Accordingly, add the input message:
Add a field to the Tamagotchi contract the address of the fungible token. Accordingly, add the following input message to set the fungible token address:

```rust
#[derive(Encode, Decode, TypeInfo)]
Expand All @@ -31,9 +33,8 @@ pub enum TmgAction {
}
```

that will set the fungible token address.

Add the input message:
Add the input message to allow Tamagotchi to approve to transfer of its tokens (and accordingly the field `transaction_id` for communication with the fungible token contract):

```rust
#[derive(Encode, Decode, TypeInfo)]
Expand All @@ -49,7 +50,6 @@ pub enum TmgAction {
}
```

that will allow Tamagotchi to approve to transfer of its tokens (and accordingly the field `transaction_id` for communication with the fungible token contract).

To approve tokens you should send the fungible token the Approve message:

Expand Down Expand Up @@ -78,7 +78,7 @@ async fn approve_tokens(&mut self, account: &ActorId, amount: u128) {
}
```

Add the ability to your Tamagotchi contract to buy attributes. Add the input message:
Add the ability to your Tamagotchi contract to buy attributes using the input message below:

```rust
#[derive(Encode, Decode, TypeInfo)]
Expand Down Expand Up @@ -188,9 +188,7 @@ pub enum TmgEvent {
}
```

Please attach a link to the pull request (PR) in your repo with your Tamagotchi contract. Also, please paste your Tamagotchi program address.

Example:
Please attach a link to the pull request (PR) in your repo with your Tamagotchi contract. Also, please paste your Tamagotchi program address as shown in the example below:

- PR: <https://github.com/mynick/myname-gear-academy/pull/6>
- Program address: `0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d`