Skip to content

Commit

Permalink
fix: staking length
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveVodrazka committed Jun 27, 2024
1 parent 3242a24 commit 32f00c1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
10 changes: 7 additions & 3 deletions src/components/Airdrop/AirdropModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { AccountInterface } from "starknet";
import { Eligible } from "./getProof";

import { shortInteger } from "../../utils/computations";
import { CARMINE_STAKING_MONTH, GOVERNANCE_ADDRESS } from "../../constants/amm";
import {
CARMINE_STAKING_MONTH,
CARMINE_STAKING_YEAR,
GOVERNANCE_ADDRESS,
} from "../../constants/amm";

import GovernanceABI from "../../abi/governance_abi.json";
import {
Expand Down Expand Up @@ -194,7 +198,7 @@ export const AirdropModal = ({ account, data, open, setOpen }: Props) => {
account,
data.proof,
data.claimable,
CARMINE_STAKING_MONTH,
CARMINE_STAKING_YEAR,
setYearState
).then(() => {
setMonthState(TransactionState.Initial);
Expand All @@ -214,7 +218,7 @@ export const AirdropModal = ({ account, data, open, setOpen }: Props) => {
<h3>Claim Airdrop</h3>
<p>
Congratulations! You are eligible to claim{" "}
{shortInteger(data.claimable, 18)} <b>CRM</b>!
{shortInteger(data.claimable, 18)} <b>veCRM</b>!
</p>
<p>You can claim and stake for any of these periods:</p>
<div className={styles.buttongroup}>
Expand Down
16 changes: 9 additions & 7 deletions src/components/CarmineStaking/StakeCRM.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { AccountInterface } from "starknet";
import { useState } from "react";
import { longInteger, shortInteger } from "../../utils/computations";
import { CARMINE_STAKING_MONTH, GOVERNANCE_ADDRESS } from "../../constants/amm";
import {
CARMINE_STAKING_MONTH,
CARMINE_STAKING_YEAR,
GOVERNANCE_ADDRESS,
} from "../../constants/amm";
import { TransactionState, TxTracking } from "../../types/network";
import { stateToClassName } from "./StakingModal";
import { LoadingAnimation } from "../Loading/Loading";
Expand Down Expand Up @@ -102,12 +106,10 @@ export const StakeCrm = ({ account, carmBalance }: Props) => {
const handleYear = () => {
setMonthState(TransactionState.Processing);
setSixMonthsState(TransactionState.Processing);
stake(account, amount, 12 * CARMINE_STAKING_MONTH, setYearState).then(
() => {
setMonthState(TransactionState.Initial);
setSixMonthsState(TransactionState.Initial);
}
);
stake(account, amount, CARMINE_STAKING_YEAR, setYearState).then(() => {
setMonthState(TransactionState.Initial);
setSixMonthsState(TransactionState.Initial);
});
};

const handleInputChange = (value: string) => {
Expand Down
8 changes: 6 additions & 2 deletions src/components/CarmineStaking/StakingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { Dialog } from "@mui/material";
import { AccountInterface } from "starknet";

import { longInteger, shortInteger } from "../../utils/computations";
import { CARMINE_STAKING_MONTH, GOVERNANCE_ADDRESS } from "../../constants/amm";
import {
CARMINE_STAKING_MONTH,
CARMINE_STAKING_YEAR,
GOVERNANCE_ADDRESS,
} from "../../constants/amm";
import GovernanceABI from "../../abi/governance_abi.json";
import {
addTx,
Expand Down Expand Up @@ -142,7 +146,7 @@ export const StakingModal = ({ account, amount, open, setOpen }: Props) => {
unstakeAndStake(
account,
selectedAmount,
12 * CARMINE_STAKING_MONTH,
CARMINE_STAKING_YEAR,
setYearState
).then(() => {
setMonthState(TransactionState.Initial);
Expand Down
1 change: 1 addition & 0 deletions src/constants/amm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ export const BASE_MATH_64 = BigInt(2) ** BigInt(64);
export const USDC_PRECISSION = 1000;

export const CARMINE_STAKING_MONTH = 2629743;
export const CARMINE_STAKING_YEAR = 31536000;
3 changes: 2 additions & 1 deletion src/network/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export const connect = (
// do not open the dialog if the page is loading/just loaded
return;
}
openNetworkMismatchDialog();
// TODO: fix this
// openNetworkMismatchDialog();
}

addWalletEventHandlers(wallet);
Expand Down

0 comments on commit 32f00c1

Please sign in to comment.