Skip to content

Commit

Permalink
Merge branch 'igor/adv-staking-4' into 'main'
Browse files Browse the repository at this point in the history
feat(dapp): Extend Advanced Staking to V4

See merge request pantherprotocol/panther-core!1403
  • Loading branch information
pycckuu committed Nov 15, 2023
2 parents 8b8c894 + c56ba00 commit 746ecde
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dapp/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ SUBGRAPH_IDS_137=QmTi7Z7YoUpzYqwGytPuKYu2FuYPEhtPTsXti5dRxn8wHR,QmZPs5CFi5vpZW73
Z_ASSETS_REGISTRY_CONTRACT_137=0xb658B085144a0BEd098620BB829b676371B9B48c

ADVANCED_STAKING_APY=15
CURRENT_STAKING_TERM=advanced-v3
CURRENT_STAKING_TERM=advanced-v4
APY_PRP=10

# Faucet
Expand Down
2 changes: 2 additions & 0 deletions dapp/src/constants/stake-terms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ export const CLASSIC_TYPE_HEX = utils.id('classic').slice(0, 10);
export const ADVANCED_TYPE_HEX = utils.id('advanced').slice(0, 10);
export const ADVANCED_2_TYPE_HEX = utils.id('advanced-v2').slice(0, 10);
export const ADVANCED_3_TYPE_HEX = utils.id('advanced-v3').slice(0, 10);
export const ADVANCED_4_TYPE_HEX = utils.id('advanced-v4').slice(0, 10);

export const HEX_STAKE_TYPE_TO_STAKE_TYPE = new Map<string, StakeTypes>([
[CLASSIC_TYPE_HEX, 'classic'],
[ADVANCED_TYPE_HEX, 'advanced'],
[ADVANCED_2_TYPE_HEX, 'advanced-v2'],
[ADVANCED_3_TYPE_HEX, 'advanced-v3'],
[ADVANCED_4_TYPE_HEX, 'advanced-v4'],
]);

export const STAKE_TYPE_TO_HEX_STAKE_TYPE = invertMap(
Expand Down
1 change: 1 addition & 0 deletions dapp/src/redux/slices/staking/stake-terms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const getStakeTerms = createAsyncThunk(
StakeType.Classic,
StakeType.AdvancedTwo,
StakeType.AdvancedThree,
StakeType.AdvancedFour,
]) {
const terms = await getStakingTermsFromContract(
library,
Expand Down
4 changes: 3 additions & 1 deletion dapp/src/services/rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ADVANCED_TYPE_HEX,
ADVANCED_2_TYPE_HEX,
ADVANCED_3_TYPE_HEX,
ADVANCED_4_TYPE_HEX,
HEX_STAKE_TYPE_TO_STAKE_TYPE,
} from 'constants/stake-terms';
import {oneYearInMs} from 'constants/time';
Expand Down Expand Up @@ -168,7 +169,8 @@ export function calculateRewardsForStake(
if (
stake.stakeType === ADVANCED_TYPE_HEX ||
stake.stakeType === ADVANCED_2_TYPE_HEX ||
stake.stakeType === ADVANCED_3_TYPE_HEX
stake.stakeType === ADVANCED_3_TYPE_HEX ||
ADVANCED_4_TYPE_HEX
) {
return calculateRewardsForAdvancedStake(
stake,
Expand Down
8 changes: 7 additions & 1 deletion dapp/src/types/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ import {IStakingTypes} from 'contracts/Staking';
import {BigNumber} from 'ethers';
import {LoadingStatus} from 'loading';

export type StakeTypes = 'classic' | 'advanced' | 'advanced-v2' | 'advanced-v3';
export type StakeTypes =
| 'classic'
| 'advanced'
| 'advanced-v2'
| 'advanced-v3'
| 'advanced-v4';

export enum StakeType {
Classic = 'classic',
Advanced = 'advanced',
AdvancedTwo = 'advanced-v2',
AdvancedThree = 'advanced-v3',
AdvancedFour = 'advanced-v4',
}

export type StakeReward = {
Expand Down

0 comments on commit 746ecde

Please sign in to comment.