Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
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
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# graphql Subsquid endpoint
VITE_SUBSQUID_URL="https://squid.subsquid.io/origin-squid/graphql"
VITE_SUBSQUID_URL="https://origin.squids.live/origin-squid/v/v29/graphql"
# graphql Snapshot endpoint
VITE_SNAPSHOT_URL="https://hub.snapshot.org/graphql"
# Alchemy rpc url
Expand Down
2 changes: 1 addition & 1 deletion .graphqlconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Subsquid GraphQL Schema",
"schemaPath": [
"https://squid.subsquid.io/origin-squid/graphql",
"https://origin.squids.live/origin-squid/v/v29/graphql",
"https://squid.subsquid.io/prime-eth-squid/graphql",
"https://hub.snapshot.org/graphql"
]
Expand Down
4 changes: 2 additions & 2 deletions libs/defi/home/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export const useTokenInfo = (token: Token) =>
}

if (token.symbol === tokens.mainnet.OUSD.symbol) {
info.apy30DayAvg = data?.ousdapies?.at(0)?.apy30DayAvg ?? 0;
info.apy30DayAvg = data?.oTokenApies?.at(0)?.apy30DayAvg ?? 0;
info.tvl = +formatUnits(
BigInt(data?.ousds?.at(0)?.totalSupply ?? '0'),
BigInt(data?.oTokens?.at(0)?.totalSupply ?? '0'),
tokens.mainnet.OUSD.decimals,
);
}
Expand Down
14 changes: 11 additions & 3 deletions libs/defi/home/src/queries.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { graphqlClient } from '@origin/defi/shared';
export type ProductCardQueryVariables = Types.Exact<{ [key: string]: never; }>;


export type ProductCardQuery = { __typename?: 'Query', oethDailyStats: Array<{ __typename?: 'OETHDailyStat', apy30DayAvg: number, totalSupply: string }>, ousds: Array<{ __typename?: 'OUSD', totalSupply: string }>, ousdapies: Array<{ __typename?: 'OUSDAPY', apy30DayAvg: number }> };
export type ProductCardQuery = { __typename?: 'Query', oethDailyStats: Array<{ __typename?: 'OETHDailyStat', apy30DayAvg: number, totalSupply: string }>, oTokens: Array<{ __typename?: 'OToken', totalSupply: string }>, oTokenApies: Array<{ __typename?: 'OTokenAPY', apy30DayAvg: number }> };



