Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/auto-release-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Auto Release PR

on:
push:
branches: [develop]
workflow_dispatch:

permissions:
contents: read
pull-requests: write

concurrency:
group: auto-release-pr
cancel-in-progress: false

jobs:
create-release-pr:
name: Create Release PR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Fetch main branch
run: git fetch origin main

- name: Check for existing PR
id: check-pr
run: |
PR_COUNT=$(gh pr list --base main --head develop --state open --json number --jq 'length')
echo "pr_exists=$([[ $PR_COUNT -gt 0 ]] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
echo "::notice::Open PRs from develop to main: $PR_COUNT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check for differences
id: check-diff
if: steps.check-pr.outputs.pr_exists == 'false'
run: |
DIFF_COUNT=$(git rev-list --count origin/main..origin/develop)
echo "has_changes=$([[ $DIFF_COUNT -gt 0 ]] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
echo "commit_count=$DIFF_COUNT" >> $GITHUB_OUTPUT
echo "::notice::Commits ahead of main: $DIFF_COUNT"

- name: Create Release PR
if: steps.check-pr.outputs.pr_exists == 'false' && steps.check-diff.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_COUNT: ${{ steps.check-diff.outputs.commit_count }}
run: |
printf '%s\n' \
"## Automatic Release PR" \
"" \
"This PR was automatically created after changes were pushed to develop." \
"" \
"**Commits:** ${COMMIT_COUNT} new commit(s)" \
"" \
"### Checklist" \
"- [ ] Review all changes" \
"- [ ] Verify CI passes" \
"- [ ] Approve and merge when ready for production" \
> /tmp/pr-body.md

