{"id":51165391,"url":"https://github.com/0xhappydev/depeg-swap","last_synced_at":"2026-06-26T18:31:03.777Z","repository":{"id":339300027,"uuid":"1088218450","full_name":"0xhappydev/depeg-swap","owner":"0xhappydev","description":"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.","archived":false,"fork":false,"pushed_at":"2025-11-02T14:50:18.000Z","size":4994,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-24T22:00:03.148Z","etag":null,"topics":["sui","swap"],"latest_commit_sha":null,"homepage":"https://suipeg.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xhappydev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-02T14:49:53.000Z","updated_at":"2025-11-02T15:09:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/0xhappydev/depeg-swap","commit_stats":null,"previous_names":["0xhappydev/depeg-swap"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/0xhappydev/depeg-swap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xhappydev%2Fdepeg-swap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xhappydev%2Fdepeg-swap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xhappydev%2Fdepeg-swap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xhappydev%2Fdepeg-swap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xhappydev","download_url":"https://codeload.github.com/0xhappydev/depeg-swap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xhappydev%2Fdepeg-swap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34829415,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sui","swap"],"created_at":"2026-06-26T18:31:03.076Z","updated_at":"2026-06-26T18:31:03.764Z","avatar_url":"https://github.com/0xhappydev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌀 Depeg Swap Protocol on Sui\n\n**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). \n\n1. 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)\n2. when there is no depeg events upon maturity, underwriter could claim underlying tokens from the vault (i.e. $wBTC and $LBTC)\n\n\n---\n\n## 📦 Modules Overview\n\n### 1. `depeg_swap::vault`\n\nThis module handles the core logic of vault creation, token minting, and redemption.\n\n#### ✅ Key Functions\n\n##### `init(witness: VAULT, ctx: \u0026mut TxContext)`\n- Initializes the `VAULT` token type and sets up the treasury.\n- Mints the DS (Depeg Swap) token and shares the treasury on-chain.\n\n##### `create_vault\u003cP, U\u003e(...)`\n- Mints DS tokens backed by equal amounts of a pegged asset and an underlying asset.\n\n##### `redeem_depeg_swap(...)`\n- Allows users to redeem DS tokens **before expiry**.\n- Burns DS tokens and returns the underlying asset in exchange for the pegged tokens.\n\n##### `redeem_underlying(...)`\n- Allows **underwriters** to claim both underlying and pegged assets **after expiry**.\n\n\n### 2. `depeg_swap::registry`\n\nManages a global registry of all created vaults.\n\n#### ✅ Key Functions\n\n##### `init(_: REGISTRY, ctx: \u0026mut TxContext)`\n- Initializes and shares the `VaultRegistry` object.\n\n##### `create_vault_collection\u003cP, U\u003e(...)`\n- A wrapper around `vault::create_vault`.\n- Registers the new vault ID into the global registry.\n- Transfers minted DS coins and underwriter caps to the sender.\n\n##### `list_vaults(reg: \u0026VaultRegistry): \u0026vector\u003cID\u003e`\n- Returns the list of all created vault IDs.\n\n---\n\n## 🛠 Data Structures\n\n### `Vault\u003cP, U\u003e`\n- Stores paired assets (`pegged`, `underlying`), expiry, and DS token total.\n\n### `VaultTreasury`\n- Stores the treasury capability for minting and burning DS tokens.\n\n### `UnderwriterCap`\n- A capability object granting permission to call `redeem_underlying`.\n\n### `VaultRegistry`\n- A shared object tracking all vault IDs.\n\n---\n\n## 👨‍💻 Author\n\nBuilt by Sui Peg — Soon on Sui.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xhappydev%2Fdepeg-swap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xhappydev%2Fdepeg-swap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xhappydev%2Fdepeg-swap/lists"}