Vault System

The Vault system provides businesses with deterministic deposit addresses for their users. Each user gets a unique address that accepts any enabled token, with automatic processing and webhook notifications.

Overview

Key Features:

  • One Address Per User - Each user gets a single deposit address that accepts ANY enabled token

  • Deterministic Addresses - Addresses are computed using CREATE2, same across all supported chains

  • Permissionless - No on-chain registration required, works immediately

  • Automatic Processing - Deposits are detected and processed automatically

  • Webhook Notifications - Real-time notifications when deposits are processed

  • Low Fees - 0.25% default fee on all deposits

How It Works

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                         User Flow                                │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│  1. Business creates user     2. User deposits tokens            │
│     via API/Dashboard            to their address                │
│           │                           │                          │
│           ▼                           ▼                          │
│  ┌─────────────────┐         ┌─────────────────┐                │
│  │ MakaPay Backend │         │ Deposit Address │                │
│  │ computeAddress()│         │  (CREATE2)      │                │
│  └────────┬────────┘         └────────┬────────┘                │
│           │                           │                          │
│           ▼                           ▼                          │
│  ┌─────────────────┐         ┌─────────────────┐                │
│  │ Deposit Address │         │ Deposit Detected│                │
│  │ returned to     │         │ by cron job     │                │
│  │ business        │         └────────┬────────┘                │
│  └─────────────────┘                  │                          │
│                                       ▼                          │
│                              ┌─────────────────┐                │
│  3. Funds swept to           │ Factory.process()│                │
│     business wallet          │ sweeps funds    │                │
│           ▲                  └────────┬────────┘                │
│           │                           │                          │
│           └───────────────────────────┘                          │
│                                                                  │
│  4. Webhook sent to business with deposit details                │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

Address Computation

Deposit addresses are deterministic using CREATE2:

Important: The same userId + casinoAddress combination always produces the same deposit address, regardless of which token is being deposited.

Smart Contracts

Contract Addresses

Contract
Address
Networks

Factory

0xDEBd5F39a53e86DC1887eaf9eBc9B8a8E635bEA2

Sepolia, MakaChain Testnet

Implementation

0x74260BBA1dD0a990Eef6950f58D2eC14f14403e1

Sepolia, MakaChain Testnet

Factory Functions

computeAddress(string userId, address casino)

Computes the deterministic deposit address for a user.

Parameters:

  • userId - Your internal user identifier (e.g., "user_123", "player_abc")

  • casino - Your business wallet address (where funds are sent after processing)

Returns: The deposit address for this user

process(string userId, address casino, address token, bytes callbackData)

Processes a deposit by sweeping funds from the deposit address to the casino wallet.

Parameters:

  • userId - The user's identifier

  • casino - Your business wallet address

  • token - The token contract address being processed

  • callbackData - Optional data passed to your callback (usually the userId encoded)

Returns:

  • wallet - The deposit wallet address

  • amount - Total amount processed (before fee)

  • fee - Fee amount deducted

Fee Structure

Type
Fee
Recipient

Default (unregistered)

0.25% (25 bps)

MakaPay Treasury

Registered Casino

Custom (0-1%)

Custom recipient

Fees are automatically deducted during the process() call:

  • Fee is sent to the fee recipient

  • Remaining funds are sent to the casino wallet

Dashboard Setup

1. Configure Your Vault

Navigate to Dashboard > Vault > Settings:

  1. Business Name - Your business display name

  2. Wallet Address - Where processed funds are sent

  3. Enabled Tokens - Select which tokens to accept (USDT, USDC, etc.)

2. Create User Addresses

Navigate to Dashboard > Vault > Users:

  1. Click Create User

  2. Enter the User ID (your internal identifier)

  3. The deposit address is generated automatically

3. Configure Webhooks (Optional)

Navigate to Dashboard > Vault > Settings > Webhooks:

  1. Enter your Webhook URL

  2. Add a Webhook Secret for signature verification

  3. Select which events to receive

API Integration

Authentication

All API endpoints require an API key in the x-api-key header:

Endpoints

Get Vault Configuration

Response:

Create User / Get Deposit Address

Response:

Get User Info

Response:

List Deposits

Query Parameters:

  • limit - Max results (default: 50, max: 100)

  • status - Filter by status: detected, processing, completed, failed

  • externalUserId - Filter by user

Response:

Get Supported Tokens (Public)

No authentication required. Returns publicly available token information.

Response:

Webhooks

Webhook Events

Event
Description

deposit.completed

Deposit successfully processed

deposit.failed

Deposit processing failed

deposit.*

All deposit events

Webhook Payload

Webhook Signature Verification

If you configure a webhook secret, requests include an X-Webhook-Signature header:

Verification Example (Node.js):

Integration Examples

Computing Address On-Chain (Solidity)

Computing Address Off-Chain (JavaScript)

Full Integration Flow

Supported Networks

Network
Chain ID
Status

Sepolia Testnet

11155111

Active

MakaChain Testnet

777177

Active

MakaChain Mainnet

777178

Coming Soon

Ethereum Mainnet

1

Coming Soon

Polygon

137

Coming Soon

BSC

56

Coming Soon

Deposit Statuses

Status
Description

detected

Deposit detected, awaiting processing

processing

Currently being processed on-chain

completed

Successfully processed, funds sent to wallet

failed

Processing failed (will retry automatically)

Best Practices

User ID Guidelines

  • Use unique, stable identifiers (database IDs, UUIDs)

  • Don't use email addresses (may change)

  • Don't use session tokens (temporary)

  • Keep IDs under 100 characters

Security

  1. Store API keys securely - Use environment variables, never commit to code

  2. Verify webhook signatures - Always validate the X-Webhook-Signature header

  3. Use HTTPS - All webhook endpoints must use HTTPS

  4. Idempotency - Handle duplicate webhook deliveries gracefully

Error Handling

  1. Check deposit status - Poll the deposits endpoint if webhooks fail

  2. Retry logic - Failed deposits are automatically retried

  3. Monitor failed deposits - Set up alerts for repeated failures

Troubleshooting

Deposit Not Detected

  1. Verify the correct deposit address was used

  2. Check the token is in the enabled tokens list

  3. Ensure minimum deposit amount (> 0.001 tokens)

  4. Wait for block confirmations

Webhook Not Received

  1. Verify webhook URL is accessible from the internet

  2. Check webhook is enabled and active

  3. Ensure the event type is selected

  4. Check your server logs for incoming requests

Process Transaction Failed

  1. Check the casino wallet address is correct

  2. Verify sufficient gas on the processing account

  3. Check the token contract is valid

  4. Review error message in the deposit record

Rate Limits

Endpoint
Limit

Create User

100/min

Get User

1000/min

List Deposits

100/min

Get Config

100/min

Support

Last updated