Skip to content
marverkioPublic

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

L1X Fungible Token (ERC-20 Equivalent) Smart Contract

This repository contains the source code for a Fungible Token (FT) built on top of the L1X SDK using the Rust programming language. This smart contract implements core functionalities similar to the ERC-20 standard on EVM networks, including balance management, token transfers, and an allowance delegation system.


Key Features

  • FT/ERC-20 Standard Compatibility: Supports core functions such as transfer, transfer_from, approve, and allowance checks.
  • Built-in Metadata Management: Stores comprehensive token information including Name, Symbol, Decimals (up to 18), and an optional icon URL.
  • Authorized Minting Mechanism: The contract owner can add other addresses to the Authorized Callers list to mint new tokens in the future.
  • Automated Transaction Safety: Utilizes Rust's safe arithmetic methods (checked_add & checked_sub) to prevent overflow or underflow vulnerabilities.

Core Data Structures

The smart contract organizes its data into three main structures:

1. FTMetadata

Stores the basic identity of the issued token:

  • name: Full name of the token (e.g., "Layer One X Coin").
  • symbol: Token symbol/ticker (e.g., "L1X").
  • decimals: Number of decimal places (maximum 18 decimals).
  • icon: Optional external link for the token icon image.

2. L1xFtErc20 (Contract State)

The main state stored in the blockchain:

  • metadata: Token identity profile.
  • balances: A key-value map (LookupMap) connecting addresses (Address) to their token balances (u128).
  • allowances: A key-value map (LookupMap) managing token withdrawal quotas for third parties.
  • total_supply: The total amount of tokens currently in circulation.
  • authorized_callers: A set of addresses (BTreeSet) granted permission to mint new tokens.

Contract Functions (API Reference)

Contract Initialization

pub fn new(metadata: FTMetadata, account_ids: Vec<Address>, amounts: Vec<U128>)

License

This smart contract project is open-source and available under the MIT / Apache 2.0 license. You are free to copy, modify, and redistribute it for your DeFi project needs. Security Note: This function can only be called once by the contract owner during initial deployment. It sets the metadata and directly distributes the initial token supply to the targeted accounts.

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages