> ## Documentation Index
> Fetch the complete documentation index at: https://docs.signalium.site/llms.txt
> Use this file to discover all available pages before exploring further.

# GimoAdapter

> IYieldAdapter implementation for Gimo Finance liquid staking. Native 0G in, st0G out, ~3 day unbonding.

Source: [`packages/contracts/src/yield/GimoAdapter.sol`](https://github.com/rstfulzz/signalium/blob/main/packages/contracts/src/yield/GimoAdapter.sol)

Single-purpose, immutable. One adapter per Treasury keeps accounting isolated.

## Why a per-market adapter

Gimo's `unstake(lsdAmount)` queues a withdrawal ticket against the *caller's* address. If two markets shared an adapter, their unbonding queues would commingle and accounting would have to disambiguate. A fresh adapter per market sidesteps that — each adapter sees only its own tickets.

## Lifecycle

| Call                                            | Effect                                                                                                                                                                                                                                      |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `constructor(treasury, stakePool, referrer)`    | Stores immutable wiring; max-approves `st0G` to `stakePool` so subsequent `unstake()` works                                                                                                                                                 |
| `deposit() payable` (only treasury)             | Calls `stakePool.stake{value: msg.value}(referrer)`, returns minted shares                                                                                                                                                                  |
| `requestWithdraw(nativeAmount)` (only treasury) | Burns `ceil(nativeAmount × 1e18 / rate)` `st0G`, books `_pendingClaim += nativeAmount`. If the request overshoots the position by rounding, drains the position instead of reverting (caller learns the actual amount via `pendingClaim()`) |
| `claim()` (only treasury)                       | Calls `stakePool.withdraw()`, forwards realized native to the Treasury, reconciles `_pendingClaim` against actual payout                                                                                                                    |
| `syncLsdApproval()` (permissionless)            | Re-runs the max-approve. Useful if Gimo upgrades and rotates the `lsdToken` proxy                                                                                                                                                           |

## totalAssets vs pendingClaim

```solidity theme={null}
function totalAssets() returns uint256 {
    return shares() × stakePool.getRate() / 1e18;  // still earning in Gimo
}
function pendingClaim() returns uint256 {
    return _pendingClaim;                          // queued, no longer earning
}
```

Callers (Treasury) sum the two for the full deliverable amount. Single-purpose accessors avoid the trap of one number meaning two things mid-unstake.

## Mainnet probe

Discovered by `cast call` against the deployed Gimo proxy at [`0xAc06d1Df…35aF`](https://chainscan.0g.ai/address/0xAc06d1Df23a4Fa00981aFAC0f33A5936Bd2135aF):

| Method                | Returns                 | What it means               |
| --------------------- | ----------------------- | --------------------------- |
| `getRate()`           | `uint256` (1e18-scaled) | st0G → 0G exchange rate     |
| `eraSeconds()`        | `86400`                 | 1 day per era               |
| `unbondingDuration()` | `3`                     | 3 eras = \~3 day unbonding  |
| `minStakeAmount()`    | `1e16` (0.01 0G)        | Smallest stake Gimo accepts |
| `lsdToken()`          | `0x7bBC…1404`           | st0G ERC20                  |

The 4 fork tests in [`GimoAdapter.fork.t.sol`](https://github.com/rstfulzz/signalium/blob/main/packages/contracts/test/yield/GimoAdapter.fork.t.sol) exercise the full `deposit → unstake → wait → claim` round-trip against this real proxy.
