Skip to content

Commit f2c4fbd

Browse files
[base-apy] add SSV token support and refactor APY components
1 parent 3a6efa4 commit f2c4fbd

File tree

11 files changed

+69
-35
lines changed

11 files changed

+69
-35
lines changed

changelog/next-release.md

+16
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,19 @@ type Output = {
1616
|---------------------|-------------------------|
1717
| `assets` | Balance in ETH |
1818
| `totalEarnedAssets` | Total earned rewards |
19+
20+
21+
### 2. [sdk.vault.getVault](https://sdk.stakewise.io/vault/requests/getvault)
22+
23+
#### Add new output item:
24+
25+
```ts
26+
type Output = {
27+
baseApy: number
28+
}
29+
```
30+
| Name | Description |
31+
|-----------|--------------------------------------------------------------|
32+
| `baseApy` | The vault average weekly base APY (without extra incentives) |
33+
34+
### 3. Add SSV token to config

src/graphql/subgraph/vault/vaultQuery.graphql

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ query Vault($address: ID!) {
1010
admin
1111
version
1212
isErc20
13+
baseApy
1314
imageUrl
1415
capacity
1516
mevEscrow

src/methods/vault/requests/getVault/getVault.md

+36-34
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Returns the master data of the vault
1818
```ts
1919
type Output = {
2020
apy: number
21+
baseApy: number
2122
version: number
2223
isErc20: boolean
2324
capacity: string
@@ -50,40 +51,41 @@ type Output = {
5051
}
5152
```
5253
53-
| Name | Description |
54-
|-----------------------------|-------------------------------------------------|
55-
| `version` | Vault version |
56-
| `apy` | Current vault apy |
57-
| `isErc20` | Does the vault have its own ERC20 token |
58-
| `capacity` | Maximum TVL of Vault |
59-
| `createdAt` | Date of Creation |
60-
| `feePercent` | Commission rate |
61-
| `isPrivate` | Whether the vault is private |
62-
| `isGenesis` | Is a stakewise vault |
63-
| `queuedShares` | The total number of queued shares |
64-
| `isBlocklist` | Whether the vault has blocklist |
65-
| `vaultAdmin` | Vault administrator address |
66-
| `totalAssets` | TVL of Vault |
67-
| `feeRecipient` | Vault fee address |
68-
| `whitelistManager` | Whitelist manager |
69-
| `vaultAddress` | Address of vault |
70-
| `mevRecipient` | Validator fee recipient |
71-
| `whitelistCount` | Number of addresses in the [whitelist](/vault/requests/getwhitelist) |
72-
| `blocklistCount` | Number of addresses in the [blocklist](/vault/requests/getblocklist) |
73-
| `imageUrl` | Link for vault logo |
74-
| `blocklistManager` | Blocklist manager |
75-
| `depositDataManager` | Keys manager address |
76-
| `isSmoothingPool` | Smoothing poll or Vault escrow |
77-
| `tokenName` | ERC20 token name |
78-
| `tokenSymbol` | ERC20 token symbol |
79-
| `displayName` | Name of vault |
80-
| `allocatorMaxBoostApy` | The average max boost APY earned in this vault by the allocator |
81-
| `osTokenHolderMaxBoostApy` | The average max boost APY earned in this vault by the osToken holder |
82-
| `description` | Description of vault |
83-
| `whitelist` | List of authorized users for deposits |
84-
| `blocklist` | List of blocked users for deposits |
85-
| `performance` | Vault performance indicator (percent) |
86-
| `osTokenConfig` | contains the ltvPercent, which is the percentage used to calculate how much a user can mint in OsToken shares, and thresholdPercent, which is the liquidation threshold percentage used to calculate the health factor for the OsToken position |
54+
| Name | Description |
55+
|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
56+
| `version` | Vault version |
57+
| `apy` | Current vault apy |
58+
| `baseApy` | The vault average weekly base APY (without extra incentives) |
59+
| `isErc20` | Does the vault have its own ERC20 token |
60+
| `capacity` | Maximum TVL of Vault |
61+
| `createdAt` | Date of Creation |
62+
| `feePercent` | Commission rate |
63+
| `isPrivate` | Whether the vault is private |
64+
| `isGenesis` | Is a stakewise vault |
65+
| `queuedShares` | The total number of queued shares |
66+
| `isBlocklist` | Whether the vault has blocklist |
67+
| `vaultAdmin` | Vault administrator address |
68+
| `totalAssets` | TVL of Vault |
69+
| `feeRecipient` | Vault fee address |
70+
| `whitelistManager` | Whitelist manager |
71+
| `vaultAddress` | Address of vault |
72+
| `mevRecipient` | Validator fee recipient |
73+
| `whitelistCount` | Number of addresses in the [whitelist](/vault/requests/getwhitelist) |
74+
| `blocklistCount` | Number of addresses in the [blocklist](/vault/requests/getblocklist) |
75+
| `imageUrl` | Link for vault logo |
76+
| `blocklistManager` | Blocklist manager |
77+
| `depositDataManager` | Keys manager address |
78+
| `isSmoothingPool` | Smoothing poll or Vault escrow |
79+
| `tokenName` | ERC20 token name |
80+
| `tokenSymbol` | ERC20 token symbol |
81+
| `displayName` | Name of vault |
82+
| `allocatorMaxBoostApy` | The average max boost APY earned in this vault by the allocator |
83+
| `osTokenHolderMaxBoostApy` | The average max boost APY earned in this vault by the osToken holder |
84+
| `description` | Description of vault |
85+
| `whitelist` | List of authorized users for deposits |
86+
| `blocklist` | List of blocked users for deposits |
87+
| `performance` | Vault performance indicator (percent) |
88+
| `osTokenConfig` | contains the ltvPercent, which is the percentage used to calculate how much a user can mint in OsToken shares, and thresholdPercent, which is the liquidation threshold percentage used to calculate the health factor for the OsToken position |
8789
8890
#### Example:
8991

src/methods/vault/requests/getVault/modifyVault.spec.ts

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ describe('modifyVault', () => {
2626
allocatorMaxBoostApy: '123.2',
2727
osTokenHolderMaxBoostApy: '123.2',
2828
apy: '2.80',
29+
baseApy: '0.80',
2930
queuedShares: '0',
3031
blocklistCount: '0',
3132
whitelistCount: '0',
@@ -52,6 +53,7 @@ describe('modifyVault', () => {
5253
it('should correctly transform the vault data', () => {
5354
const expectedModifiedVault: ModifiedVault = {
5455
apy: 2.80,
56+
baseApy: 0.80,
5557
isErc20: true,
5658
feePercent: 2,
5759
version: 1,

src/methods/vault/requests/getVault/modifyVault.ts

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const modifyVault = (input: ModifyVaultInput): ModifiedVault => {
2323
admin,
2424
address,
2525
version,
26+
baseApy,
2627
mevEscrow,
2728
createdAt,
2829
feePercent,
@@ -43,6 +44,7 @@ const modifyVault = (input: ModifyVaultInput): ModifiedVault => {
4344
return {
4445
...rest,
4546
apy: Number(apy),
47+
baseApy: Number(baseApy),
4648
version: Number(version),
4749
isSmoothingPool: !mevEscrow,
4850
feePercent: feePercent / 100,

src/methods/vault/requests/getVault/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export type ModifiedVault = Omit<
66
'apy'
77
| 'admin'
88
| 'address'
9+
| 'baseApy'
910
| 'version'
1011
| 'createdAt'
1112
| 'mevEscrow'
@@ -18,6 +19,7 @@ export type ModifiedVault = Omit<
1819
| 'osTokenHolderMaxBoostApy'
1920
> & {
2021
apy: number
22+
baseApy: number
2123
version: number
2224
createdAt: number
2325
vaultAdmin: string

src/utils/configs/chiado.ts

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default {
1414
},
1515
addresses: {
1616
tokens: {
17+
ssv: ZeroAddress,
1718
swise: '0x460d2c6c3254809949a7d0b4646ce15F77e9c545',
1819
mintToken: '0x0b4F6bFB694790051E0203Db83edbB5888099556',
1920
depositToken: '0x19C653Da7c37c66208fbfbE8908A5051B57b4C70',
@@ -48,6 +49,7 @@ export default {
4849
},
4950
},
5051
tokens: {
52+
ssv: constants.tokens.ssv,
5153
swise: constants.tokens.swise,
5254
mintToken: constants.tokens.osGNO,
5355
nativeToken: constants.tokens.xdai,

src/utils/configs/gnosis.ts

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default {
1414
},
1515
addresses: {
1616
tokens: {
17+
ssv: ZeroAddress,
1718
swise: '0xfdA94F056346d2320d4B5E468D6Ad099b2277746',
1819
mintToken: '0xF490c80aAE5f2616d3e3BDa2483E30C4CB21d1A0',
1920
depositToken: '0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb',
@@ -48,6 +49,7 @@ export default {
4849
},
4950
},
5051
tokens: {
52+
ssv: constants.tokens.ssv,
5153
swise: constants.tokens.swise,
5254
mintToken: constants.tokens.osGNO,
5355
nativeToken: constants.tokens.xdai,

src/utils/configs/holesky.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ export default {
1414
},
1515
addresses: {
1616
tokens: {
17+
ssv: ZeroAddress,
18+
depositToken: ZeroAddress,
1719
swise: '0x484871C6D54a3dAEBeBBDB0AB7a54c97D72986Bb',
1820
mintToken: '0xF603c5A3F774F05d4D848A9bB139809790890864',
19-
depositToken: ZeroAddress,
2021
v2RewardToken: '0x2ee2E20702B5881a1171c5dbEd01C3d1e49Bf632',
2122
v2StakedToken: '0x91167861c590Fd68bEbE662951fBE30C9B23D759',
2223
},
@@ -48,6 +49,7 @@ export default {
4849
},
4950
},
5051
tokens: {
52+
ssv: constants.tokens.ssv,
5153
swise: constants.tokens.swise,
5254
mintToken: constants.tokens.osETH,
5355
nativeToken: constants.tokens.eth,

src/utils/configs/mainnet.ts

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default {
1919
},
2020
addresses: {
2121
tokens: {
22+
ssv: '0x9d65ff81a3c488d585bbfb0bfe3c7707c7917f54',
2223
swise: '0x48C3399719B582dD63eB5AADf12A40B4C3f52FA2',
2324
mintToken: '0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38',
2425
depositToken: ZeroAddress,
@@ -53,6 +54,7 @@ export default {
5354
},
5455
},
5556
tokens: {
57+
ssv: constants.tokens.ssv,
5658
swise: constants.tokens.swise,
5759
mintToken: constants.tokens.osETH,
5860
nativeToken: constants.tokens.eth,

src/utils/constants/tokens.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export default {
22
// Mainnet
33
eth: 'ETH',
4+
ssv: 'SSV',
45
swise: 'SWISE',
56
osETH: 'osETH',
67

0 commit comments

Comments
 (0)