From 88a276303df54b7cfc50bb228f54846401bd7b9a Mon Sep 17 00:00:00 2001 From: Kristijan Date: Wed, 10 Jun 2026 19:34:18 +0200 Subject: [PATCH] Rebrand wTON as wGRAM --- .../{wton => wgram}/JettonMinter.tolk | 6 ++--- .../{wton => wgram}/JettonWallet.tolk | 8 +++---- contracts/contracts/wgram/README.md | 5 ++++ .../{wton => wgram}/fees-management.tolk | 2 +- contracts/contracts/wton/README.md | 5 ---- contracts/package.json | 2 +- .../wton.spec.ts => wgram/wgram.spec.ts} | 24 +++++++++---------- .../wton.spec.ts => wgram/wgram.spec.ts} | 24 +++++++++---------- ...t.config.ts => wgram-gas-report.config.ts} | 4 ++-- ...-gas-report.json => wgram-gas-report.json} | 0 contracts/wrappers/jetton/JettonWallet.ts | 2 +- ...mpile.ts => wgram.JettonMinter.compile.ts} | 2 +- ...mpile.ts => wgram.JettonWallet.compile.ts} | 2 +- .../wrappers/{wton => wgram}/constants.ts | 0 contracts/wrappers/{wton => wgram}/errors.ts | 0 contracts/wrappers/{wton => wgram}/index.ts | 0 docs/contracts/index.md | 2 +- docs/contracts/overview/index.md | 2 +- .../overview/{wton => wgram}/_category_.yaml | 4 ++-- .../overview/{wton => wgram}/design.md | 22 ++++++++--------- .../overview/{wton => wgram}/gas_report.md | 16 ++++++------- .../overview/{wton => wgram}/index.md | 12 +++++----- 22 files changed, 72 insertions(+), 72 deletions(-) rename contracts/contracts/{wton => wgram}/JettonMinter.tolk (97%) rename contracts/contracts/{wton => wgram}/JettonWallet.tolk (96%) create mode 100644 contracts/contracts/wgram/README.md rename contracts/contracts/{wton => wgram}/fees-management.tolk (97%) delete mode 100644 contracts/contracts/wton/README.md rename contracts/tests/gas-report/{wton/wton.spec.ts => wgram/wgram.spec.ts} (94%) rename contracts/tests/{wton/wton.spec.ts => wgram/wgram.spec.ts} (98%) rename contracts/{wton-gas-report.config.ts => wgram-gas-report.config.ts} (83%) rename contracts/{wton-gas-report.json => wgram-gas-report.json} (100%) rename contracts/wrappers/{wton.JettonWallet.compile.ts => wgram.JettonMinter.compile.ts} (72%) rename contracts/wrappers/{wton.JettonMinter.compile.ts => wgram.JettonWallet.compile.ts} (72%) rename contracts/wrappers/{wton => wgram}/constants.ts (100%) rename contracts/wrappers/{wton => wgram}/errors.ts (100%) rename contracts/wrappers/{wton => wgram}/index.ts (100%) rename docs/contracts/overview/{wton => wgram}/_category_.yaml (56%) rename docs/contracts/overview/{wton => wgram}/design.md (65%) rename docs/contracts/overview/{wton => wgram}/gas_report.md (53%) rename docs/contracts/overview/{wton => wgram}/index.md (56%) diff --git a/contracts/contracts/wton/JettonMinter.tolk b/contracts/contracts/wgram/JettonMinter.tolk similarity index 97% rename from contracts/contracts/wton/JettonMinter.tolk rename to contracts/contracts/wgram/JettonMinter.tolk index 0cb12198a..8e1a75dad 100644 --- a/contracts/contracts/wton/JettonMinter.tolk +++ b/contracts/contracts/wgram/JettonMinter.tolk @@ -12,7 +12,7 @@ import "fees-management" contract JettonMinter { author: "SmartContract Chainlink Limited SEZC" version: "0.0.1" - description: "link.chain.ton.wton.JettonMinter" + description: "link.chain.ton.wgram.JettonMinter" storage: MinterStorage incomingMessages: AllowedMessageToMinter @@ -96,7 +96,7 @@ fun onInternalMessage(in: InMessage) { queryId: msg.queryId } }); - // If the send action cannot be executed, the tx must fail and bounce back to the wallet to restore wTON. + // If the send action cannot be executed, the tx must fail and bounce back to the wallet to restore wGRAM. excessesMsg.send(SEND_MODE_CARRY_ALL_REMAINING_MESSAGE_VALUE | SEND_MODE_BOUNCE_ON_ACTION_FAIL); } @@ -193,7 +193,7 @@ struct (0x00) OnchainMetadataReply { // --- Getters --- get fun typeAndVersion(): (slice, slice) { - return ("link.chain.ton.wton.JettonMinter".literalSlice(), "0.0.1".literalSlice()); + return ("link.chain.ton.wgram.JettonMinter".literalSlice(), "0.0.1".literalSlice()); } get fun get_jetton_data(): JettonDataReply { diff --git a/contracts/contracts/wton/JettonWallet.tolk b/contracts/contracts/wgram/JettonWallet.tolk similarity index 96% rename from contracts/contracts/wton/JettonWallet.tolk rename to contracts/contracts/wgram/JettonWallet.tolk index 0c2a48b8c..cef901036 100644 --- a/contracts/contracts/wton/JettonWallet.tolk +++ b/contracts/contracts/wgram/JettonWallet.tolk @@ -11,7 +11,7 @@ import "fees-management" contract JettonWallet { author: "SmartContract Chainlink Limited SEZC" version: "0.0.1" - description: "link.chain.ton.wton.JettonWallet" + description: "link.chain.ton.wgram.JettonWallet" storage: WalletStorage incomingMessages: AllowedMessageToWallet @@ -68,7 +68,7 @@ fun onInternalMessage(in: InMessage) { val jettonBalanceNext = storage.jettonBalance + msg.jettonAmount; val requiredReserve = requiredWalletReserve(jettonBalanceNext); // Hard reserve check: the inbound transfer must fund the full post-credit backing floor - // before we credit wTON or allow any forward / excess action to run. + // before we credit wGRAM or allow any forward / excess action to run. assert (contract.getOriginalBalance() >= requiredReserve + msg.forwardTonAmount) throw ERROR_UNSUFFICIENT_AMOUNT; // Soft reserve check: keep TON that was already on the wallet before this message from // being reclassified as outbound excess. This surplus is best-effort under RESERVE_MODE_AT_MOST. @@ -127,7 +127,7 @@ fun onInternalMessage(in: InMessage) { storage.jettonBalance -= msg.jettonAmount; storage.save(); - // Preserve the remaining wTON backing plus storage reserve exactly, or abort the transfer. + // Preserve the remaining wGRAM backing plus storage reserve exactly, or abort the transfer. reserveToncoinsOnBalance(requiredWalletReserve(storage.jettonBalance), reserveModeExactFail()); val deployMsg = createMessage({ @@ -214,7 +214,7 @@ struct JettonWalletDataReply { // --- Getters --- get fun typeAndVersion(): (slice, slice) { - return ("link.chain.ton.wton.JettonWallet".literalSlice(), "0.0.1".literalSlice()); + return ("link.chain.ton.wgram.JettonWallet".literalSlice(), "0.0.1".literalSlice()); } get fun get_wallet_data(): JettonWalletDataReply { diff --git a/contracts/contracts/wgram/README.md b/contracts/contracts/wgram/README.md new file mode 100644 index 000000000..3094aa332 --- /dev/null +++ b/contracts/contracts/wgram/README.md @@ -0,0 +1,5 @@ +# Wrapped TON + +A token escrow protocol to make TON behave as Jetton in a new asset called wGRAM. + +Documentation: [docs/contracts/overview/wgram](../../../docs/contracts/overview/wgram/index.md) diff --git a/contracts/contracts/wton/fees-management.tolk b/contracts/contracts/wgram/fees-management.tolk similarity index 97% rename from contracts/contracts/wton/fees-management.tolk rename to contracts/contracts/wgram/fees-management.tolk index 586e1fdc8..2250405e1 100644 --- a/contracts/contracts/wton/fees-management.tolk +++ b/contracts/contracts/wgram/fees-management.tolk @@ -29,7 +29,7 @@ const MIN_STORAGE_DURATION = 5 * 365 * 24 * 3600 // 5 years // these constants are used to estimate gas fee (how much we should remain on balance for a swap to succeed); // they must stay exactly equal to the calibrated measured gas values for the covered live paths; // if those measured values drift, tests fail. -// actual consumed gas is measured by tests/gas-report/wton/Wton.spec.ts via yarn wton-gas-report +// actual consumed gas is measured by tests/gas-report/wgram/wgram.spec.ts via yarn wgram-gas-report // GAS_CONSUMPTION_JettonTransfer is calibrated against the max sender-side path that reuses // checkAmountIsEnoughToTransfer (wallet transfer sender vs mint sender candidate). // GAS_CONSUMPTION_JettonReceive is calibrated against the max live receive branch with both diff --git a/contracts/contracts/wton/README.md b/contracts/contracts/wton/README.md deleted file mode 100644 index 6a04aaabb..000000000 --- a/contracts/contracts/wton/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Wrapped TON - -A token escrow protocol to make TON behave as Jetton in a new asset called wTON. - -Documentation: [docs/contracts/overview/wton](../../../docs/contracts/overview/wton/index.md) diff --git a/contracts/package.json b/contracts/package.json index 4f7618230..2714645ad 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -27,7 +27,7 @@ "fmt-typescript:check": "prettier --check .", "fmt-typescript": "prettier --write .", "ccip-gas-report": "blueprint test --gas-report -- --config ccip-gas-report.config.ts", - "wton-gas-report": "blueprint test --gas-report -- --config wton-gas-report.config.ts", + "wgram-gas-report": "blueprint test --gas-report -- --config wgram-gas-report.config.ts", "get-key-pair": "ts-node scripts/getKeyPair.ts" }, "dependencies": { diff --git a/contracts/tests/gas-report/wton/wton.spec.ts b/contracts/tests/gas-report/wgram/wgram.spec.ts similarity index 94% rename from contracts/tests/gas-report/wton/wton.spec.ts rename to contracts/tests/gas-report/wgram/wgram.spec.ts index 0b5d651f4..d80fdfab9 100644 --- a/contracts/tests/gas-report/wton/wton.spec.ts +++ b/contracts/tests/gas-report/wgram/wgram.spec.ts @@ -8,9 +8,9 @@ import { Blockchain, SandboxContract, TreasuryContract, printTransactionFees } f import { JettonMinter, builder as minterBuilder } from '../../../wrappers/jetton/JettonMinter' import { JettonWallet, builder as walletBuilder } from '../../../wrappers/jetton/JettonWallet' -import { WTON_MINT_OPCODE } from '../../../wrappers/wton' +import { WTON_MINT_OPCODE } from '../../../wrappers/wgram' -const JETTON_DATA_URI = 'wton.gas' +const JETTON_DATA_URI = 'wgram.gas' type ConfiguredGasConstants = { GAS_CONSUMPTION_JettonTransfer: number @@ -35,7 +35,7 @@ function readFeesManagementConstant(source: string, name: string) { } function readFeesManagementSource() { - const feesFile = path.join(__dirname, '../../../contracts/wton/fees-management.tolk') + const feesFile = path.join(__dirname, '../../../contracts/wgram/fees-management.tolk') return fs.readFileSync(feesFile, 'utf8') } @@ -118,7 +118,7 @@ function internalTxTo(result: { transactions: Array }, destination: Address return tx } -describe('wTON gas calibration', () => { +describe('wGRAM gas calibration', () => { let blockchain: Blockchain let minterCode: Cell let walletCode: Cell @@ -132,8 +132,8 @@ describe('wTON gas calibration', () => { let nextQueryId: bigint beforeAll(async () => { - minterCode = await compile('wton.JettonMinter') - walletCode = await compile('wton.JettonWallet') + minterCode = await compile('wgram.JettonMinter') + walletCode = await compile('wgram.JettonWallet') }) beforeEach(async () => { @@ -205,10 +205,10 @@ describe('wTON gas calibration', () => { it('keeps fee-management gas constants aligned with measured wallet and minter execution', async () => { const configured = readConfiguredGasConstants() // Exercise the highest live receive branch: notify recipient owner and still send excesses. - const transferForwardPayload = beginCell().storeStringTail('wton.gas.forward').endCell() - const transferCustomPayload = beginCell().storeStringTail('wton.gas.custom').endCell() - const burnCustomPayload = beginCell().storeStringTail('wton.gas.burn').endCell() - const mintForwardPayload = beginCell().storeStringTail('wton.gas.mint-forward').endCell() + const transferForwardPayload = beginCell().storeStringTail('wgram.gas.forward').endCell() + const transferCustomPayload = beginCell().storeStringTail('wgram.gas.custom').endCell() + const burnCustomPayload = beginCell().storeStringTail('wgram.gas.burn').endCell() + const mintForwardPayload = beginCell().storeStringTail('wgram.gas.mint-forward').endCell() const mintResult = await mintTo(alice.address, toNano('1.5'), { tonAmount: toNano('0.3'), @@ -277,7 +277,7 @@ describe('wTON gas calibration', () => { it('keeps fee-shape constants aligned with live transfer and burn message bodies', () => { const configured = readConfiguredShapeConstants() - const forwardPayload = beginCell().storeStringTail('wton.gas.shape').endCell() + const forwardPayload = beginCell().storeStringTail('wgram.gas.shape').endCell() const maxCoins = (1n << 120n) - 1n const transferBodyStats = cellStats( @@ -375,7 +375,7 @@ describe('wTON gas calibration', () => { destination: alice.address, tonAmount: toNano('0.3'), jettonAmount: toNano('0.7'), - // The wTON minter enforces transferInitiator == null on mint, so the actual outgoing + // The wGRAM minter enforces transferInitiator == null on mint, so the actual outgoing // InternalTransferStep is smaller than transferBodyStats. We use transferBodyStats as // a strict upper bound for the outgoing — if that bound fits inside the incoming, // the real outgoing fits too. diff --git a/contracts/tests/wton/wton.spec.ts b/contracts/tests/wgram/wgram.spec.ts similarity index 98% rename from contracts/tests/wton/wton.spec.ts rename to contracts/tests/wgram/wgram.spec.ts index bb737f00f..18c71af30 100644 --- a/contracts/tests/wton/wton.spec.ts +++ b/contracts/tests/wgram/wgram.spec.ts @@ -15,10 +15,10 @@ import { ERROR_INVALID_RECIPIENT, WTON_MINT_OPCODE, WTON_WITHDRAW_EXCESS_OPCODE, -} from '../../wrappers/wton' +} from '../../wrappers/wgram' import * as bouncer from '../../wrappers/test/mock/Bouncer' -const JETTON_DATA_URI = 'wton.test' +const JETTON_DATA_URI = 'wgram.test' const MASTERCHAIN_ZERO_ADDRESS = Address.parse(`-1:${'0'.repeat(64)}`) type MintOptions = { @@ -34,7 +34,7 @@ type MintOptions = { value?: bigint } -describe('wTON', () => { +describe('wGRAM', () => { let blockchain: Blockchain let minterCode: Cell @@ -50,8 +50,8 @@ describe('wTON', () => { let nextQueryId: bigint beforeAll(async () => { - minterCode = await compile('wton.JettonMinter') - walletCode = await compile('wton.JettonWallet') + minterCode = await compile('wgram.JettonMinter') + walletCode = await compile('wgram.JettonWallet') bouncerCode = await compile('tests.mock.Bouncer') }) @@ -60,7 +60,7 @@ describe('wTON', () => { const contract = blockchain.openContract( JettonMinter.createFromConfig( { - // wTON has no admin runtime path; deploy storage matches the get_jetton_data null admin. + // wGRAM has no admin runtime path; deploy storage matches the get_jetton_data null admin. admin: null, transferAdmin: null, walletCode: customWalletCode, @@ -494,7 +494,7 @@ describe('wTON', () => { }) describe('minting', () => { - it('mints wTON into a backed wallet', async () => { + it('mints wGRAM into a backed wallet', async () => { const mintAmount = toNano('1') await mintTo(alice.address, { jettonAmount: mintAmount }) @@ -814,12 +814,12 @@ describe('wTON', () => { expect(await totalSupply()).toEqual(0n) }) - it('rejects metadata changes because wTON has no admin opcode surface', async () => { + it('rejects metadata changes because wGRAM has no admin opcode surface', async () => { const dataBefore = await minter.getJettonData() const result = await minter.sendChangeContent(deployer.getSender(), { message: { queryId: nextQueryId++, - content: beginCell().storeStringTail('wton.changed').endCell(), + content: beginCell().storeStringTail('wgram.changed').endCell(), }, }) @@ -836,7 +836,7 @@ describe('wTON', () => { }) describe('transferring', () => { - it('transfers wTON between wallets', async () => { + it('transfers wGRAM between wallets', async () => { const mintAmount = toNano('2') const transferAmount = toNano('0.75') await mintTo(alice.address, { jettonAmount: mintAmount }) @@ -1264,7 +1264,7 @@ describe('wTON', () => { expect(await walletBalance(alice.address)).toEqual(mintAmount) }) - it('burns wTON and pays the nominated recipient', async () => { + it('burns wGRAM and pays the nominated recipient', async () => { const mintAmount = toNano('1') await mintTo(alice.address, { jettonAmount: mintAmount }) @@ -1792,7 +1792,7 @@ describe('wTON', () => { } } - // For wTON solvency we care about two invariants: supply matches wallet balances, and the + // For wGRAM solvency we care about two invariants: supply matches wallet balances, and the // minter plus all wallet backings still cover that supply with the minter reserve on top. async function assertCoreInvariants(owners: Address[]) { const supply = await totalSupply() diff --git a/contracts/wton-gas-report.config.ts b/contracts/wgram-gas-report.config.ts similarity index 83% rename from contracts/wton-gas-report.config.ts rename to contracts/wgram-gas-report.config.ts index 280282171..37b3619e7 100644 --- a/contracts/wton-gas-report.config.ts +++ b/contracts/wgram-gas-report.config.ts @@ -3,7 +3,7 @@ import type { Config } from 'jest' const config: Config = { preset: 'ts-jest', testEnvironment: '@ton/sandbox/jest-environment', - testMatch: ['**/tests/gas-report/wton/**/*.spec.ts'], + testMatch: ['**/tests/gas-report/wgram/**/*.spec.ts'], modulePathIgnorePatterns: ['/node_modules/', '/dist/', '/vendor/'], testTimeout: 120000, reporters: [ @@ -13,7 +13,7 @@ const config: Config = { { snapshotDir: '.snapshot', contractDatabase: 'contract.abi.json', - reportName: 'wton-gas-report', + reportName: 'wgram-gas-report', depthCompare: 2, removeRawResult: true, }, diff --git a/contracts/wton-gas-report.json b/contracts/wgram-gas-report.json similarity index 100% rename from contracts/wton-gas-report.json rename to contracts/wgram-gas-report.json diff --git a/contracts/wrappers/jetton/JettonWallet.ts b/contracts/wrappers/jetton/JettonWallet.ts index 37a5fbe31..7f3e31f42 100644 --- a/contracts/wrappers/jetton/JettonWallet.ts +++ b/contracts/wrappers/jetton/JettonWallet.ts @@ -108,7 +108,7 @@ export type WithdrawTonsMessage = { queryId: bigint } -// wTON-specific extension: lets the wallet owner withdraw any TON surplus +// wGRAM-specific extension: lets the wallet owner withdraw any TON surplus // sitting above the strict `jettonBalance + storage_fee` export type AskToWithdrawExcess = { queryId: bigint diff --git a/contracts/wrappers/wton.JettonWallet.compile.ts b/contracts/wrappers/wgram.JettonMinter.compile.ts similarity index 72% rename from contracts/wrappers/wton.JettonWallet.compile.ts rename to contracts/wrappers/wgram.JettonMinter.compile.ts index cc63f5673..39d33bd27 100644 --- a/contracts/wrappers/wton.JettonWallet.compile.ts +++ b/contracts/wrappers/wgram.JettonMinter.compile.ts @@ -2,6 +2,6 @@ import { CompilerConfig } from '@ton/blueprint' export const compile: CompilerConfig = { lang: 'tolk', - entrypoint: 'contracts/wton/JettonWallet.tolk', + entrypoint: 'contracts/wgram/JettonMinter.tolk', withStackComments: true, } diff --git a/contracts/wrappers/wton.JettonMinter.compile.ts b/contracts/wrappers/wgram.JettonWallet.compile.ts similarity index 72% rename from contracts/wrappers/wton.JettonMinter.compile.ts rename to contracts/wrappers/wgram.JettonWallet.compile.ts index 1fec5cb05..cc6cb356e 100644 --- a/contracts/wrappers/wton.JettonMinter.compile.ts +++ b/contracts/wrappers/wgram.JettonWallet.compile.ts @@ -2,6 +2,6 @@ import { CompilerConfig } from '@ton/blueprint' export const compile: CompilerConfig = { lang: 'tolk', - entrypoint: 'contracts/wton/JettonMinter.tolk', + entrypoint: 'contracts/wgram/JettonWallet.tolk', withStackComments: true, } diff --git a/contracts/wrappers/wton/constants.ts b/contracts/wrappers/wgram/constants.ts similarity index 100% rename from contracts/wrappers/wton/constants.ts rename to contracts/wrappers/wgram/constants.ts diff --git a/contracts/wrappers/wton/errors.ts b/contracts/wrappers/wgram/errors.ts similarity index 100% rename from contracts/wrappers/wton/errors.ts rename to contracts/wrappers/wgram/errors.ts diff --git a/contracts/wrappers/wton/index.ts b/contracts/wrappers/wgram/index.ts similarity index 100% rename from contracts/wrappers/wton/index.ts rename to contracts/wrappers/wgram/index.ts diff --git a/docs/contracts/index.md b/docs/contracts/index.md index f7f671149..9c0ecd5f4 100644 --- a/docs/contracts/index.md +++ b/docs/contracts/index.md @@ -15,7 +15,7 @@ This repository includes many contracts for the TON network implemented in the [ - [CCIP](./overview/ccip/index.md) - [Deployable](./overview/deployable.md) - [MCMS](./overview/mcms/index.md) -- [wTON](./overview/wton/index.md) +- [wGRAM](./overview/wgram/index.md) ## Development guides diff --git a/docs/contracts/overview/index.md b/docs/contracts/overview/index.md index bfe63073f..8742f2f36 100644 --- a/docs/contracts/overview/index.md +++ b/docs/contracts/overview/index.md @@ -12,7 +12,7 @@ sidebar_position: 1 - [CCIP](./ccip/index.md) - [Deployable](./deployable.md) - [MCMS](./mcms/index.md) -- [wTON](./wton/index.md) +- [wGRAM](./wgram/index.md) ### Examples diff --git a/docs/contracts/overview/wton/_category_.yaml b/docs/contracts/overview/wgram/_category_.yaml similarity index 56% rename from docs/contracts/overview/wton/_category_.yaml rename to docs/contracts/overview/wgram/_category_.yaml index d5787011f..92d560dc4 100644 --- a/docs/contracts/overview/wton/_category_.yaml +++ b/docs/contracts/overview/wgram/_category_.yaml @@ -1,7 +1,7 @@ position: 6 -label: wTON +label: wGRAM collapsible: true collapsed: true link: type: doc - id: contracts-overview-wton-index + id: contracts-overview-wgram-index diff --git a/docs/contracts/overview/wton/design.md b/docs/contracts/overview/wgram/design.md similarity index 65% rename from docs/contracts/overview/wton/design.md rename to docs/contracts/overview/wgram/design.md index ec8bb4d1e..b85b415f6 100644 --- a/docs/contracts/overview/wton/design.md +++ b/docs/contracts/overview/wgram/design.md @@ -1,31 +1,31 @@ --- -id: contracts-overview-wton-design +id: contracts-overview-wgram-design title: Design sidebar_label: Design sidebar_position: 1 --- -# wTON - Design +# wGRAM - Design -wTON is a fully backed Jetton wrapper around TON: +wGRAM is a fully backed Jetton wrapper around GRAM: -- Minting funds the recipient wallet with the TON backing and issues the same amount of wTON there. -- Burning destroys wTON in the wallet and routes the withdrawn TON back to the chosen payout destination via the minter. -- Transfers move both the wTON balance and its TON backing between wTON wallets. -- Transfers stay Jetton-compatible, so ordinary Jetton tooling can interact with wTON wallets. +- Minting funds the recipient wallet with the GRAM backing and issues the same amount of wGRAM there. +- Burning destroys wGRAM in the wallet and routes the withdrawn GRAM back to the chosen payout destination via the minter. +- Transfers move both the wGRAM balance and its GRAM backing between wGRAM wallets. +- Transfers stay Jetton-compatible, so ordinary Jetton tooling can interact with wGRAM wallets. The implementation keeps the protocol surface intentionally small: - `JettonMinter.tolk` tracks total supply, serves wallet-address requests, dispatches mint funding into wallets, and settles burn withdrawals. -- `JettonWallet.tolk` holds user balances, escrows the per-wallet TON backing, enforces owner-only transfer and burn requests, and processes incoming internal transfers. +- `JettonWallet.tolk` holds user balances, escrows the per-wallet GRAM backing, enforces owner-only transfer and burn requests, and processes incoming internal transfers. - `fees-management.tolk` contains the storage, forward-fee, and gas constants that the runtime checks use to reject underfunded mint, transfer, and burn messages before balances move. The main behavior differences from a generic Jetton are deliberate: -- wTON has no admin controls after deployment. +- wGRAM has no admin controls after deployment. - Workflows are restricted to `MY_WORKCHAIN` so fee budgeting and refund paths stay deterministic. - Mint bounce refunds are best-effort: supply is restored first, and any refund send is attempted with `IGNORE_ERRORS` rather than treated as protocol-critical. -- Burn payouts are protocol-critical, not best-effort. The minter sends the payout to `sendExcessesTo` under `SEND_MODE_CARRY_ALL_REMAINING_MESSAGE_VALUE | SEND_MODE_BOUNCE_ON_ACTION_FAIL`. If the action phase fails — either because RAWRESERVE cannot keep the minter's rent reserve intact (post-msg balance below the floor) or because the subsequent payout send would push the balance below the just-set reserve floor — the transaction reverts, the compute-phase `totalSupply` decrement is undone, the burn notification bounces back to the wallet, and the wallet's `onBouncedMessage` restores the burned `jettonBalance`. Net effect: the burner keeps their wTON and no TON is moved. The recipient's compute-phase failure (i.e., a non-bounceable destination that throws on receive) is _not_ an action-phase failure for the minter — with `BounceMode.NoBounce` the TON is still deposited at the recipient address even if its code throws. +- Burn payouts are protocol-critical, not best-effort. The minter sends the payout to `sendExcessesTo` under `SEND_MODE_CARRY_ALL_REMAINING_MESSAGE_VALUE | SEND_MODE_BOUNCE_ON_ACTION_FAIL`. If the action phase fails — either because RAWRESERVE cannot keep the minter's rent reserve intact (post-msg balance below the floor) or because the subsequent payout send would push the balance below the just-set reserve floor — the transaction reverts, the compute-phase `totalSupply` decrement is undone, the burn notification bounces back to the wallet, and the wallet's `onBouncedMessage` restores the burned `jettonBalance`. Net effect: the burner keeps their wGRAM and no GRAM is moved. The recipient's compute-phase failure (i.e., a non-bounceable destination that throws on receive) is _not_ an action-phase failure for the minter — with `BounceMode.NoBounce` the GRAM is still deposited at the recipient address even if its code throws. ## Jetton Version @@ -39,4 +39,4 @@ Base Jetton Tolk implementation from > This version is straightforward - it is a forked Stablecoin contract with removed governance functionality and added burn mechanism. Until recent times, it was the most suitable Jetton for basic on-chain coin use cases. -Which is exactly what we need as a base for wTON (and CCTs), and the [ton-blockchain/tolk-bench](https://github.com/ton-blockchain/tolk-bench) is implemented in latest Tolk 1.4 and brings substantial gas improvements over using FunC originals. +Which is exactly what we need as a base for wGRAM (and CCTs), and the [ton-blockchain/tolk-bench](https://github.com/ton-blockchain/tolk-bench) is implemented in latest Tolk 1.4 and brings substantial gas improvements over using FunC originals. diff --git a/docs/contracts/overview/wton/gas_report.md b/docs/contracts/overview/wgram/gas_report.md similarity index 53% rename from docs/contracts/overview/wton/gas_report.md rename to docs/contracts/overview/wgram/gas_report.md index 2ecedae94..6d6e8f958 100644 --- a/docs/contracts/overview/wton/gas_report.md +++ b/docs/contracts/overview/wgram/gas_report.md @@ -1,22 +1,22 @@ --- -id: contracts-overview-wton-gas-report +id: contracts-overview-wgram-gas-report title: Gas Report sidebar_label: Gas Report sidebar_position: 2 --- -# wTON - Gas Reporter And Fee Constants +# wGRAM - Gas Reporter And Fee Constants -The fee guards in `fees-management.tolk` must stay aligned with the measured live paths covered by [tests/gas-report/wton/Wton.spec.ts](../../../../contracts/tests/gas-report/wton/Wton.spec.ts). +The fee guards in `fees-management.tolk` must stay aligned with the measured live paths covered by [tests/gas-report/wgram/wgram.spec.ts](../../../../contracts/tests/gas-report/wgram/wgram.spec.ts). From [contracts/package.json](../../../../contracts/package.json), run the dedicated reporter from the `contracts` workspace: ```sh cd chainlink-ton/contracts -yarn wton-gas-report +yarn wgram-gas-report ``` -This suite measures the worst covered execution branches and compares them against the constants in [contracts/contracts/wton/fees-management.tolk](../../../../contracts/contracts/wton/fees-management.tolk): +This suite measures the worst covered execution branches and compares them against the constants in [contracts/contracts/wgram/fees-management.tolk](../../../../contracts/contracts/wgram/fees-management.tolk): - `GAS_CONSUMPTION_JettonTransfer` - `GAS_CONSUMPTION_JettonReceive` @@ -27,8 +27,8 @@ This suite measures the worst covered execution branches and compares them again When the reporter fails after a contract-path change: -1. Re-run `yarn wton-gas-report` and read the measured values printed by the failing test. -2. Update the matching constants in [contracts/contracts/wton/fees-management.tolk](../../../../contracts/contracts/wton/fees-management.tolk). -3. Re-run `yarn wton-gas-report` until the measured values and configured constants match exactly. +1. Re-run `yarn wgram-gas-report` and read the measured values printed by the failing test. +2. Update the matching constants in [contracts/contracts/wgram/fees-management.tolk](../../../../contracts/contracts/wgram/fees-management.tolk). +3. Re-run `yarn wgram-gas-report` until the measured values and configured constants match exactly. Only update these constants after an intentional logic change on a covered path. If the numbers drift unexpectedly, treat that as a behavior change to review first, not just a docs-only constant refresh. diff --git a/docs/contracts/overview/wton/index.md b/docs/contracts/overview/wgram/index.md similarity index 56% rename from docs/contracts/overview/wton/index.md rename to docs/contracts/overview/wgram/index.md index d41161f10..f3dfa8c5e 100644 --- a/docs/contracts/overview/wton/index.md +++ b/docs/contracts/overview/wgram/index.md @@ -1,20 +1,20 @@ --- -id: contracts-overview-wton-index -title: wTON +id: contracts-overview-wgram-index +title: wGRAM sidebar_label: Overview sidebar_position: 1 --- -# wTON +# wGRAM -A token escrow protocol to make TON behave as Jetton in a new asset called wTON. +A token escrow protocol to make GRAM behave as Jetton in a new asset called wGRAM. **Features:** - Standard Jetton [TEP #74](https://github.com/ton-blockchain/TEPs/blob/master/text/0074-jettons-standard.md) minimal deviation - No admin: - - Mint (new) wTON by providing TON - - Burn wTON to withdraw TON + - Mint (new) wGRAM by providing GRAM + - Burn wGRAM to withdraw GRAM ## Topics