Skip to content

sleet-zig/token-contract-zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fungible Token Contract

A minimal fungible token implementation following the NEP-141 standard.

Build

zig build wasm

Deploy

near deploy --accountId token.testnet --wasmFile zig-out/lib/contract.wasm

Contract Methods

  • new() - Initialize the token contract
  • ft_transfer() - Transfer tokens to a receiver
  • ft_balance_of() - Get the balance of an account (view method)
  • ft_total_supply() - Get the total token supply (view method)
  • ft_metadata() - Get token metadata (NEP-148) (view method)

Interactions

# Initialize
near call token.testnet new '{"owner_id": "owner.testnet", "total_supply": "1000000000000000000000000"}' --accountId token.testnet

# Transfer tokens
near call token.testnet ft_transfer '{"receiver_id": "bob.testnet", "amount": "1000000000000000000"}' --accountId alice.testnet --depositYocto 1

# Check balance
near view token.testnet ft_balance_of '{"account_id": "alice.testnet"}'

# Get total supply
near view token.testnet ft_total_supply '{}'

# Get metadata
near view token.testnet ft_metadata '{}'

About

⚡️ demo token contract in zig

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages