Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
5 changes: 5 additions & 0 deletions .changeset/clear-yaks-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@aave/graphql": patch
---

**feat**: Add fee recipients support to the vault
33 changes: 30 additions & 3 deletions packages/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@ enum OperationType {
VAULT_FEE_WITHDRAWN
VAULT_WITHDRAW
LIQUIDATION
REVENUE_SPLITTER_OWNER_DEPLOYED
REVENUE_SPLITTER_RECIPIENT_SET
}

enum OrderDirection {
Expand Down Expand Up @@ -941,6 +943,24 @@ type Query {
savingsGhoWithdraw(request: SavingsGhoWithdrawRequest!): ExecutionPlan!
}

type RecipientPercent {
"""Address of the recipient."""
address: EvmAddress!

"""
Percentage of the fee that will be sent to the recipient, expressed in basis points.
"""
percent: PercentValue!
}

input RecipientPercentInput {
"""Address of the recipient."""
address: EvmAddress!

"""Percentage of the fee that will be sent to the recipient."""
percent: BigDecimal!
}

input RepayAmountInput @oneOf {
"""The native amount"""
native: BigDecimal
Expand Down Expand Up @@ -1708,9 +1728,6 @@ type Vault {
"""The vault address"""
address: EvmAddress!

"""The owner of the vault"""
owner: EvmAddress!

"""The name of the share"""
shareName: String!

Expand All @@ -1737,11 +1754,15 @@ type Vault {
"""The user's shares info on the vault"""
userShares: UserVaultShares

"""The owner of the vault"""
owner: EvmAddress!

"""The total fees the owner can claim currently for the vault"""
feesBalance: TokenAmount!

"""The total vault APR after their fee is taken off"""
vaultApr: PercentValue!
feeRecipients: [RecipientPercent!]!
Copy link
Contributor

Choose a reason for hiding this comment

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

Is 'fee' here used with the same meaning as 'fee' when used in feesBalance for example?

}

input VaultDeployRequest {
Expand Down Expand Up @@ -1775,6 +1796,12 @@ input VaultDeployRequest {
The initial amount of underlying assets to deposit. This must be a non-zero, non-trivial amount, depending on the underlying asset's decimals.
"""
initialLockDeposit: BigDecimal!

"""
The recipients of the fee revenue, expressed as a percentage of the total fee revenue.
If not provided, the fee revenue will be sent to the owner of the vault.
"""
recipients: [RecipientPercentInput!]
}

input VaultDepositAmountInput {
Expand Down
12 changes: 12 additions & 0 deletions packages/graphql/src/fragments/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ export const PercentValueFragment = graphql(
);
export type PercentValue = FragmentOf<typeof PercentValueFragment>;

export const RecipientPercentFragment = graphql(
`fragment RecipientPercent on RecipientPercent {
__typename
address
percent {
...PercentValue
}
}`,
[PercentValueFragment],
);
export type RecipientPercent = FragmentOf<typeof RecipientPercentFragment>;

export const CurrencyFragment = graphql(
`fragment Currency on Currency {
__typename
Expand Down
5 changes: 5 additions & 0 deletions packages/graphql/src/fragments/vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { type FragmentDocumentFor, graphql } from '../graphql';
import {
PaginatedResultInfoFragment,
PercentValueFragment,
RecipientPercentFragment,
TokenAmountFragment,
} from './common';
import { ReserveFragment } from './reserve';
Expand Down Expand Up @@ -37,6 +38,9 @@ export const VaultFragment = graphql(
totalFeeRevenue {
...TokenAmount
}
feeRecipients {
...RecipientPercent
}
balance {
...TokenAmount
}
Expand All @@ -56,6 +60,7 @@ export const VaultFragment = graphql(
PercentValueFragment,
TokenAmountFragment,
UserVaultSharesFragment,
RecipientPercentFragment,
],
);
export type Vault = FragmentOf<typeof VaultFragment>;
Expand Down
8 changes: 5 additions & 3 deletions packages/graphql/src/graphql-env.d.ts

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions packages/spec/vaults/vault.helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
type BigDecimal,
type EvmAddress,
evmAddress,
nonNullable,
Expand Down Expand Up @@ -33,6 +34,10 @@ export function createVault(
symbol: string;
address: EvmAddress;
};
recipients?: {
address: EvmAddress;
percent: BigDecimal;
}[];
},
): ResultAsync<Vault, Error> {
return fundErc20Address(
Expand All @@ -55,6 +60,7 @@ export function createVault(
shareName: config?.token?.name ?? 'Aave WETH Vault Shares',
shareSymbol: config?.token?.symbol ?? 'avWETH',
underlyingToken: reserve!.underlyingToken.address,
recipients: config?.recipients,
})
.andThen(sendWith(organization))
.andThen(client.waitForTransaction)
Expand Down
Loading