├── env.template ├── .gitignore ├── .prettierrc.json ├── images └── image1.png ├── sources ├── output │ ├── SampleJetton_SampleJetton.code.boc │ ├── SampleJetton_JettonDefaultWallet.code.boc │ ├── SampleJetton_SampleJetton.stdlib.fc │ ├── SampleJetton_JettonDefaultWallet.md │ ├── SampleJetton_SampleJetton.md │ ├── SampleJetton_JettonDefaultWallet.stdlib.fc │ ├── SampleJetton_JettonDefaultWallet.headers.fc │ ├── SampleJetton_SampleJetton.headers.fc │ ├── SampleJetton_JettonDefaultWallet.abi │ ├── SampleJetton_SampleJetton.abi │ ├── SampleJetton_SampleJetton.storage.fc │ ├── SampleJetton_JettonDefaultWallet.code.fc │ ├── SampleJetton_JettonDefaultWallet.storage.fc │ ├── SampleJetton_SampleJetton.code.fc │ ├── SampleJetton_JettonDefaultWallet.code.fif │ └── SampleJetton_SampleJetton.code.fif ├── contract.tact ├── utils │ ├── jetton-helpers.ts │ ├── print.ts │ └── deploy.ts ├── messages.tact ├── 2_TransferURL.ts ├── contract.read.ts ├── contract.deploy.ts ├── 1_Transfer.ts ├── jetton.tact └── contract.spec.ts ├── .vscode └── settings.json ├── jest.config.js ├── tact.config.json ├── LICENSE ├── package.json ├── README.md └── tsconfig.json /env.template: -------------------------------------------------------------------------------- 1 | mnemonics = "BURGER MACBOOK ...." -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.env 3 | sources/output -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "tabWidth": 4, 4 | "useTabs": false 5 | } -------------------------------------------------------------------------------- /images/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howardpen9/jetton-implementation-in-tact/HEAD/images/image1.png -------------------------------------------------------------------------------- /sources/output/SampleJetton_SampleJetton.code.boc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howardpen9/jetton-implementation-in-tact/HEAD/sources/output/SampleJetton_SampleJetton.code.boc -------------------------------------------------------------------------------- /sources/output/SampleJetton_JettonDefaultWallet.code.boc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howardpen9/jetton-implementation-in-tact/HEAD/sources/output/SampleJetton_JettonDefaultWallet.code.boc -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.background": "#062C61", 4 | "titleBar.activeBackground": "#093D88", 5 | "titleBar.activeForeground": "#F7FAFE" 6 | } 7 | } -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ 2 | module.exports = { 3 | preset: 'ts-jest', 4 | testEnvironment: 'node', 5 | testPathIgnorePatterns: ["/node_modules/","/dist/"], 6 | maxWorkers: 1 7 | }; -------------------------------------------------------------------------------- /tact.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "projects": [{ 3 | "name": "SampleJetton", 4 | "path": "./sources/contract.tact", 5 | "output": "./sources/output", 6 | "options":{ 7 | 8 | } 9 | }] 10 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2023 @howardpen9 @0kenx 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "build": "tact --config ./tact.config.json", 5 | "test": "jest", 6 | "deploy": "ts-node ./sources/contract.deploy.ts", 7 | "read": "ts-node ./sources/contract.read.ts", 8 | "d1": "ts-node ./sources/1_Transfer.ts", 9 | "d2": "ts-node ./sources/2_TransferURL.ts" 10 | }, 11 | "dependencies": { 12 | "@aws-crypto/sha256-js": "^4.0.0", 13 | "@dedust/sdk": "^0.8.6", 14 | "@ston-fi/sdk": "^0.4.0", 15 | "@tact-lang/compiler": "^1.2.0", 16 | "@tact-lang/emulator": "^3.2.2", 17 | "@ton/core": "^0.54.0", 18 | "@ton/crypto": "^3.2.0", 19 | "@ton/sandbox": "^0.15.0", 20 | "@ton/test-utils": "^0.4.2", 21 | "@ton/ton": "^13.9.0", 22 | "@types/jest": "^29.5.3", 23 | "@types/node": "^20.2.5", 24 | "@types/qs": "^6.9.7", 25 | "base64url": "^3.0.1", 26 | "dotenv": "^16.3.1", 27 | "enquirer": "^2.3.6", 28 | "jest": "^29.6.2", 29 | "open": "^8.4.0", 30 | "prando": "^6.0.1", 31 | "prettier": "^2.8.8", 32 | "qs": "^6.11.0", 33 | "ton-crypto": "^3.2.0", 34 | "ton-emulator": "^2.1.1", 35 | "tonweb": "^0.0.62", 36 | "ts-jest": "^29.1.1", 37 | "ts-node": "^10.9.1", 38 | "typescript": "^5.1.6" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /sources/contract.tact: -------------------------------------------------------------------------------- 1 | import "./jetton"; 2 | 3 | message Mint { 4 | amount: Int; 5 | receiver: Address; 6 | } 7 | 8 | contract SampleJetton with Jetton { 9 | total_supply: Int as coins; 10 | owner: Address; 11 | content: Cell; 12 | mintable: Bool; 13 | 14 | max_supply: Int as coins; // Extract parameter we set here. The Jetton Standards doesn't have this parameter. 15 | 16 | init(owner: Address, content: Cell, max_supply: Int) { 17 | self.total_supply = 0; 18 | self.owner = owner; 19 | self.mintable = true; 20 | self.content = content; 21 | self.max_supply = max_supply; 22 | } 23 | 24 | receive(msg: Mint) { // 0xfc708bd2 25 | let ctx: Context = context(); 26 | require(ctx.sender == self.owner, "Not owner"); 27 | require(self.mintable, "Not mintable"); 28 | require(self.total_supply + msg.amount <= self.max_supply, "Max supply exceeded"); 29 | self.mint(msg.receiver, msg.amount, self.owner); // (to, amount, response_destination) 30 | } 31 | 32 | receive("Mint: 100") { // Public Minting 33 | let ctx: Context = context(); 34 | require(self.mintable, "Not mintable"); 35 | require(self.total_supply + 100 <= self.max_supply, "Max supply exceeded"); 36 | self.mint(ctx.sender, 100, self.owner); // 🔴 37 | } 38 | 39 | receive("Owner: MintClose") { 40 | let ctx: Context = context(); 41 | require(ctx.sender == self.owner, "Not owner"); 42 | self.mintable = false; 43 | } 44 | } -------------------------------------------------------------------------------- /sources/utils/jetton-helpers.ts: -------------------------------------------------------------------------------- 1 | import { Sha256 } from "@aws-crypto/sha256-js"; 2 | import { Dictionary, beginCell, Cell } from "@ton/core"; 3 | 4 | const ONCHAIN_CONTENT_PREFIX = 0x00; 5 | const SNAKE_PREFIX = 0x00; 6 | const CELL_MAX_SIZE_BYTES = Math.floor((1023 - 8) / 8); 7 | 8 | const sha256 = (str: string) => { 9 | const sha = new Sha256(); 10 | sha.update(str); 11 | return Buffer.from(sha.digestSync()); 12 | }; 13 | 14 | const toKey = (key: string) => { 15 | return BigInt(`0x${sha256(key).toString("hex")}`); 16 | }; 17 | 18 | export function buildOnchainMetadata(data: { name: string; description: string; image: string }): Cell { 19 | let dict = Dictionary.empty(Dictionary.Keys.BigUint(256), Dictionary.Values.Cell()); 20 | 21 | // Store the on-chain metadata in the dictionary 22 | Object.entries(data).forEach(([key, value]) => { 23 | dict.set(toKey(key), makeSnakeCell(Buffer.from(value, "utf8"))); 24 | }); 25 | 26 | return beginCell().storeInt(ONCHAIN_CONTENT_PREFIX, 8).storeDict(dict).endCell(); 27 | } 28 | 29 | export function makeSnakeCell(data: Buffer) { 30 | // Create a cell that package the data 31 | let chunks = bufferToChunks(data, CELL_MAX_SIZE_BYTES); 32 | 33 | const b = chunks.reduceRight((curCell, chunk, index) => { 34 | if (index === 0) { 35 | curCell.storeInt(SNAKE_PREFIX, 8); 36 | } 37 | curCell.storeBuffer(chunk); 38 | if (index > 0) { 39 | const cell = curCell.endCell(); 40 | return beginCell().storeRef(cell); 41 | } else { 42 | return curCell; 43 | } 44 | }, beginCell()); 45 | return b.endCell(); 46 | } 47 | 48 | function bufferToChunks(buff: Buffer, chunkSize: number) { 49 | let chunks: Buffer[] = []; 50 | while (buff.byteLength > 0) { 51 | chunks.push(buff.slice(0, chunkSize)); 52 | buff = buff.slice(chunkSize); 53 | } 54 | return chunks; 55 | } 56 | -------------------------------------------------------------------------------- /sources/messages.tact: -------------------------------------------------------------------------------- 1 | struct JettonData { 2 | total_supply: Int; 3 | mintable: Bool; 4 | owner: Address; 5 | content: Cell; 6 | wallet_code: Cell; 7 | } 8 | 9 | struct JettonWalletData { 10 | balance: Int; 11 | owner: Address; 12 | master: Address; 13 | code: Cell; 14 | } 15 | 16 | message(0xf8a7ea5) TokenTransfer { 17 | query_id: Int as uint64; 18 | amount: Int as coins; 19 | sender: Address; 20 | response_destination: Address?; 21 | custom_payload: Cell?; 22 | forward_ton_amount: Int as coins; 23 | forward_payload: Slice as remaining; 24 | } 25 | 26 | message(0x178d4519) TokenTransferInternal { 27 | query_id: Int as uint64; 28 | amount: Int as coins; 29 | from: Address; 30 | response_destination: Address?; 31 | forward_ton_amount: Int as coins; 32 | forward_payload: Slice as remaining; 33 | } 34 | 35 | message(0x7362d09c) TokenNotification { 36 | query_id: Int as uint64; 37 | amount: Int as coins; 38 | from: Address; 39 | forward_payload: Slice as remaining; 40 | } 41 | 42 | message(0x595f07bc) TokenBurn { 43 | query_id: Int as uint64; 44 | amount: Int as coins; 45 | response_destination: Address?; 46 | custom_payload: Cell?; 47 | } 48 | 49 | message(0x7bdd97de) TokenBurnNotification { 50 | query_id: Int as uint64; 51 | amount: Int as coins; 52 | sender: Address; 53 | response_destination: Address?; 54 | } 55 | 56 | message(0xd53276db) TokenExcesses { 57 | query_id: Int as uint64; 58 | } 59 | 60 | message TokenUpdateContent { 61 | content: Cell; 62 | } 63 | 64 | // ==== TEP89: Jetton Wallet Discovery ==== 65 | message(0x2c76b973) ProvideWalletAddress { 66 | query_id: Int as uint64; 67 | owner_address: Address; 68 | include_address: Bool; 69 | } 70 | 71 | // take_wallet_address#d1735400 72 | // query_id:uint64 wallet_address:MsgAddress owner_address:(Maybe ^MsgAddress) = InternalMsgBody; 73 | message(0xd1735400) TakeWalletAddress { 74 | query_id: Int as uint64; 75 | wallet_address: Address; 76 | owner_address: Slice as remaining; 77 | } 78 | -------------------------------------------------------------------------------- /sources/utils/print.ts: -------------------------------------------------------------------------------- 1 | import { Address, beginCell, Cell, contractAddress, storeStateInit } from "@ton/ton"; 2 | import qs from "qs"; 3 | import base64url from "base64url"; 4 | 5 | export function printSeparator() { 6 | console.log("========================================================================================"); 7 | } 8 | 9 | export function printHeader(name: string) { 10 | printSeparator(); 11 | console.log("Contract: " + name); 12 | printSeparator(); 13 | } 14 | 15 | export function printAddress(address: Address, testnet: boolean = true) { 16 | console.log("Address: " + address.toString({ testOnly: testnet })); 17 | console.log( 18 | "Explorer: " + 19 | "https://" + 20 | (testnet ? "testnet." : "") + 21 | "tonapi.io/account/" + 22 | address.toString({ testOnly: testnet }) 23 | ); 24 | printSeparator(); 25 | } 26 | 27 | export function printDeploy( 28 | init: { code: Cell; data: Cell }, 29 | value: bigint, 30 | command: Cell | string, 31 | testnet: boolean = true 32 | ) { 33 | // Resolve target address 34 | let to = contractAddress(0, init); 35 | 36 | // Resovle init 37 | let initStr = base64url(beginCell().store(storeStateInit(init)).endCell().toBoc({ idx: false })); 38 | 39 | let link: string; 40 | if (typeof command === "string") { 41 | link = 42 | `https://${testnet ? "test." : ""}tonhub.com/transfer/` + 43 | to.toString({ testOnly: testnet }) + 44 | "?" + 45 | qs.stringify({ 46 | text: command, 47 | amount: value.toString(10), 48 | init: initStr, 49 | }); 50 | } else { 51 | link = 52 | `https://${testnet ? "test." : ""}tonhub.com/transfer/` + 53 | to.toString({ testOnly: testnet }) + 54 | "?" + 55 | qs.stringify({ 56 | text: "Deploy contract", 57 | amount: value.toString(10), 58 | init: initStr, 59 | bin: base64url(command.toBoc({ idx: false })), 60 | }); 61 | } 62 | console.log("Deploy: " + link); 63 | printSeparator(); 64 | } 65 | -------------------------------------------------------------------------------- /sources/2_TransferURL.ts: -------------------------------------------------------------------------------- 1 | import { Address, beginCell, contractAddress, toNano, Cell, TonClient4 } from "ton"; 2 | import { ContractSystem, testAddress } from "ton-emulator"; 3 | import { buildOnchainMetadata } from "./utils/jetton-helpers"; 4 | import { printAddress, printHeader, printDeploy, printSeparator } from "./utils/print"; 5 | import { deploy } from "./utils/deploy"; 6 | 7 | import { SampleJetton } from "./output/SampleJetton_SampleJetton"; 8 | import { JettonDefaultWallet, storeTokenTransfer } from "./output/SampleJetton_JettonDefaultWallet"; 9 | 10 | // 🔴 Jetton Root Address 11 | let jetton_minter_root = Address.parse(""); 12 | 13 | // 🔴 the caller address that who wants to transfer the jetton(the person who will click the URL) 14 | let caller_wallet_address = Address.parse(""); 15 | 16 | // 🔴 The Address of new Owner WalletV4 Address 17 | let new_owner_Address = Address.parse(""); 18 | 19 | (async () => { 20 | let contract_address = await SampleJetton.fromAddress(jetton_minter_root); 21 | 22 | // Get the Jetton Wallet Address of the deployer 23 | let target_jetton_wallet_init = await JettonDefaultWallet.init(contract_address.address, caller_wallet_address); 24 | 25 | // Get the Jetton Wallet Address of the new owner 26 | let new_owner_jetton_wallet = await JettonDefaultWallet.fromInit(contract_address.address, new_owner_Address); 27 | printSeparator(); 28 | 29 | // ✨Pack the forward message into a cell 30 | const test_message = beginCell() 31 | .storeBit(1) 32 | .storeRef(beginCell().storeUint(0, 32).storeBuffer(Buffer.from("Hello, GM. -- Right", "utf-8")).endCell()) 33 | .endCell(); 34 | 35 | let deployAmount = toNano("0.3"); 36 | let packed = beginCell() 37 | .store( 38 | storeTokenTransfer({ 39 | $$type: "TokenTransfer", 40 | query_id: 0n, 41 | amount: toNano(1), 42 | destination: new_owner_jetton_wallet.address, 43 | response_destination: caller_wallet_address, // Original Owner, aka. First Minter's Jetton Wallet 44 | custom_payload: null, 45 | forward_ton_amount: toNano("0.000000001"), 46 | forward_payload: test_message, 47 | }) 48 | ) 49 | .endCell(); 50 | printHeader("Write Contract"); 51 | printAddress(contract_address.address); 52 | 53 | // printDeploy(init, deployAmount, packed); 54 | await deploy(target_jetton_wallet_init, deployAmount, packed); 55 | })(); 56 | -------------------------------------------------------------------------------- /sources/contract.read.ts: -------------------------------------------------------------------------------- 1 | import { 2 | WalletContractV4, 3 | beginCell, 4 | Address, 5 | contractAddress, 6 | ContractProvider, 7 | TonClient4, 8 | TonClient, 9 | fromNano, 10 | toNano, 11 | Cell, 12 | BitString, 13 | Slice, 14 | } from "ton"; 15 | import { printSeparator } from "./utils/print"; 16 | 17 | // Contract Abi // 18 | import { buildOnchainMetadata } from "./utils/jetton-helpers"; 19 | import { mnemonicToPrivateKey } from "ton-crypto"; 20 | 21 | import { SampleJetton, loadTokenTransfer } from "./output/SampleJetton_SampleJetton"; 22 | import { JettonDefaultWallet } from "./output/SampleJetton_JettonDefaultWallet"; 23 | 24 | (async () => { 25 | // //create client for testnet sandboxv4 API - alternative endpoint 26 | // const client = new TonClient4({ 27 | // endpoint: "https://sandbox-v4.tonhubapi.com", 28 | // }); 29 | // const mnemonics = "YOUR OWN mnemonics"; 30 | // let keyPair = await mnemonicToPrivateKey(mnemonics.split(" ")); 31 | // let secretKey = keyPair.secretKey; 32 | // let workchain = 0; //we are working in basechain. 33 | // let deploy_wallet = WalletContractV4.create({ workchain, publicKey: keyPair.publicKey }); 34 | // let deploy_wallet_contract = client.open(deploy_wallet); 35 | // // Get deployment wallet balance 36 | // // let balance: bigint = await deploy_address.getBalance(); 37 | // const jettonParams = { 38 | // name: "Test 123 Best Practice", 39 | // description: "This is description of Test tact jetton", 40 | // symbol: "PPPPPPPP", 41 | // image: "https://cdn.logo.com/hotlink-ok/logo-social.png", 42 | // }; 43 | // let max_supply = toNano(1234567666666689011); // Set the specific total supply in nano 44 | // // Create content Cell 45 | // let content = buildOnchainMetadata(jettonParams); 46 | // let init = await SampleJetton.init(deploy_wallet_contract.address, content, max_supply); 47 | // let jetton_minter_contract_address = contractAddress(workchain, init); 48 | // console.log("Jetton Master: " + jetton_minter_contract_address); 49 | // let contract_ddd = await client.open(SampleJetton.fromAddress(jetton_minter_contract_address)); 50 | // let jetton_wallet = await contract_ddd.getGetWalletAddress(deploy_wallet_contract.address); 51 | // let contract_dataFormat = JettonDefaultWallet.fromAddress(jetton_wallet); 52 | // let contract = client.open(contract_dataFormat); 53 | // console.log("Deployer's JettonWallet: " + contract.address); 54 | // let jettonWalletBalance = await (await contract.getGetWalletData()).balance; 55 | // let owner_of_wallet = await (await contract.getGetWalletData()).owner; 56 | // console.log("JettonWallet Balance: " + jettonWalletBalance); 57 | // console.log("JettonWallet Owner: \n" + owner_of_wallet); 58 | // TODO: 59 | // // loadOwnershipAssigned => msg.forwardload 60 | // let aa = loadTransferEvent(src.asSlice()); 61 | // console.log("Mint MemberID: " + aa.item_index + ", by " + aa.minter); 62 | })(); 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🚚 Jetton Implementation Template by Howard 2 | 3 | This project is targeting to provide a template for the Jetton Implementation. It's a good start point for the developer to start the Jetton Implementation. 4 | 5 | ### Usage 6 | 7 | ```bash 8 | yarn build # To build & compile the contract 9 | yarn test # To run test cases for the contract 10 | yarn deploy # To deploy contract 11 | --- 12 | yarn read # To read contract data from the blockchain 13 | yarn d1 # (Optional) To Transfer the Jetton Token to the new account 14 | yarn d2 # (Optional) To generate the Transfer URL to let the new account to transfer the Jetton Token to the other account 15 | ``` 16 | 17 | 🔍 Detail can be found in `package.json` LOL 18 | 19 | # ✨ Important knowledge points 20 | 21 | ![image1.png](./image1.png) 22 | 23 | - Store the Jetton content in the `Cell` data type. 24 | - Use lowercase for the name in `get_jetton_data()` as per [TEP-74](https://github.com/ton-blockchain/TEPs/blob/master/text/0074-jettons-standard.md). Otherwise, major explorers won't be able to read the Jetton information correctly. 25 | - The `max_supply` parameter is optional. You can choose to use it or not. Regardless, the Explorer will only track the `Total Supply` in the Jetton Root Contract. 26 | - In Jetton, if you want to transfer your Jetton Token to someone, you need to send a message to YOUR Jetton Wallet, not to the new recipient's wallet. 27 | - forward_ton_amount can be set as lower as possible: Same as [TelemintNFT](https://github.com/TelegramMessenger/telemint). I don't know why, but looks like we can set (1e-9 TON) in forward_ton_amount without any error. 28 | 29 | ### Reference 30 | 31 | - https://blog.ton.org/how-to-shard-your-ton-smart-contract-and-why-studying-the-anatomy-of-tons-jettons 32 | - https://github.com/ton-blockchain/TEPs/blob/master/text/0074-jettons-standard.md 33 | - https://docs.ton.org/develop/dapps/asset-processing/jettons 34 | - https://docs.tact-lang.org/learn/jetton/jetton-3 35 | 36 | ## Community 37 | 38 | - Tact Lang Community (https://t.me/tactlang) 39 | - Ton101 (https://t.me/ton101) 40 | - TON Dev Chat[EN] (https://t.me/tondev_eng) 41 | - TON Dev 中文 (https://t.me/tondev_zh) 42 | 43 | ## Deployment 44 | 45 | To deploy contract you should: 46 | 47 | 1. Specify `contract.tact` that will be used as entry point of your contract 48 | 2. Configure `contract.deploy.ts` according to your `contract.tact` to generate a deployment link. In particular, it is necessary to correctly call the Init() function from the contract. 49 | 50 | If you renamed `contract.tact` to something else, you need to update `tact.config.json` correspondingly. For more information , see [Tact Documentation](https://docs.tact-lang.org/language/guides/config) 51 | 52 | ## Testing 53 | 54 | Example of contract tests are in `contract.spec.ts`. For more information about testing, see [Tact Documentation](https://docs.tact-lang.org/language/guides/debug) 55 | 56 | To add new test files to contract you should create `*.spec.ts` files similar to template's one and they would be automatically included in testing. 57 | 58 | ## Licence 59 | 60 | MIT 61 | -------------------------------------------------------------------------------- /sources/contract.deploy.ts: -------------------------------------------------------------------------------- 1 | import { beginCell, contractAddress, toNano, TonClient4, WalletContractV4, internal, fromNano } from "@ton/ton"; 2 | import { mnemonicToPrivateKey } from "ton-crypto"; 3 | import { buildOnchainMetadata } from "./utils/jetton-helpers"; 4 | 5 | import { SampleJetton, storeMint } from "./output/SampleJetton_SampleJetton"; 6 | import { JettonDefaultWallet, TokenBurn } from "./output/SampleJetton_JettonDefaultWallet"; 7 | 8 | import { printSeparator } from "./utils/print"; 9 | import * as dotenv from "dotenv"; 10 | dotenv.config(); 11 | 12 | (async () => { 13 | //create client for testnet sandboxv4 API - alternative endpoint 14 | const client4 = new TonClient4({ 15 | // endpoint: "https://sandbox-v4.tonhubapi.com", 16 | endpoint: "https://mainnet-v4.tonhubapi.com", 17 | }); 18 | 19 | let mnemonics = (process.env.mnemonics_2 || "").toString(); // 🔴 Change to your own, by creating .env file! 20 | let keyPair = await mnemonicToPrivateKey(mnemonics.split(" ")); 21 | let secretKey = keyPair.secretKey; 22 | let workchain = 0; //we are working in basechain. 23 | let deployer_wallet = WalletContractV4.create({ workchain, publicKey: keyPair.publicKey }); 24 | console.log(deployer_wallet.address); 25 | 26 | let deployer_wallet_contract = client4.open(deployer_wallet); 27 | 28 | const jettonParams = { 29 | name: "XXXXXX Name", 30 | description: "This is description of Test Jetton Token in Tact-lang", 31 | symbol: "XXXXXXXXX", 32 | image: "https://avatars.githubusercontent.com/u/104382459?s=200&v=4", 33 | }; 34 | 35 | // Create content Cell 36 | let content = buildOnchainMetadata(jettonParams); 37 | let max_supply = toNano(123456766689011); // 🔴 Set the specific total supply in nano 38 | 39 | // Compute init data for deployment 40 | // NOTICE: the parameters inside the init functions were the input for the contract address 41 | // which means any changes will change the smart contract address as well 42 | let init = await SampleJetton.init(deployer_wallet_contract.address, content, max_supply); 43 | let jettonMaster = contractAddress(workchain, init); 44 | let deployAmount = toNano("0.15"); 45 | 46 | let supply = toNano(1000000000); // 🔴 Specify total supply in nano 47 | let packed_msg = beginCell() 48 | .store( 49 | storeMint({ 50 | $$type: "Mint", 51 | amount: supply, 52 | receiver: deployer_wallet_contract.address, 53 | }) 54 | ) 55 | .endCell(); 56 | 57 | // send a message on new address contract to deploy it 58 | let seqno: number = await deployer_wallet_contract.getSeqno(); 59 | console.log("🛠️Preparing new outgoing massage from deployment wallet. \n" + deployer_wallet_contract.address); 60 | console.log("Seqno: ", seqno + "\n"); 61 | printSeparator(); 62 | 63 | // Get deployment wallet balance 64 | let balance: bigint = await deployer_wallet_contract.getBalance(); 65 | 66 | console.log("Current deployment wallet balance = ", fromNano(balance).toString(), "💎TON"); 67 | console.log("Minting:: ", fromNano(supply)); 68 | printSeparator(); 69 | 70 | await deployer_wallet_contract.sendTransfer({ 71 | seqno, 72 | secretKey, 73 | messages: [ 74 | internal({ 75 | to: jettonMaster, 76 | value: deployAmount, 77 | init: { 78 | code: init.code, 79 | data: init.data, 80 | }, 81 | body: packed_msg, 82 | }), 83 | ], 84 | }); 85 | console.log("====== Deployment message sent to =======\n", jettonMaster); 86 | })(); 87 | -------------------------------------------------------------------------------- /sources/1_Transfer.ts: -------------------------------------------------------------------------------- 1 | import { Address, beginCell, contractAddress, toNano, TonClient4, internal, fromNano, WalletContractV4 } from "ton"; 2 | import { deploy } from "./utils/deploy"; 3 | import { printAddress, printDeploy, printHeader, printSeparator } from "./utils/print"; 4 | import { buildOnchainMetadata } from "./utils/jetton-helpers"; 5 | import { mnemonicToPrivateKey } from "ton-crypto"; 6 | import * as dotenv from "dotenv"; 7 | dotenv.config(); 8 | // ======================================== 9 | import { SampleJetton, storeTokenTransfer } from "./output/SampleJetton_SampleJetton"; 10 | // ======================================== 11 | 12 | let NewOnwer_Address = Address.parse(""); // 🔴 Owner should usually be the deploying wallet's address. 13 | 14 | (async () => { 15 | const client4 = new TonClient4({ 16 | //create client for testnet sandboxv4 API - alternative endpoint 17 | endpoint: "https://sandbox-v4.tonhubapi.com", 18 | }); 19 | 20 | let mnemonics = (process.env.mnemonics || "").toString(); // 🔴 Change to your own, by creating .env file! 21 | let keyPair = await mnemonicToPrivateKey(mnemonics.split(" ")); 22 | let secretKey = keyPair.secretKey; 23 | let workchain = 0; 24 | let wallet = WalletContractV4.create({ 25 | workchain, 26 | publicKey: keyPair.publicKey, 27 | }); 28 | 29 | let wallet_contract = client4.open(wallet); 30 | const jettonParams = { 31 | name: "Test Token Name", 32 | description: "This is description of Test Jetton Token in Tact-lang", 33 | symbol: "TTN", 34 | image: "https://avatars.githubusercontent.com/u/104382459?s=200&v=4", 35 | }; 36 | 37 | // Create content Cell 38 | let content = buildOnchainMetadata(jettonParams); 39 | let max_supply = toNano("666.123456789"); // 🔴 Set the specific total supply in nano 40 | 41 | // Compute init data for deployment 42 | // NOTICE: the parameters inside the init functions were the input for the contract address 43 | // which means any changes will change the smart contract address as well. 44 | let init = await SampleJetton.init(wallet_contract.address, content, max_supply); 45 | let jetton_masterWallet = contractAddress(workchain, init); 46 | let contract_dataFormat = SampleJetton.fromAddress(jetton_masterWallet); 47 | let contract = client4.open(contract_dataFormat); 48 | let jetton_wallet = await contract.getGetWalletAddress(wallet_contract.address); 49 | console.log("✨ " + wallet_contract.address + "'s JettonWallet ==> "); 50 | 51 | // ✨Pack the forward message into a cell 52 | const test_message_left = beginCell() 53 | .storeBit(0) // 🔴 whether you want to store the forward payload in the same cell or not. 0 means no, 1 means yes. 54 | .storeUint(0, 32) 55 | .storeBuffer(Buffer.from("Hello, GM -- Left.", "utf-8")) 56 | .endCell(); 57 | 58 | // const test_message_right = beginCell() 59 | // .storeBit(1) // 🔴 whether you want to store the forward payload in the same cell or not. 0 means no, 1 means yes. 60 | // .storeRef(beginCell().storeUint(0, 32).storeBuffer(Buffer.from("Hello, GM. -- Right", "utf-8")).endCell()) 61 | // .endCell(); 62 | 63 | // ======================================== 64 | let forward_string_test = beginCell().storeBit(1).storeUint(0, 32).storeStringTail("EEEEEE").endCell(); 65 | let packed = beginCell() 66 | .store( 67 | storeTokenTransfer({ 68 | $$type: "TokenTransfer", 69 | query_id: 0n, 70 | amount: toNano(20000), 71 | destination: NewOnwer_Address, 72 | response_destination: wallet_contract.address, // Original Owner, aka. First Minter's Jetton Wallet 73 | custom_payload: forward_string_test, 74 | forward_ton_amount: toNano("0.000000001"), 75 | forward_payload: test_message_left, 76 | }) 77 | ) 78 | .endCell(); 79 | 80 | let deployAmount = toNano("0.3"); 81 | let seqno: number = await wallet_contract.getSeqno(); 82 | let balance: bigint = await wallet_contract.getBalance(); 83 | // ======================================== 84 | printSeparator(); 85 | console.log("Current deployment wallet balance: ", fromNano(balance).toString(), "💎TON"); 86 | console.log("\n🛠️ Calling To JettonWallet:\n" + jetton_wallet + "\n"); 87 | await wallet_contract.sendTransfer({ 88 | seqno, 89 | secretKey, 90 | messages: [ 91 | internal({ 92 | to: jetton_wallet, 93 | value: deployAmount, 94 | init: { 95 | code: init.code, 96 | data: init.data, 97 | }, 98 | bounce: true, 99 | body: packed, 100 | }), 101 | ], 102 | }); 103 | })(); 104 | -------------------------------------------------------------------------------- /sources/output/SampleJetton_SampleJetton.stdlib.fc: -------------------------------------------------------------------------------- 1 | global (int, slice, int, slice) __tact_context; 2 | global slice __tact_context_sender; 3 | global cell __tact_context_sys; 4 | global int __tact_randomized; 5 | 6 | slice __tact_verify_address(slice address) inline { 7 | throw_unless(136, address.slice_bits() == 267); 8 | var h = address.preload_uint(11); 9 | throw_if(137, h == 1279); 10 | throw_unless(136, h == 1024); 11 | return address; 12 | } 13 | 14 | (slice, slice) __tact_load_address(slice cs) inline { 15 | slice raw = cs~load_msg_addr(); 16 | return (cs, __tact_verify_address(raw)); 17 | } 18 | 19 | (slice, slice) __tact_load_address_opt(slice cs) inline { 20 | slice raw = cs~load_msg_addr(); 21 | if (raw.preload_uint(2) != 0) { 22 | return (cs, __tact_verify_address(raw)); 23 | } else { 24 | return (cs, null()); 25 | } 26 | } 27 | 28 | builder __tact_store_address(builder b, slice address) inline { 29 | return b.store_slice(__tact_verify_address(address)); 30 | } 31 | 32 | builder __tact_store_address_opt(builder b, slice address) inline { 33 | if (null?(address)) { 34 | b = b.store_uint(0, 2); 35 | return b; 36 | } else { 37 | return __tact_store_address(b, address); 38 | } 39 | } 40 | 41 | slice __tact_create_address(int chain, int hash) inline { 42 | var b = begin_cell(); 43 | b = b.store_uint(2, 2); 44 | b = b.store_uint(0, 1); 45 | b = b.store_int(chain, 8); 46 | b = b.store_uint(hash, 256); 47 | var addr = b.end_cell().begin_parse(); 48 | return __tact_verify_address(addr); 49 | } 50 | 51 | slice __tact_compute_contract_address(int chain, cell code, cell data) inline { 52 | var b = begin_cell(); 53 | b = b.store_uint(0, 2); 54 | b = b.store_uint(3, 2); 55 | b = b.store_uint(0, 1); 56 | b = b.store_ref(code); 57 | b = b.store_ref(data); 58 | var hash = cell_hash(b.end_cell()); 59 | return __tact_create_address(chain, hash); 60 | } 61 | 62 | forall X -> X __tact_not_null(X x) inline { 63 | throw_if(128, null?(x)); return x; 64 | } 65 | 66 | (int, slice, int, slice) __tact_context_get() inline { 67 | return __tact_context; 68 | } 69 | 70 | slice __tact_context_get_sender() inline { 71 | return __tact_context_sender; 72 | } 73 | 74 | builder __tact_store_bool(builder b, int v) inline { 75 | return b.store_int(v, 1); 76 | } 77 | 78 | int __tact_slice_eq_bits(slice a, slice b) inline { 79 | return equal_slice_bits(a, b); 80 | } 81 | 82 | cell __tact_dict_set_code(cell dict, int id, cell code) inline { 83 | return udict_set_ref(dict, 16, id, code); 84 | } 85 | 86 | cell __tact_dict_get_code(cell dict, int id) inline { 87 | var (data, ok) = udict_get_ref?(dict, 16, id); 88 | throw_unless(135, ok); 89 | return data; 90 | } 91 | 92 | slice $global_contractAddress((cell, cell) $s) impure inline { 93 | var (($s'code, $s'data)) = $s; 94 | return __tact_compute_contract_address(0, $s'code, $s'data); 95 | } 96 | 97 | () $global_send((int, slice, int, int, cell, cell, cell) $params) impure inline_ref { 98 | var (($params'bounce, $params'to, $params'value, $params'mode, $params'body, $params'code, $params'data)) = $params; 99 | builder $b = begin_cell(); 100 | $b = store_int($b, 1, 2); 101 | $b = __tact_store_bool($b, $params'bounce); 102 | $b = store_int($b, 0, 3); 103 | $b = __tact_store_address($b, $params'to); 104 | $b = store_coins($b, $params'value); 105 | $b = store_int($b, 0, ((((1 + 4) + 4) + 64) + 32)); 106 | if (( ((~ null?($params'code))) ? (true) : ((~ null?($params'data))) )) { 107 | $b = __tact_store_bool($b, true); 108 | builder $bc = begin_cell(); 109 | $bc = __tact_store_bool($bc, false); 110 | $bc = __tact_store_bool($bc, false); 111 | if ((~ null?($params'code))) { 112 | $bc = __tact_store_bool($bc, true); 113 | $bc = store_ref($bc, __tact_not_null($params'code)); 114 | } else { 115 | $bc = __tact_store_bool($bc, false); 116 | } 117 | if ((~ null?($params'data))) { 118 | $bc = __tact_store_bool($bc, true); 119 | $bc = store_ref($bc, __tact_not_null($params'data)); 120 | } else { 121 | $bc = __tact_store_bool($bc, false); 122 | } 123 | $bc = __tact_store_bool($bc, false); 124 | $b = __tact_store_bool($b, true); 125 | $b = store_ref($b, end_cell($bc)); 126 | } else { 127 | $b = __tact_store_bool($b, false); 128 | } 129 | cell $body = $params'body; 130 | if ((~ null?($body))) { 131 | $b = __tact_store_bool($b, true); 132 | $b = store_ref($b, __tact_not_null($body)); 133 | } else { 134 | $b = __tact_store_bool($b, false); 135 | } 136 | cell $c = end_cell($b); 137 | send_raw_message($c, $params'mode); 138 | } 139 | 140 | slice $Cell$_fun_asSlice(cell $self) impure inline { 141 | var ($self) = $self; 142 | return begin_parse($self); 143 | } -------------------------------------------------------------------------------- /sources/output/SampleJetton_JettonDefaultWallet.md: -------------------------------------------------------------------------------- 1 | # TACT Compilation Report 2 | Contract: JettonDefaultWallet 3 | BOC Size: 2109 bytes 4 | 5 | # Types 6 | Total Types: 17 7 | 8 | ## StateInit 9 | TLB: `_ code:^cell data:^cell = StateInit` 10 | Signature: `StateInit{code:^cell,data:^cell}` 11 | 12 | ## Context 13 | TLB: `_ bounced:bool sender:address value:int257 raw:^slice = Context` 14 | Signature: `Context{bounced:bool,sender:address,value:int257,raw:^slice}` 15 | 16 | ## SendParameters 17 | TLB: `_ bounce:bool to:address value:int257 mode:int257 body:Maybe ^cell code:Maybe ^cell data:Maybe ^cell = SendParameters` 18 | Signature: `SendParameters{bounce:bool,to:address,value:int257,mode:int257,body:Maybe ^cell,code:Maybe ^cell,data:Maybe ^cell}` 19 | 20 | ## ChangeOwner 21 | TLB: `change_owner#819dbe99 queryId:uint64 newOwner:address = ChangeOwner` 22 | Signature: `ChangeOwner{queryId:uint64,newOwner:address}` 23 | 24 | ## ChangeOwnerOk 25 | TLB: `change_owner_ok#327b2b4a queryId:uint64 newOwner:address = ChangeOwnerOk` 26 | Signature: `ChangeOwnerOk{queryId:uint64,newOwner:address}` 27 | 28 | ## JettonData 29 | TLB: `_ total_supply:int257 mintable:bool owner:address content:^cell wallet_code:^cell = JettonData` 30 | Signature: `JettonData{total_supply:int257,mintable:bool,owner:address,content:^cell,wallet_code:^cell}` 31 | 32 | ## JettonWalletData 33 | TLB: `_ balance:int257 owner:address master:address code:^cell = JettonWalletData` 34 | Signature: `JettonWalletData{balance:int257,owner:address,master:address,code:^cell}` 35 | 36 | ## TokenTransfer 37 | TLB: `token_transfer#0f8a7ea5 query_id:uint64 amount:coins sender:address response_destination:Maybe address custom_payload:Maybe ^cell forward_ton_amount:coins forward_payload:remainder = TokenTransfer` 38 | Signature: `TokenTransfer{query_id:uint64,amount:coins,sender:address,response_destination:Maybe address,custom_payload:Maybe ^cell,forward_ton_amount:coins,forward_payload:remainder}` 39 | 40 | ## TokenTransferInternal 41 | TLB: `token_transfer_internal#178d4519 query_id:uint64 amount:coins from:address response_destination:Maybe address forward_ton_amount:coins forward_payload:remainder = TokenTransferInternal` 42 | Signature: `TokenTransferInternal{query_id:uint64,amount:coins,from:address,response_destination:Maybe address,forward_ton_amount:coins,forward_payload:remainder}` 43 | 44 | ## TokenNotification 45 | TLB: `token_notification#7362d09c query_id:uint64 amount:coins from:address forward_payload:remainder = TokenNotification` 46 | Signature: `TokenNotification{query_id:uint64,amount:coins,from:address,forward_payload:remainder}` 47 | 48 | ## TokenBurn 49 | TLB: `token_burn#595f07bc query_id:uint64 amount:coins response_destination:Maybe address custom_payload:Maybe ^cell = TokenBurn` 50 | Signature: `TokenBurn{query_id:uint64,amount:coins,response_destination:Maybe address,custom_payload:Maybe ^cell}` 51 | 52 | ## TokenBurnNotification 53 | TLB: `token_burn_notification#7bdd97de query_id:uint64 amount:coins sender:address response_destination:Maybe address = TokenBurnNotification` 54 | Signature: `TokenBurnNotification{query_id:uint64,amount:coins,sender:address,response_destination:Maybe address}` 55 | 56 | ## TokenExcesses 57 | TLB: `token_excesses#d53276db query_id:uint64 = TokenExcesses` 58 | Signature: `TokenExcesses{query_id:uint64}` 59 | 60 | ## TokenUpdateContent 61 | TLB: `token_update_content#af1ca26a content:^cell = TokenUpdateContent` 62 | Signature: `TokenUpdateContent{content:^cell}` 63 | 64 | ## ProvideWalletAddress 65 | TLB: `provide_wallet_address#2c76b973 query_id:uint64 owner_address:address include_address:bool = ProvideWalletAddress` 66 | Signature: `ProvideWalletAddress{query_id:uint64,owner_address:address,include_address:bool}` 67 | 68 | ## TakeWalletAddress 69 | TLB: `take_wallet_address#d1735400 query_id:uint64 wallet_address:address owner_address:remainder = TakeWalletAddress` 70 | Signature: `TakeWalletAddress{query_id:uint64,wallet_address:address,owner_address:remainder}` 71 | 72 | ## Mint 73 | TLB: `mint#fc708bd2 amount:int257 receiver:address = Mint` 74 | Signature: `Mint{amount:int257,receiver:address}` 75 | 76 | # Get Methods 77 | Total Get Methods: 1 78 | 79 | ## get_wallet_data 80 | 81 | # Error Codes 82 | 2: Stack undeflow 83 | 3: Stack overflow 84 | 4: Integer overflow 85 | 5: Integer out of expected range 86 | 6: Invalid opcode 87 | 7: Type check error 88 | 8: Cell overflow 89 | 9: Cell underflow 90 | 10: Dictionary error 91 | 13: Out of gas error 92 | 32: Method ID not found 93 | 34: Action is invalid or not supported 94 | 37: Not enough TON 95 | 38: Not enough extra-currencies 96 | 128: Null reference exception 97 | 129: Invalid serialization prefix 98 | 130: Invalid incoming message 99 | 131: Constraints error 100 | 132: Access denied 101 | 133: Contract stopped 102 | 134: Invalid argument 103 | 135: Code of a contract was not found 104 | 136: Invalid address 105 | 137: Masterchain support is not enabled for this contract 106 | 3688: Not mintable 107 | 4429: Invalid sender 108 | 12241: Max supply exceeded 109 | 14534: Not owner 110 | 16059: Invalid value 111 | 18668: Can't Mint Anymore 112 | 23951: Insufficient gas 113 | 42708: Invalid sender! 114 | 43422: Invalid value - Burn 115 | 62972: Invalid balance -------------------------------------------------------------------------------- /sources/output/SampleJetton_SampleJetton.md: -------------------------------------------------------------------------------- 1 | # TACT Compilation Report 2 | Contract: SampleJetton 3 | BOC Size: 2212 bytes 4 | 5 | # Types 6 | Total Types: 17 7 | 8 | ## StateInit 9 | TLB: `_ code:^cell data:^cell = StateInit` 10 | Signature: `StateInit{code:^cell,data:^cell}` 11 | 12 | ## Context 13 | TLB: `_ bounced:bool sender:address value:int257 raw:^slice = Context` 14 | Signature: `Context{bounced:bool,sender:address,value:int257,raw:^slice}` 15 | 16 | ## SendParameters 17 | TLB: `_ bounce:bool to:address value:int257 mode:int257 body:Maybe ^cell code:Maybe ^cell data:Maybe ^cell = SendParameters` 18 | Signature: `SendParameters{bounce:bool,to:address,value:int257,mode:int257,body:Maybe ^cell,code:Maybe ^cell,data:Maybe ^cell}` 19 | 20 | ## ChangeOwner 21 | TLB: `change_owner#819dbe99 queryId:uint64 newOwner:address = ChangeOwner` 22 | Signature: `ChangeOwner{queryId:uint64,newOwner:address}` 23 | 24 | ## ChangeOwnerOk 25 | TLB: `change_owner_ok#327b2b4a queryId:uint64 newOwner:address = ChangeOwnerOk` 26 | Signature: `ChangeOwnerOk{queryId:uint64,newOwner:address}` 27 | 28 | ## JettonData 29 | TLB: `_ total_supply:int257 mintable:bool owner:address content:^cell wallet_code:^cell = JettonData` 30 | Signature: `JettonData{total_supply:int257,mintable:bool,owner:address,content:^cell,wallet_code:^cell}` 31 | 32 | ## JettonWalletData 33 | TLB: `_ balance:int257 owner:address master:address code:^cell = JettonWalletData` 34 | Signature: `JettonWalletData{balance:int257,owner:address,master:address,code:^cell}` 35 | 36 | ## TokenTransfer 37 | TLB: `token_transfer#0f8a7ea5 query_id:uint64 amount:coins sender:address response_destination:Maybe address custom_payload:Maybe ^cell forward_ton_amount:coins forward_payload:remainder = TokenTransfer` 38 | Signature: `TokenTransfer{query_id:uint64,amount:coins,sender:address,response_destination:Maybe address,custom_payload:Maybe ^cell,forward_ton_amount:coins,forward_payload:remainder}` 39 | 40 | ## TokenTransferInternal 41 | TLB: `token_transfer_internal#178d4519 query_id:uint64 amount:coins from:address response_destination:Maybe address forward_ton_amount:coins forward_payload:remainder = TokenTransferInternal` 42 | Signature: `TokenTransferInternal{query_id:uint64,amount:coins,from:address,response_destination:Maybe address,forward_ton_amount:coins,forward_payload:remainder}` 43 | 44 | ## TokenNotification 45 | TLB: `token_notification#7362d09c query_id:uint64 amount:coins from:address forward_payload:remainder = TokenNotification` 46 | Signature: `TokenNotification{query_id:uint64,amount:coins,from:address,forward_payload:remainder}` 47 | 48 | ## TokenBurn 49 | TLB: `token_burn#595f07bc query_id:uint64 amount:coins response_destination:Maybe address custom_payload:Maybe ^cell = TokenBurn` 50 | Signature: `TokenBurn{query_id:uint64,amount:coins,response_destination:Maybe address,custom_payload:Maybe ^cell}` 51 | 52 | ## TokenBurnNotification 53 | TLB: `token_burn_notification#7bdd97de query_id:uint64 amount:coins sender:address response_destination:Maybe address = TokenBurnNotification` 54 | Signature: `TokenBurnNotification{query_id:uint64,amount:coins,sender:address,response_destination:Maybe address}` 55 | 56 | ## TokenExcesses 57 | TLB: `token_excesses#d53276db query_id:uint64 = TokenExcesses` 58 | Signature: `TokenExcesses{query_id:uint64}` 59 | 60 | ## TokenUpdateContent 61 | TLB: `token_update_content#af1ca26a content:^cell = TokenUpdateContent` 62 | Signature: `TokenUpdateContent{content:^cell}` 63 | 64 | ## ProvideWalletAddress 65 | TLB: `provide_wallet_address#2c76b973 query_id:uint64 owner_address:address include_address:bool = ProvideWalletAddress` 66 | Signature: `ProvideWalletAddress{query_id:uint64,owner_address:address,include_address:bool}` 67 | 68 | ## TakeWalletAddress 69 | TLB: `take_wallet_address#d1735400 query_id:uint64 wallet_address:address owner_address:remainder = TakeWalletAddress` 70 | Signature: `TakeWalletAddress{query_id:uint64,wallet_address:address,owner_address:remainder}` 71 | 72 | ## Mint 73 | TLB: `mint#fc708bd2 amount:int257 receiver:address = Mint` 74 | Signature: `Mint{amount:int257,receiver:address}` 75 | 76 | # Get Methods 77 | Total Get Methods: 3 78 | 79 | ## get_jetton_data 80 | 81 | ## get_wallet_address 82 | Argument: owner 83 | 84 | ## owner 85 | 86 | # Error Codes 87 | 2: Stack undeflow 88 | 3: Stack overflow 89 | 4: Integer overflow 90 | 5: Integer out of expected range 91 | 6: Invalid opcode 92 | 7: Type check error 93 | 8: Cell overflow 94 | 9: Cell underflow 95 | 10: Dictionary error 96 | 13: Out of gas error 97 | 32: Method ID not found 98 | 34: Action is invalid or not supported 99 | 37: Not enough TON 100 | 38: Not enough extra-currencies 101 | 128: Null reference exception 102 | 129: Invalid serialization prefix 103 | 130: Invalid incoming message 104 | 131: Constraints error 105 | 132: Access denied 106 | 133: Contract stopped 107 | 134: Invalid argument 108 | 135: Code of a contract was not found 109 | 136: Invalid address 110 | 137: Masterchain support is not enabled for this contract 111 | 3688: Not mintable 112 | 4429: Invalid sender 113 | 12241: Max supply exceeded 114 | 14534: Not owner 115 | 16059: Invalid value 116 | 18668: Can't Mint Anymore 117 | 23951: Insufficient gas 118 | 42708: Invalid sender! 119 | 43422: Invalid value - Burn 120 | 62972: Invalid balance -------------------------------------------------------------------------------- /sources/output/SampleJetton_JettonDefaultWallet.stdlib.fc: -------------------------------------------------------------------------------- 1 | global (int, slice, int, slice) __tact_context; 2 | global slice __tact_context_sender; 3 | global cell __tact_context_sys; 4 | global int __tact_randomized; 5 | 6 | slice __tact_verify_address(slice address) inline { 7 | throw_unless(136, address.slice_bits() == 267); 8 | var h = address.preload_uint(11); 9 | throw_if(137, h == 1279); 10 | throw_unless(136, h == 1024); 11 | return address; 12 | } 13 | 14 | (slice, slice) __tact_load_address(slice cs) inline { 15 | slice raw = cs~load_msg_addr(); 16 | return (cs, __tact_verify_address(raw)); 17 | } 18 | 19 | (slice, slice) __tact_load_address_opt(slice cs) inline { 20 | slice raw = cs~load_msg_addr(); 21 | if (raw.preload_uint(2) != 0) { 22 | return (cs, __tact_verify_address(raw)); 23 | } else { 24 | return (cs, null()); 25 | } 26 | } 27 | 28 | builder __tact_store_address(builder b, slice address) inline { 29 | return b.store_slice(__tact_verify_address(address)); 30 | } 31 | 32 | builder __tact_store_address_opt(builder b, slice address) inline { 33 | if (null?(address)) { 34 | b = b.store_uint(0, 2); 35 | return b; 36 | } else { 37 | return __tact_store_address(b, address); 38 | } 39 | } 40 | 41 | slice __tact_create_address(int chain, int hash) inline { 42 | var b = begin_cell(); 43 | b = b.store_uint(2, 2); 44 | b = b.store_uint(0, 1); 45 | b = b.store_int(chain, 8); 46 | b = b.store_uint(hash, 256); 47 | var addr = b.end_cell().begin_parse(); 48 | return __tact_verify_address(addr); 49 | } 50 | 51 | slice __tact_compute_contract_address(int chain, cell code, cell data) inline { 52 | var b = begin_cell(); 53 | b = b.store_uint(0, 2); 54 | b = b.store_uint(3, 2); 55 | b = b.store_uint(0, 1); 56 | b = b.store_ref(code); 57 | b = b.store_ref(data); 58 | var hash = cell_hash(b.end_cell()); 59 | return __tact_create_address(chain, hash); 60 | } 61 | 62 | int __tact_my_balance() inline { 63 | return pair_first(get_balance()); 64 | } 65 | 66 | forall X -> X __tact_not_null(X x) inline { 67 | throw_if(128, null?(x)); return x; 68 | } 69 | 70 | (int, slice, int, slice) __tact_context_get() inline { 71 | return __tact_context; 72 | } 73 | 74 | builder __tact_store_bool(builder b, int v) inline { 75 | return b.store_int(v, 1); 76 | } 77 | 78 | int __tact_slice_eq_bits(slice a, slice b) inline { 79 | return equal_slice_bits(a, b); 80 | } 81 | 82 | cell __tact_dict_set_code(cell dict, int id, cell code) inline { 83 | return udict_set_ref(dict, 16, id, code); 84 | } 85 | 86 | cell __tact_dict_get_code(cell dict, int id) inline { 87 | var (data, ok) = udict_get_ref?(dict, 16, id); 88 | throw_unless(135, ok); 89 | return data; 90 | } 91 | 92 | slice $global_contractAddress((cell, cell) $s) impure inline { 93 | var (($s'code, $s'data)) = $s; 94 | return __tact_compute_contract_address(0, $s'code, $s'data); 95 | } 96 | 97 | () $global_send((int, slice, int, int, cell, cell, cell) $params) impure inline_ref { 98 | var (($params'bounce, $params'to, $params'value, $params'mode, $params'body, $params'code, $params'data)) = $params; 99 | builder $b = begin_cell(); 100 | $b = store_int($b, 1, 2); 101 | $b = __tact_store_bool($b, $params'bounce); 102 | $b = store_int($b, 0, 3); 103 | $b = __tact_store_address($b, $params'to); 104 | $b = store_coins($b, $params'value); 105 | $b = store_int($b, 0, ((((1 + 4) + 4) + 64) + 32)); 106 | if (( ((~ null?($params'code))) ? (true) : ((~ null?($params'data))) )) { 107 | $b = __tact_store_bool($b, true); 108 | builder $bc = begin_cell(); 109 | $bc = __tact_store_bool($bc, false); 110 | $bc = __tact_store_bool($bc, false); 111 | if ((~ null?($params'code))) { 112 | $bc = __tact_store_bool($bc, true); 113 | $bc = store_ref($bc, __tact_not_null($params'code)); 114 | } else { 115 | $bc = __tact_store_bool($bc, false); 116 | } 117 | if ((~ null?($params'data))) { 118 | $bc = __tact_store_bool($bc, true); 119 | $bc = store_ref($bc, __tact_not_null($params'data)); 120 | } else { 121 | $bc = __tact_store_bool($bc, false); 122 | } 123 | $bc = __tact_store_bool($bc, false); 124 | $b = __tact_store_bool($b, true); 125 | $b = store_ref($b, end_cell($bc)); 126 | } else { 127 | $b = __tact_store_bool($b, false); 128 | } 129 | cell $body = $params'body; 130 | if ((~ null?($body))) { 131 | $b = __tact_store_bool($b, true); 132 | $b = store_ref($b, __tact_not_null($body)); 133 | } else { 134 | $b = __tact_store_bool($b, false); 135 | } 136 | cell $c = end_cell($b); 137 | send_raw_message($c, $params'mode); 138 | } 139 | 140 | int $Context$_fun_readForwardFee((int, slice, int, slice) $self) impure inline_ref { 141 | var (($self'bounced, $self'sender, $self'value, $self'raw)) = $self; 142 | var (($self'bounced, $self'sender, $self'value, $self'raw)) = $self; 143 | slice $sc = $self'raw; 144 | $sc~__tact_load_address(); 145 | $sc~load_coins(); 146 | $sc~skip_bits(1); 147 | $sc~load_coins(); 148 | return (($sc~load_coins() * 3) / 2); 149 | } -------------------------------------------------------------------------------- /sources/utils/deploy.ts: -------------------------------------------------------------------------------- 1 | import { beginCell, Cell, contractAddress, storeStateInit } from "ton-core"; 2 | import { prompt } from "enquirer"; 3 | import open from "open"; 4 | import base64url from "base64url"; 5 | import { printSeparator } from "./print"; 6 | import qs from "qs"; 7 | 8 | function getLink( 9 | prefix: string, 10 | init: { code: Cell; data: Cell }, 11 | value: bigint, 12 | command: Cell | string, 13 | testnet: boolean 14 | ) { 15 | // Resolve target address 16 | let to = contractAddress(0, init); 17 | 18 | // Resovle init 19 | let initStr = base64url(beginCell().store(storeStateInit(init)).endCell().toBoc({ idx: false })); 20 | 21 | let link: string; 22 | if (typeof command === "string") { 23 | link = 24 | prefix + 25 | `transfer/` + 26 | to.toString({ testOnly: testnet }) + 27 | "?" + 28 | qs.stringify({ 29 | text: command, 30 | amount: value.toString(10), 31 | init: initStr, 32 | }); 33 | } else { 34 | link = 35 | prefix + 36 | `transfer/` + 37 | to.toString({ testOnly: testnet }) + 38 | "?" + 39 | qs.stringify({ 40 | text: "Deploy contract", 41 | amount: value.toString(10), 42 | init: initStr, 43 | bin: base64url(command.toBoc({ idx: false })), 44 | }); 45 | } 46 | return link; 47 | } 48 | 49 | export function getTonhubLink( 50 | init: { code: Cell; data: Cell }, 51 | value: bigint, 52 | command: Cell | string, 53 | testnet: boolean 54 | ) { 55 | return getLink(`https://${testnet ? "test." : ""}tonhub.com/`, init, value, command, testnet); 56 | } 57 | 58 | export function getTonkeeperLink( 59 | init: { code: Cell; data: Cell }, 60 | value: bigint, 61 | command: Cell | string, 62 | testnet: boolean 63 | ) { 64 | return getLink(`https://app.tonkeeper.com/`, init, value, command, testnet); 65 | } 66 | 67 | export function getLocalLink( 68 | init: { code: Cell; data: Cell }, 69 | value: bigint, 70 | command: Cell | string, 71 | testnet: boolean 72 | ) { 73 | return getLink(`ton://`, init, value, command, testnet); 74 | } 75 | 76 | export function get(init: { code: Cell; data: Cell }, value: bigint, command: Cell | string, testnet: boolean) { 77 | // Resolve target address 78 | let to = contractAddress(0, init); 79 | 80 | // Resovle init 81 | let initStr = base64url(beginCell().store(storeStateInit(init)).endCell().toBoc({ idx: false })); 82 | 83 | let link: string; 84 | if (typeof command === "string") { 85 | link = 86 | `https://${testnet ? "test." : ""}tonhub.com/transfer/` + 87 | to.toString({ testOnly: testnet }) + 88 | "?" + 89 | qs.stringify({ 90 | text: command, 91 | amount: value.toString(10), 92 | init: initStr, 93 | }); 94 | } else { 95 | link = 96 | `https://${testnet ? "test." : ""}tonhub.com/transfer/` + 97 | to.toString({ testOnly: testnet }) + 98 | "?" + 99 | qs.stringify({ 100 | text: "Deploy contract", 101 | amount: value.toString(10), 102 | init: initStr, 103 | bin: base64url(command.toBoc({ idx: false })), 104 | }); 105 | } 106 | return link; 107 | } 108 | 109 | export async function deploy( 110 | init: { code: Cell; data: Cell }, 111 | value: bigint, 112 | command: Cell | string, 113 | testnet: boolean = true 114 | ) { 115 | let kind = ( 116 | await prompt<{ kind: "tonhub" | "tonkeeper" | "local" }>([ 117 | { 118 | type: "select", 119 | name: "kind", 120 | message: "Way to deploy", 121 | initial: 0, 122 | choices: [ 123 | { 124 | message: "Tonhub/Sandbox", 125 | name: "tonhub", 126 | }, 127 | { 128 | message: "Tonkeeper", 129 | name: "tonkeeper", 130 | }, 131 | { 132 | message: "Open local link", 133 | name: "local", 134 | }, 135 | ], 136 | }, 137 | ]) 138 | ).kind; 139 | 140 | // Show tonhub link 141 | if (kind === "tonhub") { 142 | printSeparator(); 143 | console.log("Deploy: " + getTonhubLink(init, value, command, testnet)); 144 | printSeparator(); 145 | return; 146 | } 147 | 148 | // Show tonkeeper link 149 | if (kind === "tonkeeper") { 150 | printSeparator(); 151 | console.log("Deploy: " + getTonkeeperLink(init, value, command, testnet)); 152 | printSeparator(); 153 | return; 154 | } 155 | 156 | // Show tonkeeper link 157 | if (kind === "local") { 158 | // Create a link and display to the user 159 | let l = getLocalLink(init, value, command, testnet); 160 | printSeparator(); 161 | console.log("Deploy: " + l); 162 | printSeparator(); 163 | 164 | // Open link 165 | open(l); 166 | 167 | return; 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | /* Basic Options */ 5 | // "incremental": true, /* Enable incremental compilation */ 6 | "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ 7 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ 8 | // "lib": [], /* Specify library files to be included in the compilation. */ 9 | // "allowJs": true, /* Allow javascript files to be compiled. */ 10 | // "checkJs": true, /* Report errors in .js files. */ 11 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ 12 | "declaration": true, /* Generates corresponding '.d.ts' file. */ 13 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 14 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 15 | // "outFile": "./", /* Concatenate and emit output to single file. */ 16 | "outDir": "./dist", /* Redirect output structure to the directory. */ 17 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 18 | // "composite": true, /* Enable project compilation */ 19 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 20 | // "removeComments": true, /* Do not emit comments to output. */ 21 | // "noEmit": false, /* Do not emit outputs. */ 22 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 23 | "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 24 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 25 | /* Strict Type-Checking Options */ 26 | "strict": true, /* Enable all strict type-checking options. */ 27 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 28 | // "strictNullChecks": true, /* Enable strict null checks. */ 29 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 30 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 31 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 32 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 33 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 34 | /* Additional Checks */ 35 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 36 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 37 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 38 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 39 | // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ 40 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ 41 | // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ 42 | /* Module Resolution Options */ 43 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 44 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 45 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 46 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 47 | // "typeRoots": [], /* List of folders to include type definitions from. */ 48 | // "types": [], /* Type declaration files to be included in compilation. */ 49 | "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 50 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 51 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 52 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 53 | /* Source Map Options */ 54 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 55 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 56 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 57 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 58 | /* Experimental Options */ 59 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 60 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 61 | /* Advanced Options */ 62 | "skipLibCheck": true, /* Skip type checking of declaration files. */ 63 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */, 64 | "resolveJsonModule": true 65 | }, 66 | "include": [ 67 | "src/**/*" 68 | ] 69 | } -------------------------------------------------------------------------------- /sources/output/SampleJetton_JettonDefaultWallet.headers.fc: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Header files for JettonDefaultWallet 3 | ;; NOTE: declarations are sorted for optimal order 4 | ;; 5 | 6 | ;; __tact_verify_address 7 | slice __tact_verify_address(slice address) inline; 8 | 9 | ;; __tact_load_address 10 | (slice, slice) __tact_load_address(slice cs) inline; 11 | 12 | ;; __tact_load_address_opt 13 | (slice, slice) __tact_load_address_opt(slice cs) inline; 14 | 15 | ;; __tact_store_address 16 | builder __tact_store_address(builder b, slice address) inline; 17 | 18 | ;; __tact_store_address_opt 19 | builder __tact_store_address_opt(builder b, slice address) inline; 20 | 21 | ;; __tact_create_address 22 | slice __tact_create_address(int chain, int hash) inline; 23 | 24 | ;; __tact_compute_contract_address 25 | slice __tact_compute_contract_address(int chain, cell code, cell data) inline; 26 | 27 | ;; __tact_my_balance 28 | int __tact_my_balance() inline; 29 | 30 | ;; __tact_not_null 31 | forall X -> X __tact_not_null(X x) inline; 32 | 33 | ;; __tact_context_get 34 | (int, slice, int, slice) __tact_context_get() inline; 35 | 36 | ;; __tact_store_bool 37 | builder __tact_store_bool(builder b, int v) inline; 38 | 39 | ;; __tact_slice_eq_bits 40 | int __tact_slice_eq_bits(slice a, slice b) inline; 41 | 42 | ;; __tact_dict_set_code 43 | cell __tact_dict_set_code(cell dict, int id, cell code) inline; 44 | 45 | ;; __tact_dict_get_code 46 | cell __tact_dict_get_code(cell dict, int id) inline; 47 | 48 | ;; $TokenTransfer$_load 49 | (slice, ((int, int, slice, slice, cell, int, slice))) $TokenTransfer$_load(slice sc_0) inline_ref; 50 | 51 | ;; $TokenTransferInternal$_store 52 | builder $TokenTransferInternal$_store(builder build_0, (int, int, slice, slice, int, slice) v) inline_ref; 53 | 54 | ;; $TokenTransferInternal$_store_cell 55 | cell $TokenTransferInternal$_store_cell((int, int, slice, slice, int, slice) v) inline; 56 | 57 | ;; $TokenTransferInternal$_load 58 | (slice, ((int, int, slice, slice, int, slice))) $TokenTransferInternal$_load(slice sc_0) inline_ref; 59 | 60 | ;; $TokenTransferInternal$_load_bounced 61 | (slice, ((int, int))) $TokenTransferInternal$_load_bounced(slice sc_0) inline; 62 | 63 | ;; $TokenNotification$_store 64 | builder $TokenNotification$_store(builder build_0, (int, int, slice, slice) v) inline; 65 | 66 | ;; $TokenNotification$_store_cell 67 | cell $TokenNotification$_store_cell((int, int, slice, slice) v) inline; 68 | 69 | ;; $TokenBurn$_load 70 | (slice, ((int, int, slice, cell))) $TokenBurn$_load(slice sc_0) inline; 71 | 72 | ;; $TokenBurnNotification$_store 73 | builder $TokenBurnNotification$_store(builder build_0, (int, int, slice, slice) v) inline; 74 | 75 | ;; $TokenBurnNotification$_store_cell 76 | cell $TokenBurnNotification$_store_cell((int, int, slice, slice) v) inline; 77 | 78 | ;; $TokenBurnNotification$_load_bounced 79 | (slice, ((int, int))) $TokenBurnNotification$_load_bounced(slice sc_0) inline; 80 | 81 | ;; $TokenExcesses$_store 82 | builder $TokenExcesses$_store(builder build_0, (int) v) inline; 83 | 84 | ;; $TokenExcesses$_store_cell 85 | cell $TokenExcesses$_store_cell((int) v) inline; 86 | 87 | ;; $JettonDefaultWallet$_store 88 | builder $JettonDefaultWallet$_store(builder build_0, (int, slice, slice) v) inline; 89 | 90 | ;; $JettonDefaultWallet$_load 91 | (slice, ((int, slice, slice))) $JettonDefaultWallet$_load(slice sc_0) inline; 92 | 93 | ;; $StateInit$_get_code 94 | _ $StateInit$_get_code((cell, cell) v) inline; 95 | 96 | ;; $JettonWalletData$_to_external 97 | (int, slice, slice, cell) $JettonWalletData$_to_external(((int, slice, slice, cell)) v) inline; 98 | 99 | ;; $JettonDefaultWallet$init$_store 100 | builder $JettonDefaultWallet$init$_store(builder build_0, (slice, slice) v) inline; 101 | 102 | ;; $JettonDefaultWallet$init$_load 103 | (slice, ((slice, slice))) $JettonDefaultWallet$init$_load(slice sc_0) inline; 104 | 105 | ;; $JettonDefaultWallet$_contract_init 106 | (int, slice, slice) $JettonDefaultWallet$_contract_init(slice $owner, slice $master) impure inline_ref; 107 | 108 | ;; $JettonDefaultWallet$_contract_load 109 | (int, slice, slice) $JettonDefaultWallet$_contract_load() impure inline_ref; 110 | 111 | ;; $JettonDefaultWallet$_contract_store 112 | () $JettonDefaultWallet$_contract_store((int, slice, slice) v) impure inline; 113 | 114 | ;; $global_contractAddress 115 | slice $global_contractAddress((cell, cell) $s) impure inline; 116 | 117 | ;; $global_send 118 | () $global_send((int, slice, int, int, cell, cell, cell) $params) impure inline_ref; 119 | 120 | ;; $Context$_fun_readForwardFee 121 | int $Context$_fun_readForwardFee((int, slice, int, slice) $self) impure inline_ref; 122 | 123 | ;; $JettonDefaultWallet$_init_child 124 | (cell, cell) $JettonDefaultWallet$_init_child(cell sys', slice $owner, slice $master) inline_ref; 125 | 126 | ;; $JettonDefaultWallet$_fun_msg_value 127 | ((int, slice, slice), int) $JettonDefaultWallet$_fun_msg_value((int, slice, slice) $self, int $value) impure inline_ref; 128 | 129 | ;; $JettonWalletData$_constructor_balance_owner_master_code 130 | ((int, slice, slice, cell)) $JettonWalletData$_constructor_balance_owner_master_code(int balance, slice owner, slice master, cell code) inline; 131 | 132 | ;; $JettonDefaultWallet$_fun_get_wallet_data 133 | ((int, slice, slice), (int, slice, slice, cell)) $JettonDefaultWallet$_fun_get_wallet_data((int, slice, slice) $self) impure inline_ref; 134 | 135 | ;; $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload 136 | ((int, int, slice, slice, int, slice)) $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload(int query_id, int amount, slice from, slice response_destination, int forward_ton_amount, slice forward_payload) inline; 137 | 138 | ;; $SendParameters$_constructor_to_value_mode_bounce_body_code_data 139 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_mode_bounce_body_code_data(slice to, int value, int mode, int bounce, cell body, cell code, cell data) inline; 140 | 141 | ;; $SendParameters$_constructor_to_value_mode_bounce_body 142 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_mode_bounce_body(slice to, int value, int mode, int bounce, cell body) inline; 143 | 144 | ;; $TokenNotification$_constructor_query_id_amount_from_forward_payload 145 | ((int, int, slice, slice)) $TokenNotification$_constructor_query_id_amount_from_forward_payload(int query_id, int amount, slice from, slice forward_payload) inline; 146 | 147 | ;; $SendParameters$_constructor_to_value_bounce_body_mode 148 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_bounce_body_mode(slice to, int value, int bounce, cell body, int mode) inline; 149 | 150 | ;; $TokenExcesses$_constructor_query_id 151 | ((int)) $TokenExcesses$_constructor_query_id(int query_id) inline; 152 | 153 | ;; $TokenBurnNotification$_constructor_query_id_amount_sender_response_destination 154 | ((int, int, slice, slice)) $TokenBurnNotification$_constructor_query_id_amount_sender_response_destination(int query_id, int amount, slice sender, slice response_destination) inline; 155 | -------------------------------------------------------------------------------- /sources/output/SampleJetton_SampleJetton.headers.fc: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Header files for SampleJetton 3 | ;; NOTE: declarations are sorted for optimal order 4 | ;; 5 | 6 | ;; __tact_verify_address 7 | slice __tact_verify_address(slice address) inline; 8 | 9 | ;; __tact_load_address 10 | (slice, slice) __tact_load_address(slice cs) inline; 11 | 12 | ;; __tact_load_address_opt 13 | (slice, slice) __tact_load_address_opt(slice cs) inline; 14 | 15 | ;; __tact_store_address 16 | builder __tact_store_address(builder b, slice address) inline; 17 | 18 | ;; __tact_store_address_opt 19 | builder __tact_store_address_opt(builder b, slice address) inline; 20 | 21 | ;; __tact_create_address 22 | slice __tact_create_address(int chain, int hash) inline; 23 | 24 | ;; __tact_compute_contract_address 25 | slice __tact_compute_contract_address(int chain, cell code, cell data) inline; 26 | 27 | ;; __tact_not_null 28 | forall X -> X __tact_not_null(X x) inline; 29 | 30 | ;; __tact_context_get 31 | (int, slice, int, slice) __tact_context_get() inline; 32 | 33 | ;; __tact_context_get_sender 34 | slice __tact_context_get_sender() inline; 35 | 36 | ;; __tact_store_bool 37 | builder __tact_store_bool(builder b, int v) inline; 38 | 39 | ;; __tact_slice_eq_bits 40 | int __tact_slice_eq_bits(slice a, slice b) inline; 41 | 42 | ;; __tact_dict_set_code 43 | cell __tact_dict_set_code(cell dict, int id, cell code) inline; 44 | 45 | ;; __tact_dict_get_code 46 | cell __tact_dict_get_code(cell dict, int id) inline; 47 | 48 | ;; $TokenTransferInternal$_store 49 | builder $TokenTransferInternal$_store(builder build_0, (int, int, slice, slice, int, slice) v) inline_ref; 50 | 51 | ;; $TokenTransferInternal$_store_cell 52 | cell $TokenTransferInternal$_store_cell((int, int, slice, slice, int, slice) v) inline; 53 | 54 | ;; $TokenBurnNotification$_load 55 | (slice, ((int, int, slice, slice))) $TokenBurnNotification$_load(slice sc_0) inline; 56 | 57 | ;; $TokenExcesses$_store 58 | builder $TokenExcesses$_store(builder build_0, (int) v) inline; 59 | 60 | ;; $TokenExcesses$_store_cell 61 | cell $TokenExcesses$_store_cell((int) v) inline; 62 | 63 | ;; $TokenUpdateContent$_load 64 | (slice, ((cell))) $TokenUpdateContent$_load(slice sc_0) inline; 65 | 66 | ;; $ProvideWalletAddress$_load 67 | (slice, ((int, slice, int))) $ProvideWalletAddress$_load(slice sc_0) inline; 68 | 69 | ;; $TakeWalletAddress$_store 70 | builder $TakeWalletAddress$_store(builder build_0, (int, slice, slice) v) inline; 71 | 72 | ;; $TakeWalletAddress$_store_cell 73 | cell $TakeWalletAddress$_store_cell((int, slice, slice) v) inline; 74 | 75 | ;; $Mint$_load 76 | (slice, ((int, slice))) $Mint$_load(slice sc_0) inline; 77 | 78 | ;; $SampleJetton$_store 79 | builder $SampleJetton$_store(builder build_0, (int, slice, cell, int, int) v) inline; 80 | 81 | ;; $SampleJetton$_load 82 | (slice, ((int, slice, cell, int, int))) $SampleJetton$_load(slice sc_0) inline; 83 | 84 | ;; $StateInit$_get_code 85 | _ $StateInit$_get_code((cell, cell) v) inline; 86 | 87 | ;; $Context$_get_value 88 | _ $Context$_get_value((int, slice, int, slice) v) inline; 89 | 90 | ;; $JettonData$_to_external 91 | (int, int, slice, cell, cell) $JettonData$_to_external(((int, int, slice, cell, cell)) v) inline; 92 | 93 | ;; $JettonDefaultWallet$init$_store 94 | builder $JettonDefaultWallet$init$_store(builder build_0, (slice, slice) v) inline; 95 | 96 | ;; $SampleJetton$init$_load 97 | (slice, ((slice, cell, int))) $SampleJetton$init$_load(slice sc_0) inline; 98 | 99 | ;; $SampleJetton$_contract_init 100 | (int, slice, cell, int, int) $SampleJetton$_contract_init(slice $owner, cell $content, int $max_supply) impure inline_ref; 101 | 102 | ;; $SampleJetton$_contract_load 103 | (int, slice, cell, int, int) $SampleJetton$_contract_load() impure inline_ref; 104 | 105 | ;; $SampleJetton$_contract_store 106 | () $SampleJetton$_contract_store((int, slice, cell, int, int) v) impure inline; 107 | 108 | ;; $global_contractAddress 109 | slice $global_contractAddress((cell, cell) $s) impure inline; 110 | 111 | ;; $global_send 112 | () $global_send((int, slice, int, int, cell, cell, cell) $params) impure inline_ref; 113 | 114 | ;; $Cell$_fun_asSlice 115 | slice $Cell$_fun_asSlice(cell $self) impure inline; 116 | 117 | ;; $JettonDefaultWallet$_init_child 118 | (cell, cell) $JettonDefaultWallet$_init_child(cell sys', slice $owner, slice $master) inline_ref; 119 | 120 | ;; $SendParameters$_constructor_to_value_bounce_mode_body_code_data 121 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_bounce_mode_body_code_data(slice to, int value, int bounce, int mode, cell body, cell code, cell data) inline; 122 | 123 | ;; $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload 124 | ((int, int, slice, slice, int, slice)) $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload(int query_id, int amount, slice from, slice response_destination, int forward_ton_amount, slice forward_payload) inline; 125 | 126 | ;; $SampleJetton$_fun_getJettonWalletInit 127 | ((int, slice, cell, int, int), (cell, cell)) $SampleJetton$_fun_getJettonWalletInit((int, slice, cell, int, int) $self, slice $address) impure inline_ref; 128 | 129 | ;; $SampleJetton$_fun_mint 130 | ((int, slice, cell, int, int), ()) $SampleJetton$_fun_mint((int, slice, cell, int, int) $self, slice $to, int $amount, slice $response_destination) impure inline_ref; 131 | 132 | ;; $SampleJetton$_fun_requireSenderAsWalletOwner 133 | ((int, slice, cell, int, int), ()) $SampleJetton$_fun_requireSenderAsWalletOwner((int, slice, cell, int, int) $self, slice $owner) impure inline_ref; 134 | 135 | ;; $JettonData$_constructor_total_supply_mintable_owner_content_wallet_code 136 | ((int, int, slice, cell, cell)) $JettonData$_constructor_total_supply_mintable_owner_content_wallet_code(int total_supply, int mintable, slice owner, cell content, cell wallet_code) inline; 137 | 138 | ;; $SampleJetton$_fun_get_jetton_data 139 | ((int, slice, cell, int, int), (int, int, slice, cell, cell)) $SampleJetton$_fun_get_jetton_data((int, slice, cell, int, int) $self) impure inline_ref; 140 | 141 | ;; $SampleJetton$_fun_get_wallet_address 142 | ((int, slice, cell, int, int), slice) $SampleJetton$_fun_get_wallet_address((int, slice, cell, int, int) $self, slice $owner) impure inline_ref; 143 | 144 | ;; $SampleJetton$_fun_requireOwner 145 | ((int, slice, cell, int, int), ()) $SampleJetton$_fun_requireOwner((int, slice, cell, int, int) $self) impure inline_ref; 146 | 147 | ;; $SampleJetton$_fun_owner 148 | ((int, slice, cell, int, int), slice) $SampleJetton$_fun_owner((int, slice, cell, int, int) $self) impure inline_ref; 149 | 150 | ;; $SendParameters$_constructor_to_value_bounce_mode_body 151 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_bounce_mode_body(slice to, int value, int bounce, int mode, cell body) inline; 152 | 153 | ;; $TokenExcesses$_constructor_query_id 154 | ((int)) $TokenExcesses$_constructor_query_id(int query_id) inline; 155 | 156 | ;; $SendParameters$_constructor_to_value_mode_body 157 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_mode_body(slice to, int value, int mode, cell body) inline; 158 | 159 | ;; $TakeWalletAddress$_constructor_query_id_wallet_address_owner_address 160 | ((int, slice, slice)) $TakeWalletAddress$_constructor_query_id_wallet_address_owner_address(int query_id, slice wallet_address, slice owner_address) inline; 161 | -------------------------------------------------------------------------------- /sources/output/SampleJetton_JettonDefaultWallet.abi: -------------------------------------------------------------------------------- 1 | {"name":"JettonDefaultWallet","types":[{"name":"StateInit","header":null,"fields":[{"name":"code","type":{"kind":"simple","type":"cell","optional":false}},{"name":"data","type":{"kind":"simple","type":"cell","optional":false}}]},{"name":"Context","header":null,"fields":[{"name":"bounced","type":{"kind":"simple","type":"bool","optional":false}},{"name":"sender","type":{"kind":"simple","type":"address","optional":false}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"raw","type":{"kind":"simple","type":"slice","optional":false}}]},{"name":"SendParameters","header":null,"fields":[{"name":"bounce","type":{"kind":"simple","type":"bool","optional":false}},{"name":"to","type":{"kind":"simple","type":"address","optional":false}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"mode","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"body","type":{"kind":"simple","type":"cell","optional":true}},{"name":"code","type":{"kind":"simple","type":"cell","optional":true}},{"name":"data","type":{"kind":"simple","type":"cell","optional":true}}]},{"name":"ChangeOwner","header":2174598809,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"newOwner","type":{"kind":"simple","type":"address","optional":false}}]},{"name":"ChangeOwnerOk","header":846932810,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"newOwner","type":{"kind":"simple","type":"address","optional":false}}]},{"name":"JettonData","header":null,"fields":[{"name":"total_supply","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"mintable","type":{"kind":"simple","type":"bool","optional":false}},{"name":"owner","type":{"kind":"simple","type":"address","optional":false}},{"name":"content","type":{"kind":"simple","type":"cell","optional":false}},{"name":"wallet_code","type":{"kind":"simple","type":"cell","optional":false}}]},{"name":"JettonWalletData","header":null,"fields":[{"name":"balance","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"owner","type":{"kind":"simple","type":"address","optional":false}},{"name":"master","type":{"kind":"simple","type":"address","optional":false}},{"name":"code","type":{"kind":"simple","type":"cell","optional":false}}]},{"name":"TokenTransfer","header":260734629,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"sender","type":{"kind":"simple","type":"address","optional":false}},{"name":"response_destination","type":{"kind":"simple","type":"address","optional":true}},{"name":"custom_payload","type":{"kind":"simple","type":"cell","optional":true}},{"name":"forward_ton_amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"forward_payload","type":{"kind":"simple","type":"slice","optional":false,"format":"remainder"}}]},{"name":"TokenTransferInternal","header":395134233,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"from","type":{"kind":"simple","type":"address","optional":false}},{"name":"response_destination","type":{"kind":"simple","type":"address","optional":true}},{"name":"forward_ton_amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"forward_payload","type":{"kind":"simple","type":"slice","optional":false,"format":"remainder"}}]},{"name":"TokenNotification","header":1935855772,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"from","type":{"kind":"simple","type":"address","optional":false}},{"name":"forward_payload","type":{"kind":"simple","type":"slice","optional":false,"format":"remainder"}}]},{"name":"TokenBurn","header":1499400124,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"response_destination","type":{"kind":"simple","type":"address","optional":true}},{"name":"custom_payload","type":{"kind":"simple","type":"cell","optional":true}}]},{"name":"TokenBurnNotification","header":2078119902,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"sender","type":{"kind":"simple","type":"address","optional":false}},{"name":"response_destination","type":{"kind":"simple","type":"address","optional":true}}]},{"name":"TokenExcesses","header":3576854235,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}}]},{"name":"TokenUpdateContent","header":2937889386,"fields":[{"name":"content","type":{"kind":"simple","type":"cell","optional":false}}]},{"name":"ProvideWalletAddress","header":745978227,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"owner_address","type":{"kind":"simple","type":"address","optional":false}},{"name":"include_address","type":{"kind":"simple","type":"bool","optional":false}}]},{"name":"TakeWalletAddress","header":3513996288,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"wallet_address","type":{"kind":"simple","type":"address","optional":false}},{"name":"owner_address","type":{"kind":"simple","type":"slice","optional":false,"format":"remainder"}}]},{"name":"Mint","header":4235234258,"fields":[{"name":"amount","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"receiver","type":{"kind":"simple","type":"address","optional":false}}]}],"receivers":[{"receiver":"internal","message":{"kind":"typed","type":"TokenTransfer"}},{"receiver":"internal","message":{"kind":"typed","type":"TokenTransferInternal"}},{"receiver":"internal","message":{"kind":"typed","type":"TokenBurn"}}],"getters":[{"name":"get_wallet_data","arguments":[],"returnType":{"kind":"simple","type":"JettonWalletData","optional":false}}],"errors":{"2":{"message":"Stack undeflow"},"3":{"message":"Stack overflow"},"4":{"message":"Integer overflow"},"5":{"message":"Integer out of expected range"},"6":{"message":"Invalid opcode"},"7":{"message":"Type check error"},"8":{"message":"Cell overflow"},"9":{"message":"Cell underflow"},"10":{"message":"Dictionary error"},"13":{"message":"Out of gas error"},"32":{"message":"Method ID not found"},"34":{"message":"Action is invalid or not supported"},"37":{"message":"Not enough TON"},"38":{"message":"Not enough extra-currencies"},"128":{"message":"Null reference exception"},"129":{"message":"Invalid serialization prefix"},"130":{"message":"Invalid incoming message"},"131":{"message":"Constraints error"},"132":{"message":"Access denied"},"133":{"message":"Contract stopped"},"134":{"message":"Invalid argument"},"135":{"message":"Code of a contract was not found"},"136":{"message":"Invalid address"},"137":{"message":"Masterchain support is not enabled for this contract"},"3688":{"message":"Not mintable"},"4429":{"message":"Invalid sender"},"12241":{"message":"Max supply exceeded"},"14534":{"message":"Not owner"},"16059":{"message":"Invalid value"},"18668":{"message":"Can't Mint Anymore"},"23951":{"message":"Insufficient gas"},"42708":{"message":"Invalid sender!"},"43422":{"message":"Invalid value - Burn"},"62972":{"message":"Invalid balance"}},"interfaces":["org.ton.introspection.v0","org.ton.abi.ipfs.v0","org.ton.deploy.lazy.v0","org.ton.chain.workchain.v0","org.ton.jetton.wallet"]} -------------------------------------------------------------------------------- /sources/output/SampleJetton_SampleJetton.abi: -------------------------------------------------------------------------------- 1 | {"name":"SampleJetton","types":[{"name":"StateInit","header":null,"fields":[{"name":"code","type":{"kind":"simple","type":"cell","optional":false}},{"name":"data","type":{"kind":"simple","type":"cell","optional":false}}]},{"name":"Context","header":null,"fields":[{"name":"bounced","type":{"kind":"simple","type":"bool","optional":false}},{"name":"sender","type":{"kind":"simple","type":"address","optional":false}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"raw","type":{"kind":"simple","type":"slice","optional":false}}]},{"name":"SendParameters","header":null,"fields":[{"name":"bounce","type":{"kind":"simple","type":"bool","optional":false}},{"name":"to","type":{"kind":"simple","type":"address","optional":false}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"mode","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"body","type":{"kind":"simple","type":"cell","optional":true}},{"name":"code","type":{"kind":"simple","type":"cell","optional":true}},{"name":"data","type":{"kind":"simple","type":"cell","optional":true}}]},{"name":"ChangeOwner","header":2174598809,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"newOwner","type":{"kind":"simple","type":"address","optional":false}}]},{"name":"ChangeOwnerOk","header":846932810,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"newOwner","type":{"kind":"simple","type":"address","optional":false}}]},{"name":"JettonData","header":null,"fields":[{"name":"total_supply","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"mintable","type":{"kind":"simple","type":"bool","optional":false}},{"name":"owner","type":{"kind":"simple","type":"address","optional":false}},{"name":"content","type":{"kind":"simple","type":"cell","optional":false}},{"name":"wallet_code","type":{"kind":"simple","type":"cell","optional":false}}]},{"name":"JettonWalletData","header":null,"fields":[{"name":"balance","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"owner","type":{"kind":"simple","type":"address","optional":false}},{"name":"master","type":{"kind":"simple","type":"address","optional":false}},{"name":"code","type":{"kind":"simple","type":"cell","optional":false}}]},{"name":"TokenTransfer","header":260734629,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"sender","type":{"kind":"simple","type":"address","optional":false}},{"name":"response_destination","type":{"kind":"simple","type":"address","optional":true}},{"name":"custom_payload","type":{"kind":"simple","type":"cell","optional":true}},{"name":"forward_ton_amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"forward_payload","type":{"kind":"simple","type":"slice","optional":false,"format":"remainder"}}]},{"name":"TokenTransferInternal","header":395134233,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"from","type":{"kind":"simple","type":"address","optional":false}},{"name":"response_destination","type":{"kind":"simple","type":"address","optional":true}},{"name":"forward_ton_amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"forward_payload","type":{"kind":"simple","type":"slice","optional":false,"format":"remainder"}}]},{"name":"TokenNotification","header":1935855772,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"from","type":{"kind":"simple","type":"address","optional":false}},{"name":"forward_payload","type":{"kind":"simple","type":"slice","optional":false,"format":"remainder"}}]},{"name":"TokenBurn","header":1499400124,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"response_destination","type":{"kind":"simple","type":"address","optional":true}},{"name":"custom_payload","type":{"kind":"simple","type":"cell","optional":true}}]},{"name":"TokenBurnNotification","header":2078119902,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"sender","type":{"kind":"simple","type":"address","optional":false}},{"name":"response_destination","type":{"kind":"simple","type":"address","optional":true}}]},{"name":"TokenExcesses","header":3576854235,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}}]},{"name":"TokenUpdateContent","header":2937889386,"fields":[{"name":"content","type":{"kind":"simple","type":"cell","optional":false}}]},{"name":"ProvideWalletAddress","header":745978227,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"owner_address","type":{"kind":"simple","type":"address","optional":false}},{"name":"include_address","type":{"kind":"simple","type":"bool","optional":false}}]},{"name":"TakeWalletAddress","header":3513996288,"fields":[{"name":"query_id","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"wallet_address","type":{"kind":"simple","type":"address","optional":false}},{"name":"owner_address","type":{"kind":"simple","type":"slice","optional":false,"format":"remainder"}}]},{"name":"Mint","header":4235234258,"fields":[{"name":"amount","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"receiver","type":{"kind":"simple","type":"address","optional":false}}]}],"receivers":[{"receiver":"internal","message":{"kind":"typed","type":"Mint"}},{"receiver":"internal","message":{"kind":"text","text":"Mint: 100"}},{"receiver":"internal","message":{"kind":"text","text":"Owner: MintClose"}},{"receiver":"internal","message":{"kind":"typed","type":"TokenUpdateContent"}},{"receiver":"internal","message":{"kind":"typed","type":"TokenBurnNotification"}},{"receiver":"internal","message":{"kind":"typed","type":"ProvideWalletAddress"}}],"getters":[{"name":"get_jetton_data","arguments":[],"returnType":{"kind":"simple","type":"JettonData","optional":false}},{"name":"get_wallet_address","arguments":[{"name":"owner","type":{"kind":"simple","type":"address","optional":false}}],"returnType":{"kind":"simple","type":"address","optional":false}},{"name":"owner","arguments":[],"returnType":{"kind":"simple","type":"address","optional":false}}],"errors":{"2":{"message":"Stack undeflow"},"3":{"message":"Stack overflow"},"4":{"message":"Integer overflow"},"5":{"message":"Integer out of expected range"},"6":{"message":"Invalid opcode"},"7":{"message":"Type check error"},"8":{"message":"Cell overflow"},"9":{"message":"Cell underflow"},"10":{"message":"Dictionary error"},"13":{"message":"Out of gas error"},"32":{"message":"Method ID not found"},"34":{"message":"Action is invalid or not supported"},"37":{"message":"Not enough TON"},"38":{"message":"Not enough extra-currencies"},"128":{"message":"Null reference exception"},"129":{"message":"Invalid serialization prefix"},"130":{"message":"Invalid incoming message"},"131":{"message":"Constraints error"},"132":{"message":"Access denied"},"133":{"message":"Contract stopped"},"134":{"message":"Invalid argument"},"135":{"message":"Code of a contract was not found"},"136":{"message":"Invalid address"},"137":{"message":"Masterchain support is not enabled for this contract"},"3688":{"message":"Not mintable"},"4429":{"message":"Invalid sender"},"12241":{"message":"Max supply exceeded"},"14534":{"message":"Not owner"},"16059":{"message":"Invalid value"},"18668":{"message":"Can't Mint Anymore"},"23951":{"message":"Insufficient gas"},"42708":{"message":"Invalid sender!"},"43422":{"message":"Invalid value - Burn"},"62972":{"message":"Invalid balance"}},"interfaces":["org.ton.introspection.v0","org.ton.abi.ipfs.v0","org.ton.deploy.lazy.v0","org.ton.chain.workchain.v0","org.ton.jetton.master","org.ton.ownable"]} -------------------------------------------------------------------------------- /sources/output/SampleJetton_SampleJetton.storage.fc: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Type: StateInit 3 | ;; TLB: _ code:^cell data:^cell = StateInit 4 | ;; 5 | 6 | _ $StateInit$_get_code((cell, cell) v) inline { 7 | var (v'code, v'data) = v; 8 | return v'code; 9 | } 10 | 11 | ;; 12 | ;; Type: Context 13 | ;; TLB: _ bounced:bool sender:address value:int257 raw:^slice = Context 14 | ;; 15 | 16 | _ $Context$_get_value((int, slice, int, slice) v) inline { 17 | var (v'bounced, v'sender, v'value, v'raw) = v; 18 | return v'value; 19 | } 20 | 21 | ;; 22 | ;; Type: SendParameters 23 | ;; TLB: _ bounce:bool to:address value:int257 mode:int257 body:Maybe ^cell code:Maybe ^cell data:Maybe ^cell = SendParameters 24 | ;; 25 | 26 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_bounce_mode_body_code_data(slice to, int value, int bounce, int mode, cell body, cell code, cell data) inline { 27 | return (bounce, to, value, mode, body, code, data); 28 | } 29 | 30 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_bounce_mode_body(slice to, int value, int bounce, int mode, cell body) inline { 31 | return (bounce, to, value, mode, body, null(), null()); 32 | } 33 | 34 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_mode_body(slice to, int value, int mode, cell body) inline { 35 | return (true, to, value, mode, body, null(), null()); 36 | } 37 | 38 | ;; 39 | ;; Type: JettonData 40 | ;; TLB: _ total_supply:int257 mintable:bool owner:address content:^cell wallet_code:^cell = JettonData 41 | ;; 42 | 43 | (int, int, slice, cell, cell) $JettonData$_to_external(((int, int, slice, cell, cell)) v) inline { 44 | var (v'total_supply, v'mintable, v'owner, v'content, v'wallet_code) = v; 45 | return (v'total_supply, v'mintable, v'owner, v'content, v'wallet_code); 46 | } 47 | 48 | ((int, int, slice, cell, cell)) $JettonData$_constructor_total_supply_mintable_owner_content_wallet_code(int total_supply, int mintable, slice owner, cell content, cell wallet_code) inline { 49 | return (total_supply, mintable, owner, content, wallet_code); 50 | } 51 | 52 | ;; 53 | ;; Type: TokenTransferInternal 54 | ;; Header: 0x178d4519 55 | ;; TLB: token_transfer_internal#178d4519 query_id:uint64 amount:coins from:address response_destination:Maybe address forward_ton_amount:coins forward_payload:remainder = TokenTransferInternal 56 | ;; 57 | 58 | builder $TokenTransferInternal$_store(builder build_0, (int, int, slice, slice, int, slice) v) inline_ref { 59 | var (v'query_id, v'amount, v'from, v'response_destination, v'forward_ton_amount, v'forward_payload) = v; 60 | build_0 = store_uint(build_0, 395134233, 32); 61 | build_0 = build_0.store_uint(v'query_id, 64); 62 | build_0 = build_0.store_coins(v'amount); 63 | build_0 = __tact_store_address(build_0, v'from); 64 | build_0 = __tact_store_address_opt(build_0, v'response_destination); 65 | build_0 = build_0.store_coins(v'forward_ton_amount); 66 | build_0 = build_0.store_slice(v'forward_payload); 67 | return build_0; 68 | } 69 | 70 | cell $TokenTransferInternal$_store_cell((int, int, slice, slice, int, slice) v) inline { 71 | return $TokenTransferInternal$_store(begin_cell(), v).end_cell(); 72 | } 73 | 74 | ((int, int, slice, slice, int, slice)) $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload(int query_id, int amount, slice from, slice response_destination, int forward_ton_amount, slice forward_payload) inline { 75 | return (query_id, amount, from, response_destination, forward_ton_amount, forward_payload); 76 | } 77 | 78 | ;; 79 | ;; Type: TokenBurnNotification 80 | ;; Header: 0x7bdd97de 81 | ;; TLB: token_burn_notification#7bdd97de query_id:uint64 amount:coins sender:address response_destination:Maybe address = TokenBurnNotification 82 | ;; 83 | 84 | (slice, ((int, int, slice, slice))) $TokenBurnNotification$_load(slice sc_0) inline { 85 | throw_unless(129, sc_0~load_uint(32) == 2078119902); 86 | var v'query_id = sc_0~load_uint(64); 87 | var v'amount = sc_0~load_coins(); 88 | var v'sender = sc_0~__tact_load_address(); 89 | var v'response_destination = sc_0~__tact_load_address_opt(); 90 | return (sc_0, (v'query_id, v'amount, v'sender, v'response_destination)); 91 | } 92 | 93 | ;; 94 | ;; Type: TokenExcesses 95 | ;; Header: 0xd53276db 96 | ;; TLB: token_excesses#d53276db query_id:uint64 = TokenExcesses 97 | ;; 98 | 99 | builder $TokenExcesses$_store(builder build_0, (int) v) inline { 100 | var (v'query_id) = v; 101 | build_0 = store_uint(build_0, 3576854235, 32); 102 | build_0 = build_0.store_uint(v'query_id, 64); 103 | return build_0; 104 | } 105 | 106 | cell $TokenExcesses$_store_cell((int) v) inline { 107 | return $TokenExcesses$_store(begin_cell(), v).end_cell(); 108 | } 109 | 110 | ((int)) $TokenExcesses$_constructor_query_id(int query_id) inline { 111 | return (query_id); 112 | } 113 | 114 | ;; 115 | ;; Type: TokenUpdateContent 116 | ;; Header: 0xaf1ca26a 117 | ;; TLB: token_update_content#af1ca26a content:^cell = TokenUpdateContent 118 | ;; 119 | 120 | (slice, ((cell))) $TokenUpdateContent$_load(slice sc_0) inline { 121 | throw_unless(129, sc_0~load_uint(32) == 2937889386); 122 | var v'content = sc_0~load_ref(); 123 | return (sc_0, (v'content)); 124 | } 125 | 126 | ;; 127 | ;; Type: ProvideWalletAddress 128 | ;; Header: 0x2c76b973 129 | ;; TLB: provide_wallet_address#2c76b973 query_id:uint64 owner_address:address include_address:bool = ProvideWalletAddress 130 | ;; 131 | 132 | (slice, ((int, slice, int))) $ProvideWalletAddress$_load(slice sc_0) inline { 133 | throw_unless(129, sc_0~load_uint(32) == 745978227); 134 | var v'query_id = sc_0~load_uint(64); 135 | var v'owner_address = sc_0~__tact_load_address(); 136 | var v'include_address = sc_0~load_int(1); 137 | return (sc_0, (v'query_id, v'owner_address, v'include_address)); 138 | } 139 | 140 | ;; 141 | ;; Type: TakeWalletAddress 142 | ;; Header: 0xd1735400 143 | ;; TLB: take_wallet_address#d1735400 query_id:uint64 wallet_address:address owner_address:remainder = TakeWalletAddress 144 | ;; 145 | 146 | builder $TakeWalletAddress$_store(builder build_0, (int, slice, slice) v) inline { 147 | var (v'query_id, v'wallet_address, v'owner_address) = v; 148 | build_0 = store_uint(build_0, 3513996288, 32); 149 | build_0 = build_0.store_uint(v'query_id, 64); 150 | build_0 = __tact_store_address(build_0, v'wallet_address); 151 | build_0 = build_0.store_slice(v'owner_address); 152 | return build_0; 153 | } 154 | 155 | cell $TakeWalletAddress$_store_cell((int, slice, slice) v) inline { 156 | return $TakeWalletAddress$_store(begin_cell(), v).end_cell(); 157 | } 158 | 159 | ((int, slice, slice)) $TakeWalletAddress$_constructor_query_id_wallet_address_owner_address(int query_id, slice wallet_address, slice owner_address) inline { 160 | return (query_id, wallet_address, owner_address); 161 | } 162 | 163 | ;; 164 | ;; Type: Mint 165 | ;; Header: 0xfc708bd2 166 | ;; TLB: mint#fc708bd2 amount:int257 receiver:address = Mint 167 | ;; 168 | 169 | (slice, ((int, slice))) $Mint$_load(slice sc_0) inline { 170 | throw_unless(129, sc_0~load_uint(32) == 4235234258); 171 | var v'amount = sc_0~load_int(257); 172 | var v'receiver = sc_0~__tact_load_address(); 173 | return (sc_0, (v'amount, v'receiver)); 174 | } 175 | 176 | ;; 177 | ;; Type: JettonDefaultWallet 178 | ;; 179 | 180 | builder $JettonDefaultWallet$init$_store(builder build_0, (slice, slice) v) inline { 181 | var (v'owner, v'master) = v; 182 | build_0 = __tact_store_address(build_0, v'owner); 183 | build_0 = __tact_store_address(build_0, v'master); 184 | return build_0; 185 | } 186 | 187 | (cell, cell) $JettonDefaultWallet$_init_child(cell sys', slice $owner, slice $master) inline_ref { 188 | slice sc' = sys'.begin_parse(); 189 | cell source = sc'~load_dict(); 190 | cell contracts = new_dict(); 191 | 192 | ;; Contract Code: JettonDefaultWallet 193 | cell mine = __tact_dict_get_code(source, 55471); 194 | contracts = __tact_dict_set_code(contracts, 55471, mine); 195 | 196 | ;; Build cell 197 | builder b = begin_cell(); 198 | b = b.store_ref(begin_cell().store_dict(contracts).end_cell()); 199 | b = b.store_int(false, 1); 200 | b = $JettonDefaultWallet$init$_store(b, ($owner, $master)); 201 | return (mine, b.end_cell()); 202 | } 203 | 204 | ;; 205 | ;; Type: SampleJetton 206 | ;; 207 | 208 | builder $SampleJetton$_store(builder build_0, (int, slice, cell, int, int) v) inline { 209 | var (v'total_supply, v'owner, v'content, v'mintable, v'max_supply) = v; 210 | build_0 = build_0.store_coins(v'total_supply); 211 | build_0 = __tact_store_address(build_0, v'owner); 212 | build_0 = build_0.store_ref(v'content); 213 | build_0 = build_0.store_int(v'mintable, 1); 214 | build_0 = build_0.store_coins(v'max_supply); 215 | return build_0; 216 | } 217 | 218 | (slice, ((int, slice, cell, int, int))) $SampleJetton$_load(slice sc_0) inline { 219 | var v'total_supply = sc_0~load_coins(); 220 | var v'owner = sc_0~__tact_load_address(); 221 | var v'content = sc_0~load_ref(); 222 | var v'mintable = sc_0~load_int(1); 223 | var v'max_supply = sc_0~load_coins(); 224 | return (sc_0, (v'total_supply, v'owner, v'content, v'mintable, v'max_supply)); 225 | } 226 | 227 | (slice, ((slice, cell, int))) $SampleJetton$init$_load(slice sc_0) inline { 228 | var v'owner = sc_0~__tact_load_address(); 229 | var v'content = sc_0~load_ref(); 230 | var v'max_supply = sc_0~load_int(257); 231 | return (sc_0, (v'owner, v'content, v'max_supply)); 232 | } 233 | 234 | (int, slice, cell, int, int) $SampleJetton$_contract_load() impure inline_ref { 235 | slice $sc = get_data().begin_parse(); 236 | __tact_context_sys = $sc~load_ref(); 237 | int $loaded = $sc~load_int(1); 238 | if ($loaded) { 239 | return $sc~$SampleJetton$_load(); 240 | } else { 241 | ;; Allow only workchain deployments 242 | throw_unless(137, my_address().preload_uint(11) == 1024); 243 | (slice owner, cell content, int max_supply) = $sc~$SampleJetton$init$_load(); 244 | $sc.end_parse(); 245 | return $SampleJetton$_contract_init(owner, content, max_supply); 246 | } 247 | } 248 | 249 | () $SampleJetton$_contract_store((int, slice, cell, int, int) v) impure inline { 250 | builder b = begin_cell(); 251 | b = b.store_ref(__tact_context_sys); 252 | b = b.store_int(true, 1); 253 | b = $SampleJetton$_store(b, v); 254 | set_data(b.end_cell()); 255 | } -------------------------------------------------------------------------------- /sources/jetton.tact: -------------------------------------------------------------------------------- 1 | import "@stdlib/ownable"; 2 | import "./messages"; 3 | // ============================================================================================================ // 4 | @interface("org.ton.jetton.master") 5 | trait Jetton with Ownable { 6 | total_supply: Int; 7 | mintable: Bool; 8 | owner: Address; 9 | content: Cell; 10 | 11 | receive(msg: TokenUpdateContent){ 12 | self.requireOwner(); // Allow changing content only by owner 13 | self.content = msg.content; // Update content 14 | } 15 | 16 | receive(msg: TokenBurnNotification){ 17 | self.requireSenderAsWalletOwner(msg.sender); // Check wallet 18 | self.total_supply = (self.total_supply - msg.amount); // Update supply 19 | if (msg.response_destination != null) { 20 | // Cashback 21 | send(SendParameters{ 22 | to: msg.response_destination!!, 23 | value: 0, 24 | bounce: false, 25 | mode: SendRemainingValue, 26 | body: TokenExcesses{query_id: msg.query_id}.toCell() 27 | } 28 | ); 29 | } 30 | } 31 | 32 | // https://github.com/ton-blockchain/TEPs/blob/master/text/0089-jetton-wallet-discovery.md 33 | receive(msg: ProvideWalletAddress){ 34 | // 0x2c76b973 35 | require(context().value >= ton("0.0061"), "Insufficient gas"); 36 | let init: StateInit = initOf JettonDefaultWallet(msg.owner_address, myAddress()); 37 | if (msg.include_address) { 38 | send(SendParameters{ 39 | to: sender(), 40 | value: 0, 41 | mode: SendRemainingValue, 42 | body: TakeWalletAddress{ 43 | query_id: msg.query_id, 44 | wallet_address: contractAddress(init), 45 | owner_address: beginCell().storeBool(true).storeAddress(msg.owner_address).endCell().asSlice() 46 | }.toCell() 47 | } 48 | ); 49 | } else { 50 | send(SendParameters{ 51 | to: sender(), 52 | value: 0, 53 | mode: SendRemainingValue, 54 | body: TakeWalletAddress{ // 0xd1735400 55 | query_id: msg.query_id, 56 | wallet_address: contractAddress(init), 57 | owner_address: beginCell().storeBool(false).endCell().asSlice() 58 | }.toCell() 59 | } 60 | ); 61 | } 62 | } 63 | 64 | // Private Methods // 65 | // @to The Address receive the Jetton token after minting 66 | // @amount The amount of Jetton token being minted 67 | // @response_destination The previous owner address 68 | fun mint(to: Address, amount: Int, response_destination: Address) { 69 | require(self.mintable, "Can't Mint Anymore"); 70 | self.total_supply = (self.total_supply + amount); // Update total supply 71 | 72 | let winit: StateInit = self.getJettonWalletInit(to); // Create message 73 | send(SendParameters{ 74 | to: contractAddress(winit), 75 | value: 0, 76 | bounce: true, 77 | mode: SendRemainingValue, 78 | body: TokenTransferInternal{ 79 | query_id: 0, 80 | amount: amount, 81 | from: myAddress(), 82 | response_destination: response_destination, 83 | forward_ton_amount: 0, 84 | forward_payload: beginCell().endCell().asSlice() 85 | }.toCell(), 86 | code: winit.code, 87 | data: winit.data 88 | } 89 | ); 90 | } 91 | 92 | fun requireSenderAsWalletOwner(owner: Address) { 93 | let ctx: Context = context(); 94 | let winit: StateInit = self.getJettonWalletInit(owner); 95 | require(contractAddress(winit) == ctx.sender, "Invalid sender"); 96 | } 97 | 98 | virtual fun getJettonWalletInit(address: Address): StateInit { 99 | return initOf JettonDefaultWallet(address, myAddress()); 100 | } 101 | 102 | // ====== Get Methods ====== // 103 | 104 | get fun get_jetton_data(): JettonData { 105 | return 106 | JettonData{ 107 | total_supply: self.total_supply, 108 | mintable: self.mintable, 109 | owner: self.owner, 110 | content: self.content, 111 | wallet_code: initOf JettonDefaultWallet(self.owner, myAddress()).code 112 | }; 113 | } 114 | 115 | get fun get_wallet_address(owner: Address): Address { 116 | return contractAddress(initOf JettonDefaultWallet(owner, myAddress())); 117 | } 118 | } 119 | 120 | // ============================================================ // 121 | @interface("org.ton.jetton.wallet") 122 | contract JettonDefaultWallet 123 | { 124 | const minTonsForStorage: Int = ton("0.019"); 125 | const gasConsumption: Int = ton("0.013"); 126 | balance: Int as coins = 0; 127 | owner: Address; 128 | master: Address; 129 | init(owner: Address, master: Address){ 130 | self.balance = 0; 131 | self.owner = owner; 132 | self.master = master; 133 | } 134 | 135 | receive(msg: TokenTransfer){ 136 | // 0xf8a7ea5 137 | let ctx: Context = context(); // Check sender 138 | require(ctx.sender == self.owner, "Invalid sender"); 139 | let final: Int = 140 | (((ctx.readForwardFee() * 2 + 2 * self.gasConsumption) + self.minTonsForStorage) + msg.forward_ton_amount); // Gas checks, forward_ton = 0.152 141 | require(ctx.value > final, "Invalid value"); 142 | // Update balance 143 | self.balance = (self.balance - msg.amount); 144 | require(self.balance >= 0, "Invalid balance"); 145 | let init: StateInit = initOf JettonDefaultWallet(msg.sender, self.master); 146 | let wallet_address: Address = contractAddress(init); 147 | send(SendParameters{ 148 | to: wallet_address, 149 | value: 0, 150 | mode: SendRemainingValue, 151 | bounce: true, 152 | body: TokenTransferInternal{ // 0x178d4519 153 | query_id: msg.query_id, 154 | amount: msg.amount, 155 | from: self.owner, 156 | response_destination: msg.response_destination, 157 | forward_ton_amount: msg.forward_ton_amount, 158 | forward_payload: msg.forward_payload 159 | }.toCell(), 160 | code: init.code, 161 | data: init.data 162 | } 163 | ); 164 | } 165 | 166 | receive(msg: TokenTransferInternal){ 167 | // 0x178d4519 168 | let ctx: Context = context(); 169 | if (ctx.sender != self.master) { 170 | let sinit: StateInit = initOf JettonDefaultWallet(msg.from, self.master); 171 | require(contractAddress(sinit) == ctx.sender, "Invalid sender!"); 172 | } 173 | // Update balance 174 | self.balance = (self.balance + msg.amount); 175 | require(self.balance >= 0, "Invalid balance"); 176 | // Get value for gas 177 | let msg_value: Int = self.msg_value(ctx.value); 178 | let fwd_fee: Int = ctx.readForwardFee(); 179 | if (msg.forward_ton_amount > 0) { 180 | msg_value = ((msg_value - msg.forward_ton_amount) - fwd_fee); 181 | send(SendParameters{ 182 | to: self.owner, 183 | value: msg.forward_ton_amount, 184 | mode: SendPayGasSeparately, 185 | bounce: false, 186 | body: TokenNotification{ // 0x7362d09c -- Remind the new Owner 187 | query_id: msg.query_id, 188 | amount: msg.amount, 189 | from: msg.from, 190 | forward_payload: msg.forward_payload 191 | }.toCell() 192 | } 193 | ); 194 | } 195 | // 0xd53276db -- Cashback to the original Sender 196 | if (msg.response_destination != null && msg_value > 0) { 197 | send(SendParameters{ 198 | to: msg.response_destination!!, 199 | value: msg_value, 200 | bounce: false, 201 | body: TokenExcesses{query_id: msg.query_id}.toCell(), 202 | mode: SendPayGasSeparately 203 | } 204 | ); 205 | } 206 | } 207 | 208 | receive(msg: TokenBurn){ 209 | let ctx: Context = context(); 210 | require(ctx.sender == self.owner, "Invalid sender"); // Check sender 211 | 212 | self.balance = (self.balance - msg.amount); // Update balance 213 | require(self.balance >= 0, "Invalid balance"); 214 | let fwd_fee: Int = ctx.readForwardFee(); // Gas checks 215 | require(ctx.value > ((fwd_fee + 2 * self.gasConsumption) + self.minTonsForStorage), "Invalid value - Burn"); 216 | // Burn tokens 217 | send(SendParameters{ 218 | to: self.master, 219 | value: 0, 220 | mode: SendRemainingValue, 221 | bounce: true, 222 | body: TokenBurnNotification{ 223 | query_id: msg.query_id, 224 | amount: msg.amount, 225 | sender: self.owner, 226 | response_destination: msg.response_destination 227 | }.toCell() 228 | } 229 | ); 230 | } 231 | 232 | fun msg_value(value: Int): Int { 233 | let msg_value: Int = value; 234 | let ton_balance_before_msg: Int = (myBalance() - msg_value); 235 | let storage_fee: Int = (self.minTonsForStorage - min(ton_balance_before_msg, self.minTonsForStorage)); 236 | msg_value = (msg_value - (storage_fee + self.gasConsumption)); 237 | return msg_value; 238 | } 239 | 240 | bounced(msg: bounced){ 241 | self.balance = (self.balance + msg.amount); 242 | } 243 | 244 | bounced(msg: bounced){ 245 | self.balance = (self.balance + msg.amount); 246 | } 247 | 248 | get fun get_wallet_data(): JettonWalletData { 249 | return 250 | JettonWalletData{ 251 | balance: self.balance, 252 | owner: self.owner, 253 | master: self.master, 254 | code: initOf JettonDefaultWallet(self.owner, self.master).code 255 | }; 256 | } 257 | } -------------------------------------------------------------------------------- /sources/output/SampleJetton_JettonDefaultWallet.code.fc: -------------------------------------------------------------------------------- 1 | #pragma version =0.4.3; 2 | #pragma allow-post-modification; 3 | #pragma compute-asm-ltr; 4 | 5 | #include "SampleJetton_JettonDefaultWallet.headers.fc"; 6 | #include "SampleJetton_JettonDefaultWallet.stdlib.fc"; 7 | #include "SampleJetton_JettonDefaultWallet.storage.fc"; 8 | 9 | ;; 10 | ;; Contract JettonDefaultWallet functions 11 | ;; 12 | 13 | (int, slice, slice) $JettonDefaultWallet$_contract_init(slice $owner, slice $master) impure inline_ref { 14 | var (($self'balance, $self'owner, $self'master)) = (0, null(), null()); 15 | $self'balance = 0; 16 | $self'owner = $owner; 17 | $self'master = $master; 18 | return ($self'balance, $self'owner, $self'master); 19 | } 20 | 21 | ((int, slice, slice), int) $JettonDefaultWallet$_fun_msg_value((int, slice, slice) $self, int $value) impure inline_ref { 22 | var (($self'balance, $self'owner, $self'master)) = $self; 23 | int $msg_value = $value; 24 | int $ton_balance_before_msg = (__tact_my_balance() - $msg_value); 25 | int $storage_fee = (19000000 - min($ton_balance_before_msg, 19000000)); 26 | $msg_value = ($msg_value - ($storage_fee + 13000000)); 27 | return (($self'balance, $self'owner, $self'master), $msg_value); 28 | } 29 | 30 | ((int, slice, slice), (int, slice, slice, cell)) $JettonDefaultWallet$_fun_get_wallet_data((int, slice, slice) $self) impure inline_ref { 31 | var (($self'balance, $self'owner, $self'master)) = $self; 32 | return (($self'balance, $self'owner, $self'master), $JettonWalletData$_constructor_balance_owner_master_code($self'balance, $self'owner, $self'master, $StateInit$_get_code($JettonDefaultWallet$_init_child(__tact_context_sys, $self'owner, $self'master)))); 33 | } 34 | 35 | ;; 36 | ;; Receivers of a Contract JettonDefaultWallet 37 | ;; 38 | 39 | (((int, slice, slice)), ()) $JettonDefaultWallet$_internal_binary_TokenTransfer((int, slice, slice) $self, (int, int, slice, slice, cell, int, slice) $msg) impure inline { 40 | var ($self'balance, $self'owner, $self'master) = $self; 41 | var ($msg'query_id, $msg'amount, $msg'sender, $msg'response_destination, $msg'custom_payload, $msg'forward_ton_amount, $msg'forward_payload) = $msg; 42 | var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); 43 | throw_unless(4429, ( __tact_slice_eq_bits($self'owner, $ctx'sender) )); 44 | int $final = (((($Context$_fun_readForwardFee(($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw)) * 2) + (2 * 13000000)) + 19000000) + $msg'forward_ton_amount); 45 | throw_unless(16059, ($ctx'value > $final)); 46 | $self'balance = ($self'balance - $msg'amount); 47 | throw_unless(62972, ($self'balance >= 0)); 48 | var ($init'code, $init'data) = $JettonDefaultWallet$_init_child(__tact_context_sys, $msg'sender, $self'master); 49 | slice $wallet_address = $global_contractAddress(($init'code, $init'data)); 50 | $global_send($SendParameters$_constructor_to_value_mode_bounce_body_code_data($wallet_address, 0, 64, false, $TokenTransferInternal$_store_cell($TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload($msg'query_id, $msg'amount, $self'owner, $msg'response_destination, $msg'forward_ton_amount, $msg'forward_payload)), $init'code, $init'data)); 51 | return (($self'balance, $self'owner, $self'master), ()); 52 | } 53 | 54 | (((int, slice, slice)), ()) $JettonDefaultWallet$_internal_binary_TokenTransferInternal((int, slice, slice) $self, (int, int, slice, slice, int, slice) $msg) impure inline { 55 | var ($self'balance, $self'owner, $self'master) = $self; 56 | var ($msg'query_id, $msg'amount, $msg'from, $msg'response_destination, $msg'forward_ton_amount, $msg'forward_payload) = $msg; 57 | var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); 58 | if (( ~ __tact_slice_eq_bits($self'master, $ctx'sender) )) { 59 | var ($sinit'code, $sinit'data) = $JettonDefaultWallet$_init_child(__tact_context_sys, $msg'from, $self'master); 60 | throw_unless(42708, ( __tact_slice_eq_bits($ctx'sender, $global_contractAddress(($sinit'code, $sinit'data))) )); 61 | } 62 | $self'balance = ($self'balance + $msg'amount); 63 | throw_unless(62972, ($self'balance >= 0)); 64 | int $msg_value = ($self'balance, $self'owner, $self'master)~$JettonDefaultWallet$_fun_msg_value($ctx'value); 65 | int $fwd_fee = $Context$_fun_readForwardFee(($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw)); 66 | if (($msg'forward_ton_amount > 0)) { 67 | $msg_value = (($msg_value - $msg'forward_ton_amount) - $fwd_fee); 68 | $global_send($SendParameters$_constructor_to_value_mode_bounce_body($self'owner, $msg'forward_ton_amount, 1, false, $TokenNotification$_store_cell($TokenNotification$_constructor_query_id_amount_from_forward_payload($msg'query_id, $msg'amount, $msg'from, $msg'forward_payload)))); 69 | } 70 | if (( ((~ null?($msg'response_destination))) ? (($msg_value > 0)) : (false) )) { 71 | $global_send($SendParameters$_constructor_to_value_bounce_body_mode(__tact_not_null($msg'response_destination), $msg_value, false, $TokenExcesses$_store_cell($TokenExcesses$_constructor_query_id($msg'query_id)), 1)); 72 | } 73 | return (($self'balance, $self'owner, $self'master), ()); 74 | } 75 | 76 | (((int, slice, slice)), ()) $JettonDefaultWallet$_internal_binary_TokenBurn((int, slice, slice) $self, (int, int, slice, cell) $msg) impure inline { 77 | var ($self'balance, $self'owner, $self'master) = $self; 78 | var ($msg'query_id, $msg'amount, $msg'response_destination, $msg'custom_payload) = $msg; 79 | var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); 80 | throw_unless(4429, ( __tact_slice_eq_bits($self'owner, $ctx'sender) )); 81 | $self'balance = ($self'balance - $msg'amount); 82 | throw_unless(62972, ($self'balance >= 0)); 83 | int $fwd_fee = $Context$_fun_readForwardFee(($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw)); 84 | throw_unless(43422, ($ctx'value > (($fwd_fee + (2 * 13000000)) + 19000000))); 85 | $global_send($SendParameters$_constructor_to_value_mode_bounce_body($self'master, 0, 64, true, $TokenBurnNotification$_store_cell($TokenBurnNotification$_constructor_query_id_amount_sender_response_destination($msg'query_id, $msg'amount, $self'owner, __tact_not_null($msg'response_destination))))); 86 | return (($self'balance, $self'owner, $self'master), ()); 87 | } 88 | 89 | (((int, slice, slice)), ()) $JettonDefaultWallet$_receive_binary_bounce_TokenTransferInternal((int, slice, slice) $self, (int, int) $msg) impure inline { 90 | var ($self'balance, $self'owner, $self'master) = $self; 91 | var ($msg'query_id, $msg'amount) = $msg; 92 | $self'balance = ($self'balance + $msg'amount); 93 | return (($self'balance, $self'owner, $self'master), ()); 94 | } 95 | 96 | (((int, slice, slice)), ()) $JettonDefaultWallet$_receive_binary_bounce_TokenBurnNotification((int, slice, slice) $self, (int, int) $msg) impure inline { 97 | var ($self'balance, $self'owner, $self'master) = $self; 98 | var ($msg'query_id, $msg'amount) = $msg; 99 | $self'balance = ($self'balance + $msg'amount); 100 | return (($self'balance, $self'owner, $self'master), ()); 101 | } 102 | 103 | ;; 104 | ;; Get methods of a Contract JettonDefaultWallet 105 | ;; 106 | 107 | _ %get_wallet_data() method_id(97026) { 108 | var self = $JettonDefaultWallet$_contract_load(); 109 | var res = self~$JettonDefaultWallet$_fun_get_wallet_data(); 110 | return $JettonWalletData$_to_external(res); 111 | } 112 | 113 | _ supported_interfaces() method_id { 114 | return ( 115 | "org.ton.introspection.v0"H >> 128, 116 | "org.ton.abi.ipfs.v0"H >> 128, 117 | "org.ton.deploy.lazy.v0"H >> 128, 118 | "org.ton.chain.workchain.v0"H >> 128, 119 | "org.ton.jetton.wallet"H >> 128 120 | ); 121 | } 122 | 123 | _ get_abi_ipfs() method_id { 124 | return "ipfs://Qmc2bLaTkNmXqojo7RJxrRvfezpC9VgPJHwjfGCEwBQpkM"; 125 | } 126 | 127 | _ lazy_deployment_completed() method_id { 128 | return get_data().begin_parse().load_int(1); 129 | } 130 | 131 | ;; 132 | ;; Routing of a Contract JettonDefaultWallet 133 | ;; 134 | 135 | ((int, slice, slice), int) $JettonDefaultWallet$_contract_router_internal((int, slice, slice) self, int msg_bounced, slice in_msg) impure inline_ref { 136 | ;; Handle bounced messages 137 | if (msg_bounced) { 138 | 139 | ;; Skip 0xFFFFFFFF 140 | in_msg~skip_bits(32); 141 | 142 | ;; Parse op 143 | int op = 0; 144 | if (slice_bits(in_msg) >= 32) { 145 | op = in_msg.preload_uint(32); 146 | } 147 | 148 | ;; Bounced handler for TokenTransferInternal message 149 | if (op == 395134233) { 150 | var msg = in_msg~$TokenTransferInternal$_load_bounced(); 151 | self~$JettonDefaultWallet$_receive_binary_bounce_TokenTransferInternal(msg); 152 | return (self, true); 153 | } 154 | 155 | ;; Bounced handler for TokenBurnNotification message 156 | if (op == 2078119902) { 157 | var msg = in_msg~$TokenBurnNotification$_load_bounced(); 158 | self~$JettonDefaultWallet$_receive_binary_bounce_TokenBurnNotification(msg); 159 | return (self, true); 160 | } 161 | 162 | return (self, true); 163 | } 164 | 165 | ;; Parse incoming message 166 | int op = 0; 167 | if (slice_bits(in_msg) >= 32) { 168 | op = in_msg.preload_uint(32); 169 | } 170 | 171 | 172 | ;; Receive TokenTransfer message 173 | if (op == 260734629) { 174 | var msg = in_msg~$TokenTransfer$_load(); 175 | self~$JettonDefaultWallet$_internal_binary_TokenTransfer(msg); 176 | return (self, true); 177 | } 178 | 179 | ;; Receive TokenTransferInternal message 180 | if (op == 395134233) { 181 | var msg = in_msg~$TokenTransferInternal$_load(); 182 | self~$JettonDefaultWallet$_internal_binary_TokenTransferInternal(msg); 183 | return (self, true); 184 | } 185 | 186 | ;; Receive TokenBurn message 187 | if (op == 1499400124) { 188 | var msg = in_msg~$TokenBurn$_load(); 189 | self~$JettonDefaultWallet$_internal_binary_TokenBurn(msg); 190 | return (self, true); 191 | } 192 | 193 | return (self, false); 194 | } 195 | 196 | () recv_internal(int msg_value, cell in_msg_cell, slice in_msg) impure { 197 | 198 | ;; Context 199 | var cs = in_msg_cell.begin_parse(); 200 | var msg_flags = cs~load_uint(4); 201 | var msg_bounced = -(msg_flags & 1); 202 | slice msg_sender_addr = __tact_verify_address(cs~load_msg_addr()); 203 | __tact_context = (msg_bounced, msg_sender_addr, msg_value, cs); 204 | __tact_context_sender = msg_sender_addr; 205 | 206 | ;; Load contract data 207 | var self = $JettonDefaultWallet$_contract_load(); 208 | 209 | ;; Handle operation 210 | int handled = self~$JettonDefaultWallet$_contract_router_internal(msg_bounced, in_msg); 211 | 212 | ;; Throw if not handled 213 | throw_unless(130, handled); 214 | 215 | ;; Persist state 216 | $JettonDefaultWallet$_contract_store(self); 217 | } 218 | -------------------------------------------------------------------------------- /sources/output/SampleJetton_JettonDefaultWallet.storage.fc: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Type: StateInit 3 | ;; TLB: _ code:^cell data:^cell = StateInit 4 | ;; 5 | 6 | _ $StateInit$_get_code((cell, cell) v) inline { 7 | var (v'code, v'data) = v; 8 | return v'code; 9 | } 10 | 11 | ;; 12 | ;; Type: SendParameters 13 | ;; TLB: _ bounce:bool to:address value:int257 mode:int257 body:Maybe ^cell code:Maybe ^cell data:Maybe ^cell = SendParameters 14 | ;; 15 | 16 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_mode_bounce_body_code_data(slice to, int value, int mode, int bounce, cell body, cell code, cell data) inline { 17 | return (bounce, to, value, mode, body, code, data); 18 | } 19 | 20 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_mode_bounce_body(slice to, int value, int mode, int bounce, cell body) inline { 21 | return (bounce, to, value, mode, body, null(), null()); 22 | } 23 | 24 | ((int, slice, int, int, cell, cell, cell)) $SendParameters$_constructor_to_value_bounce_body_mode(slice to, int value, int bounce, cell body, int mode) inline { 25 | return (bounce, to, value, mode, body, null(), null()); 26 | } 27 | 28 | ;; 29 | ;; Type: JettonWalletData 30 | ;; TLB: _ balance:int257 owner:address master:address code:^cell = JettonWalletData 31 | ;; 32 | 33 | (int, slice, slice, cell) $JettonWalletData$_to_external(((int, slice, slice, cell)) v) inline { 34 | var (v'balance, v'owner, v'master, v'code) = v; 35 | return (v'balance, v'owner, v'master, v'code); 36 | } 37 | 38 | ((int, slice, slice, cell)) $JettonWalletData$_constructor_balance_owner_master_code(int balance, slice owner, slice master, cell code) inline { 39 | return (balance, owner, master, code); 40 | } 41 | 42 | ;; 43 | ;; Type: TokenTransfer 44 | ;; Header: 0x0f8a7ea5 45 | ;; TLB: token_transfer#0f8a7ea5 query_id:uint64 amount:coins sender:address response_destination:Maybe address custom_payload:Maybe ^cell forward_ton_amount:coins forward_payload:remainder = TokenTransfer 46 | ;; 47 | 48 | (slice, ((int, int, slice, slice, cell, int, slice))) $TokenTransfer$_load(slice sc_0) inline_ref { 49 | throw_unless(129, sc_0~load_uint(32) == 260734629); 50 | var v'query_id = sc_0~load_uint(64); 51 | var v'amount = sc_0~load_coins(); 52 | var v'sender = sc_0~__tact_load_address(); 53 | var v'response_destination = sc_0~__tact_load_address_opt(); 54 | var v'custom_payload = sc_0~load_int(1) ? sc_0~load_ref() : null(); 55 | var v'forward_ton_amount = sc_0~load_coins(); 56 | var v'forward_payload = sc_0; 57 | return (sc_0, (v'query_id, v'amount, v'sender, v'response_destination, v'custom_payload, v'forward_ton_amount, v'forward_payload)); 58 | } 59 | 60 | ;; 61 | ;; Type: TokenTransferInternal 62 | ;; Header: 0x178d4519 63 | ;; TLB: token_transfer_internal#178d4519 query_id:uint64 amount:coins from:address response_destination:Maybe address forward_ton_amount:coins forward_payload:remainder = TokenTransferInternal 64 | ;; 65 | 66 | builder $TokenTransferInternal$_store(builder build_0, (int, int, slice, slice, int, slice) v) inline_ref { 67 | var (v'query_id, v'amount, v'from, v'response_destination, v'forward_ton_amount, v'forward_payload) = v; 68 | build_0 = store_uint(build_0, 395134233, 32); 69 | build_0 = build_0.store_uint(v'query_id, 64); 70 | build_0 = build_0.store_coins(v'amount); 71 | build_0 = __tact_store_address(build_0, v'from); 72 | build_0 = __tact_store_address_opt(build_0, v'response_destination); 73 | build_0 = build_0.store_coins(v'forward_ton_amount); 74 | build_0 = build_0.store_slice(v'forward_payload); 75 | return build_0; 76 | } 77 | 78 | cell $TokenTransferInternal$_store_cell((int, int, slice, slice, int, slice) v) inline { 79 | return $TokenTransferInternal$_store(begin_cell(), v).end_cell(); 80 | } 81 | 82 | (slice, ((int, int, slice, slice, int, slice))) $TokenTransferInternal$_load(slice sc_0) inline_ref { 83 | throw_unless(129, sc_0~load_uint(32) == 395134233); 84 | var v'query_id = sc_0~load_uint(64); 85 | var v'amount = sc_0~load_coins(); 86 | var v'from = sc_0~__tact_load_address(); 87 | var v'response_destination = sc_0~__tact_load_address_opt(); 88 | var v'forward_ton_amount = sc_0~load_coins(); 89 | var v'forward_payload = sc_0; 90 | return (sc_0, (v'query_id, v'amount, v'from, v'response_destination, v'forward_ton_amount, v'forward_payload)); 91 | } 92 | 93 | (slice, ((int, int))) $TokenTransferInternal$_load_bounced(slice sc_0) inline { 94 | throw_unless(129, sc_0~load_uint(32) == 395134233); 95 | var v'query_id = sc_0~load_uint(64); 96 | var v'amount = sc_0~load_coins(); 97 | return (sc_0, (v'query_id, v'amount)); 98 | } 99 | 100 | ((int, int, slice, slice, int, slice)) $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload(int query_id, int amount, slice from, slice response_destination, int forward_ton_amount, slice forward_payload) inline { 101 | return (query_id, amount, from, response_destination, forward_ton_amount, forward_payload); 102 | } 103 | 104 | ;; 105 | ;; Type: TokenNotification 106 | ;; Header: 0x7362d09c 107 | ;; TLB: token_notification#7362d09c query_id:uint64 amount:coins from:address forward_payload:remainder = TokenNotification 108 | ;; 109 | 110 | builder $TokenNotification$_store(builder build_0, (int, int, slice, slice) v) inline { 111 | var (v'query_id, v'amount, v'from, v'forward_payload) = v; 112 | build_0 = store_uint(build_0, 1935855772, 32); 113 | build_0 = build_0.store_uint(v'query_id, 64); 114 | build_0 = build_0.store_coins(v'amount); 115 | build_0 = __tact_store_address(build_0, v'from); 116 | build_0 = build_0.store_slice(v'forward_payload); 117 | return build_0; 118 | } 119 | 120 | cell $TokenNotification$_store_cell((int, int, slice, slice) v) inline { 121 | return $TokenNotification$_store(begin_cell(), v).end_cell(); 122 | } 123 | 124 | ((int, int, slice, slice)) $TokenNotification$_constructor_query_id_amount_from_forward_payload(int query_id, int amount, slice from, slice forward_payload) inline { 125 | return (query_id, amount, from, forward_payload); 126 | } 127 | 128 | ;; 129 | ;; Type: TokenBurn 130 | ;; Header: 0x595f07bc 131 | ;; TLB: token_burn#595f07bc query_id:uint64 amount:coins response_destination:Maybe address custom_payload:Maybe ^cell = TokenBurn 132 | ;; 133 | 134 | (slice, ((int, int, slice, cell))) $TokenBurn$_load(slice sc_0) inline { 135 | throw_unless(129, sc_0~load_uint(32) == 1499400124); 136 | var v'query_id = sc_0~load_uint(64); 137 | var v'amount = sc_0~load_coins(); 138 | var v'response_destination = sc_0~__tact_load_address_opt(); 139 | var v'custom_payload = sc_0~load_int(1) ? sc_0~load_ref() : null(); 140 | return (sc_0, (v'query_id, v'amount, v'response_destination, v'custom_payload)); 141 | } 142 | 143 | ;; 144 | ;; Type: TokenBurnNotification 145 | ;; Header: 0x7bdd97de 146 | ;; TLB: token_burn_notification#7bdd97de query_id:uint64 amount:coins sender:address response_destination:Maybe address = TokenBurnNotification 147 | ;; 148 | 149 | builder $TokenBurnNotification$_store(builder build_0, (int, int, slice, slice) v) inline { 150 | var (v'query_id, v'amount, v'sender, v'response_destination) = v; 151 | build_0 = store_uint(build_0, 2078119902, 32); 152 | build_0 = build_0.store_uint(v'query_id, 64); 153 | build_0 = build_0.store_coins(v'amount); 154 | build_0 = __tact_store_address(build_0, v'sender); 155 | build_0 = __tact_store_address_opt(build_0, v'response_destination); 156 | return build_0; 157 | } 158 | 159 | cell $TokenBurnNotification$_store_cell((int, int, slice, slice) v) inline { 160 | return $TokenBurnNotification$_store(begin_cell(), v).end_cell(); 161 | } 162 | 163 | (slice, ((int, int))) $TokenBurnNotification$_load_bounced(slice sc_0) inline { 164 | throw_unless(129, sc_0~load_uint(32) == 2078119902); 165 | var v'query_id = sc_0~load_uint(64); 166 | var v'amount = sc_0~load_coins(); 167 | return (sc_0, (v'query_id, v'amount)); 168 | } 169 | 170 | ((int, int, slice, slice)) $TokenBurnNotification$_constructor_query_id_amount_sender_response_destination(int query_id, int amount, slice sender, slice response_destination) inline { 171 | return (query_id, amount, sender, response_destination); 172 | } 173 | 174 | ;; 175 | ;; Type: TokenExcesses 176 | ;; Header: 0xd53276db 177 | ;; TLB: token_excesses#d53276db query_id:uint64 = TokenExcesses 178 | ;; 179 | 180 | builder $TokenExcesses$_store(builder build_0, (int) v) inline { 181 | var (v'query_id) = v; 182 | build_0 = store_uint(build_0, 3576854235, 32); 183 | build_0 = build_0.store_uint(v'query_id, 64); 184 | return build_0; 185 | } 186 | 187 | cell $TokenExcesses$_store_cell((int) v) inline { 188 | return $TokenExcesses$_store(begin_cell(), v).end_cell(); 189 | } 190 | 191 | ((int)) $TokenExcesses$_constructor_query_id(int query_id) inline { 192 | return (query_id); 193 | } 194 | 195 | ;; 196 | ;; Type: JettonDefaultWallet 197 | ;; 198 | 199 | builder $JettonDefaultWallet$_store(builder build_0, (int, slice, slice) v) inline { 200 | var (v'balance, v'owner, v'master) = v; 201 | build_0 = build_0.store_coins(v'balance); 202 | build_0 = __tact_store_address(build_0, v'owner); 203 | build_0 = __tact_store_address(build_0, v'master); 204 | return build_0; 205 | } 206 | 207 | (slice, ((int, slice, slice))) $JettonDefaultWallet$_load(slice sc_0) inline { 208 | var v'balance = sc_0~load_coins(); 209 | var v'owner = sc_0~__tact_load_address(); 210 | var v'master = sc_0~__tact_load_address(); 211 | return (sc_0, (v'balance, v'owner, v'master)); 212 | } 213 | 214 | builder $JettonDefaultWallet$init$_store(builder build_0, (slice, slice) v) inline { 215 | var (v'owner, v'master) = v; 216 | build_0 = __tact_store_address(build_0, v'owner); 217 | build_0 = __tact_store_address(build_0, v'master); 218 | return build_0; 219 | } 220 | 221 | (slice, ((slice, slice))) $JettonDefaultWallet$init$_load(slice sc_0) inline { 222 | var v'owner = sc_0~__tact_load_address(); 223 | var v'master = sc_0~__tact_load_address(); 224 | return (sc_0, (v'owner, v'master)); 225 | } 226 | 227 | (int, slice, slice) $JettonDefaultWallet$_contract_load() impure inline_ref { 228 | slice $sc = get_data().begin_parse(); 229 | __tact_context_sys = $sc~load_ref(); 230 | int $loaded = $sc~load_int(1); 231 | if ($loaded) { 232 | return $sc~$JettonDefaultWallet$_load(); 233 | } else { 234 | ;; Allow only workchain deployments 235 | throw_unless(137, my_address().preload_uint(11) == 1024); 236 | (slice owner, slice master) = $sc~$JettonDefaultWallet$init$_load(); 237 | $sc.end_parse(); 238 | return $JettonDefaultWallet$_contract_init(owner, master); 239 | } 240 | } 241 | 242 | () $JettonDefaultWallet$_contract_store((int, slice, slice) v) impure inline { 243 | builder b = begin_cell(); 244 | b = b.store_ref(__tact_context_sys); 245 | b = b.store_int(true, 1); 246 | b = $JettonDefaultWallet$_store(b, v); 247 | set_data(b.end_cell()); 248 | } 249 | 250 | (cell, cell) $JettonDefaultWallet$_init_child(cell sys', slice $owner, slice $master) inline_ref { 251 | slice sc' = sys'.begin_parse(); 252 | cell source = sc'~load_dict(); 253 | cell contracts = new_dict(); 254 | 255 | ;; Contract Code: JettonDefaultWallet 256 | cell mine = __tact_dict_get_code(source, 55471); 257 | contracts = __tact_dict_set_code(contracts, 55471, mine); 258 | 259 | ;; Build cell 260 | builder b = begin_cell(); 261 | b = b.store_ref(begin_cell().store_dict(contracts).end_cell()); 262 | b = b.store_int(false, 1); 263 | b = $JettonDefaultWallet$init$_store(b, ($owner, $master)); 264 | return (mine, b.end_cell()); 265 | } -------------------------------------------------------------------------------- /sources/output/SampleJetton_SampleJetton.code.fc: -------------------------------------------------------------------------------- 1 | #pragma version =0.4.3; 2 | #pragma allow-post-modification; 3 | #pragma compute-asm-ltr; 4 | 5 | #include "SampleJetton_SampleJetton.headers.fc"; 6 | #include "SampleJetton_SampleJetton.stdlib.fc"; 7 | #include "SampleJetton_SampleJetton.storage.fc"; 8 | 9 | ;; 10 | ;; Contract SampleJetton functions 11 | ;; 12 | 13 | (int, slice, cell, int, int) $SampleJetton$_contract_init(slice $owner, cell $content, int $max_supply) impure inline_ref { 14 | var (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)) = (null(), null(), null(), null(), null()); 15 | $self'total_supply = 0; 16 | $self'owner = $owner; 17 | $self'mintable = true; 18 | $self'content = $content; 19 | $self'max_supply = $max_supply; 20 | return ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply); 21 | } 22 | 23 | ((int, slice, cell, int, int), (cell, cell)) $SampleJetton$_fun_getJettonWalletInit((int, slice, cell, int, int) $self, slice $address) impure inline_ref { 24 | var (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)) = $self; 25 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), $JettonDefaultWallet$_init_child(__tact_context_sys, $address, my_address())); 26 | } 27 | 28 | ((int, slice, cell, int, int), ()) $SampleJetton$_fun_mint((int, slice, cell, int, int) $self, slice $to, int $amount, slice $response_destination) impure inline_ref { 29 | var (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)) = $self; 30 | throw_unless(18668, $self'mintable); 31 | $self'total_supply = ($self'total_supply + $amount); 32 | var ($winit'code, $winit'data) = ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)~$SampleJetton$_fun_getJettonWalletInit($to); 33 | $global_send($SendParameters$_constructor_to_value_bounce_mode_body_code_data($global_contractAddress(($winit'code, $winit'data)), 0, true, 64, $TokenTransferInternal$_store_cell($TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload(0, $amount, my_address(), $response_destination, 0, $Cell$_fun_asSlice(end_cell(begin_cell())))), $winit'code, $winit'data)); 34 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), ()); 35 | } 36 | 37 | ((int, slice, cell, int, int), ()) $SampleJetton$_fun_requireSenderAsWalletOwner((int, slice, cell, int, int) $self, slice $owner) impure inline_ref { 38 | var (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)) = $self; 39 | var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); 40 | var ($winit'code, $winit'data) = ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)~$SampleJetton$_fun_getJettonWalletInit($owner); 41 | throw_unless(4429, ( __tact_slice_eq_bits($ctx'sender, $global_contractAddress(($winit'code, $winit'data))) )); 42 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), ()); 43 | } 44 | 45 | ((int, slice, cell, int, int), (int, int, slice, cell, cell)) $SampleJetton$_fun_get_jetton_data((int, slice, cell, int, int) $self) impure inline_ref { 46 | var (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)) = $self; 47 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), $JettonData$_constructor_total_supply_mintable_owner_content_wallet_code($self'total_supply, $self'mintable, $self'owner, $self'content, $StateInit$_get_code($JettonDefaultWallet$_init_child(__tact_context_sys, $self'owner, my_address())))); 48 | } 49 | 50 | ((int, slice, cell, int, int), slice) $SampleJetton$_fun_get_wallet_address((int, slice, cell, int, int) $self, slice $owner) impure inline_ref { 51 | var (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)) = $self; 52 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), $global_contractAddress($JettonDefaultWallet$_init_child(__tact_context_sys, $owner, my_address()))); 53 | } 54 | 55 | ((int, slice, cell, int, int), ()) $SampleJetton$_fun_requireOwner((int, slice, cell, int, int) $self) impure inline_ref { 56 | var (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)) = $self; 57 | throw_unless(132, ( __tact_slice_eq_bits($self'owner, __tact_context_get_sender()) )); 58 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), ()); 59 | } 60 | 61 | ((int, slice, cell, int, int), slice) $SampleJetton$_fun_owner((int, slice, cell, int, int) $self) impure inline_ref { 62 | var (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)) = $self; 63 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), $self'owner); 64 | } 65 | 66 | ;; 67 | ;; Receivers of a Contract SampleJetton 68 | ;; 69 | 70 | (((int, slice, cell, int, int)), ()) $SampleJetton$_internal_binary_Mint((int, slice, cell, int, int) $self, (int, slice) $msg) impure inline { 71 | var ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply) = $self; 72 | var ($msg'amount, $msg'receiver) = $msg; 73 | var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); 74 | throw_unless(14534, ( __tact_slice_eq_bits($self'owner, $ctx'sender) )); 75 | throw_unless(3688, $self'mintable); 76 | throw_unless(12241, (($self'total_supply + $msg'amount) <= $self'max_supply)); 77 | ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)~$SampleJetton$_fun_mint($msg'receiver, $msg'amount, $self'owner); 78 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), ()); 79 | } 80 | 81 | ((int, slice, cell, int, int), ()) $SampleJetton$_internal_text_fcbeb9a480966477480639c7cea4a578aa6a113b2903b26d01bc384663eceef6((int, slice, cell, int, int) $self) impure inline { 82 | var ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply) = $self; 83 | var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); 84 | throw_unless(3688, $self'mintable); 85 | throw_unless(12241, (($self'total_supply + 100) <= $self'max_supply)); 86 | ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)~$SampleJetton$_fun_mint($ctx'sender, 100, $self'owner); 87 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), ()); 88 | } 89 | 90 | ((int, slice, cell, int, int), ()) $SampleJetton$_internal_text_dc004c5b75be74376bd79df8713f2390620cc8a3095068b0583eb28ca3ac8ba0((int, slice, cell, int, int) $self) impure inline { 91 | var ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply) = $self; 92 | var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); 93 | throw_unless(14534, ( __tact_slice_eq_bits($self'owner, $ctx'sender) )); 94 | $self'mintable = false; 95 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), ()); 96 | } 97 | 98 | (((int, slice, cell, int, int)), ()) $SampleJetton$_internal_binary_TokenUpdateContent((int, slice, cell, int, int) $self, (cell) $msg) impure inline { 99 | var ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply) = $self; 100 | var ($msg'content) = $msg; 101 | ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)~$SampleJetton$_fun_requireOwner(); 102 | $self'content = $msg'content; 103 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), ()); 104 | } 105 | 106 | (((int, slice, cell, int, int)), ()) $SampleJetton$_internal_binary_TokenBurnNotification((int, slice, cell, int, int) $self, (int, int, slice, slice) $msg) impure inline { 107 | var ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply) = $self; 108 | var ($msg'query_id, $msg'amount, $msg'sender, $msg'response_destination) = $msg; 109 | ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply)~$SampleJetton$_fun_requireSenderAsWalletOwner(__tact_not_null($msg'response_destination)); 110 | $self'total_supply = ($self'total_supply - $msg'amount); 111 | if ((~ null?($msg'response_destination))) { 112 | $global_send($SendParameters$_constructor_to_value_bounce_mode_body(__tact_not_null($msg'response_destination), 0, false, 64, $TokenExcesses$_store_cell($TokenExcesses$_constructor_query_id($msg'query_id)))); 113 | } 114 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), ()); 115 | } 116 | 117 | (((int, slice, cell, int, int)), ()) $SampleJetton$_internal_binary_ProvideWalletAddress((int, slice, cell, int, int) $self, (int, slice, int) $msg) impure inline { 118 | var ($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply) = $self; 119 | var ($msg'query_id, $msg'owner_address, $msg'include_address) = $msg; 120 | throw_unless(23951, ($Context$_get_value(__tact_context_get()) >= 6100000)); 121 | var ($init'code, $init'data) = $JettonDefaultWallet$_init_child(__tact_context_sys, $msg'owner_address, my_address()); 122 | if ($msg'include_address) { 123 | $global_send($SendParameters$_constructor_to_value_mode_body(__tact_context_get_sender(), 0, 64, $TakeWalletAddress$_store_cell($TakeWalletAddress$_constructor_query_id_wallet_address_owner_address($msg'query_id, $global_contractAddress(($init'code, $init'data)), $Cell$_fun_asSlice(end_cell(__tact_store_address(__tact_store_bool(begin_cell(), true), $msg'owner_address))))))); 124 | } else { 125 | $global_send($SendParameters$_constructor_to_value_mode_body(__tact_context_get_sender(), 0, 64, $TakeWalletAddress$_store_cell($TakeWalletAddress$_constructor_query_id_wallet_address_owner_address($msg'query_id, $global_contractAddress(($init'code, $init'data)), $Cell$_fun_asSlice(end_cell(__tact_store_bool(begin_cell(), false))))))); 126 | } 127 | return (($self'total_supply, $self'owner, $self'content, $self'mintable, $self'max_supply), ()); 128 | } 129 | 130 | ;; 131 | ;; Get methods of a Contract SampleJetton 132 | ;; 133 | 134 | _ %get_jetton_data() method_id(106029) { 135 | var self = $SampleJetton$_contract_load(); 136 | var res = self~$SampleJetton$_fun_get_jetton_data(); 137 | return $JettonData$_to_external(res); 138 | } 139 | 140 | _ %get_wallet_address(slice $$owner) method_id(103289) { 141 | slice $owner = __tact_verify_address($$owner); 142 | var self = $SampleJetton$_contract_load(); 143 | var res = self~$SampleJetton$_fun_get_wallet_address($owner); 144 | return res; 145 | } 146 | 147 | _ %owner() method_id(83229) { 148 | var self = $SampleJetton$_contract_load(); 149 | var res = self~$SampleJetton$_fun_owner(); 150 | return res; 151 | } 152 | 153 | _ supported_interfaces() method_id { 154 | return ( 155 | "org.ton.introspection.v0"H >> 128, 156 | "org.ton.abi.ipfs.v0"H >> 128, 157 | "org.ton.deploy.lazy.v0"H >> 128, 158 | "org.ton.chain.workchain.v0"H >> 128, 159 | "org.ton.jetton.master"H >> 128, 160 | "org.ton.ownable"H >> 128 161 | ); 162 | } 163 | 164 | _ get_abi_ipfs() method_id { 165 | return "ipfs://QmRhXefkwiW3BmtPXfEV1Ji1ExEZHG7Z6Nk6p7yJ8zM3Bj"; 166 | } 167 | 168 | _ lazy_deployment_completed() method_id { 169 | return get_data().begin_parse().load_int(1); 170 | } 171 | 172 | ;; 173 | ;; Routing of a Contract SampleJetton 174 | ;; 175 | 176 | ((int, slice, cell, int, int), int) $SampleJetton$_contract_router_internal((int, slice, cell, int, int) self, int msg_bounced, slice in_msg) impure inline_ref { 177 | ;; Handle bounced messages 178 | if (msg_bounced) { 179 | return (self, true); 180 | } 181 | 182 | ;; Parse incoming message 183 | int op = 0; 184 | if (slice_bits(in_msg) >= 32) { 185 | op = in_msg.preload_uint(32); 186 | } 187 | 188 | 189 | ;; Receive Mint message 190 | if (op == 4235234258) { 191 | var msg = in_msg~$Mint$_load(); 192 | self~$SampleJetton$_internal_binary_Mint(msg); 193 | return (self, true); 194 | } 195 | 196 | ;; Receive TokenUpdateContent message 197 | if (op == 2937889386) { 198 | var msg = in_msg~$TokenUpdateContent$_load(); 199 | self~$SampleJetton$_internal_binary_TokenUpdateContent(msg); 200 | return (self, true); 201 | } 202 | 203 | ;; Receive TokenBurnNotification message 204 | if (op == 2078119902) { 205 | var msg = in_msg~$TokenBurnNotification$_load(); 206 | self~$SampleJetton$_internal_binary_TokenBurnNotification(msg); 207 | return (self, true); 208 | } 209 | 210 | ;; Receive ProvideWalletAddress message 211 | if (op == 745978227) { 212 | var msg = in_msg~$ProvideWalletAddress$_load(); 213 | self~$SampleJetton$_internal_binary_ProvideWalletAddress(msg); 214 | return (self, true); 215 | } 216 | 217 | ;; Text Receivers 218 | if (op == 0) { 219 | var text_op = slice_hash(in_msg); 220 | 221 | ;; Receive "Mint: 100" message 222 | if (text_op == 0xfcbeb9a480966477480639c7cea4a578aa6a113b2903b26d01bc384663eceef6) { 223 | self~$SampleJetton$_internal_text_fcbeb9a480966477480639c7cea4a578aa6a113b2903b26d01bc384663eceef6(); 224 | return (self, true); 225 | } 226 | 227 | ;; Receive "Owner: MintClose" message 228 | if (text_op == 0xdc004c5b75be74376bd79df8713f2390620cc8a3095068b0583eb28ca3ac8ba0) { 229 | self~$SampleJetton$_internal_text_dc004c5b75be74376bd79df8713f2390620cc8a3095068b0583eb28ca3ac8ba0(); 230 | return (self, true); 231 | } 232 | } 233 | 234 | return (self, false); 235 | } 236 | 237 | () recv_internal(int msg_value, cell in_msg_cell, slice in_msg) impure { 238 | 239 | ;; Context 240 | var cs = in_msg_cell.begin_parse(); 241 | var msg_flags = cs~load_uint(4); 242 | var msg_bounced = -(msg_flags & 1); 243 | slice msg_sender_addr = __tact_verify_address(cs~load_msg_addr()); 244 | __tact_context = (msg_bounced, msg_sender_addr, msg_value, cs); 245 | __tact_context_sender = msg_sender_addr; 246 | 247 | ;; Load contract data 248 | var self = $SampleJetton$_contract_load(); 249 | 250 | ;; Handle operation 251 | int handled = self~$SampleJetton$_contract_router_internal(msg_bounced, in_msg); 252 | 253 | ;; Throw if not handled 254 | throw_unless(130, handled); 255 | 256 | ;; Persist state 257 | $SampleJetton$_contract_store(self); 258 | } 259 | -------------------------------------------------------------------------------- /sources/contract.spec.ts: -------------------------------------------------------------------------------- 1 | import { buildOnchainMetadata } from "./utils/jetton-helpers"; 2 | import { 3 | Blockchain, 4 | SandboxContract, 5 | TreasuryContract, 6 | printTransactionFees, 7 | prettyLogTransactions, 8 | RemoteBlockchainStorage, 9 | wrapTonClient4ForRemote, 10 | } from "@ton/sandbox"; 11 | import "@ton/test-utils"; 12 | import { Address, beginCell, fromNano, StateInit, toNano } from "@ton/core"; 13 | import { TonClient4 } from "@ton/ton"; 14 | import { printSeparator } from "./utils/print"; 15 | 16 | // -------- Contract SDK -------- 17 | import { SampleJetton, Mint, TokenTransfer } from "./output/SampleJetton_SampleJetton"; 18 | import { JettonDefaultWallet, TokenBurn } from "./output/SampleJetton_JettonDefaultWallet"; 19 | 20 | // -------- DeDust.io SDK -------- 21 | import { 22 | Asset, 23 | Factory, 24 | MAINNET_FACTORY_ADDR, 25 | PoolType, 26 | Vault, 27 | LiquidityDeposit, 28 | VaultJetton, 29 | JettonRoot, 30 | ReadinessStatus, 31 | } from "@dedust/sdk"; 32 | 33 | // ------------ STON.fi SDK ------------ 34 | import TonWeb from "tonweb"; 35 | import { Router, ROUTER_REVISION, ROUTER_REVISION_ADDRESS } from "@ston-fi/sdk"; 36 | 37 | const jettonParams = { 38 | name: "Best Practice", 39 | description: "This is description of Test tact jetton", 40 | symbol: "XXXE", 41 | image: "https://play-lh.googleusercontent.com/ahJtMe0vfOlAu1XJVQ6rcaGrQBgtrEZQefHy7SXB7jpijKhu1Kkox90XDuH8RmcBOXNn", 42 | }; 43 | let content = buildOnchainMetadata(jettonParams); 44 | let max_supply = toNano(1234766689011); // Set the specific total supply in nano 45 | 46 | describe("contract", () => { 47 | let blockchain: Blockchain; 48 | let token: SandboxContract; 49 | let jettonWallet: SandboxContract; 50 | let deployer: SandboxContract; 51 | // let player: SandboxContract; 52 | 53 | beforeAll(async () => { 54 | // Create content Cell 55 | 56 | blockchain = await Blockchain.create(); 57 | deployer = await blockchain.treasury("deployer"); 58 | // player = await blockchain.treasury("player"); 59 | 60 | token = blockchain.openContract(await SampleJetton.fromInit(deployer.address, content, max_supply)); 61 | 62 | // Send Transaction 63 | const deployResult = await token.send(deployer.getSender(), { value: toNano("10") }, "Mint: 100"); 64 | expect(deployResult.transactions).toHaveTransaction({ 65 | from: deployer.address, 66 | to: token.address, 67 | deploy: true, 68 | success: true, 69 | }); 70 | 71 | const playerWallet = await token.getGetWalletAddress(deployer.address); 72 | jettonWallet = blockchain.openContract(await JettonDefaultWallet.fromAddress(playerWallet)); 73 | }); 74 | 75 | it("Test: whether contract deployed successfully", async () => { 76 | // the check is done inside beforeEach, blockchain and token are ready to use 77 | // console.log((await token.getGetJettonData()).owner); 78 | // console.log((await token.getGetJettonData()).totalSupply); 79 | // console.log((await token.getGetJettonData()).max_supply); 80 | // console.log((await token.getGetJettonData()).content); 81 | }); 82 | 83 | it("Test: Minting is successfully", async () => { 84 | const totalSupplyBefore = (await token.getGetJettonData()).total_supply; 85 | const mintAmount = toNano(100); 86 | const Mint: Mint = { 87 | $$type: "Mint", 88 | amount: mintAmount, 89 | receiver: deployer.address, 90 | }; 91 | const mintResult = await token.send(deployer.getSender(), { value: toNano("10") }, Mint); 92 | expect(mintResult.transactions).toHaveTransaction({ 93 | from: deployer.address, 94 | to: token.address, 95 | success: true, 96 | }); 97 | // printTransactionFees(mintResult.transactions); 98 | 99 | const totalSupplyAfter = (await token.getGetJettonData()).total_supply; 100 | expect(totalSupplyBefore + mintAmount).toEqual(totalSupplyAfter); 101 | 102 | const walletData = await jettonWallet.getGetWalletData(); 103 | expect(walletData.owner).toEqualAddress(deployer.address); 104 | expect(walletData.balance).toBeGreaterThanOrEqual(mintAmount); 105 | }); 106 | 107 | it("should transfer successfully", async () => { 108 | const sender = await blockchain.treasury("sender"); 109 | const receiver = await blockchain.treasury("receiver"); 110 | const initMintAmount = toNano(1000); 111 | const transferAmount = toNano(80); 112 | 113 | const mintMessage: Mint = { 114 | $$type: "Mint", 115 | amount: initMintAmount, 116 | receiver: sender.address, 117 | }; 118 | await token.send(deployer.getSender(), { value: toNano("0.25") }, mintMessage); 119 | 120 | const senderWalletAddress = await token.getGetWalletAddress(sender.address); 121 | const senderWallet = blockchain.openContract(JettonDefaultWallet.fromAddress(senderWalletAddress)); 122 | 123 | // Transfer tokens from sender's wallet to receiver's wallet // 0xf8a7ea5 124 | const transferMessage: TokenTransfer = { 125 | $$type: "TokenTransfer", 126 | query_id: 0n, 127 | amount: transferAmount, 128 | sender: receiver.address, 129 | response_destination: sender.address, 130 | custom_payload: null, 131 | forward_ton_amount: toNano("0.1"), 132 | forward_payload: beginCell().storeUint(0, 1).storeUint(0, 32).endCell(), 133 | }; 134 | const transferResult = await senderWallet.send(sender.getSender(), { value: toNano("0.5") }, transferMessage); 135 | expect(transferResult.transactions).toHaveTransaction({ 136 | from: sender.address, 137 | to: senderWallet.address, 138 | success: true, 139 | }); 140 | // printTransactionFees(transferResult.transactions); 141 | // prettyLogTransactions(transferResult.transactions); 142 | 143 | const receiverWalletAddress = await token.getGetWalletAddress(receiver.address); 144 | const receiverWallet = blockchain.openContract(JettonDefaultWallet.fromAddress(receiverWalletAddress)); 145 | 146 | const senderWalletDataAfterTransfer = await senderWallet.getGetWalletData(); 147 | const receiverWalletDataAfterTransfer = await receiverWallet.getGetWalletData(); 148 | 149 | expect(senderWalletDataAfterTransfer.balance).toEqual(initMintAmount - transferAmount); // check that the sender transferred the right amount of tokens 150 | expect(receiverWalletDataAfterTransfer.balance).toEqual(transferAmount); // check that the receiver received the right amount of tokens 151 | // const balance1 = (await receiverWallet.getGetWalletData()).balance; 152 | // console.log(fromNano(balance1)); 153 | }); 154 | 155 | it("Mint tokens then Burn tokens", async () => { 156 | // const sender = await blockchain.treasury("sender"); 157 | const deployerWalletAddress = await token.getGetWalletAddress(deployer.address); 158 | const deployerWallet = blockchain.openContract(JettonDefaultWallet.fromAddress(deployerWalletAddress)); 159 | let deployerBalanceInit = (await deployerWallet.getGetWalletData()).balance; 160 | 161 | const initMintAmount = toNano(100); 162 | const mintMessage: Mint = { 163 | $$type: "Mint", 164 | amount: initMintAmount, 165 | receiver: deployer.address, 166 | }; 167 | await token.send(deployer.getSender(), { value: toNano("10") }, mintMessage); 168 | let deployerBalance = (await deployerWallet.getGetWalletData()).balance; 169 | expect(deployerBalance).toEqual(deployerBalanceInit + initMintAmount); 170 | 171 | let burnAmount = toNano(10); 172 | const burnMessage: TokenBurn = { 173 | $$type: "TokenBurn", 174 | query_id: 0n, 175 | amount: burnAmount, 176 | response_destination: deployer.address, 177 | custom_payload: beginCell().endCell(), 178 | }; 179 | 180 | await deployerWallet.send(deployer.getSender(), { value: toNano("10") }, burnMessage); 181 | let deployerBalanceAfterBurn = (await deployerWallet.getGetWalletData()).balance; 182 | expect(deployerBalanceAfterBurn).toEqual(deployerBalance - burnAmount); 183 | }); 184 | 185 | it("Should return value", async () => { 186 | const player = await blockchain.treasury("player"); 187 | const mintAmount = 1119000n; 188 | const Mint: Mint = { 189 | $$type: "Mint", 190 | amount: mintAmount, 191 | receiver: player.address, 192 | }; 193 | await token.send(deployer.getSender(), { value: toNano("1") }, Mint); 194 | 195 | let totalSupply = (await token.getGetJettonData()).total_supply; 196 | const messateResult = await token.send(player.getSender(), { value: 10033460n }, Mint); 197 | expect(messateResult.transactions).toHaveTransaction({ 198 | from: player.address, 199 | to: token.address, 200 | }); 201 | let totalSupply_later = (await token.getGetJettonData()).total_supply; 202 | expect(totalSupply_later).toEqual(totalSupply); 203 | 204 | // printTransactionFees(messateResult.transactions); 205 | // prettyLogTransactions(messateResult.transactions); 206 | }); 207 | 208 | it("Convert Address Format", async () => { 209 | console.log("Example Address(Jetton Root Contract: " + token.address); 210 | console.log("Is Friendly Address: " + Address.isFriendly(token.address.toString())); 211 | 212 | const testAddr = Address.parse(token.address.toString()); 213 | console.log("✓ Address: " + testAddr.toString({ bounceable: false })); 214 | console.log("✓ Address: " + testAddr.toString()); 215 | console.log("✓ Address(urlSafe: true): " + testAddr.toString({ urlSafe: true })); 216 | console.log("✓ Address(urlSafe: false): " + testAddr.toString({ urlSafe: false })); 217 | console.log("✓ Raw Address: " + testAddr.toRawString()); 218 | }); 219 | 220 | it("Onchian Testing: DeDust", async () => { 221 | const blkch = await Blockchain.create({ 222 | storage: new RemoteBlockchainStorage( 223 | wrapTonClient4ForRemote( 224 | new TonClient4({ 225 | endpoint: "https://mainnet-v4.tonhubapi.com", 226 | }) 227 | ) 228 | ), 229 | }); 230 | const player = await blkch.treasury("player"); 231 | 232 | const jettonRoot = blkch.openContract(await SampleJetton.fromInit(player.address, content, max_supply)); 233 | await jettonRoot.send(player.getSender(), { value: toNano("10") }, "Mint: 100"); 234 | 235 | const tonAmount = toNano("0.1"); // 5 TON 236 | const scaleAmount = toNano("0.000000001"); // 10 SCALE 237 | 238 | const TON = Asset.native(); 239 | const SCALE = Asset.jetton(jettonRoot.address); 240 | 241 | const assets: [Asset, Asset] = [TON, SCALE]; 242 | const targetBalances: [bigint, bigint] = [tonAmount, scaleAmount]; 243 | console.log("DeDust Factory Address: " + MAINNET_FACTORY_ADDR); 244 | 245 | // Step 1: 0x21cfe02b / 567271467: Create Vault 246 | // https://docs.dedust.io/reference/tlb-schemes#message-create_vault 247 | const factory = blkch.openContract(Factory.createFromAddress(MAINNET_FACTORY_ADDR)); 248 | const Tx = await factory.sendCreateVault(player.getSender(), { 249 | asset: SCALE, 250 | }); 251 | await printTransactionFees(await Tx.transactions); 252 | 253 | // ------------------------------------------------------------------------------------------------ 254 | // Step 2: 0x97d51f2f / 2547326767: Create a volatile pool) 255 | // https://docs.dedust.io/reference/tlb-schemes#message-create_volatile_pool 256 | const pool = blkch.openContract(await factory.getPool(PoolType.VOLATILE, [TON, SCALE])); 257 | 258 | const poolReadiness = await pool.getReadinessStatus(); 259 | if (poolReadiness === ReadinessStatus.NOT_DEPLOYED) { 260 | const transferLiquidity = await factory.sendCreateVolatilePool(player.getSender(), { 261 | assets: [TON, SCALE], 262 | }); 263 | await printTransactionFees(await transferLiquidity.transactions); 264 | } 265 | 266 | // ------------------------------------------------------------------------------------------------ 267 | // Step 3-1: 0xd55e4686, Deposit / Adding Liquidity: Deposit TON to Vault 268 | // https://docs.dedust.io/reference/tlb-schemes#message-deposit_liquidity 269 | const tonVault = blkch.openContract(await factory.getNativeVault()); 270 | console.log("Native Vault Address: " + tonVault.address); 271 | const tx = await tonVault.sendDepositLiquidity(player.getSender(), { 272 | poolType: PoolType.VOLATILE, 273 | assets, 274 | targetBalances, 275 | amount: tonAmount, 276 | }); 277 | await printTransactionFees(await tx.transactions); 278 | 279 | // Step 3-2: Deposit Jetton to Vault 280 | const scaleRoot = blkch.openContract(JettonRoot.createFromAddress(jettonRoot.address)); 281 | const scaleWallet = blkch.openContract(await scaleRoot.getWallet(player.address)); 282 | await jettonRoot.send(player.getSender(), { value: toNano("10") }, "Mint: 100"); 283 | 284 | const jettonVault = blkch.openContract(await factory.getJettonVault(jettonRoot.address)); 285 | const tx_jetton = await scaleWallet.sendTransfer(player.getSender(), toNano("0.5"), { 286 | amount: scaleAmount, 287 | destination: jettonVault.address, 288 | responseAddress: player.address, 289 | forwardAmount: toNano("0.4"), 290 | forwardPayload: VaultJetton.createDepositLiquidityPayload({ 291 | poolType: PoolType.VOLATILE, 292 | assets, 293 | targetBalances, 294 | }), 295 | }); 296 | console.log("----- Deposit Jetton To Vault: -----" + jettonVault.address); 297 | await printTransactionFees(await tx_jetton.transactions); 298 | printSeparator(); 299 | 300 | // ------------------------------------------------------------------------------------------------ 301 | console.log("----- Swap: -----"); 302 | if ((await pool.getReadinessStatus()) !== ReadinessStatus.READY) { 303 | throw new Error("Pool (TON, Jetton) does not exist."); 304 | } 305 | // Check if vault exits: 306 | if ((await tonVault.getReadinessStatus()) !== ReadinessStatus.READY) { 307 | throw new Error("Vault (TON) does not exist."); 308 | } 309 | 310 | // Step 4-1: 0xea06185d Swap TON to Jetton 311 | const amountIn = toNano("0.0001"); // 5 TON 312 | const swapTx_result = await tonVault.sendSwap(player.getSender(), { 313 | poolAddress: pool.address, 314 | amount: amountIn, 315 | gasAmount: toNano("0.252"), 316 | }); 317 | await printTransactionFees(await swapTx_result.transactions); 318 | 319 | // Swap 4-2: 0xf8a7ea5 Jetton to TON 0xf8a7ea5 320 | const jettonAmountIn = toNano("0.00000001"); // 50 SCALE 321 | const swapJetton_result = await scaleWallet.sendTransfer(player.getSender(), toNano("0.3030303"), { 322 | amount: jettonAmountIn, 323 | destination: jettonVault.address, 324 | responseAddress: player.address, // return gas to user 325 | forwardAmount: toNano("0.25"), 326 | forwardPayload: VaultJetton.createSwapPayload({ 327 | poolAddress: pool.address, 328 | swapParams: { recipientAddress: deployer.address }, 329 | }), 330 | }); 331 | // await printTransactionFees(await swapJetton_result.transactions); 332 | // await prettyLogTransactions(await swapJetton_result.transactions); 333 | 334 | // ------------------------------------------------------------------------------------------------ 335 | // Step 5: Remove Liquidity 336 | // https://docs.dedust.io/docs/liquidity-provisioning#withdraw-liquidity 337 | const lpWallet = blkch.openContract(await pool.getWallet(player.address)); 338 | 339 | const removeTx_Result = await lpWallet.sendBurn(player.getSender(), toNano("10"), { 340 | amount: await lpWallet.getBalance(), 341 | }); 342 | console.log("removeTx_Result: "); 343 | await printTransactionFees(await removeTx_Result.transactions); 344 | 345 | console.log("JettonWallet: " + scaleWallet.address); 346 | // await prettyLogTransactions(await removeTx_Result.transactions); 347 | }, 10000); 348 | 349 | it("Onchian Testing: STON.fi", async () => { 350 | const blkch = await Blockchain.create({ 351 | storage: new RemoteBlockchainStorage( 352 | wrapTonClient4ForRemote( 353 | new TonClient4({ 354 | endpoint: "https://mainnet-v4.tonhubapi.com", 355 | }) 356 | ) 357 | ), 358 | }); 359 | 360 | const provider = new TonWeb.HttpProvider(); 361 | 362 | const router = new Router(provider, { 363 | revision: ROUTER_REVISION.V1, 364 | address: ROUTER_REVISION_ADDRESS.V1, 365 | }); 366 | 367 | // const router = new Router(blkch, { 368 | // revision: ROUTER_REVISION.V1, 369 | // address: ROUTER_REVISION_ADDRESS.V1, 370 | // }); 371 | 372 | console.log("Router Address: " + router.address); 373 | 374 | // const JETTON0 = "EQDQoc5M3Bh8eWFephi9bClhevelbZZvWhkqdo80XuY_0qXv"; 375 | // const JETTON1 = "EQC_1YoM8RBixN95lz7odcF3Vrkc_N8Ne7gQi7Abtlet_Efi"; 376 | // const pool = await router.getPool({ jettonAddresses: [JETTON0, JETTON1] }); 377 | // console.log((await pool!!.getData()).protocolFeeAddress); 378 | 379 | const OWNER_ADDRESS = ""; 380 | const JETTON0 = "EQDQoc5M3Bh8eWFephi9bClhevelbZZvWhkqdo80XuY_0qXv"; 381 | const JETTON1 = "EQC_1YoM8RBixN95lz7odcF3Vrkc_N8Ne7gQi7Abtlet_Efi"; 382 | 383 | const routerData = await router.getData(); 384 | const { isLocked, adminAddress, tempUpgrade, poolCode, jettonLpWalletCode, lpAccountCode } = routerData; 385 | 386 | const pool = await router.getPool({ jettonAddresses: [JETTON0, JETTON1] }); 387 | 388 | if (!pool) { 389 | throw Error(`Pool for ${JETTON0}/${JETTON1} not found`); 390 | } 391 | 392 | const poolAddress = await pool.getAddress(); 393 | 394 | const poolData = await pool.getData(); 395 | const { 396 | reserve0, 397 | reserve1, 398 | token0WalletAddress, 399 | token1WalletAddress, 400 | lpFee, 401 | protocolFee, 402 | refFee, 403 | protocolFeeAddress, 404 | collectedToken0ProtocolFee, 405 | collectedToken1ProtocolFee, 406 | } = poolData; 407 | 408 | const expectedLiquidityData = await pool.getExpectedLiquidity({ 409 | jettonAmount: new TonWeb.utils.BN(500000000), 410 | }); 411 | 412 | const { amount0, amount1 } = expectedLiquidityData; 413 | 414 | const expectedLpTokensAmount = await pool.getExpectedTokens({ 415 | amount0: new TonWeb.utils.BN(500000000), 416 | amount1: new TonWeb.utils.BN(200000000), 417 | }); 418 | 419 | if (token0WalletAddress) { 420 | const expectedOutputsData = await pool.getExpectedOutputs({ 421 | amount: new TonWeb.utils.BN(500000000), 422 | jettonWallet: token0WalletAddress, 423 | }); 424 | const { jettonToReceive, protocolFeePaid, refFeePaid } = expectedOutputsData; 425 | } 426 | 427 | const lpAccountAddress = await pool.getLpAccountAddress({ 428 | ownerAddress: OWNER_ADDRESS, 429 | }); 430 | 431 | const lpAccount = await pool.getLpAccount({ ownerAddress: OWNER_ADDRESS }); 432 | if (lpAccount) { 433 | const lpAccountData = await lpAccount.getData(); 434 | const { userAddress, poolAddress, amount0, amount1 } = lpAccountData; 435 | } 436 | }); 437 | }); 438 | 439 | // it("should interact with STON.fi router and pool contracts", async () => { 440 | // const OWNER_ADDRESS = "YOUR WALLET ADDRESS HERE"; 441 | // const JETTON0 = "EQDQoc5M3Bh8eWFephi9bClhevelbZZvWhkqdo80XuY_0qXv"; 442 | // const JETTON1 = "EQC_1YoM8RBixN95lz7odcF3Vrkc_N8Ne7gQi7Abtlet_Efi"; 443 | 444 | // const routerData = await router.getData(); 445 | // const pool = await router.getPool({ jettonAddresses: [JETTON0, JETTON1] }); 446 | 447 | // if (!pool) { 448 | // throw new Error(`Pool for ${JETTON0}/${JETTON1} not found`); 449 | // } 450 | 451 | // const poolData = await pool.getData(); 452 | // const expectedLiquidityData = await pool.getExpectedLiquidity({ 453 | // jettonAmount: new tonWeb.utils.BN(toNano("1")), 454 | // }); 455 | 456 | // const { amount0, amount1 } = expectedLiquidityData; 457 | 458 | // const lpAccountAddress = await pool.getLpAccountAddress({ ownerAddress: OWNER_ADDRESS }); 459 | // const lpAccount = await pool.getLpAccount({ ownerAddress: OWNER_ADDRESS }); 460 | 461 | // if (lpAccount) { 462 | // const lpAccountData = await lpAccount.getData(); 463 | // } 464 | 465 | // // Assertions to verify the data received from STON.fi SDK 466 | // expect(poolData).toBeDefined(); 467 | // expect(expectedLiquidityData).toBeDefined(); 468 | // expect(lpAccountAddress).toBeDefined(); 469 | 470 | // if (lpAccount) { 471 | // expect(lpAccountData).toBeDefined(); 472 | // } 473 | // }); 474 | // }); 475 | -------------------------------------------------------------------------------- /sources/output/SampleJetton_JettonDefaultWallet.code.fif: -------------------------------------------------------------------------------- 1 | PROGRAM{ 2 | DECLPROC __tact_verify_address 3 | DECLPROC __tact_load_address 4 | DECLPROC __tact_load_address_opt 5 | DECLPROC __tact_store_address 6 | DECLPROC __tact_store_address_opt 7 | DECLPROC __tact_create_address 8 | DECLPROC __tact_compute_contract_address 9 | DECLPROC __tact_my_balance 10 | DECLPROC __tact_not_null 11 | DECLPROC __tact_context_get 12 | DECLPROC __tact_store_bool 13 | DECLPROC __tact_slice_eq_bits 14 | DECLPROC __tact_dict_set_code 15 | DECLPROC __tact_dict_get_code 16 | DECLPROC $TokenTransfer$_load 17 | DECLPROC $TokenTransferInternal$_store 18 | DECLPROC $TokenTransferInternal$_store_cell 19 | DECLPROC $TokenTransferInternal$_load 20 | DECLPROC $TokenTransferInternal$_load_bounced 21 | DECLPROC $TokenNotification$_store 22 | DECLPROC $TokenNotification$_store_cell 23 | DECLPROC $TokenBurn$_load 24 | DECLPROC $TokenBurnNotification$_store 25 | DECLPROC $TokenBurnNotification$_store_cell 26 | DECLPROC $TokenBurnNotification$_load_bounced 27 | DECLPROC $TokenExcesses$_store 28 | DECLPROC $TokenExcesses$_store_cell 29 | DECLPROC $JettonDefaultWallet$_store 30 | DECLPROC $JettonDefaultWallet$_load 31 | DECLPROC $StateInit$_get_code 32 | DECLPROC $JettonWalletData$_to_external 33 | DECLPROC $JettonDefaultWallet$init$_store 34 | DECLPROC $JettonDefaultWallet$init$_load 35 | DECLPROC $JettonDefaultWallet$_contract_init 36 | DECLPROC $JettonDefaultWallet$_contract_load 37 | DECLPROC $JettonDefaultWallet$_contract_store 38 | DECLPROC $global_contractAddress 39 | DECLPROC $global_send 40 | DECLPROC $Context$_fun_readForwardFee 41 | DECLPROC $JettonDefaultWallet$_init_child 42 | DECLPROC $JettonDefaultWallet$_fun_msg_value 43 | DECLPROC $JettonWalletData$_constructor_balance_owner_master_code 44 | DECLPROC $JettonDefaultWallet$_fun_get_wallet_data 45 | DECLPROC $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload 46 | DECLPROC $SendParameters$_constructor_to_value_mode_bounce_body_code_data 47 | DECLPROC $SendParameters$_constructor_to_value_mode_bounce_body 48 | DECLPROC $TokenNotification$_constructor_query_id_amount_from_forward_payload 49 | DECLPROC $SendParameters$_constructor_to_value_bounce_body_mode 50 | DECLPROC $TokenExcesses$_constructor_query_id 51 | DECLPROC $TokenBurnNotification$_constructor_query_id_amount_sender_response_destination 52 | DECLPROC $JettonDefaultWallet$_internal_binary_TokenTransfer 53 | DECLPROC $JettonDefaultWallet$_internal_binary_TokenTransferInternal 54 | DECLPROC $JettonDefaultWallet$_internal_binary_TokenBurn 55 | DECLPROC $JettonDefaultWallet$_receive_binary_bounce_TokenTransferInternal 56 | DECLPROC $JettonDefaultWallet$_receive_binary_bounce_TokenBurnNotification 57 | 97026 DECLMETHOD %get_wallet_data 58 | 113617 DECLMETHOD supported_interfaces 59 | 121275 DECLMETHOD get_abi_ipfs 60 | 115390 DECLMETHOD lazy_deployment_completed 61 | DECLPROC $JettonDefaultWallet$_contract_router_internal 62 | DECLPROC recv_internal 63 | DECLGLOBVAR __tact_context 64 | DECLGLOBVAR __tact_context_sender 65 | DECLGLOBVAR __tact_context_sys 66 | DECLGLOBVAR __tact_randomized 67 | __tact_verify_address PROCINLINE:<{ 68 | DUP 69 | SBITS 70 | 267 PUSHINT 71 | EQUAL 72 | 136 THROWIFNOT 73 | DUP 74 | 11 PLDU 75 | DUP 76 | 1279 PUSHINT 77 | EQUAL 78 | 137 THROWIF 79 | 10 PUSHPOW2 80 | EQUAL 81 | 136 THROWIFNOT 82 | }> 83 | __tact_load_address PROCINLINE:<{ 84 | LDMSGADDR 85 | SWAP 86 | __tact_verify_address INLINECALLDICT 87 | }> 88 | __tact_load_address_opt PROCINLINE:<{ 89 | LDMSGADDR 90 | OVER 91 | 2 PLDU 92 | 0 NEQINT 93 | IF:<{ 94 | SWAP 95 | __tact_verify_address INLINECALLDICT 96 | }>ELSE<{ 97 | NIP 98 | PUSHNULL 99 | }> 100 | }> 101 | __tact_store_address PROCINLINE:<{ 102 | __tact_verify_address INLINECALLDICT 103 | STSLICER 104 | }> 105 | __tact_store_address_opt PROCINLINE:<{ 106 | DUP 107 | ISNULL 108 | IF:<{ 109 | DROP 110 | 0 PUSHINT 111 | SWAP 112 | 2 STU 113 | }>ELSE<{ 114 | __tact_store_address INLINECALLDICT 115 | }> 116 | }> 117 | __tact_create_address PROCINLINE:<{ 118 | NEWC 119 | 2 PUSHINT 120 | SWAP 121 | 2 STU 122 | 0 PUSHINT 123 | SWAP 124 | 1 STU 125 | s1 s2 XCHG 126 | 8 STI 127 | 256 STU 128 | ENDC 129 | CTOS 130 | __tact_verify_address INLINECALLDICT 131 | }> 132 | __tact_compute_contract_address PROCINLINE:<{ 133 | NEWC 134 | 0 PUSHINT 135 | SWAP 136 | 2 STU 137 | 3 PUSHINT 138 | SWAP 139 | 2 STU 140 | 0 PUSHINT 141 | SWAP 142 | 1 STU 143 | s1 s2 XCHG 144 | STREF 145 | STREF 146 | ENDC 147 | HASHCU 148 | __tact_create_address INLINECALLDICT 149 | }> 150 | __tact_my_balance PROCINLINE:<{ 151 | BALANCE 152 | FIRST 153 | }> 154 | __tact_not_null PROCINLINE:<{ 155 | DUP 156 | ISNULL 157 | 128 THROWIF 158 | }> 159 | __tact_context_get PROCINLINE:<{ 160 | __tact_context GETGLOB 161 | 4 UNTUPLE 162 | }> 163 | __tact_store_bool PROCINLINE:<{ 164 | SWAP 165 | 1 STI 166 | }> 167 | __tact_slice_eq_bits PROCINLINE:<{ 168 | SDEQ 169 | }> 170 | __tact_dict_set_code PROCINLINE:<{ 171 | s0 s2 XCHG 172 | 16 PUSHINT 173 | DICTUSETREF 174 | }> 175 | __tact_dict_get_code PROCINLINE:<{ 176 | SWAP 177 | 16 PUSHINT 178 | DICTUGETREF 179 | NULLSWAPIFNOT 180 | 135 THROWIFNOT 181 | }> 182 | $TokenTransfer$_load PROCREF:<{ 183 | 32 LDU 184 | SWAP 185 | 260734629 PUSHINT 186 | EQUAL 187 | 129 THROWIFNOT 188 | 64 LDU 189 | LDGRAMS 190 | __tact_load_address INLINECALLDICT 191 | SWAP 192 | __tact_load_address_opt INLINECALLDICT 193 | SWAP 194 | 1 LDI 195 | SWAP 196 | IF:<{ 197 | LDREF 198 | }>ELSE<{ 199 | PUSHNULL 200 | SWAP 201 | }> 202 | LDGRAMS 203 | s6 s6 XCPU 204 | s1 s6 XCHG 205 | s1 s5 XCHG 206 | s1 s4 XCHG 207 | s3 s3 s0 XCHG3 208 | }> 209 | $TokenTransferInternal$_store PROCREF:<{ 210 | 395134233 PUSHINT 211 | s0 s7 XCHG2 212 | 32 STU 213 | s1 s5 XCHG 214 | 64 STU 215 | s0 s3 XCHG2 216 | STGRAMS 217 | SWAP 218 | __tact_store_address INLINECALLDICT 219 | SWAP 220 | __tact_store_address_opt INLINECALLDICT 221 | SWAP 222 | STGRAMS 223 | SWAP 224 | STSLICER 225 | }> 226 | $TokenTransferInternal$_store_cell PROCINLINE:<{ 227 | NEWC 228 | 6 -ROLL 229 | $TokenTransferInternal$_store INLINECALLDICT 230 | ENDC 231 | }> 232 | $TokenTransferInternal$_load PROCREF:<{ 233 | 32 LDU 234 | SWAP 235 | 395134233 PUSHINT 236 | EQUAL 237 | 129 THROWIFNOT 238 | 64 LDU 239 | LDGRAMS 240 | __tact_load_address INLINECALLDICT 241 | SWAP 242 | __tact_load_address_opt INLINECALLDICT 243 | SWAP 244 | LDGRAMS 245 | s5 s5 XCPU 246 | s1 s5 XCHG 247 | s1 s4 XCHG 248 | s3 s3 s0 XCHG3 249 | }> 250 | $TokenTransferInternal$_load_bounced PROCINLINE:<{ 251 | 32 LDU 252 | SWAP 253 | 395134233 PUSHINT 254 | EQUAL 255 | 129 THROWIFNOT 256 | 64 LDU 257 | LDGRAMS 258 | -ROT 259 | }> 260 | $TokenNotification$_store PROCINLINE:<{ 261 | 1935855772 PUSHINT 262 | s0 s5 XCHG2 263 | 32 STU 264 | s1 s3 XCHG 265 | 64 STU 266 | SWAP 267 | STGRAMS 268 | SWAP 269 | __tact_store_address INLINECALLDICT 270 | SWAP 271 | STSLICER 272 | }> 273 | $TokenNotification$_store_cell PROCINLINE:<{ 274 | NEWC 275 | 4 -ROLL 276 | $TokenNotification$_store INLINECALLDICT 277 | ENDC 278 | }> 279 | $TokenBurn$_load PROCINLINE:<{ 280 | 32 LDU 281 | SWAP 282 | 1499400124 PUSHINT 283 | EQUAL 284 | 129 THROWIFNOT 285 | 64 LDU 286 | LDGRAMS 287 | __tact_load_address_opt INLINECALLDICT 288 | SWAP 289 | 1 LDI 290 | SWAP 291 | IF:<{ 292 | LDREF 293 | }>ELSE<{ 294 | PUSHNULL 295 | SWAP 296 | }> 297 | 4 -ROLL 298 | }> 299 | $TokenBurnNotification$_store PROCINLINE:<{ 300 | 2078119902 PUSHINT 301 | s0 s5 XCHG2 302 | 32 STU 303 | s1 s3 XCHG 304 | 64 STU 305 | SWAP 306 | STGRAMS 307 | SWAP 308 | __tact_store_address INLINECALLDICT 309 | SWAP 310 | __tact_store_address_opt INLINECALLDICT 311 | }> 312 | $TokenBurnNotification$_store_cell PROCINLINE:<{ 313 | NEWC 314 | 4 -ROLL 315 | $TokenBurnNotification$_store INLINECALLDICT 316 | ENDC 317 | }> 318 | $TokenBurnNotification$_load_bounced PROCINLINE:<{ 319 | 32 LDU 320 | SWAP 321 | 2078119902 PUSHINT 322 | EQUAL 323 | 129 THROWIFNOT 324 | 64 LDU 325 | LDGRAMS 326 | -ROT 327 | }> 328 | $TokenExcesses$_store PROCINLINE:<{ 329 | 3576854235 PUSHINT 330 | ROT 331 | 32 STU 332 | 64 STU 333 | }> 334 | $TokenExcesses$_store_cell PROCINLINE:<{ 335 | NEWC 336 | SWAP 337 | $TokenExcesses$_store INLINECALLDICT 338 | ENDC 339 | }> 340 | $JettonDefaultWallet$_store PROCINLINE:<{ 341 | 2SWAP 342 | STGRAMS 343 | ROT 344 | __tact_store_address INLINECALLDICT 345 | SWAP 346 | __tact_store_address INLINECALLDICT 347 | }> 348 | $JettonDefaultWallet$_load PROCINLINE:<{ 349 | LDGRAMS 350 | __tact_load_address INLINECALLDICT 351 | SWAP 352 | __tact_load_address INLINECALLDICT 353 | s3 s3 s0 XCHG3 354 | }> 355 | $StateInit$_get_code PROCINLINE:<{ 356 | DROP 357 | }> 358 | $JettonWalletData$_to_external PROCINLINE:<{ 359 | }> 360 | $JettonDefaultWallet$init$_store PROCINLINE:<{ 361 | -ROT 362 | __tact_store_address INLINECALLDICT 363 | SWAP 364 | __tact_store_address INLINECALLDICT 365 | }> 366 | $JettonDefaultWallet$init$_load PROCINLINE:<{ 367 | __tact_load_address INLINECALLDICT 368 | SWAP 369 | __tact_load_address INLINECALLDICT 370 | s1 s2 XCHG 371 | }> 372 | $JettonDefaultWallet$_contract_init PROCREF:<{ 373 | 0 PUSHINT 374 | -ROT 375 | }> 376 | $JettonDefaultWallet$_contract_load PROCREF:<{ 377 | c4 PUSH 378 | CTOS 379 | LDREF 380 | SWAP 381 | __tact_context_sys SETGLOB 382 | 1 LDI 383 | SWAP 384 | IFJMP:<{ 385 | $JettonDefaultWallet$_load INLINECALLDICT 386 | 1 3 BLKDROP2 387 | }> 388 | MYADDR 389 | 11 PLDU 390 | 10 PUSHPOW2 391 | EQUAL 392 | 137 THROWIFNOT 393 | $JettonDefaultWallet$init$_load INLINECALLDICT 394 | s0 s2 XCHG 395 | ENDS 396 | SWAP 397 | $JettonDefaultWallet$_contract_init INLINECALLDICT 398 | }> 399 | $JettonDefaultWallet$_contract_store PROCINLINE:<{ 400 | NEWC 401 | __tact_context_sys GETGLOB 402 | SWAP 403 | STREF 404 | TRUE 405 | SWAP 406 | 1 STI 407 | 3 -ROLL 408 | $JettonDefaultWallet$_store INLINECALLDICT 409 | ENDC 410 | c4 POP 411 | }> 412 | $global_contractAddress PROCINLINE:<{ 413 | 0 PUSHINT 414 | -ROT 415 | __tact_compute_contract_address INLINECALLDICT 416 | }> 417 | $global_send PROCREF:<{ 418 | NEWC 419 | 1 PUSHINT 420 | SWAP 421 | 2 STI 422 | s0 s7 XCHG2 423 | __tact_store_bool INLINECALLDICT 424 | 0 PUSHINT 425 | SWAP 426 | 3 STI 427 | s0 s5 XCHG2 428 | __tact_store_address INLINECALLDICT 429 | s0 s3 XCHG2 430 | STGRAMS 431 | 0 PUSHINT 432 | SWAP 433 | 105 STI 434 | s3 PUSH 435 | ISNULL 436 | NOT 437 | IF:<{ 438 | TRUE 439 | }>ELSE<{ 440 | s4 PUSH 441 | ISNULL 442 | NOT 443 | }> 444 | IF:<{ 445 | TRUE 446 | __tact_store_bool INLINECALLDICT 447 | NEWC 448 | FALSE 449 | __tact_store_bool INLINECALLDICT 450 | FALSE 451 | __tact_store_bool INLINECALLDICT 452 | s4 PUSH 453 | ISNULL 454 | NOT 455 | IF:<{ 456 | TRUE 457 | __tact_store_bool INLINECALLDICT 458 | s0 s4 XCHG 459 | __tact_not_null INLINECALLDICT 460 | s0 s4 XCHG2 461 | STREF 462 | }>ELSE<{ 463 | s4 POP 464 | s0 s3 XCHG 465 | FALSE 466 | __tact_store_bool INLINECALLDICT 467 | }> 468 | s4 PUSH 469 | ISNULL 470 | NOT 471 | IF:<{ 472 | TRUE 473 | __tact_store_bool INLINECALLDICT 474 | s0 s4 XCHG 475 | __tact_not_null INLINECALLDICT 476 | s0 s4 XCHG2 477 | STREF 478 | }>ELSE<{ 479 | s4 POP 480 | s0 s3 XCHG 481 | FALSE 482 | __tact_store_bool INLINECALLDICT 483 | }> 484 | FALSE 485 | __tact_store_bool INLINECALLDICT 486 | s0 s2 XCHG 487 | TRUE 488 | __tact_store_bool INLINECALLDICT 489 | s0 s2 XCHG 490 | ENDC 491 | ROT 492 | STREF 493 | }>ELSE<{ 494 | s3 POP 495 | s3 POP 496 | SWAP 497 | FALSE 498 | __tact_store_bool INLINECALLDICT 499 | }> 500 | OVER 501 | ISNULL 502 | NOT 503 | IF:<{ 504 | TRUE 505 | __tact_store_bool INLINECALLDICT 506 | SWAP 507 | __tact_not_null INLINECALLDICT 508 | SWAP 509 | STREF 510 | }>ELSE<{ 511 | NIP 512 | FALSE 513 | __tact_store_bool INLINECALLDICT 514 | }> 515 | ENDC 516 | SWAP 517 | SENDRAWMSG 518 | }> 519 | $Context$_fun_readForwardFee PROCREF:<{ 520 | 3 1 BLKDROP2 521 | __tact_load_address INLINECALLDICT 522 | DROP 523 | LDGRAMS 524 | NIP 525 | 1 PUSHINT 526 | SDSKIPFIRST 527 | LDGRAMS 528 | NIP 529 | LDGRAMS 530 | DROP 531 | 3 MULCONST 532 | 1 RSHIFT# 533 | }> 534 | $JettonDefaultWallet$_init_child PROCREF:<{ 535 | s0 s2 XCHG 536 | CTOS 537 | LDDICT 538 | DROP 539 | NEWDICT 540 | SWAP 541 | 55471 PUSHINT 542 | __tact_dict_get_code INLINECALLDICT 543 | SWAP 544 | 55471 PUSHINT 545 | s2 PUSH 546 | __tact_dict_set_code INLINECALLDICT 547 | NEWC 548 | SWAP 549 | NEWC 550 | STDICT 551 | ENDC 552 | SWAP 553 | STREF 554 | FALSE 555 | SWAP 556 | 1 STI 557 | s0 s0 s3 XCHG3 558 | $JettonDefaultWallet$init$_store INLINECALLDICT 559 | ENDC 560 | }> 561 | $JettonDefaultWallet$_fun_msg_value PROCREF:<{ 562 | __tact_my_balance INLINECALLDICT 563 | OVER 564 | SUB 565 | 19000000 PUSHINT 566 | TUCK 567 | MIN 568 | SUB 569 | 13000000 PUSHINT 570 | ADD 571 | SUB 572 | }> 573 | $JettonWalletData$_constructor_balance_owner_master_code PROCINLINE:<{ 574 | }> 575 | $JettonDefaultWallet$_fun_get_wallet_data PROCREF:<{ 576 | __tact_context_sys GETGLOB 577 | s2 s1 PUSH2 578 | $JettonDefaultWallet$_init_child INLINECALLDICT 579 | $StateInit$_get_code INLINECALLDICT 580 | s3 s2 s(-2) PU2XC 581 | s3 s(-1) PUXC 582 | $JettonWalletData$_constructor_balance_owner_master_code INLINECALLDICT 583 | }> 584 | $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload PROCINLINE:<{ 585 | }> 586 | $SendParameters$_constructor_to_value_mode_bounce_body_code_data PROCINLINE:<{ 587 | s3 s6 XCHG 588 | s3 s5 XCHG 589 | s3 s4 XCHG 590 | }> 591 | $SendParameters$_constructor_to_value_mode_bounce_body PROCINLINE:<{ 592 | s1 s4 XCHG 593 | s3 s3 s0 XCHG3 594 | PUSHNULL 595 | PUSHNULL 596 | }> 597 | $TokenNotification$_constructor_query_id_amount_from_forward_payload PROCINLINE:<{ 598 | }> 599 | $SendParameters$_constructor_to_value_bounce_body_mode PROCINLINE:<{ 600 | s2 s4 XCHG 601 | s3 s0 s0 XCHG3 602 | PUSHNULL 603 | PUSHNULL 604 | }> 605 | $TokenExcesses$_constructor_query_id PROCINLINE:<{ 606 | }> 607 | $TokenBurnNotification$_constructor_query_id_amount_sender_response_destination PROCINLINE:<{ 608 | }> 609 | $JettonDefaultWallet$_internal_binary_TokenTransfer PROCINLINE:<{ 610 | s2 POP 611 | __tact_context_get INLINECALLDICT 612 | 4429 PUSHINT 613 | s12 s3 PUSH2 614 | __tact_slice_eq_bits INLINECALLDICT 615 | THROWANYIFNOT 616 | s3 s3 s0 XCHG3 617 | s3 s(-1) PUXC 618 | $Context$_fun_readForwardFee INLINECALLDICT 619 | 1 LSHIFT# 620 | 26000000 PUSHINT 621 | ADD 622 | 19000000 PUSHINT 623 | ADD 624 | s2 PUSH 625 | ADD 626 | SWAP 627 | 16059 PUSHINT 628 | s0 s2 XCHG 629 | GREATER 630 | THROWANYIFNOT 631 | s8 s4 XCPU 632 | SUB 633 | 62972 PUSHINT 634 | OVER 635 | -1 GTINT 636 | THROWANYIFNOT 637 | __tact_context_sys GETGLOB 638 | s0 s4 s7 XC2PU 639 | $JettonDefaultWallet$_init_child INLINECALLDICT 640 | 2DUP 641 | $global_contractAddress INLINECALLDICT 642 | s7 s6 XCHG2 643 | 0 PUSHINT 644 | 64 PUSHINT 645 | FALSE 646 | s12 PUSH 647 | s8 s1 s3 XCHG3 648 | s14 s7 XCHG2 649 | $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload INLINECALLDICT 650 | $TokenTransferInternal$_store_cell INLINECALLDICT 651 | s5 s6 XCHG 652 | 4 2 REVERSE 653 | s3 s9 XCHG 654 | s0 s2 XCHG 655 | $SendParameters$_constructor_to_value_mode_bounce_body_code_data INLINECALLDICT 656 | $global_send INLINECALLDICT 657 | }> 658 | $JettonDefaultWallet$_internal_binary_TokenTransferInternal PROCINLINE:<{ 659 | __tact_context_get INLINECALLDICT 660 | s10 s2 PUSH2 661 | __tact_slice_eq_bits INLINECALLDICT 662 | NOT 663 | IF:<{ 664 | __tact_context_sys GETGLOB 665 | s8 s11 PUSH2 666 | $JettonDefaultWallet$_init_child INLINECALLDICT 667 | SWAP 668 | 42708 PUSHINT 669 | s0 s2 XCHG 670 | $global_contractAddress INLINECALLDICT 671 | s4 s(-1) PUXC 672 | __tact_slice_eq_bits INLINECALLDICT 673 | THROWANYIFNOT 674 | }> 675 | s12 s8 XCPU 676 | ADD 677 | 62972 PUSHINT 678 | OVER 679 | -1 GTINT 680 | THROWANYIFNOT 681 | s0 s11 s10 XCHG3 682 | s11 PUSH 683 | $JettonDefaultWallet$_fun_msg_value INLINECALLDICT 684 | s3 s4 XCHG 685 | s11 s12 s13 XCHG3 686 | $Context$_fun_readForwardFee INLINECALLDICT 687 | s3 PUSH 688 | 0 GTINT 689 | IF:<{ 690 | s10 s3 XCPU 691 | SUB 692 | s0 s10 XCHG2 693 | SUB 694 | 1 PUSHINT 695 | FALSE 696 | s8 PUSH 697 | s8 s1 s3 XCHG3 698 | s7 s4 XCHG2 699 | $TokenNotification$_constructor_query_id_amount_from_forward_payload INLINECALLDICT 700 | $TokenNotification$_store_cell INLINECALLDICT 701 | s7 PUSH 702 | s6 s1 s4 XCHG3 703 | s5 s5 XCHG2 704 | $SendParameters$_constructor_to_value_mode_bounce_body INLINECALLDICT 705 | $global_send INLINECALLDICT 706 | s0 s5 XCHG2 707 | }>ELSE<{ 708 | DROP 709 | s3 s5 XCHG 710 | 4 1 BLKDROP2 711 | }> 712 | OVER 713 | ISNULL 714 | NOT 715 | IF:<{ 716 | s5 PUSH 717 | 0 GTINT 718 | }>ELSE<{ 719 | FALSE 720 | }> 721 | IF:<{ 722 | SWAP 723 | __tact_not_null INLINECALLDICT 724 | FALSE 725 | s0 s3 XCHG 726 | $TokenExcesses$_constructor_query_id INLINECALLDICT 727 | $TokenExcesses$_store_cell INLINECALLDICT 728 | s6 s3 s0 XCHG3 729 | 1 PUSHINT 730 | $SendParameters$_constructor_to_value_bounce_body_mode INLINECALLDICT 731 | $global_send INLINECALLDICT 732 | }>ELSE<{ 733 | s5 POP 734 | 2DROP 735 | }> 736 | SWAP 737 | }> 738 | $JettonDefaultWallet$_internal_binary_TokenBurn PROCINLINE:<{ 739 | DROP 740 | __tact_context_get INLINECALLDICT 741 | 4429 PUSHINT 742 | s9 s3 PUSH2 743 | __tact_slice_eq_bits INLINECALLDICT 744 | THROWANYIFNOT 745 | s9 s5 XCPU 746 | SUB 747 | 62972 PUSHINT 748 | OVER 749 | -1 GTINT 750 | THROWANYIFNOT 751 | s3 s3 s0 XCHG3 752 | s3 s9 PUXC 753 | $Context$_fun_readForwardFee INLINECALLDICT 754 | 43422 PUSHINT 755 | SWAP 756 | 26000000 PUSHINT 757 | ADD 758 | 19000000 PUSHINT 759 | ADD 760 | s1 s2 XCHG 761 | GREATER 762 | THROWANYIFNOT 763 | 0 PUSHINT 764 | 64 PUSHINT 765 | TRUE 766 | s0 s3 XCHG 767 | __tact_not_null INLINECALLDICT 768 | s5 s4 s0 XCHG3 769 | s7 s(-1) PUXC 770 | $TokenBurnNotification$_constructor_query_id_amount_sender_response_destination INLINECALLDICT 771 | $TokenBurnNotification$_store_cell INLINECALLDICT 772 | s4 PUSH 773 | 4 -ROLL 774 | $SendParameters$_constructor_to_value_mode_bounce_body INLINECALLDICT 775 | $global_send INLINECALLDICT 776 | }> 777 | $JettonDefaultWallet$_receive_binary_bounce_TokenTransferInternal PROCINLINE:<{ 778 | NIP 779 | s1 s3 XCHG 780 | ADD 781 | s0 s2 XCHG 782 | }> 783 | $JettonDefaultWallet$_receive_binary_bounce_TokenBurnNotification PROCINLINE:<{ 784 | NIP 785 | s1 s3 XCHG 786 | ADD 787 | s0 s2 XCHG 788 | }> 789 | %get_wallet_data PROC:<{ 790 | $JettonDefaultWallet$_contract_load INLINECALLDICT 791 | $JettonDefaultWallet$_fun_get_wallet_data INLINECALLDICT 792 | 3 4 BLKDROP2 793 | $JettonWalletData$_to_external INLINECALLDICT 794 | }> 795 | supported_interfaces PROC:<{ 796 | 123515602279859691144772641439386770278 PUSHINT 797 | 209801025412363888721030803524359905849 PUSHINT 798 | 42980537499636128163026532310500881091 PUSHINT 799 | 209474421377847335869795010607481022628 PUSHINT 800 | 209778528950190195973528115415557644819 PUSHINT 801 | }> 802 | get_abi_ipfs PROC:<{ 803 | x{697066733a2f2f516d6332624c61546b4e6d58716f6a6f37524a7872527666657a7043395667504a48776a66474345774251706b4d} PUSHSLICE 804 | }> 805 | lazy_deployment_completed PROC:<{ 806 | c4 PUSH 807 | CTOS 808 | 1 LDI 809 | SWAP 810 | }> 811 | $JettonDefaultWallet$_contract_router_internal PROCREF:<{ 812 | SWAP 813 | IFJMP:<{ 814 | 32 PUSHINT 815 | SDSKIPFIRST 816 | 0 PUSHINT 817 | OVER 818 | SBITS 819 | 31 GTINT 820 | IF:<{ 821 | DROP 822 | DUP 823 | 32 PLDU 824 | }> 825 | DUP 826 | 395134233 PUSHINT 827 | EQUAL 828 | IFJMP:<{ 829 | DROP 830 | $TokenTransferInternal$_load_bounced INLINECALLDICT 831 | 1 2 BLKDROP2 832 | $JettonDefaultWallet$_receive_binary_bounce_TokenTransferInternal INLINECALLDICT 833 | TRUE 834 | }> 835 | 2078119902 PUSHINT 836 | EQUAL 837 | IFJMP:<{ 838 | $TokenBurnNotification$_load_bounced INLINECALLDICT 839 | 1 2 BLKDROP2 840 | $JettonDefaultWallet$_receive_binary_bounce_TokenBurnNotification INLINECALLDICT 841 | TRUE 842 | }> 843 | DROP 844 | TRUE 845 | }> 846 | 0 PUSHINT 847 | OVER 848 | SBITS 849 | 31 GTINT 850 | IF:<{ 851 | DROP 852 | DUP 853 | 32 PLDU 854 | }> 855 | DUP 856 | 260734629 PUSHINT 857 | EQUAL 858 | IFJMP:<{ 859 | DROP 860 | $TokenTransfer$_load INLINECALLDICT 861 | 1 7 BLKDROP2 862 | $JettonDefaultWallet$_internal_binary_TokenTransfer INLINECALLDICT 863 | TRUE 864 | }> 865 | DUP 866 | 395134233 PUSHINT 867 | EQUAL 868 | IFJMP:<{ 869 | DROP 870 | $TokenTransferInternal$_load INLINECALLDICT 871 | 1 6 BLKDROP2 872 | $JettonDefaultWallet$_internal_binary_TokenTransferInternal INLINECALLDICT 873 | TRUE 874 | }> 875 | 1499400124 PUSHINT 876 | EQUAL 877 | IFJMP:<{ 878 | $TokenBurn$_load INLINECALLDICT 879 | 1 4 BLKDROP2 880 | $JettonDefaultWallet$_internal_binary_TokenBurn INLINECALLDICT 881 | TRUE 882 | }> 883 | DROP 884 | FALSE 885 | }> 886 | recv_internal PROC:<{ 887 | SWAP 888 | CTOS 889 | 4 LDU 890 | SWAP 891 | 1 PUSHINT 892 | AND 893 | NEGATE 894 | SWAP 895 | LDMSGADDR 896 | SWAP 897 | __tact_verify_address INLINECALLDICT 898 | s0 s4 s2 PUXCPU 899 | s0 s3 XCHG 900 | 4 TUPLE 901 | __tact_context SETGLOB 902 | s0 s2 XCHG 903 | __tact_context_sender SETGLOB 904 | $JettonDefaultWallet$_contract_load INLINECALLDICT 905 | 2 3 BLKSWAP 906 | $JettonDefaultWallet$_contract_router_internal INLINECALLDICT 907 | 130 THROWIFNOT 908 | $JettonDefaultWallet$_contract_store INLINECALLDICT 909 | }> 910 | }END>c 911 | -------------------------------------------------------------------------------- /sources/output/SampleJetton_SampleJetton.code.fif: -------------------------------------------------------------------------------- 1 | PROGRAM{ 2 | DECLPROC __tact_verify_address 3 | DECLPROC __tact_load_address 4 | DECLPROC __tact_load_address_opt 5 | DECLPROC __tact_store_address 6 | DECLPROC __tact_store_address_opt 7 | DECLPROC __tact_create_address 8 | DECLPROC __tact_compute_contract_address 9 | DECLPROC __tact_not_null 10 | DECLPROC __tact_context_get 11 | DECLPROC __tact_context_get_sender 12 | DECLPROC __tact_store_bool 13 | DECLPROC __tact_slice_eq_bits 14 | DECLPROC __tact_dict_set_code 15 | DECLPROC __tact_dict_get_code 16 | DECLPROC $TokenTransferInternal$_store 17 | DECLPROC $TokenTransferInternal$_store_cell 18 | DECLPROC $TokenBurnNotification$_load 19 | DECLPROC $TokenExcesses$_store 20 | DECLPROC $TokenExcesses$_store_cell 21 | DECLPROC $TokenUpdateContent$_load 22 | DECLPROC $ProvideWalletAddress$_load 23 | DECLPROC $TakeWalletAddress$_store 24 | DECLPROC $TakeWalletAddress$_store_cell 25 | DECLPROC $Mint$_load 26 | DECLPROC $SampleJetton$_store 27 | DECLPROC $SampleJetton$_load 28 | DECLPROC $StateInit$_get_code 29 | DECLPROC $Context$_get_value 30 | DECLPROC $JettonData$_to_external 31 | DECLPROC $JettonDefaultWallet$init$_store 32 | DECLPROC $SampleJetton$init$_load 33 | DECLPROC $SampleJetton$_contract_init 34 | DECLPROC $SampleJetton$_contract_load 35 | DECLPROC $SampleJetton$_contract_store 36 | DECLPROC $global_contractAddress 37 | DECLPROC $global_send 38 | DECLPROC $Cell$_fun_asSlice 39 | DECLPROC $JettonDefaultWallet$_init_child 40 | DECLPROC $SendParameters$_constructor_to_value_bounce_mode_body_code_data 41 | DECLPROC $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload 42 | DECLPROC $SampleJetton$_fun_getJettonWalletInit 43 | DECLPROC $SampleJetton$_fun_mint 44 | DECLPROC $SampleJetton$_fun_requireSenderAsWalletOwner 45 | DECLPROC $JettonData$_constructor_total_supply_mintable_owner_content_wallet_code 46 | DECLPROC $SampleJetton$_fun_get_jetton_data 47 | DECLPROC $SampleJetton$_fun_get_wallet_address 48 | DECLPROC $SampleJetton$_fun_requireOwner 49 | DECLPROC $SampleJetton$_fun_owner 50 | DECLPROC $SendParameters$_constructor_to_value_bounce_mode_body 51 | DECLPROC $TokenExcesses$_constructor_query_id 52 | DECLPROC $SendParameters$_constructor_to_value_mode_body 53 | DECLPROC $TakeWalletAddress$_constructor_query_id_wallet_address_owner_address 54 | DECLPROC $SampleJetton$_internal_binary_Mint 55 | DECLPROC $SampleJetton$_internal_text_fcbeb9a480966477480639c7cea4a578aa6a113b2903b26d01bc384663eceef6 56 | DECLPROC $SampleJetton$_internal_text_dc004c5b75be74376bd79df8713f2390620cc8a3095068b0583eb28ca3ac8ba0 57 | DECLPROC $SampleJetton$_internal_binary_TokenUpdateContent 58 | DECLPROC $SampleJetton$_internal_binary_TokenBurnNotification 59 | DECLPROC $SampleJetton$_internal_binary_ProvideWalletAddress 60 | 106029 DECLMETHOD %get_jetton_data 61 | 103289 DECLMETHOD %get_wallet_address 62 | 83229 DECLMETHOD %owner 63 | 113617 DECLMETHOD supported_interfaces 64 | 121275 DECLMETHOD get_abi_ipfs 65 | 115390 DECLMETHOD lazy_deployment_completed 66 | DECLPROC $SampleJetton$_contract_router_internal 67 | DECLPROC recv_internal 68 | DECLGLOBVAR __tact_context 69 | DECLGLOBVAR __tact_context_sender 70 | DECLGLOBVAR __tact_context_sys 71 | DECLGLOBVAR __tact_randomized 72 | __tact_verify_address PROCINLINE:<{ 73 | DUP 74 | SBITS 75 | 267 PUSHINT 76 | EQUAL 77 | 136 THROWIFNOT 78 | DUP 79 | 11 PLDU 80 | DUP 81 | 1279 PUSHINT 82 | EQUAL 83 | 137 THROWIF 84 | 10 PUSHPOW2 85 | EQUAL 86 | 136 THROWIFNOT 87 | }> 88 | __tact_load_address PROCINLINE:<{ 89 | LDMSGADDR 90 | SWAP 91 | __tact_verify_address INLINECALLDICT 92 | }> 93 | __tact_load_address_opt PROCINLINE:<{ 94 | LDMSGADDR 95 | OVER 96 | 2 PLDU 97 | 0 NEQINT 98 | IF:<{ 99 | SWAP 100 | __tact_verify_address INLINECALLDICT 101 | }>ELSE<{ 102 | NIP 103 | PUSHNULL 104 | }> 105 | }> 106 | __tact_store_address PROCINLINE:<{ 107 | __tact_verify_address INLINECALLDICT 108 | STSLICER 109 | }> 110 | __tact_store_address_opt PROCINLINE:<{ 111 | DUP 112 | ISNULL 113 | IF:<{ 114 | DROP 115 | 0 PUSHINT 116 | SWAP 117 | 2 STU 118 | }>ELSE<{ 119 | __tact_store_address INLINECALLDICT 120 | }> 121 | }> 122 | __tact_create_address PROCINLINE:<{ 123 | NEWC 124 | 2 PUSHINT 125 | SWAP 126 | 2 STU 127 | 0 PUSHINT 128 | SWAP 129 | 1 STU 130 | s1 s2 XCHG 131 | 8 STI 132 | 256 STU 133 | ENDC 134 | CTOS 135 | __tact_verify_address INLINECALLDICT 136 | }> 137 | __tact_compute_contract_address PROCINLINE:<{ 138 | NEWC 139 | 0 PUSHINT 140 | SWAP 141 | 2 STU 142 | 3 PUSHINT 143 | SWAP 144 | 2 STU 145 | 0 PUSHINT 146 | SWAP 147 | 1 STU 148 | s1 s2 XCHG 149 | STREF 150 | STREF 151 | ENDC 152 | HASHCU 153 | __tact_create_address INLINECALLDICT 154 | }> 155 | __tact_not_null PROCINLINE:<{ 156 | DUP 157 | ISNULL 158 | 128 THROWIF 159 | }> 160 | __tact_context_get PROCINLINE:<{ 161 | __tact_context GETGLOB 162 | 4 UNTUPLE 163 | }> 164 | __tact_context_get_sender PROCINLINE:<{ 165 | __tact_context_sender GETGLOB 166 | }> 167 | __tact_store_bool PROCINLINE:<{ 168 | SWAP 169 | 1 STI 170 | }> 171 | __tact_slice_eq_bits PROCINLINE:<{ 172 | SDEQ 173 | }> 174 | __tact_dict_set_code PROCINLINE:<{ 175 | s0 s2 XCHG 176 | 16 PUSHINT 177 | DICTUSETREF 178 | }> 179 | __tact_dict_get_code PROCINLINE:<{ 180 | SWAP 181 | 16 PUSHINT 182 | DICTUGETREF 183 | NULLSWAPIFNOT 184 | 135 THROWIFNOT 185 | }> 186 | $TokenTransferInternal$_store PROCREF:<{ 187 | 395134233 PUSHINT 188 | s0 s7 XCHG2 189 | 32 STU 190 | s1 s5 XCHG 191 | 64 STU 192 | s0 s3 XCHG2 193 | STGRAMS 194 | SWAP 195 | __tact_store_address INLINECALLDICT 196 | SWAP 197 | __tact_store_address_opt INLINECALLDICT 198 | SWAP 199 | STGRAMS 200 | SWAP 201 | STSLICER 202 | }> 203 | $TokenTransferInternal$_store_cell PROCINLINE:<{ 204 | NEWC 205 | 6 -ROLL 206 | $TokenTransferInternal$_store INLINECALLDICT 207 | ENDC 208 | }> 209 | $TokenBurnNotification$_load PROCINLINE:<{ 210 | 32 LDU 211 | SWAP 212 | 2078119902 PUSHINT 213 | EQUAL 214 | 129 THROWIFNOT 215 | 64 LDU 216 | LDGRAMS 217 | __tact_load_address INLINECALLDICT 218 | SWAP 219 | __tact_load_address_opt INLINECALLDICT 220 | s1 s4 XCHG 221 | s3 s3 s0 XCHG3 222 | }> 223 | $TokenExcesses$_store PROCINLINE:<{ 224 | 3576854235 PUSHINT 225 | ROT 226 | 32 STU 227 | 64 STU 228 | }> 229 | $TokenExcesses$_store_cell PROCINLINE:<{ 230 | NEWC 231 | SWAP 232 | $TokenExcesses$_store INLINECALLDICT 233 | ENDC 234 | }> 235 | $TokenUpdateContent$_load PROCINLINE:<{ 236 | 32 LDU 237 | SWAP 238 | 2937889386 PUSHINT 239 | EQUAL 240 | 129 THROWIFNOT 241 | LDREF 242 | SWAP 243 | }> 244 | $ProvideWalletAddress$_load PROCINLINE:<{ 245 | 32 LDU 246 | SWAP 247 | 745978227 PUSHINT 248 | EQUAL 249 | 129 THROWIFNOT 250 | 64 LDU 251 | __tact_load_address INLINECALLDICT 252 | SWAP 253 | 1 LDI 254 | 3 -ROLL 255 | }> 256 | $TakeWalletAddress$_store PROCINLINE:<{ 257 | 3513996288 PUSHINT 258 | s0 s4 XCHG2 259 | 32 STU 260 | s1 s2 XCHG 261 | 64 STU 262 | SWAP 263 | __tact_store_address INLINECALLDICT 264 | SWAP 265 | STSLICER 266 | }> 267 | $TakeWalletAddress$_store_cell PROCINLINE:<{ 268 | NEWC 269 | 3 -ROLL 270 | $TakeWalletAddress$_store INLINECALLDICT 271 | ENDC 272 | }> 273 | $Mint$_load PROCINLINE:<{ 274 | 32 LDU 275 | SWAP 276 | 4235234258 PUSHINT 277 | EQUAL 278 | 129 THROWIFNOT 279 | 257 PUSHINT 280 | LDIX 281 | __tact_load_address INLINECALLDICT 282 | s1 s2 XCHG 283 | }> 284 | $SampleJetton$_store PROCINLINE:<{ 285 | s5 s4 XCHG2 286 | STGRAMS 287 | ROT 288 | __tact_store_address INLINECALLDICT 289 | STREF 290 | s1 s2 XCHG 291 | 1 STI 292 | SWAP 293 | STGRAMS 294 | }> 295 | $SampleJetton$_load PROCINLINE:<{ 296 | LDGRAMS 297 | __tact_load_address INLINECALLDICT 298 | SWAP 299 | LDREF 300 | 1 LDI 301 | LDGRAMS 302 | 5 -ROLL 303 | }> 304 | $StateInit$_get_code PROCINLINE:<{ 305 | DROP 306 | }> 307 | $Context$_get_value PROCINLINE:<{ 308 | s1 s3 XCHG 309 | 3 BLKDROP 310 | }> 311 | $JettonData$_to_external PROCINLINE:<{ 312 | }> 313 | $JettonDefaultWallet$init$_store PROCINLINE:<{ 314 | -ROT 315 | __tact_store_address INLINECALLDICT 316 | SWAP 317 | __tact_store_address INLINECALLDICT 318 | }> 319 | $SampleJetton$init$_load PROCINLINE:<{ 320 | __tact_load_address INLINECALLDICT 321 | SWAP 322 | LDREF 323 | 257 PUSHINT 324 | LDIX 325 | 3 -ROLL 326 | }> 327 | $SampleJetton$_contract_init PROCREF:<{ 328 | 0 PUSHINT 329 | 3 -ROLL 330 | TRUE 331 | SWAP 332 | }> 333 | $SampleJetton$_contract_load PROCREF:<{ 334 | c4 PUSH 335 | CTOS 336 | LDREF 337 | SWAP 338 | __tact_context_sys SETGLOB 339 | 1 LDI 340 | SWAP 341 | IFJMP:<{ 342 | $SampleJetton$_load INLINECALLDICT 343 | 1 5 BLKDROP2 344 | }> 345 | MYADDR 346 | 11 PLDU 347 | 10 PUSHPOW2 348 | EQUAL 349 | 137 THROWIFNOT 350 | $SampleJetton$init$_load INLINECALLDICT 351 | s0 s3 XCHG 352 | ENDS 353 | ROT 354 | $SampleJetton$_contract_init INLINECALLDICT 355 | }> 356 | $SampleJetton$_contract_store PROCINLINE:<{ 357 | NEWC 358 | __tact_context_sys GETGLOB 359 | SWAP 360 | STREF 361 | TRUE 362 | SWAP 363 | 1 STI 364 | 5 -ROLL 365 | $SampleJetton$_store INLINECALLDICT 366 | ENDC 367 | c4 POP 368 | }> 369 | $global_contractAddress PROCINLINE:<{ 370 | 0 PUSHINT 371 | -ROT 372 | __tact_compute_contract_address INLINECALLDICT 373 | }> 374 | $global_send PROCREF:<{ 375 | NEWC 376 | 1 PUSHINT 377 | SWAP 378 | 2 STI 379 | s0 s7 XCHG2 380 | __tact_store_bool INLINECALLDICT 381 | 0 PUSHINT 382 | SWAP 383 | 3 STI 384 | s0 s5 XCHG2 385 | __tact_store_address INLINECALLDICT 386 | s0 s3 XCHG2 387 | STGRAMS 388 | 0 PUSHINT 389 | SWAP 390 | 105 STI 391 | s3 PUSH 392 | ISNULL 393 | NOT 394 | IF:<{ 395 | TRUE 396 | }>ELSE<{ 397 | s4 PUSH 398 | ISNULL 399 | NOT 400 | }> 401 | IF:<{ 402 | TRUE 403 | __tact_store_bool INLINECALLDICT 404 | NEWC 405 | FALSE 406 | __tact_store_bool INLINECALLDICT 407 | FALSE 408 | __tact_store_bool INLINECALLDICT 409 | s4 PUSH 410 | ISNULL 411 | NOT 412 | IF:<{ 413 | TRUE 414 | __tact_store_bool INLINECALLDICT 415 | s0 s4 XCHG 416 | __tact_not_null INLINECALLDICT 417 | s0 s4 XCHG2 418 | STREF 419 | }>ELSE<{ 420 | s4 POP 421 | s0 s3 XCHG 422 | FALSE 423 | __tact_store_bool INLINECALLDICT 424 | }> 425 | s4 PUSH 426 | ISNULL 427 | NOT 428 | IF:<{ 429 | TRUE 430 | __tact_store_bool INLINECALLDICT 431 | s0 s4 XCHG 432 | __tact_not_null INLINECALLDICT 433 | s0 s4 XCHG2 434 | STREF 435 | }>ELSE<{ 436 | s4 POP 437 | s0 s3 XCHG 438 | FALSE 439 | __tact_store_bool INLINECALLDICT 440 | }> 441 | FALSE 442 | __tact_store_bool INLINECALLDICT 443 | s0 s2 XCHG 444 | TRUE 445 | __tact_store_bool INLINECALLDICT 446 | s0 s2 XCHG 447 | ENDC 448 | ROT 449 | STREF 450 | }>ELSE<{ 451 | s3 POP 452 | s3 POP 453 | SWAP 454 | FALSE 455 | __tact_store_bool INLINECALLDICT 456 | }> 457 | OVER 458 | ISNULL 459 | NOT 460 | IF:<{ 461 | TRUE 462 | __tact_store_bool INLINECALLDICT 463 | SWAP 464 | __tact_not_null INLINECALLDICT 465 | SWAP 466 | STREF 467 | }>ELSE<{ 468 | NIP 469 | FALSE 470 | __tact_store_bool INLINECALLDICT 471 | }> 472 | ENDC 473 | SWAP 474 | SENDRAWMSG 475 | }> 476 | $Cell$_fun_asSlice PROCINLINE:<{ 477 | CTOS 478 | }> 479 | $JettonDefaultWallet$_init_child PROCREF:<{ 480 | s0 s2 XCHG 481 | CTOS 482 | LDDICT 483 | DROP 484 | NEWDICT 485 | SWAP 486 | 55471 PUSHINT 487 | __tact_dict_get_code INLINECALLDICT 488 | SWAP 489 | 55471 PUSHINT 490 | s2 PUSH 491 | __tact_dict_set_code INLINECALLDICT 492 | NEWC 493 | SWAP 494 | NEWC 495 | STDICT 496 | ENDC 497 | SWAP 498 | STREF 499 | FALSE 500 | SWAP 501 | 1 STI 502 | s0 s0 s3 XCHG3 503 | $JettonDefaultWallet$init$_store INLINECALLDICT 504 | ENDC 505 | }> 506 | $SendParameters$_constructor_to_value_bounce_mode_body_code_data PROCINLINE:<{ 507 | s4 s6 XCHG 508 | s4 s5 XCHG 509 | }> 510 | $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload PROCINLINE:<{ 511 | }> 512 | $SampleJetton$_fun_getJettonWalletInit PROCREF:<{ 513 | __tact_context_sys GETGLOB 514 | MYADDR 515 | s1 s2 XCHG 516 | $JettonDefaultWallet$_init_child INLINECALLDICT 517 | }> 518 | $SampleJetton$_fun_mint PROCREF:<{ 519 | 18668 PUSHINT 520 | s5 PUSH 521 | THROWANYIFNOT 522 | s7 s1 XCPU 523 | ADD 524 | 5 2 BLKSWAP 525 | $SampleJetton$_fun_getJettonWalletInit INLINECALLDICT 526 | 2DUP 527 | $global_contractAddress INLINECALLDICT 528 | 0 PUSHINT 529 | TRUE 530 | 64 PUSHINT 531 | s2 PUSH 532 | MYADDR 533 | OVER 534 | NEWC 535 | ENDC 536 | $Cell$_fun_asSlice INLINECALLDICT 537 | s3 s5 XCHG 538 | s4 s15 XCHG 539 | s2 s3 XCHG 540 | s2 16 s() XCHG 541 | $TokenTransferInternal$_constructor_query_id_amount_from_response_destination_forward_ton_amount_forward_payload INLINECALLDICT 542 | $TokenTransferInternal$_store_cell INLINECALLDICT 543 | s6 s5 s0 XCHG3 544 | s4 s11 XCHG 545 | s3 s10 XCHG 546 | s0 s11 s10 XCHG3 547 | $SendParameters$_constructor_to_value_bounce_mode_body_code_data INLINECALLDICT 548 | $global_send INLINECALLDICT 549 | s0 s3 s4 XCHG3 550 | }> 551 | $SampleJetton$_fun_requireSenderAsWalletOwner PROCREF:<{ 552 | __tact_context_get INLINECALLDICT 553 | s2 s3 XCHG 554 | 3 BLKDROP 555 | 6 -ROLL 556 | $SampleJetton$_fun_getJettonWalletInit INLINECALLDICT 557 | SWAP 558 | 4429 PUSHINT 559 | s0 s2 XCHG 560 | $global_contractAddress INLINECALLDICT 561 | s1 s7 XCHG 562 | __tact_slice_eq_bits INLINECALLDICT 563 | s1 s6 XCHG 564 | THROWANYIFNOT 565 | 4 ROLL 566 | }> 567 | $JettonData$_constructor_total_supply_mintable_owner_content_wallet_code PROCINLINE:<{ 568 | }> 569 | $SampleJetton$_fun_get_jetton_data PROCREF:<{ 570 | __tact_context_sys GETGLOB 571 | MYADDR 572 | s5 s(-1) PUXC 573 | $JettonDefaultWallet$_init_child INLINECALLDICT 574 | $StateInit$_get_code INLINECALLDICT 575 | s5 s2 s(-2) PU2XC 576 | s6 s5 s(-2) PU2XC 577 | $JettonData$_constructor_total_supply_mintable_owner_content_wallet_code INLINECALLDICT 578 | }> 579 | $SampleJetton$_fun_get_wallet_address PROCREF:<{ 580 | __tact_context_sys GETGLOB 581 | MYADDR 582 | s1 s2 XCHG 583 | $JettonDefaultWallet$_init_child INLINECALLDICT 584 | $global_contractAddress INLINECALLDICT 585 | }> 586 | $SampleJetton$_fun_requireOwner PROCREF:<{ 587 | __tact_context_get_sender INLINECALLDICT 588 | s4 s(-1) PUXC 589 | __tact_slice_eq_bits INLINECALLDICT 590 | 132 THROWIFNOT 591 | }> 592 | $SampleJetton$_fun_owner PROCREF:<{ 593 | s3 PUSH 594 | }> 595 | $SendParameters$_constructor_to_value_bounce_mode_body PROCINLINE:<{ 596 | s2 s4 XCHG 597 | s2 s3 XCHG 598 | PUSHNULL 599 | PUSHNULL 600 | }> 601 | $TokenExcesses$_constructor_query_id PROCINLINE:<{ 602 | }> 603 | $SendParameters$_constructor_to_value_mode_body PROCINLINE:<{ 604 | TRUE 605 | 4 -ROLL 606 | PUSHNULL 607 | PUSHNULL 608 | }> 609 | $TakeWalletAddress$_constructor_query_id_wallet_address_owner_address PROCINLINE:<{ 610 | }> 611 | $SampleJetton$_internal_binary_Mint PROCINLINE:<{ 612 | __tact_context_get INLINECALLDICT 613 | s2 s3 XCHG 614 | 3 BLKDROP 615 | s6 PUSH 616 | 14534 PUSHINT 617 | s0 s2 XCHG 618 | __tact_slice_eq_bits INLINECALLDICT 619 | THROWANYIFNOT 620 | 3688 PUSHINT 621 | s4 PUSH 622 | THROWANYIFNOT 623 | 12241 PUSHINT 624 | s7 s2 PUSH2 625 | ADD 626 | s4 PUSH 627 | LEQ 628 | THROWANYIFNOT 629 | s1 s5 XCPU 630 | $SampleJetton$_fun_mint INLINECALLDICT 631 | }> 632 | $SampleJetton$_internal_text_fcbeb9a480966477480639c7cea4a578aa6a113b2903b26d01bc384663eceef6 PROCINLINE:<{ 633 | __tact_context_get INLINECALLDICT 634 | s2 s3 XCHG 635 | 3 BLKDROP 636 | 3688 PUSHINT 637 | s3 PUSH 638 | THROWANYIFNOT 639 | 12241 PUSHINT 640 | s6 PUSH 641 | 100 ADDCONST 642 | s3 PUSH 643 | LEQ 644 | THROWANYIFNOT 645 | 100 PUSHINT 646 | s5 PUSH 647 | $SampleJetton$_fun_mint INLINECALLDICT 648 | }> 649 | $SampleJetton$_internal_text_dc004c5b75be74376bd79df8713f2390620cc8a3095068b0583eb28ca3ac8ba0 PROCINLINE:<{ 650 | NIP 651 | __tact_context_get INLINECALLDICT 652 | s2 s3 XCHG 653 | 3 BLKDROP 654 | s3 PUSH 655 | 14534 PUSHINT 656 | s0 s2 XCHG 657 | __tact_slice_eq_bits INLINECALLDICT 658 | THROWANYIFNOT 659 | FALSE 660 | SWAP 661 | }> 662 | $SampleJetton$_internal_binary_TokenUpdateContent PROCINLINE:<{ 663 | 5 -ROLL 664 | $SampleJetton$_fun_requireOwner INLINECALLDICT 665 | s2 POP 666 | s3 s4 XCHG 667 | s3 s0 s0 XCHG3 668 | }> 669 | $SampleJetton$_internal_binary_TokenBurnNotification PROCINLINE:<{ 670 | NIP 671 | DUP 672 | __tact_not_null INLINECALLDICT 673 | s5 s8 XCHG 674 | s4 s7 XCHG 675 | s3 s6 XCHG 676 | s8 s7 s0 XCHG3 677 | $SampleJetton$_fun_requireSenderAsWalletOwner INLINECALLDICT 678 | s4 s7 XCHG2 679 | SUB 680 | s5 PUSH 681 | ISNULL 682 | NOT 683 | IF:<{ 684 | s0 s5 XCHG 685 | __tact_not_null INLINECALLDICT 686 | 0 PUSHINT 687 | FALSE 688 | 64 PUSHINT 689 | s0 s7 XCHG 690 | $TokenExcesses$_constructor_query_id INLINECALLDICT 691 | $TokenExcesses$_store_cell INLINECALLDICT 692 | s3 s4 XCHG 693 | s1 s3 s0 XCHG3 694 | s1 s7 XCHG 695 | $SendParameters$_constructor_to_value_bounce_mode_body INLINECALLDICT 696 | $global_send INLINECALLDICT 697 | s2 s3 XCHG 698 | }>ELSE<{ 699 | s4 POP 700 | s4 POP 701 | }> 702 | s4 s1 s3 XCHG3 703 | s0 s2 XCHG 704 | }> 705 | $SampleJetton$_internal_binary_ProvideWalletAddress PROCINLINE:<{ 706 | 23951 PUSHINT 707 | __tact_context_get INLINECALLDICT 708 | $Context$_get_value INLINECALLDICT 709 | 6100000 PUSHINT 710 | GEQ 711 | THROWANYIFNOT 712 | __tact_context_sys GETGLOB 713 | MYADDR 714 | s3 s(-1) PUXC 715 | $JettonDefaultWallet$_init_child INLINECALLDICT 716 | s0 s2 XCHG 717 | IF:<{ 718 | __tact_context_get_sender INLINECALLDICT 719 | 0 PUSHINT 720 | s0 s2 XCHG 721 | 64 PUSHINT 722 | s0 s4 XCHG 723 | $global_contractAddress INLINECALLDICT 724 | NEWC 725 | TRUE 726 | __tact_store_bool INLINECALLDICT 727 | s0 s5 XCHG2 728 | __tact_store_address INLINECALLDICT 729 | ENDC 730 | $Cell$_fun_asSlice INLINECALLDICT 731 | s5 s4 s0 XCHG3 732 | $TakeWalletAddress$_constructor_query_id_wallet_address_owner_address INLINECALLDICT 733 | $TakeWalletAddress$_store_cell INLINECALLDICT 734 | s2 s3 XCHG 735 | $SendParameters$_constructor_to_value_mode_body INLINECALLDICT 736 | $global_send INLINECALLDICT 737 | }>ELSE<{ 738 | s2 POP 739 | __tact_context_get_sender INLINECALLDICT 740 | 0 PUSHINT 741 | s0 s3 XCHG 742 | 64 PUSHINT 743 | s0 s3 XCHG 744 | $global_contractAddress INLINECALLDICT 745 | NEWC 746 | FALSE 747 | __tact_store_bool INLINECALLDICT 748 | ENDC 749 | $Cell$_fun_asSlice INLINECALLDICT 750 | s2 s5 XCHG 751 | $TakeWalletAddress$_constructor_query_id_wallet_address_owner_address INLINECALLDICT 752 | $TakeWalletAddress$_store_cell INLINECALLDICT 753 | $SendParameters$_constructor_to_value_mode_body INLINECALLDICT 754 | $global_send INLINECALLDICT 755 | }> 756 | }> 757 | %get_jetton_data PROC:<{ 758 | $SampleJetton$_contract_load INLINECALLDICT 759 | $SampleJetton$_fun_get_jetton_data INLINECALLDICT 760 | 5 5 BLKDROP2 761 | $JettonData$_to_external INLINECALLDICT 762 | }> 763 | %get_wallet_address PROC:<{ 764 | __tact_verify_address INLINECALLDICT 765 | $SampleJetton$_contract_load INLINECALLDICT 766 | 5 ROLL 767 | $SampleJetton$_fun_get_wallet_address INLINECALLDICT 768 | 5 1 BLKDROP2 769 | }> 770 | %owner PROC:<{ 771 | $SampleJetton$_contract_load INLINECALLDICT 772 | $SampleJetton$_fun_owner INLINECALLDICT 773 | 5 1 BLKDROP2 774 | }> 775 | supported_interfaces PROC:<{ 776 | 123515602279859691144772641439386770278 PUSHINT 777 | 209801025412363888721030803524359905849 PUSHINT 778 | 42980537499636128163026532310500881091 PUSHINT 779 | 209474421377847335869795010607481022628 PUSHINT 780 | 258390863389042349688353801369539695109 PUSHINT 781 | 86142586315491086060343270784266291122 PUSHINT 782 | }> 783 | get_abi_ipfs PROC:<{ 784 | x{697066733a2f2f516d52685865666b77695733426d745058664556314a69314578455a4847375a364e6b367037794a387a4d33426a} PUSHSLICE 785 | }> 786 | lazy_deployment_completed PROC:<{ 787 | c4 PUSH 788 | CTOS 789 | 1 LDI 790 | SWAP 791 | }> 792 | $SampleJetton$_contract_router_internal PROCREF:<{ 793 | c2 SAVE 794 | SAMEALTSAVE 795 | SWAP 796 | IFJMP:<{ 797 | DROP 798 | TRUE 799 | }> 800 | 0 PUSHINT 801 | OVER 802 | SBITS 803 | 31 GTINT 804 | IF:<{ 805 | DROP 806 | DUP 807 | 32 PLDU 808 | }> 809 | DUP 810 | 4235234258 PUSHINT 811 | EQUAL 812 | IFJMP:<{ 813 | DROP 814 | $Mint$_load INLINECALLDICT 815 | 1 2 BLKDROP2 816 | $SampleJetton$_internal_binary_Mint INLINECALLDICT 817 | TRUE 818 | }> 819 | DUP 820 | 2937889386 PUSHINT 821 | EQUAL 822 | IFJMP:<{ 823 | DROP 824 | $TokenUpdateContent$_load INLINECALLDICT 825 | NIP 826 | $SampleJetton$_internal_binary_TokenUpdateContent INLINECALLDICT 827 | TRUE 828 | }> 829 | DUP 830 | 2078119902 PUSHINT 831 | EQUAL 832 | IFJMP:<{ 833 | DROP 834 | $TokenBurnNotification$_load INLINECALLDICT 835 | 1 4 BLKDROP2 836 | $SampleJetton$_internal_binary_TokenBurnNotification INLINECALLDICT 837 | TRUE 838 | }> 839 | DUP 840 | 745978227 PUSHINT 841 | EQUAL 842 | IFJMP:<{ 843 | DROP 844 | $ProvideWalletAddress$_load INLINECALLDICT 845 | 1 3 BLKDROP2 846 | $SampleJetton$_internal_binary_ProvideWalletAddress INLINECALLDICT 847 | TRUE 848 | }> 849 | 0 EQINT 850 | IF:<{ 851 | HASHSU 852 | DUP 853 | 114319820043338273756724545349405963582647504019519623841762688061413941636854 PUSHINT 854 | EQUAL 855 | IFJMP:<{ 856 | DROP 857 | $SampleJetton$_internal_text_fcbeb9a480966477480639c7cea4a578aa6a113b2903b26d01bc384663eceef6 INLINECALLDICT 858 | TRUE 859 | RETALT 860 | }> 861 | 99509353686795994580079343596348776708726008258819386693306414918577339272096 PUSHINT 862 | EQUAL 863 | IFJMP:<{ 864 | $SampleJetton$_internal_text_dc004c5b75be74376bd79df8713f2390620cc8a3095068b0583eb28ca3ac8ba0 INLINECALLDICT 865 | TRUE 866 | RETALT 867 | }> 868 | }>ELSE<{ 869 | DROP 870 | }> 871 | FALSE 872 | }> 873 | recv_internal PROC:<{ 874 | SWAP 875 | CTOS 876 | 4 LDU 877 | SWAP 878 | 1 PUSHINT 879 | AND 880 | NEGATE 881 | SWAP 882 | LDMSGADDR 883 | SWAP 884 | __tact_verify_address INLINECALLDICT 885 | s0 s4 s2 PUXCPU 886 | s0 s3 XCHG 887 | 4 TUPLE 888 | __tact_context SETGLOB 889 | s0 s2 XCHG 890 | __tact_context_sender SETGLOB 891 | $SampleJetton$_contract_load INLINECALLDICT 892 | 2 5 BLKSWAP 893 | $SampleJetton$_contract_router_internal INLINECALLDICT 894 | 130 THROWIFNOT 895 | $SampleJetton$_contract_store INLINECALLDICT 896 | }> 897 | }END>c 898 | --------------------------------------------------------------------------------