Skip to content

Conversation

@LeonardoVieira1630
Copy link
Member

No description provided.

LeonardoVieira1630 and others added 29 commits December 17, 2025 19:05
- Add TreasuryService with provider interface
- Implement DefiLlama provider for treasury data
- Implement Dune provider as fallback option
- Add treasury-provider-factory for dynamic provider initialization
- Support for liquid treasury historical data

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add DEFILLAMA_API_URL optional environment variable
- Add TREASURY_PROVIDER_PROTOCOL_ID for provider configuration
- Update .env.example with treasury provider examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Rename fetchTotalAssets to fetchLiquidTreasury
- Move DuneResponse type to treasury providers
- Update import to use treasury provider types
- Remove obsolete types.ts file

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Update assets controller to use TreasuryService
- Replace DuneService instantiation with createTreasuryProvider factory
- Change endpoint from /total-assets to /liquid-treasury
- Add order parameter support for historical data sorting
- Remove totalAssets import from controllers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Update @types/pg to version 8.15.4
- Update pnpm lockfile

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Dec 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
anticapture Ready Ready Preview, Comment Dec 23, 2025 6:42pm
anticapture-storybook Ready Ready Preview, Comment Dec 23, 2025 6:42pm

@vercel vercel bot temporarily deployed to Preview – anticapture-storybook December 22, 2025 17:06 Inactive
});

// Create timeline from first data point to today
const timeline = createDailyTimelineFromData(liquidMap);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be moved to inside the forward fill func?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can… but I think it’s better to keep it separated.

  1. Make each thing responsible for a single responsibility.
  2. The treasury functions can keep using the timeline generated by calling createDailyTimelineFromData. If you take a look at that function in this file, the output of createDailyTimelineFromData is not used only for the forward fill.

Comment on lines 60 to 89
export const useTreasury = (
daoId: DaoIdEnum,
type: TreasuryType = "total",
days: TimeInterval = TimeInterval.ONE_YEAR,
options?: {
order?: "asc" | "desc";
config?: Partial<SWRConfiguration<TreasuryResponse, Error>>;
},
) => {
const { order = "asc", config } = options || {};
const key = daoId ? ["treasury", daoId, type, days, order] : null;

const { data, error, isValidating, mutate } = useSWR<TreasuryResponse>(
key,
() => fetchTreasury({ daoId, type, days, order }),
{
revalidateOnFocus: false,
shouldRetryOnError: false,
...config,
},
);

return {
data: data?.items ?? [],
totalCount: data?.totalCount ?? 0,
loading: isValidating,
error,
refetch: mutate,
};
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const useTreasury = (
daoId: DaoIdEnum,
type: TreasuryType = "total",
days: TimeInterval = TimeInterval.ONE_YEAR,
options?: {
order?: "asc" | "desc";
config?: Partial<SWRConfiguration<TreasuryResponse, Error>>;
},
) => {
const { order = "asc", config } = options || {};
const key = daoId ? ["treasury", daoId, type, days, order] : null;
const { data, error, isValidating, mutate } = useSWR<TreasuryResponse>(
key,
() => fetchTreasury({ daoId, type, days, order }),
{
revalidateOnFocus: false,
shouldRetryOnError: false,
...config,
},
);
return {
data: data?.items ?? [],
totalCount: data?.totalCount ?? 0,
loading: isValidating,
error,
refetch: mutate,
};
};
export const useTreasury = (
daoId: DaoIdEnum,
type: TreasuryType = "total",
days: TimeInterval = TimeInterval.ONE_YEAR,
order: "asc" | "desc" = "asc",
) => {
const { data, error, isValidating } = useSWR<TreasuryResponse>(
["treasury", daoId, type, days, order],
() => fetchTreasury({ daoId, type, days, order }),
{
revalidateOnFocus: false,
shouldRetryOnError: false,
},
);
return {
data: data?.items ?? [],
totalCount: data?.totalCount ?? 0,
loading: isValidating,
error,
};
};

@pikonha pikonha marked this pull request as ready for review December 22, 2025 18:22
@LeonardoVieira1630 LeonardoVieira1630 self-assigned this Dec 23, 2025
@LeonardoVieira1630 LeonardoVieira1630 added the refactor Refactor/Adapting the code label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactor/Adapting the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants