Skip to content

Commit

Permalink
Boost (#232)
Browse files Browse the repository at this point in the history
* [for-new-stake] add contract for genesis

* [for-new-stake] improve vaultMulticall

* [for-new-stake] improve getOsTokenPosition

* [for-new-stake] add panding to getExitQueuePositions

* [for-new-stake] add stake calculator

* [for-new-stake] improve stake calculator

* [for-new-stake] improve abis

* [for-new-stake] new stakecalculator

* [for-new-stake] change address

* [for-new-stake] improve versions

* [for-new-stake] open AbortPromise

* [for-new-stake] replace address

* [for-new-stake] change exit queue

* [for-new-stake] change logic

* New createVault method (#169)

* [improve-abi-diff] new createVault method

* [improve-abi-diff] gitignor

* [improve-abi-diff] fix

* New subgraph (#171)

* [new subgraph] update schema

* [codegen ci] add fallback subgraph codegen check (#168)

# Conflicts:
#	codegen.ts

* [codegen ci] add fallback subgraph codegen check (#168)

# Conflicts:
#	codegen.ts

* [new subgraph] Update codegen

* [new subgraph] Update codegen

* [new subgraph] Update types

* [new subgraph] Update graphql

* Subgraph tvl apy (#172)

* [subgraph-tvl-ap] add getStakewiseStats

* [subgraph-tvl-ap] change urls

* [subgraph-tvl-apy] rename validatorsRoot and keysManager

* [exit queue] Update request (#173)

* [exit queue] Update request

* [exit queue] Update request

* [exit queue] Update request

* [parse exit request] Update exit queue fetch (#174)

* [parse exit request] Update exit queue fetch

* [exit queue] Update parse exit request

* [exit queue] Update parse exit request

* Vault user (#175)

* [vault user] add allocators request

* [vault user] update stake balance

* [vault user] update stake balance

* [vault user] update claim amount

* [vault user] update claim amount

* [vault user] update readme

* [vault user] update readme

* [get config] update get config (#177)

* [get config] update get config

* [get config] update get config

* [get config] update get config

* [get config] update get config

* [get config] update get config

* Add new methods getUserStats & getVaultStats (#176)

* Improve chart view logic in V3, add getUserStats, getVaultStats.

* add deprecated to README

* update docs

* fixed import

* improves, rename methods

* new addresses

* [new-stake-calculator] set new addresses (#178)

* [add-genesis-to-vault] (#180)

* Add new methods getFiatRates & getUserExchangeRewards (#179)

* add new methods getFiatRates & getUserExchangeRewards

* remove unused

* update text in docs

* remove usdToDaiRate

* remove unused methods, update docs

* update docs

* improve date in milliseconds

* [polishing] remove old & change harvest (#181)

* Replace depositDataRoot & depositDataManager (#182)

* replace (depositDataRoot & depositDataManager) V1 logic from vault.operate, to (vault.setDepositDataRoot & vault.setDepositDataManager) instead

* add version

* rename to input

* PR improves

* new-improves

* hide score percentiles

* fix types

* Remove ScorePercentiles logic (#185)

* remove ScorePercentiles logic

* improve docs

* Boost apy (#187)

* [boost-apy] set apy logic

* [boost-apy] change codegen

* [boost-apy] change user stats

* [boost-apy] improve ltv percent logic

* [boost-apy] fix config

* [boost-apy] fix readme

* [boost-apy] remove import

* [boost-part-2] remove boost percent (#189)

* [boost ui] update boost data (#188)

* remove duplicates (#186)

* refactor checkRestakeOperatorsManagerAccess

* update subgraphUrl logic

* remove duplicates (#186) (#191)

* refactor checkRestakeOperatorsManagerAccess

* update subgraphUrl logic

* Improve ltv percent logic (#193)

* improve ltv percent logic

* remove unused

* Boost methods (#192)

* remove duplicates (#186)

* refactor checkRestakeOperatorsManagerAccess

* update subgraphUrl logic

* [boost ui] add boost multicall to sdk

* [boost ui] add boost to sdk

* [boost ui] add boost to sdk

* [boost ui] update types

* [boost ui] add boost methods

* [boost ui] add boost methods

* [boost ui] add boost methods

* [boost ui] add boost methods

* [boost ui] update type

* [boost ui] update type

* [boost ui] update permit signature

---------

Co-authored-by: Kadyr Dzhemaledinov <[email protected]>

* add v2 to getVaultVersion, update holesky factories, add queuedShares (#190)

* update holesky & mainnet factories (#194)

* Boost apy (#187)

* [boost-apy] set apy logic

* [boost-apy] change codegen

* [boost-apy] change user stats

* [boost-apy] improve ltv percent logic

* [boost-apy] fix config

* [boost-apy] fix readme

* [boost-apy] remove import

* [boost-part-2] remove boost percent (#189)

* [boost ui] update boost data (#188)

* Boost methods (#192)

* remove duplicates (#186)

* refactor checkRestakeOperatorsManagerAccess

* update subgraphUrl logic

* [boost ui] add boost multicall to sdk

* [boost ui] add boost to sdk

* [boost ui] add boost to sdk

* [boost ui] update types

* [boost ui] add boost methods

* [boost ui] add boost methods

* [boost ui] add boost methods

* [boost ui] add boost methods

* [boost ui] update type

* [boost ui] update type

* [boost ui] update permit signature

---------

Co-authored-by: Kadyr Dzhemaledinov <[email protected]>

* update holesky & mainnet factories (#196)

* Boost part 3 (#195)

* Boost apy (#187)

* [boost-apy] set apy logic

* [boost-apy] change codegen

* [boost-apy] change user stats

* [boost-apy] improve ltv percent logic

* [boost-apy] fix config

* [boost-apy] fix readme

* [boost-apy] remove import

* [boost-part-2] remove boost percent (#189)

* [boost ui] update boost data (#188)

* remove duplicates (#186) (#191)

* refactor checkRestakeOperatorsManagerAccess

* update subgraphUrl logic

* Boost methods (#192)

* remove duplicates (#186)

* refactor checkRestakeOperatorsManagerAccess

* update subgraphUrl logic

* [boost ui] add boost multicall to sdk

* [boost ui] add boost to sdk

* [boost ui] add boost to sdk

* [boost ui] update types

* [boost ui] add boost methods

* [boost ui] add boost methods

* [boost ui] add boost methods

* [boost ui] add boost methods

* [boost ui] update type

* [boost ui] update type

* [boost ui] update permit signature

---------

Co-authored-by: Kadyr Dzhemaledinov <[email protected]>

* [boost-part-3] add boost method

* [boost-part-3] fixes

---------

Co-authored-by: Mike Diamond <[email protected]>
Co-authored-by: Kadyr Dzhemaledinov <[email protected]>

* Unboost (#197)

* [unboost ui] update addresses

* [unboost ui] update boost action

* [unboost ui] update boost action

* Boost updates (#198)

* [boost-updates] set addresses

* [boost-updates] update getBoost

* [boost-updates] change readme

* fix getBoost

* add upgradeToAndCall to VaultMulticall (#200)

* Fix user stats (#201)

* [fix-user-stats] fixed

* [fix-user-stats] improve

* improve CODEOWNERS (#202)

* improve BigDecimal (#203)

* Unboost (#199)

* [unboost ui] update apy calculation

* [unboost ui] add unboost method

* [unboost ui] update unboost ui

* [unboost ui] update unboost ui

* [unboost ui] update unboost ui

* [unboost ui] update unboost ui

* [unboost ui] update unboost ui

* [unboost ui] update unboost ui

* [unboost ui] fix boost

* [unboost vault] remove getBoostApy

* Unboost queue (#204)

* [unboost-queue] create getQueuePosition

* [unboost-queue] create claimQueue

* [unboost-queue] boost refactoring

* [unboost-queue] improve

* Fix queue (#205)

* [fix-queue] fixed

* [fix-queue] improve

* Add isDepositWithMint option (#206)

* add isDepositWithMint logic

* add genesis

* improve isDepositWithMint in vaultMulticall

* fix claim boost queue

* Rewards data (#207)

* [rewards-data] add merge rewards & fiat helper

* [rewards-data] change reqests

* [rewards-data] create calculateUserStats

* [rewards-data] readme

* [rewards-data] readme

* [rewards-data] fix

* [calculate-user-stats] changes (#208)

* Fix boost lock (#209)

* [fix-boost-lock] fixed

* [fix-boost-lock] readme

* Add documentation website (#210)

* update methods, add .md files

* add new website

* update dev command

* app packages

* update commands

* test build

* test build

* update README

* update README

* update docs

* Migration and Search (#211)

* add migration page

* add search

* remove RESTAKE logic (#212)

* [new-addresses] setted (#213)

* change abi

* [rewards-fix] fixed (#214)

* [new-schema] changes (#215)

* fix

* Claim (#216)

* [claim] add distributor claim modal

* [claim] add merkle distributor v2 contract

* [claim] add merkle distributor v2 contract

* [claim] move merkle distributor contract to web

* [claim] move oracles contract to web

* Referrer (#218)

* [referrer] add referrer to deposit and boost

* [referrer] add referrer to vault mint and deposit

* [referrer] add referrer to vault mint and deposit

* [referrer] add referrer to vault mint and deposit

* [referrer] add referrer to vault mint and deposit

* [referrer] add referrer to vault mint and deposit

* Update links, rename thresholdPercent to liqThresholdPercent (#219)

* update jsdoc links

* rename thresholdPercent to liqThresholdPercent

* Fiat rates and APY (#220)

* [fiat-rates] new logic

* [fiat-rates] getUserApy method

* [fiat-rates] change getOsTokenAPY

* [fix-apy] fixed (#222)

* remove apy in leverageStrategyPositionStats_collection (#223)

* Update graphql (#224)

* [referrals modal] add feature flags

* [referrals modal] update ethers

* [update stats] update stats requests (#225)

* [update stats] update stats requests

* [update stats] ui fixes

* Currencies (#227)

* [skeleton] add currencies

* [currencies] update queries

* [currencies] update graphql

* [boost-apy] add new boost actions to table (#226)

* [requests improve] update requests (#229)

* [requests improve] update requests

* [requests improve] update requests

* [requests improve] update requests

* [requests improve] update gnosis rates

* [requests improve] update gnosis rates

* [codegen fix] update codegen types (#230)

* [updates-for-apy] update fields (#231)

* set stage graph

* fix build

---------

Co-authored-by: Mike Diamond <[email protected]>
Co-authored-by: Kadyr Dzhemaledinov <[email protected]>
Co-authored-by: Kadyr Dzhemaledinov <[email protected]>
Co-authored-by: Kadyr Dzhemaledinov <[email protected]>
  • Loading branch information
5 people authored Jan 16, 2025
1 parent ec310c7 commit c3bbd1b
Show file tree
Hide file tree
Showing 305 changed files with 25,049 additions and 5,207 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@dfkadyr @mike-diamond @Cast0001
* @dfkadyr-stakewise @mike-diamond @Cast0001
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ node_modules
schema.graphql
src/types/graphql
src/contracts/types
src/contracts/vault/types
2 changes: 1 addition & 1 deletion .graphqlconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"extensions": {
"endpoints": {
"Subgraph GraphQL": {
"url": "https://holesky-graph.stakewise.io/subgraphs/name/stakewise/stakewise/graphql",
"url": "https://graphs.stakewise.io/holesky/subgraphs/name/stakewise/prod",
"headers": {
"user-agent": "JS GraphQL"
},
Expand Down
1,784 changes: 8 additions & 1,776 deletions README.md

Large diffs are not rendered by default.

253 changes: 243 additions & 10 deletions changelog/next-release.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
- Breaking change: Removed `sdk.osToken.getConfig`. Use `sdk.vault.getVault` instead to get osToken config data `{ osTokenConfig: { ltvPercent, thresholdPercent } }`.
- Added canHarvest: boolean to `sdk.vault.getHarvestParams` response.

# Updates
### 1. `sdk.vault.getVault`

Expand All @@ -10,27 +7,263 @@
type AddedOutput = {
osTokenConfig: {
ltvPercent: string
thresholdPercent: string
liqThresholdPercent: string
}
queuedShares: string
allocatorMaxBoostApy: number
osTokenHolderMaxBoostApy: number
isGenesis: boolean
}
```
| Name | Description |
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `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 |
| Name | Description |
|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `osTokenConfig` | contains the `ltvPercent`, which is the percentage used to calculate how much a user can mint in OsToken shares, and `liqThresholdPercent`, which is the liquidation threshold percentage used to calculate the health factor for the OsToken position |
| `isGenesis` | This vault is owned by stakewise |
| `allocatorMaxBoostApy` | The average max boost APY earned in this vault by the allocator |
| `osTokenHolderMaxBoostApy` | The average max boost APY earned in this vault by the osToken holder |
| `queuedShares` | The total number of queued shares |
---
### 2. `sdk.vault.getHarvestParams`
#### New output format:
```ts
type Output = {
canHarvest: boolean // NEW
params: {
reward: string
proof: Array<string>
rewardsRoot: string
unlockedMevReward: string
}
}
```
---
### 3. Removed method
### `sdk.osToken.getAvgRewardsPerSecond`
---
### 4. Removed output field
### `sdk.osToken.getPosition`
Removed fee
```ts
type RemovedOutput = {
minted: {
fee: bigint
}
}
```
| Name | Description |
|----------------|------------------------------------|
| `boost.shares` | Count of osToken tokens with boost |
### 5. Added method getStakewiseStats
### `sdk.utils.getStakewiseStats`
#### Getting common stakewise data for the network
---
### 6. Added optional input field
### `sdk.vault.getExitQueuePositions`
#### Added Argument:
| Name | Type | Required |
|--------------|-----------|----------|
| isClaimed | `boolean` | **No** |
---
### 7. Removed output field
### `sdk.vault.getStakeBalance`
```ts
type RemovedOutput = {
shares: bigint
}
```
---
### 8. Deprecated method `sdk.osToken.getConfig`
### Use `sdk.vault.getVault` instead to get the result in `osTokenConfig` field.
---
### 9. Added methods
### `sdk.vault.getVaultStats` & `sdk.vault.getUserStats`
#### With the help of this data it is possible to build a chart.
---
### 10. Removed method `sdk.vault.getSnapshots`
### Use `sdk.vault.getVaultStats` instead
---
### 11. Updated method `sdk.vault.getUserRewards`
#### Updated output format:
```ts
type Output = Array<{
date: number
dailyRewards: number
dailyRewardsEur: number
dailyRewardsGbp: number
dailyRewardsUsd: number
}>
```
#### New arguments:
| Name | Type | Type | Description |
|--------------|----------|---------|-------------------------------|
| dateFrom | `number` | **Yes** | Time to start in milliseconds |
| dateTo | `number` | **Yes** | Time to end in milliseconds |
| userAddress | `string` | **Yes** | The user address |
| vaultAddress | `string` | **Yes** | The address of the vault |
---
### 12. Added method getFiatRates
### `sdk.utils.getFiatRates`
#### Getting fiat values for the network
---
### 13. Removed input field
### `sdk.vault.operate`
#### Removed depositDataRoot use `vault.setDepositDataRoot` instead
#### Removed depositDataManager use `vault.setDepositDataManager` instead
```ts
type RemovedInput = {
depositDataManager: string
depositDataRoot: string
}
```
---
### 14. Removed method `sdk.vault.getScorePercentiles`
---
### 15. Added method
### `sdk.boost.getData`
#### Get the address of the leverage strategy proxy contract
---
### 16. Added method
### `sdk.boost.getLeverageStrategyProxy`
#### Get the address of the leverage strategy proxy contract
---
### 17. Added method
### `sdk.utils.getPermitSignature`
#### Get permit signature for ERC20 token
---
### 18. Added method
### `sdk.boost.lock`
#### Boost your osToken apy using leverage staking
---
### 19. Added method
### `sdk.boost.unlock`
#### Unboost your boosted osToken
---
### 20. Added method
### `sdk.boost.claimQueue`
#### Claim user unboost queue
---
### 20. Changed output field
### `sdk.vault.getExitQueuePositions`
```ts
// Output changed type from bigint to string
positions[number]['exitQueueIndex']
```
---
### 21. Added method
### `sdk.utils.getFiatRatesByDay`
#### Get fiat data by day
---
### 22. `sdk.osToken.getAPY`
#### New output field:
```ts
type Output = {
apy: string
feePercent: number
}
```
---
### 23. Added input field `referrerAddress`
### `sdk.vault.deposit`
### `sdk.osToken.mint`
---
### 24. `sdk.utils.getFiatRates`
#### New output fields:
```ts
type AddedOutput = {
canHarvest: boolean
'USD/CNY': number
'USD/JPY': number
'USD/KRW': number
'USD/AUD': number
}
```
---
### 3. Removed method
### `sdk.vault.getVault`
### 25. `sdk.vault.getUserRewards`
#### New output fields:
```ts
type AddedOutput = {
dailyRewardsCny: number
dailyRewardsJpy: number
dailyRewardsKrw: number
dailyRewardsAud: number
}
```
---
### 26. `sdk.utils.getFiatRatesByDay`
#### New output fields:
```ts
type AddedOutput = {
usdToCnyRate: string
usdToJpyRate: string
usdToKrwRate: string
usdToAudRate: string
}
```
6 changes: 5 additions & 1 deletion codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ if (process.env.NETWORK === 'gnosis') {
const config = configs[network]
const subgraphIndex = Number(process.env.SUBGRAPH_INDEX || 0)

const subgraphUrl = Array.isArray(config.api.subgraph)
let subgraphUrl = Array.isArray(config.api.subgraph)
? config.api.subgraph[subgraphIndex]
: config.api.subgraph

subgraphUrl = subgraphUrl.replace('prod', 'stage')

const urls: Record<string, string> = {
backend: config.api.backend,
subgraph: subgraphUrl,
Expand All @@ -30,6 +32,7 @@ console.log(`Generating types for network: ${config.network.id}`, urls)
// https://the-guild.dev/graphql/codegen/plugins/typescript/typescript
const typesConfig = {
maybeValue: 'T',
inputMaybeValue: 'Partial<T>',
defaultScalarType: 'string', // sets BigDecimal to string instead of any
noExport: true, // replaced with namespace
enumsAsTypes: true,
Expand All @@ -41,6 +44,7 @@ const typesConfig = {
// https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-urql
const requestsConfig = {
maybeValue: 'T',
inputMaybeValue: 'Partial<T>',
defaultScalarType: 'string',
operationResultSuffix: 'Payload', // gives suffix to payload type
noExport: false, // disables export by default
Expand Down
Loading

0 comments on commit c3bbd1b

Please sign in to comment.