Skip to content

Commit 27d3d6e

Browse files
committed
core: update schema to support sGHO and rename merit query
1 parent d93275a commit 27d3d6e

File tree

5 files changed

+164
-43
lines changed

5 files changed

+164
-43
lines changed

packages/graphql/schema.graphql

Lines changed: 98 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ enum ChainsFilter {
148148
ALL
149149
}
150150

151+
type ClaimableMeritReward {
152+
currency: Currency!
153+
amount: TokenAmount!
154+
}
155+
151156
input CollateralToggleRequest {
152157
"""The pool address for the market"""
153158
market: EvmAddress!
@@ -625,27 +630,6 @@ type MeritBorrowIncentive {
625630
claimLink: URL!
626631
}
627632

628-
input MeritClaimRewardsRequest {
629-
user: EvmAddress!
630-
chainId: ChainId!
631-
}
632-
633-
type MeritClaimRewardsTransaction {
634-
"""The chain the transaction is on"""
635-
chain: ChainId!
636-
637-
"""The reward tokens being claimed in the transaction"""
638-
rewards: [MeritReward!]!
639-
640-
"""The transaction to execute to claim the rewards"""
641-
transaction: TransactionRequest!
642-
}
643-
644-
type MeritReward {
645-
currency: Currency!
646-
amount: TokenAmount!
647-
}
648-
649633
type MeritSupplyIncentive {
650634
"""Extra APR for supplying this asset from AAVE Merit program"""
651635
extraSupplyApr: PercentValue!
@@ -938,7 +922,23 @@ type Query {
938922

939923
"""Top up a balance for a user or yourself on the fork"""
940924
forkTopUp(request: ForkTopUpRequest!): ForkTopUpResponse!
941-
meritClaimRewards(request: MeritClaimRewardsRequest!): MeritClaimRewardsTransaction
925+
926+
"""
927+
The user merits reward information and transaction if you wish to claim
928+
"""
929+
userMeritRewards(request: UserMeritRewardsRequest!): UserMeritRewards
930+
931+
"""
932+
Users saving GHO balance - note rewards are not paid out live onchain they paid out with the merit schema,
933+
this can be claimed using `userMeritRewards`
934+
"""
935+
savingsGhoBalance(request: SavingsGhoBalanceRequest!): TokenAmount!
936+
937+
"""Deposit into savings GHO"""
938+
savingsGhoDeposit(request: SavingsGhoDepositRequest!): ExecutionPlan!
939+
940+
"""Withdraw sGHO (savings GHO) back to GHO"""
941+
savingsGhoWithdraw(request: SavingsGhoWithdrawRequest!): TransactionRequest!
942942
}
943943

944944
input RepayAmountInput @oneOf {
@@ -1229,6 +1229,55 @@ type ReserveUserState {
12291229
isInIsolationMode: Boolean!
12301230
}
12311231

1232+
input SavingsGhoBalanceRequest {
1233+
"""The user to query the savings GHO balance"""
1234+
user: EvmAddress!
1235+
}
1236+
1237+
input SavingsGhoDepositRequest {
1238+
"""The details of the amounts to deposit."""
1239+
amount: SayingsGhoDepositAmountInput!
1240+
1241+
"""The user who is depositing"""
1242+
depositor: EvmAddress!
1243+
1244+
"""
1245+
The address to which saving GHO shares will be minted to - defaults to `depositor`.
1246+
"""
1247+
recipient: EvmAddress
1248+
}
1249+
1250+
input SavingsGhoWithdrawAmount @oneOf {
1251+
"""Exact amount to withdraw"""
1252+
exact: BigDecimal
1253+
1254+
"""Withdraw all"""
1255+
max: AlwaysTrue
1256+
}
1257+
1258+
input SavingsGhoWithdrawRequest {
1259+
"""The amount of GHO to withdraw."""
1260+
amount: SavingsGhoWithdrawAmount!
1261+
1262+
"""
1263+
The address from which saving GHO shares will be burned in return for GHO (normally your own wallet).
1264+
"""
1265+
sharesOwner: EvmAddress!
1266+
1267+
"""The address to which GHO will be minted to - defaults to `depositor`."""
1268+
recipient: EvmAddress
1269+
}
1270+
1271+
input SayingsGhoDepositAmountInput {
1272+
"""The amount of GHO to deposit"""
1273+
value: BigDecimal!
1274+
1275+
"""
1276+
The signed ERC20 permit message to operate on the relevant token without need for an ERC20 Approval transaction.
1277+
"""
1278+
permitSig: ERC712Signature
1279+
}
1280+
12321281
scalar Signature
12331282

12341283
input SupplyAPYHistoryRequest {
@@ -1409,6 +1458,33 @@ input UserMarketStateRequest {
14091458
chainId: ChainId!
14101459
}
14111460

1461+
type UserMeritRewards {
1462+
"""The chain the transaction is on"""
1463+
chain: ChainId!
1464+
1465+
"""
1466+
The reward tokens being claimed in the transaction - this is aggregated
1467+
"""
1468+
claimable: [ClaimableMeritReward!]!
1469+
1470+
"""The transaction to execute to claim the rewards"""
1471+
transaction: TransactionRequest!
1472+
}
1473+
1474+
input UserMeritRewardsFilter {
1475+
"""If you only care about certain tokens to claim and see details of"""
1476+
tokens: [EvmAddress!]
1477+
}
1478+
1479+
input UserMeritRewardsRequest {
1480+
"""The user to claim with"""
1481+
user: EvmAddress!
1482+
1483+
"""The chain id to claim on"""
1484+
chainId: ChainId!
1485+
filter: UserMeritRewardsFilter
1486+
}
1487+
14121488
"""A transaction where the user repaid borrowed assets."""
14131489
type UserRepayTransaction {
14141490
"""Amount repaid."""

packages/graphql/src/gho.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { TokenAmountFragment } from './fragments/common';
2+
import {
3+
ExecutionPlanFragment,
4+
TransactionRequestFragment,
5+
} from './fragments/transactions';
6+
import { graphql, type RequestOf } from './graphql';
7+
8+
export const SavingsGhoBalanceQuery = graphql(
9+
`query SavingsGhoBalance($request: SavingsGhoBalanceRequest!) {
10+
value: savingsGhoBalance(request: $request) {
11+
...TokenAmount
12+
}
13+
}`,
14+
[TokenAmountFragment],
15+
);
16+
export type SavingsGhoBalanceRequest = RequestOf<typeof SavingsGhoBalanceQuery>;
17+
18+
export const SavingsGhoWithdrawQuery = graphql(
19+
`query SavingsGhoWithdraw($request: SavingsGhoWithdrawRequest!) {
20+
value: savingsGhoWithdraw(request: $request) {
21+
...TransactionRequest
22+
}
23+
}`,
24+
[TransactionRequestFragment],
25+
);
26+
export type SavingsGhoWithdrawRequest = RequestOf<
27+
typeof SavingsGhoWithdrawQuery
28+
>;
29+
30+
export const SavingsGhoDepositQuery = graphql(
31+
`query SavingsGhoDeposit($request: SavingsGhoDepositRequest!) {
32+
value: savingsGhoDeposit(request: $request) {
33+
...ExecutionPlan
34+
}
35+
}`,
36+
[ExecutionPlanFragment],
37+
);
38+
export type SavingsGhoDepositRequest = RequestOf<typeof SavingsGhoDepositQuery>;

0 commit comments

Comments
 (0)