On-chain payment gateway for purchasing SKALE credits on mainnet and fulfilling them on SKALE chains.
credit-station is the payment entry point for SKALE credit purchases.
It receives payments on mainnet and coordinates credit fulfillment on SKALE
chains via the Ledger contract deployed on the SKALE chain side.
Together with the credit-distributor off-chain agent, it provides a simple way to buy credits to interact with skale chains.
Core Capabilities:
- Mainnet credit payments: Accepts ERC-20 payments to buy credits for SKALE chain usage.
- Configurable pricing and tokens: Maintains per-token pricing and a list of accepted payment tokens.
- Access-controlled operations: Uses
CreditStationAccessManagerfor role-based admin and agent permissions. - Event-driven fulfillment: Emits
PaymentReceivedevents consumed bycredit-distributorto fulfill credit purchases on schains.
Credit station project is part of the SKALE-expand vision of SKALE. With the new pricing model, developers can buy credits using their preferred token on the chain where skale-manager is deployed, and use them on SKALE-chains to pay-per-usage on network hubs, instead of having to buy their own chain and paying the monthly rate.
Details about the repository structure can be found in ARCHITECTURE.
- Node.js 22-24 (tested with modern LTS versions)
- Yarn 4 (enabled via
yarn@4.x.x"inpackage.json) - Docker (optional - for running the
credit-distributorservice viadocker compose) - Python 3.13+ with uv for local
credit-distributordevelopment slither-analyzer(installed globally or in a suitable Python environment)
git clone --recurse-submodules https://github.com/skalenetwork/credit-station.git
cd credit-station
yarn install
yarn cleanCompile
pip3 install slither-analyzer # might require the creation of a suitable Python environmentTests are written in TypeScript and Solidity and run using Hardhat’s local in-memory network. No external nodes or extra setup are required.
All tests
yarn testThis runs TypeScript type-checking (via yarn tsc) and the full Hardhat test
suite in test/.
Single test / suite
yarn hardhat test test/CreditStation.tsYou can point Hardhat to any individual file or pattern under the test/
directory.
Coverage
yarn hardhat coverageNote: coverage requires the
solidity-coverageplugin, which is already listed as a dev dependency.
Deployment is performed using Hardhat scripts in the migrations/ folder.
All scripts use the custom network defined in hardhat.config.ts, which
reads RPC and account details from environment variables.
Create a .env file at the repository root with:
ENDPOINT="https://your-endpoint" # RPC endpoint for the target network (mainnet or schain)
PRIVATE_KEY="0x..." # Deployer private key with funds on the target network
ETHERSCAN="your-etherscan-api-key" # Optional: used for contract verificationThe
ENDPOINTandPRIVATE_KEYvariables are consumed by thecustomnetwork configuration inhardhat.config.ts. TheETHERSCANkey is used by@nomicfoundation/hardhat-verifyvia@skalenetwork/upgrade-tools.
Mainnet deployment creates:
CreditStationAccessManager– access control for admin/agent rolesCreditStation– mainnet payment entry point
Optional environment variables to control roles:
OWNER="0x..." # Address that will receive ADMIN_ROLE on AccessManager (defaults to deployer)
RECEIVER="0x..." # Address that will receive payment tokens (defaults to deployer)Run the mainnet deploy script:
yarn hardhat run migrations/deployMainnet.ts --network customThis will:
- Deploy
CreditStationAccessManagerandCreditStation. - Store deployed addresses in
data/credit-station-mainnet-contracts.json. - Transfer admin permissions from the deployer to
OWNER(if explicitly set). - Try to verify both contracts.
Schain deployment creates:
CreditStationAccessManager– access control on the schainLedger– contract that fulfills payments on the schain side
Environment variables:
ENDPOINT="https://your-schain-endpoint" # RPC endpoint for the schain
PRIVATE_KEY="0x..." # Deployer key on the schain
OWNER="0x..." # (optional) target admin address; defaults to deployer
ETHERSCAN="your-etherscan-api-key" # Optional, for verification (if supported)Run the schain deploy script:
yarn hardhat run migrations/deploySchain.ts --network customThis will:
- Deploy
CreditStationAccessManagerandLedger. - Store deployed addresses in
data/credit-station-schain-contracts.json. - Transfer admin permissions from the deployer to
OWNER(if explicitly set). - Try to verify both contracts.
Official mainnet and testnet deployment addresses will be documented here.
Static Analysis
This project uses a combination of Solidity and TypeScript linters and static analysis tools:
solhintfor Solidity style and best practicesslitherfor advanced Solidity static analysiseslintfor TypeScript/JavaScriptcspellfor spellchecking
Run all lint and types checks with:
yarn fullCheckRun each tool individually:
yarn lint # solhint on contracts
yarn eslint # ESLint on TS/JS files
yarn cspell # spellcheck
yarn slither # Slither (requires Slither installed in your python environment)Please see HackerOne for SKALE’s active bug bounty program or submit a bug directly via encrypted email.
- develop – Most up-to-date branch with the latest features and ongoing work. This is where contributions should be opened.
- stable – Latest stable version of the project.
- SKALE Whitepaper – https://skale.space/whitepaper
- SKALE Developer Documentation – https://docs.skale.space/
- SKALE Main Website – https://www.skale.space/
- SKALE-BASE Ecosystem Portal – https://base.skalenodes.com/
- SKALE Expand – https://blog.skale.space/blog/skale-expand-bringing-gas-free-instant-private-execution-to-any-evm-blockchain
Copyright (C) 2025–present SKALE Labs