https://github.com/0xhappydev/depeg-swap
A DeFi protocol that enables users to lock in fixed yields on BTC liquid staking tokens, SUI staking tokens, and stablecoins through on-chain hedging strategies.
https://github.com/0xhappydev/depeg-swap
sui swap
Last synced: 3 days ago
JSON representation
A DeFi protocol that enables users to lock in fixed yields on BTC liquid staking tokens, SUI staking tokens, and stablecoins through on-chain hedging strategies.
- Host: GitHub
- URL: https://github.com/0xhappydev/depeg-swap
- Owner: 0xhappydev
- Created: 2025-11-02T14:49:53.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-11-02T14:50:18.000Z (8 months ago)
- Last Synced: 2026-06-24T22:00:03.148Z (4 days ago)
- Topics: sui, swap
- Language: TypeScript
- Homepage: https://suipeg.com
- Size: 4.76 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🌀 Depeg Swap Protocol on Sui
**Depeg Swap** is a fixed-yield, dual-asset vault system designed for the Sui blockchain. it allows underwriter to deposits their underlying and pegged token (i.e. $wBTC and $LBTC) to the vault and mints depeg token (wBTC-depeg token). And Hedger could purchase the depeg token (wBTC-depeg token) to hedge their pegged tokens positions (i.e. $LBTC).
1. when there is depeg events, hedger could redeem underlying token (i.e. $wBTC) with their pegged token (i.e. $LBTC) and depeg token (i.e. wBTC-depeg token)
2. when there is no depeg events upon maturity, underwriter could claim underlying tokens from the vault (i.e. $wBTC and $LBTC)
---
## 📦 Modules Overview
### 1. `depeg_swap::vault`
This module handles the core logic of vault creation, token minting, and redemption.
#### ✅ Key Functions
##### `init(witness: VAULT, ctx: &mut TxContext)`
- Initializes the `VAULT` token type and sets up the treasury.
- Mints the DS (Depeg Swap) token and shares the treasury on-chain.
##### `create_vault
(...)`
- Mints DS tokens backed by equal amounts of a pegged asset and an underlying asset.
##### `redeem_depeg_swap(...)`
- Allows users to redeem DS tokens **before expiry**.
- Burns DS tokens and returns the underlying asset in exchange for the pegged tokens.
##### `redeem_underlying(...)`
- Allows **underwriters** to claim both underlying and pegged assets **after expiry**.
### 2. `depeg_swap::registry`
Manages a global registry of all created vaults.
#### ✅ Key Functions
##### `init(_: REGISTRY, ctx: &mut TxContext)`
- Initializes and shares the `VaultRegistry` object.
##### `create_vault_collection
(...)`
- A wrapper around `vault::create_vault`.
- Registers the new vault ID into the global registry.
- Transfers minted DS coins and underwriter caps to the sender.
##### `list_vaults(reg: &VaultRegistry): &vector`
- Returns the list of all created vault IDs.
---
## 🛠 Data Structures
### `Vault
`
- Stores paired assets (`pegged`, `underlying`), expiry, and DS token total.
### `VaultTreasury`
- Stores the treasury capability for minting and burning DS tokens.
### `UnderwriterCap`
- A capability object granting permission to call `redeem_underlying`.
### `VaultRegistry`
- A shared object tracking all vault IDs.
---
## 👨💻 Author
Built by Sui Peg — Soon on Sui.