FXD

https://github.com/Into-the-Fathom/fathom-stablecoin-smart-contracts/blob/master/contracts/main/stablecoin-core/FathomStablecoin.sol

Overview

The FXD token adheres to the ERC-20 standard and includes additional functionalities tailored to the Fathom protocol's needs.

ERC-20 Standard Functions

name

  • Description: Returns the name of the token.

  • Returns: string representing the token's name.

symbol

  • Description: Returns the token symbol.

  • Returns: string representing the token's symbol.

decimals

  • Description: Returns the number of decimals the token uses.

  • Returns: uint8 representing the number of decimal places the token uses. This affects the granularity of the token.

totalSupply

  • Description: Returns the total amount of FXD tokens currently in circulation.

  • Returns: uint256 representing the total supply of tokens.

balanceOf

  • Parameters:

    • account (address): The address of the token holder.

  • Description: Provides the balance of FXD tokens held by a specific account.

  • Returns: uint256 representing the number of tokens held by the specified account.

transfer

  • Parameters:

    • to (address): The address of the recipient.

    • amount (uint256): The amount of FXD tokens to transfer.

  • Description: Transfers a specified amount of FXD tokens from the caller's account to another address.

  • Returns: bool indicating whether the transfer was successful.

  • Emits: Transfer event.

allowance

  • Parameters:

    • owner (address): The address of the token owner.

    • spender (address): The address of the spender.

  • Description: Returns the remaining number of tokens that the spender is allowed to spend on behalf of the owner.

  • Returns: uint256 representing the remaining amount of tokens allowed to be spent.

approve

  • Parameters:

    • spender (address): The address of the spender.

    • amount (uint256): The amount of FXD tokens the spender is allowed to use.

  • Description: Approves a spender to withdraw tokens from the owner's account multiple times, up to the specified amount.

  • Returns: bool indicating whether the approval was successful.

  • Emits: Approval event.

transferFrom

  • Parameters:

    • from (address): The address of the sender.

    • to (address): The address of the recipient.

    • amount (uint256): The amount of tokens to transfer.

  • Description: Transfers tokens from one account to another, using an allowance mechanism.

  • Returns: bool indicating whether the transfer was successful.

  • Emits: Transfer event.

Additional Functions

mint

  • Parameters:

    • to (address): The address that will receive the created tokens.

    • amount (uint256): The amount of tokens to create.

  • Description: Mints new FXD tokens and assigns them to the specified address, increasing the total supply. Can be called only by the StablecoinAdapter in the process of taking the loan.

burn

  • Parameters:

    • from (address): The address from which tokens will be burned.

    • amount (uint256): The amount of tokens to burn.

  • Description: Burns a specified amount of FXD tokens from a given account, reducing the total supply. Can be called only by the StablecoinAdapter in the process of repaying the loan.

increaseAllowance

  • Parameters:

    • spender (address): The address of the spender.

    • addedValue (uint256): The additional amount of tokens that the spender is allowed to spend.

  • Description: Increases the allowance that a spender has to use the caller’s tokens.

  • Returns: bool indicating whether the operation was successful.

decreaseAllowance

  • Parameters:

    • spender (address): The address of the spender.

    • subtractedValue (uint256): The amount by which to decrease the spender's allowance.

  • Description: Decreases the allowance that a spender has to use the caller’s tokens.

  • Returns: bool indicating whether the operation was successful.

Events

Transfer

  • Emitted when: Tokens are moved from one account to another.

  • Parameters:

    • from (address indexed): The address of the sender.

    • to (address indexed): The address of the receiver.

    • value (uint256): The amount of tokens transferred.

Approval

  • Emitted when: A spender is approved to use tokens from another account.

  • Parameters:

    • owner (address indexed): The address of the token owner.

    • spender (address indexed): The address of the spender who is granted permission.

    • value (uint256): The amount of tokens the spender is allowed to use.

Last updated

Copyright© Fathom App 2024.