Expand All @@ -15,10 +15,18 @@ export const ProductCardDocument = `
apy30DayAvg
totalSupply
}
ousds(limit: 1, orderBy: timestamp_DESC) {
oTokens(
limit: 1
orderBy: timestamp_DESC
where: {chainId_eq: 1, otoken_eq: "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86"}
) {
totalSupply
}
ousdapies(limit: 1, orderBy: timestamp_DESC) {
oTokenApies(
limit: 1
orderBy: timestamp_DESC
where: {chainId_eq: 1, otoken_eq: "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86"}
) {
apy30DayAvg
}
}
Expand Down
4 changes: 2 additions & 2 deletions libs/defi/home/src/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ query ProductCard {
apy30DayAvg
totalSupply
}
ousds(limit: 1, orderBy: timestamp_DESC) {
oTokens(limit: 1, orderBy: timestamp_DESC, where: {chainId_eq: 1, otoken_eq: "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86"} ) {
totalSupply
}
ousdapies(limit: 1, orderBy: timestamp_DESC) {
oTokenApies(limit: 1, orderBy: timestamp_DESC, where: {chainId_eq: 1, otoken_eq: "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86"} ) {
apy30DayAvg
}
}
4 changes: 2 additions & 2 deletions libs/defi/oeth/src/portfolio/components/HistoryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ function ExportDataButton() {
{
enabled: isConnected,
select: (data) => {
if (!data?.oethHistories) {
if (!data?.oTokenHistories) {
return;
}

return data.oethHistories.reduce(
return data.oTokenHistories.reduce(
(acc, curr) => [
...acc,
[curr.timestamp, curr.type, curr.value, curr.balance, curr.txHash],
Expand Down
2 changes: 1 addition & 1 deletion libs/defi/oeth/src/portfolio/components/StatCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const StatCards = (props: BoxProps) => {
{ address: address ?? ZERO_ADDRESS },
{
enabled: !!address,
select: (data) => data?.oethAddresses?.at(0),
select: (data) => data?.oTokenAddresses?.at(0),
},
);
const { data: pendingYield, isLoading: pendingYieldLoading } =
Expand Down
4 changes: 2 additions & 2 deletions libs/defi/oeth/src/portfolio/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ export const useAggregatedHistory = (
refetchOnWindowFocus: false,
...options,
enabled: isConnected && !!address,
placeholderData: { oethHistories: [] },
placeholderData: { oTokenHistories: [] },
select: useCallback((data: OethHistoryTransactionQuery) => {
const history = data?.oethHistories;
const history = data?.oTokenHistories;

const grouped = groupBy(
(hist) =>
Expand Down
12 changes: 7 additions & 5 deletions libs/defi/oeth/src/portfolio/queries.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ export type OethHistoryUserStatQueryVariables = Types.Exact<{
}>;


export type OethHistoryUserStatQuery = { __typename?: 'Query', oethAddresses: Array<{ __typename?: 'OETHAddress', balance: string, earned: string, isContract: boolean, rebasingOption: Types.RebasingOption, lastUpdated: string }> };
export type OethHistoryUserStatQuery = { __typename?: 'Query', oTokenAddresses: Array<{ __typename?: 'OTokenAddress', balance: string, earned: string, isContract: boolean, rebasingOption: Types.RebasingOption, lastUpdated: string }> };

export type OethHistoryTransactionQueryVariables = Types.Exact<{
address: Types.Scalars['String']['input'];
filters?: Types.InputMaybe<Array<Types.HistoryType> | Types.HistoryType>;
}>;


export type OethHistoryTransactionQuery = { __typename?: 'Query', oethHistories: Array<{ __typename?: 'OETHHistory', type: Types.HistoryType, value: string, txHash: string, timestamp: string, balance: string }> };
export type OethHistoryTransactionQuery = { __typename?: 'Query', oTokenHistories: Array<{ __typename?: 'OTokenHistory', type: Types.HistoryType, value: string, txHash: string, timestamp: string, balance: string }> };

export type OethDailyYieldQueryVariables = Types.Exact<{
start: Types.Scalars['DateTime']['input'];
Expand All @@ -28,7 +28,9 @@ export type OethDailyYieldQuery = { __typename?: 'Query', oethDailyStats: Array<

export const OethHistoryUserStatDocument = `
query OethHistoryUserStat($address: String!) {
oethAddresses(where: {id_containsInsensitive: $address}) {
oTokenAddresses(
where: {address_containsInsensitive: $address, chainId_eq: 1, otoken_eq: "0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3"}
) {
balance
earned
isContract
Expand Down Expand Up @@ -61,11 +63,11 @@ useOethHistoryUserStatQuery.fetcher = (variables: OethHistoryUserStatQueryVariab

export const OethHistoryTransactionDocument = `
query OethHistoryTransaction($address: String!, $filters: [HistoryType!]) {
oethHistories(
oTokenHistories(
orderBy: timestamp_DESC
offset: 0
limit: 2000
where: {AND: {address: {id_containsInsensitive: $address}, type_in: $filters}}
where: {address: {id_containsInsensitive: $address}, type_in: $filters, chainId_eq: 1, otoken_eq: "0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3"}
) {
type
value
Expand Down
13 changes: 10 additions & 3 deletions libs/defi/oeth/src/portfolio/queries.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
query OethHistoryUserStat($address: String!) {
oethAddresses(where: { id_containsInsensitive: $address }) {
oTokenAddresses(where: {
address_containsInsensitive: $address,
chainId_eq: 1,
otoken_eq: "0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3"
}) {
balance
earned
isContract
Expand All @@ -9,12 +13,15 @@ query OethHistoryUserStat($address: String!) {
}

query OethHistoryTransaction($address: String!, $filters: [HistoryType!]) {
oethHistories(
oTokenHistories(
orderBy: timestamp_DESC
offset: 0
limit: 2000
where: {
AND: { address: { id_containsInsensitive: $address }, type_in: $filters }
address: { id_containsInsensitive: $address },
type_in: $filters,
chainId_eq: 1,
otoken_eq: "0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3"
}
) {
type
Expand Down
2 changes: 1 addition & 1 deletion libs/defi/oeth/src/portfolio/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { OethHistoryTransactionQuery } from './queries.generated';

export type History = OethHistoryTransactionQuery['oethHistories'][number];
export type History = OethHistoryTransactionQuery['oTokenHistories'][number];

export type DailyHistory = History & {
transactions?: History[];
Expand Down
2 changes: 1 addition & 1 deletion libs/defi/oeth/src/swap/components/OethDetailCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function Apy() {
const once = useRef(false);
const [trailing, setTrailing] = useState(30);
const { data: apy, isLoading: apyLoading } = useOethApyQuery(undefined, {
select: (data) => data.oethapies[0],
select: (data) => data.oTokenApies[0],
});
const trailingOptions: Option[] = useMemo(
() => [
Expand Down
8 changes: 6 additions & 2 deletions libs/defi/oeth/src/swap/queries.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ import { graphqlClient } from '@origin/defi/shared';
export type OethApyQueryVariables = Types.Exact<{ [key: string]: never; }>;


export type OethApyQuery = { __typename?: 'Query', oethapies: Array<{ __typename?: 'OETHAPY', apy7DayAvg: number, apy30DayAvg: number }> };
export type OethApyQuery = { __typename?: 'Query', oTokenApies: Array<{ __typename?: 'OTokenAPY', apy7DayAvg: number, apy30DayAvg: number }> };



export const OethApyDocument = `
query OethApy {
oethapies(limit: 1, orderBy: timestamp_DESC) {
oTokenApies(
limit: 1
orderBy: timestamp_DESC
where: {chainId_eq: 1, otoken_eq: "0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3"}
) {
apy7DayAvg
apy30DayAvg
}
Expand Down
5 changes: 4 additions & 1 deletion libs/defi/oeth/src/swap/queries.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
query OethApy {
oethapies(limit: 1, orderBy: timestamp_DESC) {
oTokenApies(limit: 1, orderBy: timestamp_DESC, where: {
chainId_eq: 1,
otoken_eq: "0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3"
}) {
apy7DayAvg
apy30DayAvg
}
Expand Down
4 changes: 2 additions & 2 deletions libs/defi/ousd/src/portfolio/components/HistoryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ function ExportData() {
{ address: address ?? ZERO_ADDRESS },
{
select: (data) => {
if (!data?.ousdHistories) {
if (!data?.oTokenHistories) {
return;
}

return data.ousdHistories.reduce(
return data.oTokenHistories.reduce(
(acc, curr) => [
...acc,
[curr.timestamp, curr.type, curr.value, curr.balance, curr.txHash],
Expand Down
2 changes: 1 addition & 1 deletion libs/defi/ousd/src/portfolio/components/StatCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const StatCards = (props: BoxProps) => {
{ address: address ?? ZERO_ADDRESS },
{
enabled: !!address,
select: (data) => data?.ousdAddresses?.at(0),
select: (data) => data?.oTokenAddresses?.at(0),
},
);
const { data: pendingYield, isLoading: pendingYieldLoading } =
Expand Down
4 changes: 2 additions & 2 deletions libs/defi/ousd/src/portfolio/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ export const useAggregatedHistory = (
refetchOnWindowFocus: false,
...options,
enabled: isConnected && !isNilOrEmpty(address),
placeholderData: { ousdHistories: [] },
placeholderData: { oTokenHistories: [] },
select: useCallback((data: OusdHistoryTransactionQuery) => {
const history = data?.ousdHistories;
const history = data?.oTokenHistories;

const grouped = groupBy(
(hist) =>
Expand Down
12 changes: 7 additions & 5 deletions libs/defi/ousd/src/portfolio/queries.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ export type OusdHistoryUserStatQueryVariables = Types.Exact<{
}>;


export type OusdHistoryUserStatQuery = { __typename?: 'Query', ousdAddresses: Array<{ __typename?: 'OUSDAddress', balance: string, earned: string, isContract: boolean, rebasingOption: Types.RebasingOption, lastUpdated: string }> };
export type OusdHistoryUserStatQuery = { __typename?: 'Query', oTokenAddresses: Array<{ __typename?: 'OTokenAddress', balance: string, earned: string, isContract: boolean, rebasingOption: Types.RebasingOption, lastUpdated: string }> };

export type OusdHistoryTransactionQueryVariables = Types.Exact<{
address: Types.Scalars['String']['input'];
filters?: Types.InputMaybe<Array<Types.HistoryType> | Types.HistoryType>;
}>;


export type OusdHistoryTransactionQuery = { __typename?: 'Query', ousdHistories: Array<{ __typename?: 'OUSDHistory', type: Types.HistoryType, value: string, txHash: string, timestamp: string, balance: string }> };
export type OusdHistoryTransactionQuery = { __typename?: 'Query', oTokenHistories: Array<{ __typename?: 'OTokenHistory', type: Types.HistoryType, value: string, txHash: string, timestamp: string, balance: string }> };

export type OusdDailyYieldQueryVariables = Types.Exact<{
start: Types.Scalars['DateTime']['input'];
Expand All @@ -28,7 +28,9 @@ export type OusdDailyYieldQuery = { __typename?: 'Query', ousdDailyStats: Array<

export const OusdHistoryUserStatDocument = `
query OusdHistoryUserStat($address: String!) {
ousdAddresses(where: {id_containsInsensitive: $address}) {
oTokenAddresses(
where: {address_containsInsensitive: $address, chainId_eq: 1, otoken_eq: "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86"}
) {
balance
earned
isContract
Expand Down Expand Up @@ -61,11 +63,11 @@ useOusdHistoryUserStatQuery.fetcher = (variables: OusdHistoryUserStatQueryVariab

export const OusdHistoryTransactionDocument = `
query OusdHistoryTransaction($address: String!, $filters: [HistoryType!]) {
ousdHistories(
oTokenHistories(
orderBy: timestamp_DESC
offset: 0
limit: 2000
where: {AND: {address: {id_containsInsensitive: $address}, type_in: $filters}}
where: {address: {id_containsInsensitive: $address}, type_in: $filters, chainId_eq: 1, otoken_eq: "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86"}
) {
type
value
Expand Down
9 changes: 6 additions & 3 deletions libs/defi/ousd/src/portfolio/queries.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query OusdHistoryUserStat($address: String!) {
ousdAddresses(where: { id_containsInsensitive: $address }) {
oTokenAddresses(where: { address_containsInsensitive: $address, chainId_eq: 1, otoken_eq: "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86" }) {
balance
earned
isContract
Expand All @@ -9,12 +9,15 @@ query OusdHistoryUserStat($address: String!) {
}

query OusdHistoryTransaction($address: String!, $filters: [HistoryType!]) {
ousdHistories(
oTokenHistories(
orderBy: timestamp_DESC
offset: 0
limit: 2000
where: {
AND: { address: { id_containsInsensitive: $address }, type_in: $filters }
address: { id_containsInsensitive: $address },
type_in: $filters,
chainId_eq: 1,
otoken_eq: "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86"
}
) {
type
Expand Down
2 changes: 1 addition & 1 deletion libs/defi/ousd/src/portfolio/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { OusdHistoryTransactionQuery } from './queries.generated';

export type History = OusdHistoryTransactionQuery['ousdHistories'][number];
export type History = OusdHistoryTransactionQuery['oTokenHistories'][number];

export type DailyHistory = History & {
transactions?: History[];
Expand Down
2 changes: 1 addition & 1 deletion libs/defi/ousd/src/swap/components/OusdDetailCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function Apy() {
const once = useRef(false);
const [trailing, setTrailing] = useState(30);
const { data: apy, isLoading: apyLoading } = useOusdApyQuery(undefined, {
select: (data) => data.ousdapies[0],
select: (data) => data.oTokenApies[0],
});
const trailingOptions: Option[] = useMemo(
() => [
Expand Down
8 changes: 6 additions & 2 deletions libs/defi/ousd/src/swap/queries.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ import { graphqlClient } from '@origin/defi/shared';
export type OusdApyQueryVariables = Types.Exact<{ [key: string]: never; }>;


export type OusdApyQuery = { __typename?: 'Query', ousdapies: Array<{ __typename?: 'OUSDAPY', apy7DayAvg: number, apy30DayAvg: number }> };
export type OusdApyQuery = { __typename?: 'Query', oTokenApies: Array<{ __typename?: 'OTokenAPY', apy7DayAvg: number, apy30DayAvg: number }> };



export const OusdApyDocument = `
query OusdApy {
ousdapies(limit: 1, orderBy: timestamp_DESC) {
oTokenApies(
limit: 1
orderBy: timestamp_DESC
where: {chainId_eq: 1, otoken_eq: "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86"}
) {
apy7DayAvg
apy30DayAvg
}
Expand Down
6 changes: 5 additions & 1 deletion libs/defi/ousd/src/swap/queries.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
query OusdApy {
ousdapies(limit: 1, orderBy: timestamp_DESC) {
oTokenApies(
limit: 1,
orderBy: timestamp_DESC,
where: { chainId_eq: 1, otoken_eq: "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86" }
) {
apy7DayAvg
apy30DayAvg
}
Expand Down
Loading