Skip to content
DjedAlliancePublic

About

StablePay ✨ - A fully decentralized client-side-only widget for payments using cryptocurrencies and stablecoins

Topics

Resources

Stars

16 stars

Watchers

1 watching

Forks

Latest commit

 

History

77 Commits

Folders and files

Repository files navigation

StabilityNexus DjedAlliance StablePay

 

Static Badge

Telegram Badge    X (formerly Twitter) Badge    Discord Badge    Medium Badge    LinkedIn Badge    Youtube Badge

 

An open-source SDK
empowering you to directly accept
cryptocurrency and stablecoin payments free from centralized fintech infrastructure


StablePay is a fully decentralized solution for online payments. When the StablePay widget is embedded in a website, the widget interacts directly with smart contracts on blockchains, with no intermediary servers.

StablePay allows payments to be made either via the native cryptocurrency of the underlying blockchain or via decentralized stablecoins backed by these native currencies. StablePay also allows automatic conversion between the two. For example, a consumer may pay using a native cryptocurrency, but the merchant receives the payment in a stablecoin backed by that cryptocurrency. The conversion happens automatically, by interacting with the stablecoin contract to mint stablecoins.

StablePay uses stablecoins based on the Tectonic stablecoin protocol, deployed on EVM-compatible chains.

Status: Tectonic is not yet deployed on any public network, so there are currently no live payment networks. Development runs against a local deployment — see tectonic-local. Support for the Djed protocol was removed once StablePay moved to Tectonic; if you need it, use a release tagged before that change.

Code Structure Overview

The StablePay widget itself is located in the stablepay-sdk folder. It uses the Tectonic SDK to interact with Tectonic stablecoin contracts. The Tectonic SDK is located in the tectonic-sdk folder.

One structural point worth knowing before reading the code: the Tectonic contract is itself the stablecoin ERC-20. There is no separate token contract, so the protocol address and the token address are the same value.

The main files of the Tectonic SDK and their purposes are:

  • pricing.js - pure arithmetic mirroring the contract: what a payment mints, what an invoice costs, and fee handling. No network access, so it is directly unit-testable.
  • tectonic.js - the client: reads prices and reserve state, quotes payments, and builds transactions.
  • constants.js - fixed-point conventions and reserve-health bands.
  • artifacts/TectonicABI.js - the contract ABI, as a JS module rather than JSON so it needs no bundler configuration.

There is also a tectonic-local folder containing a Foundry project used to run Tectonic on a local chain during development. It is a development aid and will be removed once a public deployment exists.

The main files of the StablePay widget and their purposes are:

  • widget/Widget.jsx - contains the main widget component.
  • widget/PayButton.jsx - contains the `Pay with StablePay" button component.
  • widget/NetworkDropdown.jsx - contains the widget's subcomponent that allows customers to select the blockchain network that they would like to use for the payment.
  • widget/TokenDropdown.jsx - contains the widget's subcomponent that allows customers to select the token (native cryptocurrency or stablecoin) that they would like to use for the payment.
  • widget/TransactionReview.jsx - contains the widget's subcomponent that constructs the transaction, shows it to costumer and allows the customer to connect a wallet and submit the transaction.

Using the StablePay Widget

A simple example merchant website with the StablePay widget embedded is available in the StablePay-MerchantWebsiteDemo.


About

StablePay ✨ - A fully decentralized client-side-only widget for payments using cryptocurrencies and stablecoins

Topics

Resources

Stars

16 stars

Watchers

1 watching

Forks

Sponsor this project

Used by

Contributors

Languages