Skip to content

Commit

Permalink
feat: Liquid staking (#7323)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->

<!--
copilot:all
-->
### <samp>🤖 Generated by Copilot at 8d714d3</samp>

### Summary
🎁🛠️📝

<!--
1. 🎁 - This emoji represents the addition of a new feature or
functionality to the web app, such as the fixed staking page and
components.
2. 🛠️ - This emoji represents the improvement or enhancement of the web
app's performance, appearance, or maintainability, such as the CSS
extraction, dependency updates, and syntax fixes.
3. 📝 - This emoji represents the documentation or explanation of the
code changes, such as the comments, types, and constants.
-->
This pull request adds the fixed staking feature to the web app, which
allows users to stake tokens in pools with different lock periods and
earn rewards. It adds new components, hooks, types, constants, and
contract helpers for the fixed staking feature, and updates the webpack
configuration, package.json, and contract address files.

> _To stake some tokens and earn more cake_
> _You need to use the `fixedStaking` contract_
> _So we added some components and hooks to react_
> _And some constants and types to keep track_
> _Of the pools and positions in the fixed staking contract_

### Walkthrough
*  Add fixed staking feature to the web app
* Create fixed-staking/index.tsx file to render the FixedStaking
component
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-04c57ab5e0f2ec0741548960f11f8c4de67ddd6f3092023a1ac3193c285e022dR1-R10))
* Create FixedStakingCard.tsx, FixedStakingCardBody.tsx,
FixedStakingModal.tsx, FixedStakingPosition.tsx, FixedStakingRow.tsx,
HarvestFixedStaking.tsx, InlineText.tsx, LockedFixedTag.tsx, and
UnlockedFixedTag.tsx components to display the fixed staking pools and
the user's staked positions
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-587cdcd0802c7d65cfa2a5c7fa308533abbc2688dca6daaff5656529f6b6be22R1-R89),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-4746a6cb923799e7b424079b24f3c0ecd782901175b0c3699123e0880ec3e48bR1-R55),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-c172eec325144945f843eb4abcf12522e4cafc81468c3e0395423ba96747a1adR1-R234),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-7d58ade40b681cb1bfad8caa05da988d47a1d2513ad1a7595d0e10761f06ba9eR1-R221),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-8ca9d02451a4cbef48a7621a5975c3891edf7aa93fd656aa1623b0c7d4c340faR1-R217),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-9ae15b83ec723dec8d67da562c9be7314e0c95fa78565cb26d3078a9fb949749R1-R177),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-22613785f6ee2128df1c86bc575c494f5a85bdcbf1e1152713025eeb6d256b2aR1-R6),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-4f45d3362db00cf0507ea84052be6a722a1e8235dae94134e430291d74b2c2fbR1-R10),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-c2c55ad62123a8444128d948a65dac7a4af44115366f67a59dc3eff3cd324420R1-R9))
* Create constant.ts and type.ts files to define some constants and
types for the fixed staking feature
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-8cecdf16d26583b4f3bbd2240ee12d619c3f3e59a636c080b53f23b637942432R1-R3),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-2f1a557a85450e9d189325ac512049d3df82bd6b2932d77a8f541a3de048a2daR1-R107))
* Add the fixedStaking contract address to the constants/contracts.ts
file
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-6ccab19ffbec70686dc2221f7b79432ece4302c36067c91063d258209c09ec07R229-R234))
* Add the getFixedStakingAddress function to the addressHelpers.ts file
to get the fixed staking contract address for the current chainId
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-05729caa7bf80ee8f359513f222175a79f3cd3e8aa704d68f0d5c67f8b010a23R143-R146))
* Add the getFixedStakingContract function to the contractHelpers.ts
file to create a contract instance for the fixed staking contract with
the given signer and chainId
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-dbcbcd450dce97f74ff9b8fff28d36fc457775363d349db2a45e504060c0754aR35),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-dbcbcd450dce97f74ff9b8fff28d36fc457775363d349db2a45e504060c0754aR85),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-dbcbcd450dce97f74ff9b8fff28d36fc457775363d349db2a45e504060c0754aR393-R401))
* Add the useFixedStakingContract hook to the useContract.ts file to get
the fixed staking contract instance with the current signer and chainId
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-0189a20b061b4c4cd5fd74abb3ff0a22a05b9f5adde9583eb11606cb589a5af4R49),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-0189a20b061b4c4cd5fd74abb3ff0a22a05b9f5adde9583eb11606cb589a5af4R396-R403))
* Export the ActionContainer component from the SingleFarmV3Card.tsx
file to reuse it for rendering the farm actions
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-a0e14b675dc91766985e0c839ed91ba3d2a3b84ec6d3f0e3ec8a971bab841095L46-R46))
* Import the MiniCssExtractPlugin module and add it to the webpack
plugins array in the next.config.mjs file to extract CSS from the bundle
into a separate file
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-197cd8ca285a4abd2f21479e0bf6e36e90b08528fcd7f3bdbe8d1221897e377dR10),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-197cd8ca285a4abd2f21479e0bf6e36e90b08528fcd7f3bdbe8d1221897e377dR195))
* Add a missing comma after the last object in the rewrites array in the
next.config.mjs file to fix a syntax error
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-197cd8ca285a4abd2f21479e0bf6e36e90b08528fcd7f3bdbe8d1221897e377dL188-R189))
* Add the mini-css-extract-plugin, polished, @pancakeswap/next-config,
and @pancakeswap/tsconfig dependencies to the package.json file
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-14b60f636e1a2b0061da57aaf231cb1ed15a5dc0c592425ed82e58fec95d42d8L54-R56),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-14b60f636e1a2b0061da57aaf231cb1ed15a5dc0c592425ed82e58fec95d42d8L78-R83),
[link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-14b60f636e1a2b0061da57aaf231cb1ed15a5dc0c592425ed82e58fec95d42d8L101-R113))
* Remove the @pancakeswap/next-config and @pancakeswap/tsconfig
dependencies from the devDependencies section of the package.json file,
since they are already added to the dependencies section
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-14b60f636e1a2b0061da57aaf231cb1ed15a5dc0c592425ed82e58fec95d42d8L150-L151))
* Sort the dependencies in the package.json file alphabetically by name
to improve readability and consistency
([link](https://github.com/pancakeswap/pancake-frontend/pull/7323/files?diff=unified&w=0#diff-14b60f636e1a2b0061da57aaf231cb1ed15a5dc0c592425ed82e58fec95d42d8L54-R56))

---------

Co-authored-by: Philip <[email protected]>
Co-authored-by: chefilip <[email protected]>
  • Loading branch information
3 people authored Sep 29, 2023
1 parent 457d1d3 commit 1127087
Show file tree
Hide file tree
Showing 63 changed files with 4,767 additions and 63 deletions.
6 changes: 6 additions & 0 deletions apps/web/src/components/Menu/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
SwapIcon,
} from '@pancakeswap/uikit'
import {
FIXED_STAKING_SUPPORTED_CHAINS,
LIQUID_STAKING_SUPPORTED_CHAINS,
SUPPORT_BUY_CRYPTO,
SUPPORT_FARMS,
Expand Down Expand Up @@ -117,6 +118,11 @@ const config: (
href: '/liquid-staking',
supportChainIds: LIQUID_STAKING_SUPPORTED_CHAINS,
},
{
label: t('Simple Staking'),
href: '/simple-staking',
supportChainIds: FIXED_STAKING_SUPPORTED_CHAINS,
},
].map((item) => addMenuItemSupported(item, chainId)),
},
{
Expand Down
Loading

2 comments on commit 1127087

@vercel
Copy link

@vercel vercel bot commented on 1127087 Sep 29, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

uikit – ./packages/uikit

uikit.pancake.run
uikit-git-develop.pancake.run

@vercel
Copy link

@vercel vercel bot commented on 1127087 Sep 29, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.