ULedgerNET Smart Contracts & Tokens
Overview
ULedgerNET provides a comprehensive smart contract platform based on WebAssembly (WASM) and a native token system supporting fungible tokens, non-fungible tokens (NFTs), and multi-tokens.
WASM Runtime
Architecture
WASM Runtime Features
ULedgerNET uses a high-performance WASM runtime for contract execution:
| Feature | Description |
|---|
| Runtime | Production-grade WASM engine |
| Memory Model | Linear memory with growth |
| Execution | JIT compilation |
| Isolation | Sandboxed execution |
Gas Metering
Gas System Overview
Operation Categories
| Category | Description |
|---|
| Base Operations | WASM instructions, function calls |
| Memory | Allocation, growth, access |
| Storage | Read, write, delete |
| Host Functions | External calls to runtime |
Host Functions
Available Host Functions
Host Function Details
| Function | Parameters | Returns | Description |
|---|
get_storage | key: string | value | Retrieve stored value |
set_storage | key: string, value | - | Store value |
delete_storage | key: string | - | Remove stored value |
has_key | key: string | bool | Check key existence |
get_caller | - | address | Transaction sender |
get_owner | - | address | Contract owner |
get_block_height | - | uint64 | Current block height |
emit_event | name, data | - | Emit contract event |
Contract Lifecycle
Deployment
Invocation
Upgrade/Rollback
Native Token System
Supported Standards
Token Architecture
Fungible Tokens (ERC20-like)
Token Creation
Token Operations
| Operation | Description | Payload Fields |
|---|
| CREATE | Deploy new token | name, symbol, decimals, initialSupply |
| TRANSFER | Send tokens | tokenAddress, to, amount |
| APPROVE | Allow spending | tokenAddress, spender, amount |
| MINT | Create new tokens | tokenAddress, to, amount |
| BURN | Destroy tokens | tokenAddress, amount |
Non-Fungible Tokens (ERC721-like)
NFT Structure
NFT Operations
| Operation | Description | Payload Fields |
|---|
| CREATE | Deploy NFT collection | name, symbol |
| MINT | Create new NFT | tokenAddress, to, tokenId, uri |
| TRANSFER | Transfer NFT | tokenAddress, from, to, tokenId |
| APPROVE | Approve transfer | tokenAddress, to, tokenId |
| SET_APPROVAL_FOR_ALL | Approve operator | tokenAddress, operator, approved |
| BURN | Destroy NFT | tokenAddress, tokenId |
Multi-Tokens (ERC1155-like)
Multi-Token Features
Multi-Token Operations
| Operation | Description |
|---|
| CREATE | Deploy multi-token contract |
| MINT | Mint single token type |
| MINT_BATCH | Mint multiple token types |
| TRANSFER | Transfer single token type |
| TRANSFER_BATCH | Transfer multiple token types |
| CONVERT | Convert between fungible/non-fungible |
Transaction Types
Transaction Type Enumeration
Security Features
Contract Execution Security
Security Manager Features
| Feature | Description |
|---|
| Operation Validation | Pre-execution security checks |
| Call Stack Tracking | Prevent deep recursion |
| Circuit Breaker | Halt on repeated failures |
| Resource Limits | Memory and computation bounds |
State Management
Atomic Execution
State Storage
| Storage Type | Key Format | Description |
|---|
| Contract State | contract:{address}:{key} | Arbitrary key-value storage |
| Token Balances | token:{address}:balance:{owner} | Fungible token balances |
| NFT Ownership | nft:{address}:owner:{tokenId} | NFT owner mapping |
| Approvals | {type}:{address}:approval:{...} | Approval mappings |
Next: Security Considerations