gh pr create \
--base main \
--head develop \
--title "Release: develop -> main" \
--body-file /tmp/pr-body.md
31 changes: 24 additions & 7 deletions src/frontend-rewards.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Call the registration function:
function registerFrontendCode(bytes32 frontendCode) external returns (bool)
```

**Contract:** [`FrontendGateway`](https://explorer.testnet.citrea.xyz/address/0xd824b7d36594Fc3088B1D91a79F34931AA2a15D0)
**Contract:** FrontendGateway ([Mainnet](https://citreascan.com/address/0x3090a89A1fF5DC99117BE655599e5491A0BaBB92) | [Testnet](https://testnet.citreascan.com/address/0xd824b7d36594Fc3088B1D91a79F34931AA2a15D0))

### Step 3: Integrate Into Your Frontend

Expand Down Expand Up @@ -174,9 +174,16 @@ function executeChanges() external
import { ethers } from 'ethers';

const FRONTEND_CODE = ethers.utils.formatBytes32String("myapp");
const FRONTEND_GATEWAY = "0xd824b7d36594Fc3088B1D91a79F34931AA2a15D0";
const SAVINGS_GATEWAY = "0x54430781b33581CE2b0DBD837CA66113BeEEFD8e";
const MINTING_HUB_GATEWAY = "0x5fC684074fBaAE37Eb68d3e48D85f485CE5060F8";

// Mainnet addresses
const FRONTEND_GATEWAY = "0x3090a89A1fF5DC99117BE655599e5491A0BaBB92";
const SAVINGS_GATEWAY = "0x22FE239892eBC8805DA8f05eD3bc6aF75332b60b";
const MINTING_HUB_GATEWAY = "0x1a20B160bf546774246C7920939E6e7Ac0f88b8e";

// Testnet addresses (for development)
// const FRONTEND_GATEWAY = "0xd824b7d36594Fc3088B1D91a79F34931AA2a15D0";
// const SAVINGS_GATEWAY = "0x54430781b33581CE2b0DBD837CA66113BeEEFD8e";
// const MINTING_HUB_GATEWAY = "0x5fC684074fBaAE37Eb68d3e48D85f485CE5060F8";

// Investment with rewards
async function investWithRewards(amount, expectedShares) {
Expand Down Expand Up @@ -212,11 +219,21 @@ This enables:

## Contract Addresses

### Mainnet (Chain ID: 4114)

| Contract | Address | Purpose |
|----------|---------|---------|
| FrontendGateway | [`0x3090a89A1fF5DC99117BE655599e5491A0BaBB92`](https://citreascan.com/address/0x3090a89A1fF5DC99117BE655599e5491A0BaBB92) | Core reward tracking |
| MintingHubGateway | [`0x1a20B160bf546774246C7920939E6e7Ac0f88b8e`](https://citreascan.com/address/0x1a20B160bf546774246C7920939E6e7Ac0f88b8e) | Position rewards |
| SavingsGateway | [`0x22FE239892eBC8805DA8f05eD3bc6aF75332b60b`](https://citreascan.com/address/0x22FE239892eBC8805DA8f05eD3bc6aF75332b60b) | Savings rewards |

### Testnet (Chain ID: 5115)

| Contract | Address | Purpose |
|----------|---------|---------|
| FrontendGateway | [`0xd824b7d36594Fc3088B1D91a79F34931AA2a15D0`](https://explorer.testnet.citrea.xyz/address/0xd824b7d36594Fc3088B1D91a79F34931AA2a15D0) | Core reward tracking |
| MintingHubGateway | [`0x5fC684074fBaAE37Eb68d3e48D85f485CE5060F8`](https://explorer.testnet.citrea.xyz/address/0x5fC684074fBaAE37Eb68d3e48D85f485CE5060F8) | Position rewards |
| SavingsGateway | [`0x54430781b33581CE2b0DBD837CA66113BeEEFD8e`](https://explorer.testnet.citrea.xyz/address/0x54430781b33581CE2b0DBD837CA66113BeEEFD8e) | Savings rewards |
| FrontendGateway | [`0xd824b7d36594Fc3088B1D91a79F34931AA2a15D0`](https://testnet.citreascan.com/address/0xd824b7d36594Fc3088B1D91a79F34931AA2a15D0) | Core reward tracking |
| MintingHubGateway | [`0x5fC684074fBaAE37Eb68d3e48D85f485CE5060F8`](https://testnet.citreascan.com/address/0x5fC684074fBaAE37Eb68d3e48D85f485CE5060F8) | Position rewards |
| SavingsGateway | [`0x54430781b33581CE2b0DBD837CA66113BeEEFD8e`](https://testnet.citreascan.com/address/0x54430781b33581CE2b0DBD837CA66113BeEEFD8e) | Savings rewards |

## Events

Expand Down
50 changes: 49 additions & 1 deletion src/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,60 @@ JuiceDollar is a direct technological manifestation of Timothy C. May's vision o

## JuiceDollar (JUSD) and JuiceDollar Pool Shares (JUICE)

The JuiceDollar system comes with two ERC-20 tokens, a stablecoin called [JuiceDollar (JUSD)](https://explorer.testnet.citrea.xyz/address/0x6a850a548fdd050e8961223ec8FfCDfacEa57E39) and a governance token called [JuiceDollar Pool Shares (JUICE)](https://explorer.testnet.citrea.xyz/address/0x7fa131991c8A7d8C21b11391C977Fc7c4c8e0D5E). Unlike other collateralized stablecoins, JuiceDollar does not depend on external oracles, making it less susceptible to certain attacks and also more versatile with regards to the used collateral. The disadvantage of that approach is its speed, performing liquidations over the course of days whereas oracle-based systems might react within minutes.
The JuiceDollar system comes with two ERC-20 tokens, a stablecoin called JuiceDollar (JUSD) and a governance token called JuiceDollar Pool Shares (JUICE).

| Token | Mainnet | Testnet |
|-------|---------|---------|
| **JUSD** | [`0x0987...35C`](https://citreascan.com/address/0x0987D3720D38847ac6dBB9D025B9dE892a3CA35C) | [`0x6a85...E39`](https://testnet.citreascan.com/address/0x6a850a548fdd050e8961223ec8FfCDfacEa57E39) |
| **JUICE** | [`0x2A36...ae4`](https://citreascan.com/address/0x2A36f2b204B46Fd82653cd06d00c7fF757C99ae4) | [`0x7fa1...D5E`](https://testnet.citreascan.com/address/0x7fa131991c8A7d8C21b11391C977Fc7c4c8e0D5E) |

Unlike other collateralized stablecoins, JuiceDollar does not depend on external oracles, making it less susceptible to certain attacks and also more versatile with regards to the used collateral. The disadvantage of that approach is its speed, performing liquidations over the course of days whereas oracle-based systems might react within minutes.

JuiceDollar is a collateralized stablecoin that tracks the value of the US Dollar. There is no hard peg to the Dollar, but a set of economic constraints that incentivizes the market to softly push it towards parity from two sides. Most importantly, the system is [over-collateralized](positions/): for each JuiceDollar in circulation, there must be other tokens worth at least one JuiceDollar backing it. Furthermore, JUICE holders have a number of ways to influence the long term price of JuiceDollar by making it more or less expensive to mint JUSD, similarly to how a central bank keeps the exchange rate of its own currency in balance. The underlying assumption here is that the JUICE holders recognize that the system (and therefore also their tokens) is the most valuable when JuiceDollar tracks the Dollar as reliably as possible, and that they use their power to govern the system accordingly.

JuiceDollar Pool Shares (JUICE) are the [governance](governance.md) token of the system. Anyone can obtain newly minted JUICE by providing equity capital to the system (or later return them again to get their share of capital back). The JUICE holders benefit from the earned fees and liquidation profits, but they are also the ones that carry the residual risk of liquidations, similar to the shareholders of a bank. Therefore, JUICE holders have an incentive to grow the system and ensure its stability. The governance process is veto-based: anyone can propose new types of collateral or even completely new methods to bring JuiceDollar into circulation, but already 2% of the voting power suffices to veto such proposals.

## How JUSD is Backed

JuiceDollar is designed to be **over-collateralized** at all times. For every JUSD in circulation, there are assets worth more than $1 backing it. This backing comes from two primary sources:

### 1. Collateralized Positions

The main mechanism for creating JUSD is through **collateralized debt positions**. Users deposit collateral (e.g., cBTC) and can mint JUSD against it:

| Aspect | Description |
|--------|-------------|
| **Collateral Ratio** | Typically 110-150%+ depending on the collateral type |
| **Liquidation** | Undercollateralized positions can be challenged and liquidated |
| **Reserve** | Part of the minted JUSD is held back as a liquidation reserve |

For details on how positions work, see [Positions](positions/).

### 2. Stablecoin Bridges

JUSD can also be minted 1:1 against trusted external stablecoins through [bridges](swap.md):

| Bridge | Contract |
|--------|----------|
| **USDC** | [`0x920DB0aDf6fEe2D69401e9f68D60319177dCa20F`](https://citreascan.com/address/0x920DB0aDf6fEe2D69401e9f68D60319177dCa20F) |
| **USDT** | [`0x5CC0e668F8BA61E111B6168E19d17d3C65040614`](https://citreascan.com/address/0x5CC0e668F8BA61E111B6168E19d17d3C65040614) |
| **CTUSD** | [`0x8D11020286aF9ecf7E5D7bD79699c391b224a0bd`](https://citreascan.com/address/0x8D11020286aF9ecf7E5D7bD79699c391b224a0bd) |
| **StartUSD** | [`0x51ff8141D731676Fb21aE1E5D5A88c04511994dD`](https://citreascan.com/address/0x51ff8141D731676Fb21aE1E5D5A88c04511994dD) |

Bridge volume is limited and time-restricted to minimize risk from external stablecoin failures.

### Bootstrap Phase (Temporary)

::: warning
During the initial 6-week bootstrap phase, JUSD can also be minted via the StartUSD bridge. StartUSD has no intrinsic value - it exists solely to initialize the system. After 6 weeks, this bridge expires permanently and all JUSD will be backed only by real collateral and audited stablecoins.

See [StartUSD Bridge](swap.md#startusd-bridge) for full details.
:::

### The Role of JUICE

JUICE holders provide an additional safety buffer. If liquidations result in bad debt, JUICE holders absorb the loss. This makes JUICE similar to bank equity - profitable in good times, but first in line to take losses.

## Use Cases

Like other stablecoins, JuiceDollar primarily serves three use-cases. The only use-case described extensively in this documentation is that of borrowing as it is embedded in the system. To fully leverage the other use-cases, further tools and services such as exchanges and wallets are necessary that are not described herein.
Expand Down
7 changes: 4 additions & 3 deletions src/positions/roller.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,10 @@ Common errors when rolling:

## Contract Address

| Contract | Address |
|----------|---------|
| PositionRoller | [`0x8A50329559Ae3F2BaA1fC8BC59Fcd52958c61caC`](https://explorer.testnet.citrea.xyz/address/0x8A50329559Ae3F2BaA1fC8BC59Fcd52958c61caC) |
| Network | Address |
|---------|---------|
| **Mainnet** | [`0xC1b97398c06B9C6a49Fd9dCFAC8907700301e9Ac`](https://citreascan.com/address/0xC1b97398c06B9C6a49Fd9dCFAC8907700301e9Ac) |
| **Testnet** | [`0x8A50329559Ae3F2BaA1fC8BC59Fcd52958c61caC`](https://testnet.citreascan.com/address/0x8A50329559Ae3F2BaA1fC8BC59Fcd52958c61caC) |

## Events

Expand Down
13 changes: 11 additions & 2 deletions src/savings.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,19 @@ The vault uses OpenZeppelin's virtual shares pattern to prevent "inflation attac

## Contract Addresses

### Mainnet (Chain ID: 4114)

| Contract | Address | Purpose |
|----------|---------|---------|
| SavingsGateway | [`0x22FE239892eBC8805DA8f05eD3bc6aF75332b60b`](https://citreascan.com/address/0x22FE239892eBC8805DA8f05eD3bc6aF75332b60b) | Main savings with frontend rewards |
| SavingsVaultJUSD | [`0x1b70ae756b1089cc5948e4f8a2AD498DF30E897d`](https://citreascan.com/address/0x1b70ae756b1089cc5948e4f8a2AD498DF30E897d) | ERC-4626 vault adapter |

### Testnet (Chain ID: 5115)

| Contract | Address | Purpose |
|----------|---------|---------|
| SavingsGateway | [`0x54430781b33581CE2b0DBD837CA66113BeEEFD8e`](https://explorer.testnet.citrea.xyz/address/0x54430781b33581CE2b0DBD837CA66113BeEEFD8e) | Main savings with frontend rewards |
| SavingsVaultJUSD | [`0x802a29bD29f02c8C477Af5362f9ba88FAe39Cc7B`](https://explorer.testnet.citrea.xyz/address/0x802a29bD29f02c8C477Af5362f9ba88FAe39Cc7B) | ERC-4626 vault adapter |
| SavingsGateway | [`0x54430781b33581CE2b0DBD837CA66113BeEEFD8e`](https://testnet.citreascan.com/address/0x54430781b33581CE2b0DBD837CA66113BeEEFD8e) | Main savings with frontend rewards |
| SavingsVaultJUSD | [`0x802a29bD29f02c8C477Af5362f9ba88FAe39Cc7B`](https://testnet.citreascan.com/address/0x802a29bD29f02c8C477Af5362f9ba88FAe39Cc7B) | ERC-4626 vault adapter |

## Interest Calculation Example

Expand Down
Loading
Loading