LadderMine / LadderMine/yieldladder

[NF-20] [BACKEND] SDK: Governance Client

Open
#95 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backend
Dominant language
TypeScript
Stars
0
Forks
26
Avg merge
4h 36m
Merged PRs (30d)
8

Description

Overview

The TypeScript SDK only ever wrapped VaultRouter (its original GF-08 scope). This issue adds a first-class client for the Governance contract, which currently has zero SDK surface at all.

Problem

sdks/typescript/src/index.ts's YieldLadder class exposes exactly four methods: deposit, withdraw, earlyExit, position — all against VaultRouter. There is no way for a frontend or third-party integrator to call propose, veto, or execute on Governance, or to read a proposal's status, without hand-rolling raw Soroban RPC calls (which is exactly what the current app/src/app/governance/page.tsx ends up needing to do ad hoc, since no SDK method exists for it).

Proposed Solution

  • Add a YieldLadder.governance sub-client (or a separate exported GovernanceClient class, consistent with whichever pattern the maintainers prefer) with:
    • propose(poolId: string, targetBps: number): Promise<number> (returns proposal id)
    • veto(proposalId: number): Promise<void>
    • execute(proposalId: number): Promise<void>
    • proposal(proposalId: number): Promise<Proposal> — new exported Proposal type matching the on-chain struct (id, action, proposedAtLedger, status)
    • pendingProposals(): Promise<Proposal[]>
  • Resolves the Governance contract address from deployments/{network}.json, following the same address-resolution pattern already used for VaultRouter.
  • Simulates before submitting for all state-changing calls, consistent with the existing deposit/withdraw/earlyExit pattern.

Acceptance Criteria

  • All five methods above are implemented and exported
  • proposal()/pendingProposals() correctly deserialize the on-chain Proposal struct into the new TypeScript Proposal type
  • veto/execute correctly surface on-chain rejection reasons (timelock not elapsed, already vetoed, etc.) as typed errors, not raw RPC error strings
  • Governance contract address is resolved per-network, matching the existing VaultRouter address-resolution pattern
  • Unit tests cover: propose returns an id, veto/execute call the right contract method with the right args, proposal deserialization

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in sdks/typescript/src/index.ts, reading the existing VaultRouter address resolution and deposit, withdraw, and earlyExit simulation patterns; compare the ad hoc calls in app/src/app/governance/page.tsx. Add the five Governance operations, Proposal deserialization, per-network address lookup, and typed rejection errors, then add unit tests covering the listed calls and deserialization.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.