Repository navigation
fix: use tinybars for msg.value in evm hbar examples - #801
Open
theekrystallee wants to merge 2 commits into
Open
theekrystallee wants to merge 2 commits into
theekrystallee wants to merge 2 commits into
Conversation
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>
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
inside the evm,
msg.valueandaddress.balanceare tinybars (8 decimals). the consensus node divides an ethereum transaction's weibarvalueby 10^10 before the evm runs; only json-rpc wire values (transactionvalue,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); secondcall{value: 1 ether}fixedevm/hedera-services/system-contracts/exchange-rate.mdx: comparemsg.valuewithrequiredTinybarsdirectly (the old check demanded 10^10x the price and always reverted); warning rewrittenevm/hedera-services/hts-solidity/create-tokens.mdx: 1.5 usd =15 * 10**9tinycents;{value: tinybars}; payable rule (tokencreate price + 20%, minus fixed gas; a short payment returnsINSUFFICIENT_TX_FEEand a zero address without reverting); 90-day default (was ~92); json-rpc client info boxevm/tokens/whbar.mdx: solidity (10 * 10**8) vs ethers (parseEther("10")) deposits; corrected the "critical" box (only a nativeCryptoTransferlocks hbar;receive()/fallback()calldeposit())evm/differences/hbar-decimals.mdx: html table → markdown, in-evm vs json-rpc rows,VALUE_TOO_LOWrule, removed "hts up to 8 decimals"support/glossary.mdx: new tinybar entry; weibar entry no longer says the evm uses weibarsissues
closes #792
refs #379: the payable-amount rule is now documented on create-tokens