-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sky USDS staking view #4027
Sky USDS staking view #4027
Conversation
Caution Review failedThe pull request is closed. WalkthroughThe changes introduce a comprehensive staking mechanism within the blockchain ecosystem, encapsulated in a smart contract that manages token staking, reward distribution, and ownership management. New functions and events are added to facilitate staking operations, while user interface components enhance interaction with these functionalities. Observable functions are introduced to retrieve staking details, and various components are implemented to display and manage staking information effectively. Changes
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
Outside diff range and nitpick comments (1)
blockchain/better-calls/sky-swaps.ts (1)
89-92
: Clarify the purpose of the fixed parameter1001
when staking.The purpose of the fixed parameter
1001
when calling thestake
method is not clear from the code. This magic number may cause confusion for future maintainers.Consider adding a comment to explain the significance of this parameter or replace it with a named constant for better readability.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (15)
- blockchain/abi/sky-staking.json (1 hunks)
- blockchain/better-calls/sky-swaps.ts (2 hunks)
- blockchain/contracts/arbitrum.ts (1 hunks)
- blockchain/contracts/base.ts (1 hunks)
- blockchain/contracts/goerli.ts (1 hunks)
- blockchain/contracts/mainnet.ts (2 hunks)
- blockchain/contracts/optimism.ts (1 hunks)
- blockchain/networks/networks-config.ts (1 hunks)
- features/sky/components/SwapCard.tsx (3 hunks)
- features/sky/components/stake/SkyStakePositionView.tsx (1 hunks)
- features/sky/config.ts (1 hunks)
- features/sky/hooks/useSky.ts (5 hunks)
- helpers/context/ProductContext.ts (4 hunks)
- pages/earn/sky/[wallet].tsx (1 hunks)
- pages/earn/sky/index.tsx (1 hunks)
Files skipped from review due to trivial changes (2)
- blockchain/contracts/goerli.ts
- blockchain/networks/networks-config.ts
Additional context used
Biome
features/sky/components/stake/SkyStakePositionView.tsx
[error] 175-178: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
[error] 203-206: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
Additional comments not posted (42)
pages/earn/sky/index.tsx (4)
10-17
: LGTM!The
getServerSideProps
function correctly fetches the necessary translations and wallet address from the server-side context. It follows the expected signature and return type for Next.js.
19-33
: LGTM!The
SkyProxyPage
component correctly manages the wallet connection and routing based on the presence of a wallet address. It uses the necessary hooks and renders the appropriate components. The component structure and logic is clear and concise.
28-30
: Verify the intended behavior of renderingnull
as children for theWithWalletConnection
component.Rendering
null
as children for theWithWalletConnection
component seems unusual and may not provide any meaningful UI or functionality. Please confirm if this is the intended behavior.If the component is not yet fully implemented or if the children are not needed, consider adding meaningful children or removing the component altogether to avoid confusion and improve code clarity.
35-35
: LGTM!The
SkyProxyPage
component is correctly exported as the default export, allowing it to be imported and used in other parts of the application.features/sky/config.ts (2)
3-11
: LGTM!The new type definition
SkySwapTokensConfigType
is well-structured and enhances type safety for theskySwapTokensConfig
array. It clearly defines the expected properties and their types for the configuration objects.
13-13
: Verify the existing configuration matches the new type structure.The type change from
any[]
toSkySwapTokensConfigType[]
forskySwapTokensConfig
is a good improvement. It enhances type safety and ensures the configuration objects adhere to the defined structure.Run the following script to verify the existing configuration matches the new type structure:
Verification successful
Existing configuration matches the new type structure
The verification process confirms that the
skySwapTokensConfig
array is correctly typed asSkySwapTokensConfigType[]
and the existing configuration objects match the expected structure. The type change has been successfully implemented without introducing any apparent issues.Key points:
- The array is explicitly typed as
SkySwapTokensConfigType[]
.- Configuration objects contain expected properties such as
primaryToken
,secondaryToken
,primaryTokenAddress
,secondaryTokenAddress
,contractAddress
,stake
, anddescription
.- No type errors or inconsistencies are visible in the examined portion of the configuration.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existing configuration in `skySwapTokensConfig` matches the new `SkySwapTokensConfigType` structure. # Test: Search for the `skySwapTokensConfig` array. Expect: No type errors. rg --type typescript -A 20 $'skySwapTokensConfig'Length of output: 83
Script:
#!/bin/bash # Description: Find TypeScript files containing skySwapTokensConfig and display its structure # Find .ts files and search for skySwapTokensConfig with context fd -e ts -x rg -A 20 'export const skySwapTokensConfig'Length of output: 882
blockchain/better-calls/sky-swaps.ts (2)
99-106
: LGTM!The function correctly retrieves the rewards by invoking the
getReward
method from theSkyStaking
contract. The implementation looks good.
108-142
: LGTM!The function correctly retrieves the staking details for a given owner address by invoking the appropriate methods from the
SkyStaking
contract. The retrieved values are properly formatted intoBigNumber
instances for consistency. The use ofPromise.all
to retrieve the values in parallel is a good performance optimization. The defensive check forownerAddress
is also a good programming practice.Overall, the implementation looks solid and well-structured.
features/sky/hooks/useSky.ts (5)
Line range hint
17-29
: LGTM!The renaming of
UseSkyTokenSwapType
touseSkyType
improves code readability and aligns with the naming convention for custom hook types in React.
Line range hint
30-42
: LGTM!The renaming of the exported function from
useSkyTokenSwap
touseSky
improves code readability and maintainability by simplifying the function name while preserving its core functionality.
159-159
: Verify the impact on user experience.Moving the
setReloadingTokenInfo(true)
call to occur after the transaction initiation may improve the clarity of the transaction flow. However, it's important to validate through user testing that delaying the feedback to the user about reloading token information does not negatively impact the user experience.
264-264
: LGTM!Adding
setTransactionTx
to the return object of theuseSky
hook enhances its interface by providing more control over transaction handling to the consumers of the hook. This improves the flexibility and reusability of the hook.
265-265
: LGTM!Adding
signer
to the return object of theuseSky
hook enhances its interface by providing more context over transaction handling to the consumers of the hook. This improves the flexibility and reusability of the hook.features/sky/components/SwapCard.tsx (4)
11-12
: LGTM!The import statements have been updated to use the
useSky
hook and its related types. This change suggests a consolidation or simplification of the logic related to handling token swaps.
117-117
: LGTM!The
useSkyTokenSwap
hook has been replaced with theuseSky
hook in theSwapCardWrapper
component. This change is consistent with the updated import statement and the hook is being called with the same set of props.
295-295
: LGTM!The type assertion added to the
address
property in thebalancesConfig
array enhances type safety and clarity. It ensures that theconfig.primaryTokenAddress
is treated as a string, which may prevent potential runtime errors related to type mismatches.
299-299
: LGTM!The type assertion added to the
address
property in thebalancesConfig
array enhances type safety and clarity. It ensures that theconfig.secondaryTokenAddress
is treated as a string, which may prevent potential runtime errors related to type mismatches.blockchain/contracts/base.ts (1)
219-219
: Approve the addition of the 'staking' contract descriptor.The inclusion of the 'staking' contract descriptor in the
sky
object withinbaseContracts
is a valuable addition. It enables the integration of staking-related operations and interactions within the broader application context. This enhancement to the contract management system is crucial for supporting decentralized finance (DeFi) functionalities or other blockchain mechanisms that involve staking.blockchain/contracts/arbitrum.ts (1)
229-229
: New staking contract added for the Sky ecosystem.The addition of the
staking
property to thesky
object withinarbitrumContracts
suggests the introduction of a staking contract for the Sky ecosystem. The use ofemptyContractDesc
indicates that the contract is being defined without specific implementation details at this point.blockchain/abi/sky-staking.json (18)
2-27
: LGTM!The constructor parameters are well-defined and serve clear purposes:
_owner
: Address that will have ownership privileges._rewardsDistribution
: Address responsible for distributing rewards._rewardsToken
: Address of the token used for rewards._stakingToken
: Address of the token to be staked.
28-46
: LGTM!The
OwnerChanged
event is emitted when the contract ownership is transferred and includes the relevant information:
oldOwner
: Address of the previous owner.newOwner
: Address of the new owner.
47-59
: LGTM!The
OwnerNominated
event is emitted when a new owner is nominated and includes the relevant information:
newOwner
: Address of the nominated owner.
60-72
: LGTM!The
PauseChanged
event is emitted when the paused state of the contract is changed and includes the relevant information:
isPaused
: Indicates if the contract is paused.
73-91
: LGTM!The
Recovered
event is emitted when ERC20 tokens are recovered from the contract and includes the relevant information:
token
: Address of the recovered ERC20 token.amount
: Amount of tokens recovered.
92-116
: LGTM!The
Referral
event is emitted when a referral is recorded during staking and includes the relevant information:
referral
: ID of the referral.user
: Address of the user who staked with the referral.amount
: Amount staked by the user.
117-129
: LGTM!The
RewardAdded
event is emitted when rewards are added to the contract and includes the relevant information:
reward
: Amount of rewards added.
130-148
: LGTM!The
RewardPaid
event is emitted when rewards are paid to a user and includes the relevant information:
user
: Address of the user receiving the reward.reward
: Amount of reward paid to the user.
149-161
: LGTM!The
RewardsDistributionUpdated
event is emitted when the rewards distribution address is updated and includes the relevant information:
newRewardsDistribution
: Address of the new rewards distribution.
162-174
: LGTM!The
RewardsDurationUpdated
event is emitted when the rewards duration is updated and includes the relevant information:
newDuration
: New duration for rewards.
175-193
: LGTM!The
Staked
event is emitted when a user stakes tokens and includes the relevant information:
user
: Address of the user staking tokens.amount
: Amount of tokens staked by the user.
194-212
: LGTM!The
Withdrawn
event is emitted when a user withdraws staked tokens and includes the relevant information:
user
: Address of the user withdrawing tokens.amount
: Amount of tokens withdrawn by the user.
213-219
: LGTM!The
acceptOwnership
function allows the nominated owner to accept ownership of the contract. It provides a way to ensure the nominated owner consents to becoming the new owner.
220-238
: LGTM!The
balanceOf
function is a view function that returns the staked token balance of a given account. It allows querying the staked balance of any account without modifying the contract state.
239-257
: LGTM!The
earned
function is a view function that calculates the amount of rewards earned by a given account. It allows querying the earned rewards of any account without modifying the contract state.
258-264
: LGTM!The
exit
function allows a user to exit the staking contract by withdrawing their staked tokens and claiming any earned rewards in a single transaction.
265-271
: LGTM!The
getReward
function allows a user to claim their earned rewards without unstaking by transferring the rewards to their address.
272-284
: LGTM!The
getRewardForDuration
function is a view function that calculates the reward amount for a givenblockchain/contracts/optimism.ts (1)
254-254
: LGTM!The addition of the
staking
property to thesky
object usingemptyContractDesc
is consistent with the existing pattern and suggests future expansion of staking-related functionalities. The change is localized and does not appear to impact other parts of the code.blockchain/contracts/mainnet.ts (2)
49-49
: LGTM!The import statement for
skyStaking
ABI is syntactically correct and consistent with the existing import statements in the file.
287-287
: Verify the contract address for the Sky staking contract.The code change to add the
staking
entry to thesky
object within themainnetContracts
object is syntactically correct and consistent with the existing code structure.Please verify that the contract address
0x0650CAF159C5A49f711e8169D4336ECB9b950275
is the correct address for the Sky staking contract on the mainnet.Run the following script to verify the contract address:
Verification successful
Contract address for Sky staking is correctly implemented
The verification process confirms that the contract address
0x0650CAF159C5A49f711e8169D4336ECB9b950275
for the Sky staking contract is correctly implemented in theblockchain/contracts/mainnet.ts
file. This address is used only once in the entire codebase, specifically for thestaking
entry in thesky
object within themainnetContracts
object.The implementation is consistent with other contract definitions in the same file, such as
mkrsky
andsusds
.As a final step, please manually verify that
0x0650CAF159C5A49f711e8169D4336ECB9b950275
is indeed the correct address for the Sky staking contract on the mainnet.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the contract address for the Sky staking contract on the mainnet. # Test: Search for the contract address in the codebase. Expect: Only occurrences in the `mainnetContracts` object. rg --type typescript $'0x0650CAF159C5A49f711e8169D4336ECB9b950275'Length of output: 100
Script:
#!/bin/bash # Description: Verify the contract address for the Sky staking contract on the mainnet. # Search for the contract address in .ts and .js files echo "Searching in TypeScript files:" rg -C 2 '0x0650CAF159C5A49f711e8169D4336ECB9b950275' --glob '*.ts' echo -e "\nSearching in JavaScript files:" rg -C 2 '0x0650CAF159C5A49f711e8169D4336ECB9b950275' --glob '*.js'Length of output: 697
helpers/context/ProductContext.ts (1)
689-690
: LGTM!The addition of the
skyUsdsStakeDetails$
observable enhances the functionality of the product context by providing stake details for a specified owner address. The implementation leverages theonEveryBlock$
observable and theskyUsdsStakeDetails
function to retrieve the stake details on every block. The resulting observable is made available in the return object ofsetupProductContext
, allowing other parts of the application to access and react to changes in stake details.The code changes are clear, consistent, and well-integrated with the existing codebase.
pages/earn/sky/[wallet].tsx (1)
25-119
: Component Implementation Looks GoodThe
SkyStakeUsdsView
component is well-structured and effectively handles data fetching, loading states, and error handling. It properly utilizes React hooks and context providers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range and nitpick comments (2)
features/refinance/hooks/useInitializeRefinanceContextBase.ts (1)
78-78
: Looks good! Remember to define the refinance steps for theSky
protocol.The addition of the
Sky
lending protocol to the mapping is a step in the right direction. However, please ensure that you define the specific refinance steps for this protocol to avoid unexpected behavior or errors when attempting to use it for refinancing.pages/earn/ssr/[wallet].tsx (1)
43-47
: Refine dependencies in useEffect hookIncluding
tempSkyStakeData
in the dependency array may cause unnecessary re-renders. SincesetTempSkyStakeData
updatestempSkyStakeData
, which then triggersuseEffect
, consider removingtempSkyStakeData
from the dependency array to prevent potential infinite loops.Apply this diff to adjust the dependency array:
- }, [skyStakeData, tempSkyStakeData]) + }, [skyStakeData])
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (17)
- features/omni-kit/constants.ts (1 hunks)
- features/omni-kit/helpers/getOmniProtocolUrlMap.ts (1 hunks)
- features/productHub/helpers/getGenericPositionUrl.ts (1 hunks)
- features/refinance/components/RefinancePortfolioBanner.tsx (1 hunks)
- features/refinance/constants.ts (1 hunks)
- features/refinance/helpers/getProtocolNameByLendingProtocol.ts (1 hunks)
- features/refinance/hooks/useInitializeRefinanceContextBase.ts (1 hunks)
- features/sky/components/SwapCard.tsx (7 hunks)
- features/sky/components/stake/SkyStakePositionView.tsx (1 hunks)
- features/sky/hooks/useSky.ts (7 hunks)
- handlers/product-hub/update-handlers/index.ts (1 hunks)
- helpers/lambda/yields/get-yields-config.ts (1 hunks)
- pages/earn/ssr/[wallet].tsx (1 hunks)
- pages/earn/ssr/index.tsx (1 hunks)
- server/database/migrations/041-sky-protocol.sql (1 hunks)
- server/database/schema.prisma (1 hunks)
- theme/icons/usds.tsx (2 hunks)
Files skipped from review due to trivial changes (3)
- server/database/migrations/041-sky-protocol.sql
- server/database/schema.prisma
- theme/icons/usds.tsx
Files skipped from review as they are similar to previous changes (2)
- features/sky/components/SwapCard.tsx
- features/sky/hooks/useSky.ts
Additional context used
Biome
features/sky/components/stake/SkyStakePositionView.tsx
[error] 175-178: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
[error] 203-206: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
Additional comments not posted (21)
features/omni-kit/helpers/getOmniProtocolUrlMap.ts (1)
11-11
: LGTM!The addition of the
LendingProtocol.Sky
entry to theprotocolUrlMap
object is consistent with the existing pattern and expands the function's support for theSky
lending protocol. The change is necessary and well-implemented.features/refinance/helpers/getProtocolNameByLendingProtocol.ts (1)
11-11
: LGTM!The addition of the new entry for the
Sky
lending protocol to theProtocolNameByLendingProtocol
record is consistent with the existing code and follows the established pattern. The type assertionas ProtocolName
is correctly used to satisfy the record's value type.This change expands the functionality to support the
Sky
lending protocol without introducing any breaking changes or negatively impacting the existing code.handlers/product-hub/update-handlers/index.ts (1)
26-26
: LGTM! This is a good foundational step.Adding the
Sky
protocol to thePRODUCT_HUB_HANDLERS
object with theemptyHandler
as a placeholder is a solid approach. It allows the system to recognize and handle theSky
protocol gracefully, even if the specific handling logic is not yet implemented.This change lays the groundwork for future enhancements and ensures that the system can support the
Sky
protocol without causing errors in the meantime. Nice work!pages/earn/ssr/index.tsx (2)
10-17
: LGTM!The
getServerSideProps
function is correctly implemented. It fetches server-side translations and retrieves the wallet address from the query parameters as expected.
19-33
: LGTM!The
SkyProxyPage
component is well-structured and handles wallet connections and redirects as expected. It correctly integrates with theuseAccount
hook,AppLayout
, andWithWalletConnection
component.helpers/lambda/yields/get-yields-config.ts (1)
28-28
: LGTM! The addition of theSky
protocol mapping is a good precautionary measure.The change expands the configuration options available within the
getYieldsConfig
function, potentially allowing for better handling of different lending protocols in the system.As the comment suggests, the
Sky
protocol case is not expected to occur under normal circumstances. This indicates that the addition may serve as a placeholder for future functionality or as a precautionary measure to handle unexpected scenarios gracefully.While the change itself may not have an immediate impact on the system's behavior, it demonstrates good foresight in preparing the codebase for potential future requirements related to the
Sky
protocol.features/refinance/constants.ts (1)
102-102
: LGTM!The addition of
[LendingProtocol.Sky]: undefined
to therefinanceCustomProductHubFiltersOptions
object is consistent with the existing structure and expands the options for lending protocols. As the value is set toundefined
, there is no immediate impact on the existing logic or control flow. This change enables potential future configurations or functionalities associated with theSky
lending protocol.features/omni-kit/constants.ts (1)
41-41
: LGTM!The addition of the
sky
protocol to thepaybackAllAmountAllowanceMaxMultiplier
mapping is consistent with the existing pattern and the multiplier value ofone
is appropriate.features/productHub/helpers/getGenericPositionUrl.ts (1)
139-141
: LGTM!The new
case
statement forLendingProtocol.Sky
looks good. It correctly handles the 'SSR' label by returning the appropriate URL path and provides a fallback root path for other labels.features/refinance/components/RefinancePortfolioBanner.tsx (1)
179-179
: LGTM!The addition of the
LendingProtocol.Sky
entry in thecontent
object is a preparatory step for future integration of the Sky lending protocol into theRefinancePortfolioBanner
component.Setting the value to
null
indicates that there is currently no specific UI representation or functionality associated with this protocol. This change expands the existing functionality of the component by preparing it to handle theSky
protocol, although no immediate visual or functional changes are introduced.Consider adding a TODO comment to track the future implementation of the UI elements and functionality for the
Sky
protocol.features/sky/components/stake/SkyStakePositionView.tsx (9)
1-27
: LGTM!The import statements look good and are importing the necessary dependencies for the component.
28-42
: LGTM!The
SkyStakeViewType
type definition looks good and includes all the necessary props for theSkyStakePositionView
component.
54-97
: LGTM!The state management and usage of the
useSky
hook look good. The component correctly uses theuseTranslation
anduseConnectWallet
hooks for internationalization and wallet connection, and theuseState
hook to manage thestakingAction
state.
99-128
: LGTM!The
claimAction
function looks good. It correctly checks for the wallet connection and available rewards, uses theskyUsdsStakeGetRewards
function to initiate the claim transaction, and handles the transaction success and error scenarios while updating the relevant states.
130-245
: LGTM!The
sidebarSectionProps
object looks good. It correctly defines the props for theSidebarSection
component, including the title, content, and primary button properties. The content property renders the appropriate components based on thestakingAction
state, and the primary button is configured to trigger the corresponding action.Tools
Biome
[error] 175-178: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
[error] 203-206: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
246-311
: LGTM!The rendering logic using the
TabBar
component looks good. The component correctly renders the "Overview" and "FAQ" sections. The "Overview" section displays the staking details using theDetailsSection
component and theSidebarSection
component with thesidebarSectionProps
object. The "FAQ" section renders a card with the FAQ content.
173-179
: Typographical error in success message.The past review comment suggesting the correction of typographical errors in the success message is still valid and applicable to the current code segment.
Apply this diff to correct the typo:
- 'Transaction successfull.', + 'Transaction successful.',Tools
Biome
[error] 175-178: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
201-207
: Typographical error in success message.The past review comment suggesting the correction of the typographical error in the success message is still valid and applicable to the current code segment.
Apply this diff to correct the typo:
- View on etherscan. + View on Etherscan.Tools
Biome
[error] 203-206: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
184-184
: Remove incorrect type casting and adjustMessageCard
component'smessages
prop.The past review comment suggesting the removal of the incorrect type casting to
string[]
and adjusting theMessageCard
component'smessages
prop to acceptReactNode[]
is still valid and applicable to the current code segments.Remove the type casting:
- ].filter(Boolean) as string[]) + ].filter(Boolean))Ensure the
MessageCard
component'smessages
prop is typed to acceptReactNode[]
instead ofstring[]
.Also applies to: 212-212
pages/earn/ssr/[wallet].tsx (2)
134-134
: Verify network settings in WithConnection componentThe
WithConnection
component setsincludeTestNet={true}
, but the application uses mainnet network IDs and contracts. Ensure that including test networks is intentional and won't cause unexpected behavior.
77-85
: Confirm correct token symbols in allowance checksIn the allowance observables, tokens are referenced by their symbols
'USDS'
and'SKY'
. Verify that these symbols match the expected tokens in theallowanceForAccountEthers$
function and that they correspond to the correct addresses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (10)
- blockchain/better-calls/sky.ts (1 hunks)
- components/context/PreloadAppDataContextProvider.tsx (1 hunks)
- features/productHub/meta.ts (2 hunks)
- features/sky/components/stake/SkyStakePositionView.tsx (1 hunks)
- handlers/product-hub/update-handlers/index.ts (2 hunks)
- handlers/product-hub/update-handlers/sky/skyHandler.ts (1 hunks)
- handlers/product-hub/update-handlers/sky/skyProducts.ts (1 hunks)
- helpers/context/ProductContext.ts (4 hunks)
- pages/[networkOrProduct]/sky/upgrade.tsx (1 hunks)
- pages/earn/ssr/[wallet].tsx (1 hunks)
Files skipped from review due to trivial changes (1)
- pages/[networkOrProduct]/sky/upgrade.tsx
Files skipped from review as they are similar to previous changes (2)
- handlers/product-hub/update-handlers/index.ts
- helpers/context/ProductContext.ts
Additional context used
Biome
features/sky/components/stake/SkyStakePositionView.tsx
[error] 175-178: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
[error] 203-206: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
Additional comments not posted (15)
handlers/product-hub/update-handlers/sky/skyProducts.ts (2)
1-5
: LGTM!The imports are relevant and necessary for the code in this file. There are no unused imports.
6-18
: LGTM!The product item for the Sky lending protocol is structured correctly and the attributes are consistent. The use of 'USDS' token for all token-related attributes and the label 'SSR' with description 'Sky Savings Rate' clearly indicate that this is a single-token earning strategy.
components/context/PreloadAppDataContextProvider.tsx (1)
35-35
: LGTM!The addition of
LendingProtocol.Sky
to the array of lending protocols is a straightforward change that introduces support for fetching data related to the "Sky" lending protocol. This change expands the functionality of thePreloadAppDataContextProvider
without affecting existing behavior.pages/earn/ssr/[wallet].tsx (3)
25-127
: LGTM!The
SkyStakeUsdsView
component is well-structured and follows best practices. It effectively uses hooks, context providers, and observables to manage state, side effects, and data retrieval. The component also implements proper error handling and loading states, enhancing the user experience. The decomposition into sub-components promotes code reusability and maintainability.
129-145
: LGTM!The
SkyStakeUsdsViewWrapper
component effectively wraps the main view with necessary context providers, ensuring that essential data and functionality are accessible throughout the component tree. The inclusion of connection handling, gas estimation, and terms of service acceptance creates a comprehensive environment for users. The component composition is clean and readable, making it easy to understand the hierarchy of providers.
147-154
: LGTM!The
getServerSideProps
function correctly extracts the wallet address from the query parameters and prepares translations for internationalization. It returns an object with the necessary props, ensuring the page is ready for rendering with the appropriate context.features/productHub/meta.ts (3)
97-99
: LGTM!The entry for the Sky lending protocol is correctly added to the
productHubProtocolFilter
array with all necessary properties.
106-111
: LGTM!The entry for the MorphoBlue lending protocol is correctly added to the
productHubProtocolFilter
array with all necessary properties, including the feature flag.
112-116
: LGTM!The entry for the SparkV3 lending protocol is correctly added to the
productHubProtocolFilter
array with all necessary properties.The entry for the AaveV2 lending protocol is correctly moved to the end of the
productHubProtocolFilter
array.Also applies to: 128-130
features/sky/components/stake/SkyStakePositionView.tsx (6)
1-27
: LGTM!The import statements are well-organized and cover the necessary dependencies for the component. No issues found.
28-42
: LGTM!The
SkyStakeViewType
type definition is comprehensive and covers the necessary properties for the staking view. The property names are descriptive and follow a consistent naming convention. No issues found.
44-97
: LGTM!The
SkyStakePositionView
component is well-defined and receives the necessary props to handle staking functionality. The use of hooks such asuseTranslation
,useConnectWallet
, anduseSky
is appropriate and follows best practices. No issues found.
99-128
: LGTM!The
claimAction
function correctly handles the claiming of rewards for the staked tokens. It checks for the presence of a wallet address and non-zero earned rewards before proceeding. The use of theskyUsdsStakeGetRewards
function to interact with the staking contract is appropriate. The transaction status is updated based on the success or failure of the transaction, and the token information is reloaded after a successful transaction. No issues found.
130-245
: LGTM!The
sidebarSectionProps
object is well-structured and contains the necessary props for theSidebarSection
component. The action pills provide a clear way to switch between staking, unstaking, and claiming actions. TheVaultActionInput
component allows users to input the staking/unstaking amount. The message cards provide informative feedback to the user regarding transaction status, allowance status, and insufficient allowance. No issues found.Tools
Biome
[error] 175-178: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
[error] 203-206: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.(lint/correctness/useJsxKeyInIterable)
246-310
: LGTM!The JSX structure of the
SkyStakePositionView
component is well-organized using theTabBar
component. The "Overview" section displays the relevant staking details in a clear and concise manner, and the inclusion of theSidebarSection
component ensures consistency with the sidebar section defined earlier. The "FAQ" section is currently a placeholder and may require further implementation. No issues found.
Sky USDS staking view (basic one)
Summary by CodeRabbit
Release Notes
New Features
Sky
lending protocol across various components and functionalities.Sky
lending protocol.Bug Fixes
Documentation
Refactor