Skip to content

cadalt0/midnighttokencontract

Repository files navigation

ConfigurableFungibleToken Contract

Overview

ConfigurableFungibleToken is a smart contract built on Midnight Network that implements a configurable fungible token with ownership and access control.

Built On Midnight Network

This contract is deployed and executed on Midnight Network's Preprod testnet, leveraging Midnight's privacy-first blockchain infrastructure. Midnight Network enables private smart contracts using Zero Knowledge (ZK) proofs while maintaining transparency and security.

What It Does

The ConfigurableFungibleToken contract provides:

Core Functionality

  • Token Creation: Initialize a new fungible token with:
    • Custom token name
    • Configurable initial supply
    • Designated initial recipient
    • Owner assignment

Token Operations

  • Transfer: Send tokens between accounts
  • Balance Checking: Query token balances
  • Approval System: Allow third parties to spend tokens on your behalf
  • Transfer From: Execute approved token transfers

Administrative Features

  • Mint: Create new tokens (owner only)
  • Burn: Destroy tokens (owner only)
  • Ownership Transfer: Change contract owner (owner only)
  • Ownable Pattern: Role-based access control with a single owner

Key Features

Configurable Parameters
Define token name, initial supply, and owner at deployment time

ERC-20 Style Interface
Standard fungible token operations familiar to blockchain developers

Privacy on Midnight Network
Leverages Midnight's ZK proof system for enhanced privacy

Owner-Based Access Control
Administrative operations protected by owner-only restrictions

Zero Knowledge Circuits
Compiles to 12 optimized ZK circuits for efficient on-chain execution

Deployment

The contract is deployed to Midnight Network's Preprod testnet using:

  • Proof Server: Generates ZK proofs for transactions
  • Private State Provider: Manages local contract state
  • Indexer: Queries blockchain data
  • Wallet SDK: Handles transaction signing and balance management

Contract State

After deployment, the contract manages:

  • Token name and metadata
  • Total supply tracking
  • Account balances
  • Approved spending allowances
  • Current owner address

Technology Stack

  • Language: Compact (Midnight's smart contract language)
  • Network: Midnight Network (Preprod)
  • Proof System: Zero Knowledge (ZK) proofs
  • Wallet: Shielded + Unshielded wallet support
  • Gas Token: DUST (Midnight's resource/gas token)

Use Cases

  • Creating custom tokens on Midnight Network
  • Privacy-preserving token transfers
  • Decentralized finance (DeFi) building blocks
  • Testing token functionality in private contexts

About

trying compact

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors