Skip to content

Repository files navigation

token-gate-ucashpay

Zero-dependency on-chain token-gating for U.CASH. Verify a wallet holds a minimum amount of UCASH (or any ERC-20, or the native coin) to gate access: memberships, premium tiers, content paywalls, role grants. No keys, no signing, just a read-only RPC balance check.

Install

pip install token-gate-ucashpay

From source: pip install git+https://github.com/UdotCASH/token-gate-ucashpay.

Installs a token-gate CLI: token-gate 0xWALLET 100 any returns PASS/FAIL (exit code 0/1). Python and JavaScript, zero dependencies.

Use it to:

  • Gate a Discord role, a membership, or a page by UCASH holdings.
  • Verify any ERC-20 (or native) balance on any EVM chain.
  • Tie into U.CASH's "verify holdings" premium tiers + custom-token gating.

UCASH gating

from token_gate import holds_ucash, holds_ucash_any_chain

ok, balance = holds_ucash("0xWALLET", 100, chain="ethereum")      # one chain
ok, balance, chain = holds_ucash_any_chain("0xWALLET", 100)        # ETH or Polygon or Base
if ok:
    grant_access()
const { holdsUcash, holdsUcashAnyChain } = require('./token-gate.js');
const { ok, balance } = await holdsUcash('0xWALLET', 100, 'base');
const { ok, chain } = await holdsUcashAnyChain('0xWALLET', 100);

CLI: python token_gate.py 0xWALLET 100 anyPASS/FAIL.

Any token / native

holds(rpc_url, wallet, min_amount, token_address="0xTOKEN", decimals=18)
holds(rpc_url, wallet, min_amount)  # native coin (ETH/MATIC/...), 18 decimals

UCASH contracts

Ethereum 0x92e52a1A235d9A103D970901066CE910AAceFD37, Polygon 0xA94880d3A4b39746E90Cdb57f8De3732c984DE14, Base 0x26cf750abAf38aF7109Effdbdf79bA50d2EE09A1 (8 decimals).

License

MIT.

About

Zero-dependency on-chain token-gating for U.CASH: verify UCASH/ERC-20/native holdings to gate access. Python + JS.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages