# How to proceed

1. **Data Table:** Outline what data each part of the system will rely on.
2. **Wireframes:** Describe main screens/flows for the user portal (in text for review, can be turned into diagrams).
3. **Technical Details:** Components, data flow, and logic of the platform.
4. **Draft Smart Contract Architecture:** Specify major contracts, key functions/events, and relationships.

**Key Data Involved**

| Data                         | Description                                    | Usage                             |
| ---------------------------- | ---------------------------------------------- | --------------------------------- |
| User Address                 | Ethereum wallet address of user                | Identifies user across contracts  |
| Debt Amount                  | Amount lost in original protocol               | Determines vgd to mint            |
| vgd (Vested GD) Balance      | User’s unvested (locked) and vesting GD tokens | Vesting and claimable state       |
| GD Balance                   | Claimable/redeemed GD token balance            | For staking, trading, governance  |
| Vesting Schedule Per User    | Vesting start, duration, claimed amount        | Unlock tracking                   |
| Treasury Holdings            | Assets (e.g., DAI, ETH) backing GD             | Calculating backing, transparency |
| Staked GD                    | User’s staked GD for rebasing                  | Staking rewards, APY calculation  |
| GD Price & Backing Per Token | Dynamic value per protocol status              | User dashboard, oracle feeds      |
| Bonding Info                 | Discount, input asset, vesting periods         | Protocol expansion mechanism      |

#### 2. **Wireframes (Textual Flow)**

**A. Dashboard/Home**

* Wallet Connect button
* Overview cards:
  * Total original debt
  * vgd (Vested GD): locked, unlock schedule, claimable
  * GD: claimable, staked
  * Staking APY
  * Backing per GD (protocol reserves per token)
* CTA: “Claim GD” if available

**B. Debt/Vesting Page**

* Table:
  * Debt ID | Amount | Vested GD | Unlock Progress | Next Vesting Claim | Claim Button
* Vesting schedule graph (linear or custom unlock curve)
* FAQ about vesting and redemption terms

**C. Staking Page**

* GD Staked: Amount, APY, Rewards earned
* “Stake More” & “Unstake” actions
* Historical staking rewards table

**D. Bonding Page (if using bonding mechanism)**

* List available bonds: Asset type (e.g., ETH, DAI), Discount Rate, Duration
* Bond input amount, receive GD estimate
* Bond progress/claim schedule

**E. Treasury Page**

* Assets held
* Backing per GD stats
* Explorer for all protocol holdings & audit logs

**F. Governance (Optional)**

* Proposals
* Vote delegation

#### 3. **Technical Details/Components**

**Smart Contracts**

* **VGDVesting**: Manages vgd minting, vesting schedule, user claims
* **GDToken**: ERC20, rebasing (staking/interests), mint/burn control
* **Staking**: Lock GD, distribute rebase rewards/APY
* **Bonding**: Accept asset/discounts for locked GD minting, accrue to treasury
* **Treasury**: Holds reserves, verifies GD backing, manages outflows
* **Governance (Optionally)**: Handles parameter changes
* **Oracle (Externalized)**: Tracks market price of reserves

**Frontend**

* React/NextJS UI
  * Web3 wallet connect
  * Dashboard with vesting, staking, bonding modules
  * Real-time treasury dashboard (subgraph/api for contracts)
  * Claim and stake flows, modals for actions

**Backend/Indexing**

* The Graph or custom indexer for events: debt conversions, vesting, staking, treasury movements.

#### 4. **Smart Contract Architecture (Solidity Outline)**

Here’s a simplified starter code layout for your system:

// SPDX-License-Identifier: MIT pragma solidity ^0.8.19;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol";

// --- GD Token --- contract GDToken is ERC20, Ownable { address public stakingContract; address public vestingContract; address public treasury; bool public rebasingEnabled;

```
constructor() ERC20("GD Token", "GD") {}

function mint(address to, uint256 amount) external onlyOwner {
    _mint(to, amount);
}
function burn(address from, uint256 amount) external onlyOwner {
    _burn(from, amount);
}
function setContracts(address _staking, address _vesting, address _treasury) external onlyOwner {
    stakingContract = _staking;
    vestingContract = _vesting;
    treasury = _treasury;
}
// Rebase logic (optional, for APY)
function rebase(uint256 reward) external onlyOwner {
    if (rebasingEnabled) {
        _mint(stakingContract, reward);
    }
}
```

}

// --- vgd (Vested GD) Vesting --- contract VGDVesting is Ownable { GDToken public gd; struct Vesting { uint256 total; uint256 claimed; uint256 start; uint256 duration; } mapping(address => Vesting) public vests;

```
event Vested(address indexed user, uint256 total, uint256 start, uint256 duration);event Claimed(address indexed user, uint256 amount);constructor(GDToken _gd) {    gd = _gd;}function setVesting(address user, uint256 amount, uint256 duration) external onlyOwner {    require(vests[user].total == 0, "Already set");    vests[user] = Vesting(amount, 0, block.timestamp, duration);    emit Vested(user, amount, block.timestamp, duration);}function claim() external {    Vesting storage v = vests[msg.sender];    require(v.total &gt; 0, "No vesting");    uint256 vested = vestedAmount(msg.sender);    uint256 unclaimed = vested - v.claimed;    require(unclaimed &gt; 0, "Nothing to claim");    v.claimed += unclaimed;    gd.mint(msg.sender, unclaimed);    emit Claimed(msg.sender, unclaimed);}function vestedAmount(address user) public view returns (uint256) {    Vesting memory v = vests[user];    if (block.timestamp &lt;= v.start) return 0;    uint256 elapsed = block.timestamp - v.start;    if (elapsed &gt;= v.duration) return v.total;    return (v.total * elapsed) / v.duration;}
```

}

// --- Staking Contract --- contract GDStaking is Ownable { GDToken public gd; mapping(address => uint256) public staked; uint256 public rewardRate; // ...rewards & rebase logic...

text

```
event Staked(address indexed user, uint256 amount);event Unstaked(address indexed user, uint256 amount);// APY/rewards omitted for brevityconstructor(GDToken _gd) {    gd = _gd;}function stake(uint256 amount) external {    gd.transferFrom(msg.sender, address(this), amount);    staked[msg.sender] += amount;    emit Staked(msg.sender, amount);}function unstake(uint256 amount) external {    require(staked[msg.sender] &gt;= amount, "Insufficient");    staked[msg.sender] -= amount;    gd.transfer(msg.sender, amount);    emit Unstaked(msg.sender, amount);}
```

}

// --- Treasury (Simplified) --- contract GDTreasury is Ownable { mapping(address => uint256) public reserves; event ReserveAdded(address token, uint256 amount);

text

```
function addReserve(address token, uint256 amount) external onlyOwner {    reserves[token] += amount;    // IMPORTANT: Add transfer-in logic (receive tokens)    emit ReserveAdded(token, amount);}// Backing per GD, policy management etc. can be added.
```

}

// --- Bonding (Discount for Depositing Asset, Simplified) --- contract GDBonding is Ownable { GDTreasury public treasury; GDToken public gd; // bond params, issue/claim, vesting logic // Omitted for brevity }

This architecture gives you:

* Mintable GD with owner/DAO governance;
* Vesting contract for vgd → GD redemption with schedules and claims;
* Staking contract for rebase rewards (add reward logic as needed);
* Treasury for protocol reserves/backing;
* (Optional) Bonding logic for reserves expansion.

<br>
