Search code examples
nearprotocol

Decimal place is not showing right


This is my code with 18 decimals

fn ft_metadata(&self) -> FungibleTokenMetadata {
        FungibleTokenMetadata {
            spec: FT_METADATA_SPEC.to_string(),
            name: String::from("Avrit fungible token"),
            symbol: String::from("AVRIT"),
            icon: None,
            reference: None,
            reference_hash: None,
            decimals: 18,
        }
    }

1×10^25 should show 1*10^7 tokens, but ref finance shows 1×10^19. Am I doing everything right?


Solution

  • Can you post a screenshot from ref finance? That link redirects to their homepage.

    Here are some resources that may help if you haven't checked them out yet:

    A Note on Decimals

    It is important to understand that decimals is only used for display purposes. All arithmetic inside the contract is still performed on integers, and it is the different user interfaces (wallets, exchanges, etc.) that must adjust the displayed values according to decimals.

    NEAR FT Metadata Specs