{"id":13409553,"url":"https://github.com/romanovichim/TONQuest3","last_synced_at":"2025-03-14T14:31:34.597Z","repository":{"id":187437963,"uuid":"668868053","full_name":"romanovichim/TONQuest3","owner":"romanovichim","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-07T10:44:24.000Z","size":30037,"stargazers_count":4,"open_issues_count":3,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-31T20:37:23.752Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/romanovichim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-20T19:28:50.000Z","updated_at":"2024-06-19T07:00:10.000Z","dependencies_parsed_at":"2023-12-08T18:41:29.494Z","dependency_job_id":"c3d04554-8d74-4639-9c18-e2c4d15672c7","html_url":"https://github.com/romanovichim/TONQuest3","commit_stats":null,"previous_names":["romanovichim/tonquest3"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanovichim%2FTONQuest3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanovichim%2FTONQuest3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanovichim%2FTONQuest3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanovichim%2FTONQuest3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romanovichim","download_url":"https://codeload.github.com/romanovichim/TONQuest3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243593477,"owners_count":20316192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:01.880Z","updated_at":"2025-03-14T14:31:32.094Z","avatar_url":"https://github.com/romanovichim.png","language":"TypeScript","funding_links":[],"categories":["🎓 Education"],"sub_categories":["Community Tutorials"],"readme":"# TON Speedrun \n\n## 🚩 Challenge 3: Jetton Vending Machine\n\n🤖 Smart contracts are kind of like \"always on\" vending machines that anyone can access. Let's make a decentralized, digital currency (an Jetton Standart token). \n\n🌟 The final deliverable will be ICO contract deployed to the testnet\n\n\n💬 Meet other builders working in TON and get help in the [official dev chat](https://t.me/tondev_eng) or [TON learn tg](https://t.me/ton_learn)\n\n# Checkpoint 0:  🌼 Install 🌼\n\nRequired: \n* [Git](https://git-scm.com/downloads)\n* [Node](https://nodejs.org/en/download/) (Use Version 18 LTS)\n* [Yarn](https://classic.yarnpkg.com/en/docs/install/#mac-stable)\n\n(⚠️ Don't install the linux package `yarn` make sure you install yarn with `npm i -g yarn` or even `sudo npm i -g yarn`!)\n\n```sh\ngit clone https://github.com/romanovichim/TONQuest3.git\n```\n```sh\ncd challenge-3\nyarn install\n```\n---\n\n# Checkpoint 1: 💎 Jetton Standard 💎\n\nA token is a unit of account for some digital asset in some network.\n\nFungible tokens are assets that are not unique and can be easily exchanged for another asset of the same type. Such tokens are made in such a way that each token is equivalent to the next token.\n\nTo enable tokens to be used in other applications (from wallets to decentralized exchanges), smart contract interface standards for tokens are being introduced.\n\nThe standard for a fungible token in the TON is the [Jetton](https://github.com/ton-blockchain/TEPs/blob/master/text/0074-jettons-standard.md).\n\nUnlike ethereum, there is no single smart contract that stores token balances for network wallets. In the standard Token:\n- master contract stores general information about the token\n- for each owner of the token, a separate smart contract is created - a wallet contract, which allows you to transfer the token and store the balance\n\n---\n \n# Checkpoint 2:  📑 Get Jetton Master Contract Data 📂 \n\nAs in the NFT standard from the first quest, Jetton contracts have mandatory GET methods. For the master contract, one of those methods is `get_jetton_data()` which returns data about the Jetton, let's try:\n\n```sh\nyarn bolt\n```\n\nYou will get something like this:\n![image](https://user-images.githubusercontent.com/18370291/254961827-c907b673-7331-4946-b931-78f220fee498.png)\n\nThat means:\n`total_supply` - the total number of issues jettons\n`mintable` - (-1/0) - flag which indicates whether number of jettons can increase \n`admin_address`- address of smart-contract which control Jetton \n`jetton_content` - cell - data in accordance to [Token Data Standard #64](https://github.com/ton-blockchain/TEPs/blob/master/text/0064-token-data-standard.md)\n\nWell, now let's release our Jetton!\n\n---\n\n# Checkpoint 3:  🏭 ICO variation 🏭\n\nICO - Initial Coin Offering - issuance by a project or company of its own money - tokens (cryptocurrency) in order to attract investment.\n\nThe simplest smart contract for Initial Coin Offering is a slightly modified Jetton standard master contract, which, when sending cryptocurrencies to it, gives tokens in exchange.\n\n---\n\n# Checkpoint 4:  🔌 Compile🔌  \n\nAs in the previous quest, in order to use a smart contract, it must be compiled into a hexBoC format. First, we will compile the master contract, and then the wallet, the wallet will be needed to deploy the master contract:\n\n```sh\nyarn compilemaster\n```\n\n```sh\nyarn compilewallet\n```\n---\n\n# Checkpoint 6:  📻 Deploy 📡\n\nGo to the deploy.ts file, in the line 62, change the const `ownerAddress` to your own, it will be stored in register c4, and only from this address it will be possible to execute commands assigned to administer the token.\n\n![image](https://user-images.githubusercontent.com/18370291/254968050-0130250e-5bda-4e20-9643-0fc9b39f9223.png)\n\nline 63 is for token metadata, you can put some link here, as this is an example, you can just write the phrase that you want to store in the master contract instead of metadata\n\nWe launch the deployment script and scan the QR code, then you already know))\n\n```sh\nyarn deploy\n```\n\nBe sure to save the link below the quar code, it contains the address of the master contract of your Jetton.\n\n---\n\n# Checkpoint 7: 💾  Get your Master Contract Data 💾\n\nWe go into the file and change the address at the top of the file on the line to the address of your master contract.\n\n![image](https://user-images.githubusercontent.com/18370291/254981215-01803c51-6831-4f07-87d1-25fc97fd2436.png)\n\nLaunch!\n\n```sh\nyarn getjetton\n```\n\nIf everything worked out, it's time to participate in ICO\n\n---\n\n# Checkpoint 8:  📀 Participate in ICO 📀\n\nTo participate in the ISO, you just need to send a message to the smart contract, let's do this:\n\n```sh\nyarn send\n```\n\nWhat to do with the QR code you already know :) \nThe question arises how to get the balance of our Jetton wallet.\n\n---\n\n# Checkpoint 9:  🎰 Getting to the wallet 🎰\n\nUsing the master contract, we will receive a wallet token of our address. Get method `get_wallet_address()`:\n\n\n```sh\nyarn myjettonwallet\n```\n\nCopy the address, we will use it in the `jettonwalletinfo.ts` script:\n\n![image](https://user-images.githubusercontent.com/18370291/254984237-0a17e470-bacc-435d-8c3b-4b589967d263.png)\n\nIn the 12th line you need to insert the address of your wallet token, and of course run the script:\n\n```sh\nyarn  jettonbalance\n```\n\n![image](https://user-images.githubusercontent.com/18370291/254985023-b11448a4-e35f-4056-a3dd-8d0e3c742a6f.png)\n\nEnjoy the balance)\n\n---\n\n# ⚔️ Side Quests\n\nQuick results are great, but to play longer, enjoy the ecosystem, I suggest you the following tutorials:\n- Analyzing the [Jetton standard](https://github.com/romanovichim/TonFunClessons_Eng/blob/main/lessons/smartcontract/9lesson/ninthlesson.md)\n- [Deploy ICO](https://github.com/romanovichim/TonFunClessons_Eng/blob/main/lessons/golang/16lesson/ICO.md) to testnet using Golang scripts\n\n\n# 🏆 Reward \n\nCongratulations on successfully completing this challenge! Before we conclude, let's take a quick look at the exciting reward awaiting you from the \u003ca target=\"_blank\" href=\"https://getgems.io/collection/EQBsrgKiU7y80gDdjhIa9JNOqFZYpxwdEB7F9GCq_l-oAm3T\"\u003e\"TON Speedrun\"\u003c/a\u003e collection:\n\n\u003cimg style=\"border-radius: 10pt; margin: 25pt auto; display: block;\" width=\"40%\" src=\"https://ton-devrel.s3.eu-central-1.amazonaws.com/tonspeedrun/1/image.jpg\"\u003e\n\nReady to claim your reward? Just scan the QR code, which can be generated using the script below:\n\n```sh\nyarn reward\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanovichim%2FTONQuest3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromanovichim%2FTONQuest3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanovichim%2FTONQuest3/lists"}