🪪Wallet Integration
Developer guide for integrating Frankencoin and the Savings Module into wallets and applications
This guide provides developers with the technical details needed to integrate Frankencoin (ZCHF) and its native savings module into wallets, applications, and services.
Frankencoin Token (ZCHF)
ERC-20 Standard
Frankencoin is a standard ERC-20 token that implements all standard functions:
balanceOf(address account)totalSupply()transfer(address to, uint256 amount)transferFrom(address from, address to, uint256 amount)allowance(address owner, address spender)approve(address spender, uint256 amount)
Multi-chain Support
Frankencoin is deployed across multiple blockchain networks, allowing users to interact with ZCHF on their preferred chain. When integrating, ensure your wallet supports the relevant chain IDs.
Interface Reference
The complete ERC-20 interface can be found in the official repository: IERC20.sol
Savings Module Integration
The Frankencoin savings module allows users to lock up Frankencoins to earn yield. This feature can be integrated natively into wallets to provide users with seamless access to earning opportunities.
Core Concepts
The savings module uses an Account structure that tracks:
saved: Amount of ZCHF currently savedticks: Internal counter for interest calculationreferrer: Optional address for referral feesreferralFeePPM: Referral fee in parts per million (ppm)
Events
The savings module emits three primary events:
Key Constants
Interest accrues after a 3-day delay from when funds are saved.
Data Structure
Core Functions
Query Functions
Basic Operations
Referral Functions
The savings module includes a referral system that allows wallets and frontends to earn fees by facilitating user interactions:
Referral Logic
The referral system allows wallets and frontends to monetize their integration:
Referral fees can be up to 25% (250,000 ppm) of earned interest
Fees are deducted from the collected interest, not the principal
Users can drop or change referrers at any time
The fee represents convenience value - users pay for easier interaction with the protocol
Important: The referral fee is not sticky. Users retain full control and can modify or remove referrers, so the fee depends on the convenience and value your wallet provides.
API Helper Endpoints
Frankencoin provides REST API endpoints to simplify integration without requiring direct blockchain queries.
Base URL
1. Module Info
Get comprehensive information about all savings modules across all chains.
Endpoint: GET https://api.frankencoin.com/savings/core/info
Example Response:
Note: The rate is expressed in basis points (e.g., 40000 = 4% annual rate).
TypeScript Interface:
2. Ranked Accounts
Get a ranked list of accounts by savings balance across all chains.
Endpoint: GET https://api.frankencoin.com/savings/core/ranked
Example Response:
TypeScript Interface:
3. Account Balance
Get savings information for a specific account across all chains and modules.
Endpoint: GET https://api.frankencoin.com/savings/core/balance/<account>
Example: GET https://api.frankencoin.com/savings/core/balance/0x963ec454423cd543db08bc38fc7b3036b425b301
Example Response:
TypeScript Interface:
4. Account Activities
Get the latest transaction history for an account's savings activities (limited to 1000 entries).
Endpoint: GET https://api.frankencoin.com/savings/core/activity/<account>
Example: GET https://api.frankencoin.com/savings/core/activity/0x963ec454423cd543db08bc38fc7b3036b425b301
Example Response:
Activity kinds: Saved, Withdrawn, InterestCollected
TypeScript Interface:
5. Referrer Mapping
Get detailed information about all accounts that have set a specific address as their referrer.
Endpoint: GET https://api.frankencoin.com/savings/referrer/<refferer>/mapping
Example: GET https://api.frankencoin.com/savings/referrer/0x963ec454423cd543db08bc38fc7b3036b425b301/mapping
Example Response:
TypeScript Interface:
Use Case: Referrers can use this endpoint to monitor their referred accounts. They can also trigger the refreshBalance() function for these accounts to collect accrued interest and receive their referral fee split.
6. Referrer Earnings
Get aggregated earnings information for a referrer across all chains and modules.
Endpoint: GET https://api.frankencoin.com/savings/referrer/<referrer>/earnings
Example: GET https://api.frankencoin.com/savings/referrer/0x5f238e89F3ba043CF202E1831446cA8C5cd40846/earnings
Example Response:
TypeScript Interface:
Use Case: This endpoint provides referrers with a complete view of their earnings across all chains, making it easy to display total revenue from the referral program.
NPM Package
For faster integration, use the official Frankencoin API package:
Package: @frankencoin/api
This package provides typed API clients and utilities for interacting with the Frankencoin API endpoints, including all the savings module endpoints described above. All TypeScript types are included, making integration type-safe and easier.
Integration Best Practices
For Wallet Developers
Display Savings Balance: Show users their total ZCHF savings balance alongside their regular ZCHF balance
Accrued Interest: Use the
accruedInterest()function to display pending interest in real-timeSimple UX: Provide one-click "Save" and "Withdraw" buttons with amount inputs
Interest Collection: Remind users that interest accrues after a 3-day delay
Referral Integration: Set your wallet address as the referrer to earn a portion of user interest
For Frontend Developers
Use API Endpoints: Leverage the REST API for faster queries instead of direct contract calls
Multi-chain Support: Display savings across all supported chains in a unified interface
Activity History: Show users their complete savings history using the activity endpoint
Rate Display: Convert the rate from basis points to a user-friendly percentage (e.g., 40000 → "4% APY")
Referral Program Recommendations
Set a reasonable referral fee (typically 5-15%) to balance user value and wallet revenue
Clearly communicate to users that they pay a small convenience fee
Allow power users to easily drop the referrer if they prefer direct interaction
Use the referrer mapping endpoint to trigger
refreshBalance()for your referred accounts periodically
Smart Contract Addresses
For the latest contract addresses across all supported chains, please refer to the official Frankencoin Landing Page or the GitHub repository.
Support and Resources
Last updated
Was this helpful?