Skip to main content

solmate-stake-sdk

Stake-gated access control for Web3 social apps. Require a USDC stake before any action — DMs, room entry, meetup requests. Extracted from Sol Mate Trust API.

PyPI License: MIT

No ORM or framework dependencies — bring your own storage and payment layer.

Install

pip install solmate-stake-sdk

Usage

from solmate_stake_sdk import StakeGate, StakeType, SlashingPolicy, SlashReason

# Create a gate with custom minimums (falls back to defaults)
gate = StakeGate(
    min_amounts={
        StakeType.DM: 0.50,
        StakeType.MEETUP_REQUEST: 1.00,
    }
)

# Validate before accepting payment
ok, error = gate.validate(StakeType.DM, amount_usdc=0.50, no_show_count=0)
# ok=True, error=""

# Repeat offender — 2 no-shows raises DM stake to 1.50 USDC (3× base)
ok, error = gate.validate(StakeType.DM, amount_usdc=0.50, no_show_count=2)
# ok=False, error="Minimum stake for dm is 1.50 USDC (you sent 0.50)"

# Create and activate a stake record
record = gate.create_stake(
    user_id="0xABC123",
    stake_type=StakeType.DM,
    amount_usdc=0.50,
)
# record.status == StakeStatus.ACTIVE

# Refund on success
gate.refund_stake(record)
# record.status == StakeStatus.REFUNDED

# Slash on violation
gate.slash_stake(record, reason="no_show")
# record.status == StakeStatus.SLASHED

Stake Types

Type Default Minimum Use Case
DM 0.50 USDC Direct message unlock
ROOM_ENTRY 0.10 USDC Enter a social room
MEETUP_REQUEST 1.00 USDC Request an IRL meetup
PHOTO_UNLOCK 0.25 USDC View private photos
MEETUP_CONFIRM 1.00 USDC Confirm attendance

No-Show Multiplier

Each no-show increases the required stake by 0.5×, capped at 3×:

No-Shows Multiplier DM Stake
0 1.0× 0.50 USDC
1 1.5× 0.75 USDC
2 2.0× 1.00 USDC
4+ 3.0× 1.50 USDC (max)
required = gate.required_amount(StakeType.DM, no_show_count=2)
# 1.00 USDC

Slashing Policy

from solmate_stake_sdk import SlashingPolicy, SlashReason

policy = SlashingPolicy()

# Evaluate — always slash harassment regardless of history
decision = policy.evaluate(SlashReason.HARASSMENT, stake_amount=1.00)
# decision.should_slash = True, decision.slash_pct = 1.0

# No-show only slashes after 1 incident
decision = policy.evaluate(SlashReason.NO_SHOW, no_show_count=0)
# decision.should_slash = False

decision = policy.evaluate(SlashReason.NO_SHOW, no_show_count=1, stake_amount=0.50)
# decision.should_slash = True, decision.slash_pct = 1.0

# Calculate slash amount
amount = policy.slash_amount(stake_amount=1.00, reason=SlashReason.SPAM)
# 0.50 USDC (50% for spam)

Slash Reasons

Reason Slash % Requires History?
NO_SHOW 100% 1+ no-show
HARASSMENT 100% Never (always slash)
FAKE_PROFILE 100% Never (always slash)
CONSENT_VIOLATION 100% Never (always slash)
SPAM 50% 2+ reports
PAYMENT_FRAUD 100% Never (always slash)

Hooks / Callbacks

def on_stake(record):
    db.save(record)
    circle.hold_funds(record.id, record.amount_usdc)

def on_refund(record):
    circle.release_funds(record.id)

def on_slash(record, reason):
    circle.capture_funds(record.id)
    notify_safety_team(record.user_id, reason)

gate = StakeGate(on_stake=on_stake, on_refund=on_refund, on_slash=on_slash)

StakeRecord Fields

@dataclass
class StakeRecord:
    id: str                        # UUID
    user_id: str
    stake_type: StakeType
    amount_usdc: float
    status: StakeStatus            # PENDING → ACTIVE → REFUNDED/SLASHED
    room_id: Optional[str]
    reference_id: Optional[str]    # match_id, dm_id, etc.
    solana_tx_sig: Optional[str]   # SPL Memo tx signature
    circle_transfer_id: Optional[str]
    created_at: datetime
    updated_at: datetime

License

MIT — extracted from Sol Mate Trust API. Built for EasyA × Consensus Miami 2026.

Metadata

Release files for solmate-stake-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solmate-stake-sdk 0.1.0
File Size Uploaded Provenance
solmate_stake_sdk-0.1.0.tar.gz 6.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for solmate-stake-sdk 0.1.0
File Interpreter ABI Platform
solmate_stake_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / solmate_stake_sdk-0.1.0.tar.gz

Download URL solmate_stake_sdk-0.1.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
60dbf9e64ec8cc240637f823e7eb96248855ed62a7e0a10033ca2c06459951a7
BLAKE2b-256 checksum
How to use checksums
24703c2e139d39ef5470fc740d7dfaec7c54ceecc17c48a71eb4bf5c2da80bd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / solmate_stake_sdk-0.1.0-py3-none-any.whl

Download URL solmate_stake_sdk-0.1.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ecd3fff82564c8bb85063dfe251dc3535af0f2bdf3568bb84624715c1a6b507
BLAKE2b-256 checksum
How to use checksums
a6abef6652efd69e46aa37f53720974b15571fe215ad25e0c3b6e65816241eb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Security for solmate-stake-sdk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page