Skip to content

fix: use tinybars for msg.value in evm hbar examples - #801

Open
theekrystallee wants to merge 2 commits into
mainfrom
fix/792-hbar-units
Open

theekrystallee wants to merge 2 commits into
mainfrom
fix/792-hbar-units

Conversation

@theekrystallee

Copy link
Copy Markdown
Member

summary

inside the evm, msg.value and address.balance are tinybars (8 decimals). the consensus node divides an ethereum transaction's weibar value by 10^10 before the evm runs; only json-rpc wire values (transaction value, eth_getBalance, eth_gasPrice) are 18-decimal weibars. four pages taught the opposite and their solidity was off by 10^10.

  • evm/development/troubleshooting.mdx: tinybar sample (ONE_HBAR = 100_000_000); second call{value: 1 ether} fixed
  • evm/hedera-services/system-contracts/exchange-rate.mdx: compare msg.value with requiredTinybars directly (the old check demanded 10^10x the price and always reverted); warning rewritten
  • evm/hedera-services/hts-solidity/create-tokens.mdx: 1.5 usd = 15 * 10**9 tinycents; {value: tinybars}; payable rule (tokencreate price + 20%, minus fixed gas; a short payment returns INSUFFICIENT_TX_FEE and a zero address without reverting); 90-day default (was ~92); json-rpc client info box
  • evm/tokens/whbar.mdx: solidity (10 * 10**8) vs ethers (parseEther("10")) deposits; corrected the "critical" box (only a native CryptoTransfer locks hbar; receive()/fallback() call deposit())
  • evm/differences/hbar-decimals.mdx: html table → markdown, in-evm vs json-rpc rows, VALUE_TOO_LOW rule, removed "hts up to 8 decimals"
  • support/glossary.mdx: new tinybar entry; weibar entry no longer says the evm uses weibars

issues

closes #792
refs #379: the payable-amount rule is now documented on create-tokens

Inside the EVM, msg.value and address.balance are in tinybars (8
decimals). The network divides an Ethereum transaction's weibar value by
10^10 before the EVM runs; only JSON-RPC wire values (transaction value,
eth_getBalance, eth_gasPrice) are 18-decimal weibars. Four pages scaled
msg.value by 10**10, so their Solidity was off by 10^10 and the
exchange-rate example could never pass its check.

- troubleshooting, exchange-rate, create-tokens, whbar: compare and
  forward tinybars inside Solidity; show the ethers weibar case separately
- create-tokens: document the TokenCreate payable rule (price + 20%,
  INSUFFICIENT_TX_FEE returned without a revert) and the 90-day default
- whbar: only a native CryptoTransfer locks HBAR; receive()/fallback()
  call deposit()
- hbar-decimals: markdown table splitting in-EVM and JSON-RPC units
- glossary: add Tinybar, correct Weibar

Closes #792

Signed-off-by: krystal <56278409+theekrystallee@users.noreply.github.com>
@theekrystallee theekrystallee self-assigned this Oct 8, 2026
@theekrystallee
theekrystallee requested review from a team as code owners October 8, 2026 18:47
@mintlify

mintlify Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hedera-docs 🟢 Ready View Preview Nov 3, 2026, 3:40 PM

@theekrystallee

theekrystallee commented Oct 13, 2026 •

Copy link
Copy Markdown
Member Author

@LukeForrest-Hashgraph @deshmukhpranali @Reccetech can i pls get a review on this

- create-tokens: IExchangeRate(address(0x168)) so the snippet compiles; note that a create with custom fees needs about .40
- hbars, json-rpc, hardhat: relay uses 18-decimal weibars on the wire; msg.value is tinybars inside the EVM
- hbar-decimals: show the relay's -32602 error text instead of VALUE_TOO_LOW
- whbar: wrap example passes the WHBAR to the caller; unwrap is a direct holder call; repoint 404 WHBAR.sol links
- usdt0, layerzero, pyth: fix the same msg.value/tinybar wording, found in a repo-wide sweep
- layerzero: repoint 404 hedera-smart-contracts layer-zero links and the renamed bridging tutorial repo

Refs #792

Signed-off-by: krystal <56278409+theekrystallee@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
staging — 4d16262f Deployed Nov 3, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: evm pages use 18-decimal hbar values inside solidity (msg.value is tinybars)

1 participant