Linting rules
S009: prefer-grams
Replaces the standard library's `ton()` alias with `grams()`.
Available since: Acton 1.2
Metadata
Code:S009Rule:prefer-gramsStatus: Stable sincev1.2.0Quick fix: sometimes available
What it does
Replaces the standard library's ton() alias with grams().
Why is this bad?
ton() is the old name of grams(). The replacement preserves the amount.
Behavior notes
This rule reports standard-library calls when the standard library provides grams.
It leaves user-defined functions and older standard libraries without grams unchanged.
If a local binding shadows grams, the rule reports a warning without an automatic fix.
E003 does not report the same call when this rule reports it.
Example
const amount = ton("0.1");Use instead:
const amount = grams("0.1");Last updated on