more logic to lib

This commit is contained in:
johba 2025-09-23 16:57:49 +02:00
parent cf6b9fa381
commit 25fc4a4c4d
25 changed files with 5838 additions and 3464 deletions

View file

@ -4,6 +4,7 @@ import { waitForTransactionReceipt } from "@wagmi/core";
import { config } from "@/wagmi";
import { compactNumber, formatBigIntDivision } from "@/utils/helper";
import { useContractToast } from "./useContractToast";
import { TAX_RATE_OPTIONS } from "kraiken-lib";
const contractToast = useContractToast();
@ -13,38 +14,11 @@ enum State {
Action = "Action",
}
export const taxRates = [
{ index: 0,year: 1, daily: 0.00274 },
{ index: 1, year: 3, daily: 0.00822 },
{ index: 2, year: 5, daily: 0.0137 },
{ index: 3, year: 8, daily: 0.02192 },
{ index: 4, year: 12, daily: 0.03288 },
{ index: 5, year: 18, daily: 0.04932 },
{ index: 6, year: 24, daily: 0.06575 },
{ index: 7, year: 30, daily: 0.08219 },
{ index: 8, year: 40, daily: 0.10959 },
{ index: 9, year: 50, daily: 0.13699 },
{ index: 10, year: 60, daily: 0.16438 },
{ index: 11, year: 80, daily: 0.21918 },
{ index: 12, year: 100, daily: 0.27397 },
{ index: 13, year: 130, daily: 0.35616 },
{ index: 14, year: 180, daily: 0.49315 },
{ index: 15, year: 250, daily: 0.68493 },
{ index: 16, year: 320, daily: 0.87671 },
{ index: 17, year: 420, daily: 1.15068 },
{ index: 18, year: 540, daily: 1.47945 },
{ index: 19, year: 700, daily: 1.91781 },
{ index: 20, year: 920, daily: 2.52055 },
{ index: 21, year: 1200, daily: 3.28767 },
{ index: 22, year: 1600, daily: 4.38356 },
{ index: 23, year: 2000, daily: 5.47945 },
{ index: 24, year: 2600, daily: 7.12329 },
{ index: 25, year: 3400, daily: 9.31507 },
{ index: 26, year: 4400, daily: 12.05479 },
{ index: 27, year: 5700, daily: 15.61644 },
{ index: 28, year: 7500, daily: 20.54795 },
{ index: 29, year: 9700, daily: 26.57534 },
];
export const taxRates = TAX_RATE_OPTIONS.map(({ index, year, daily }) => ({
index,
year,
daily,
}));
export function useAdjustTaxRate() {
const loading = ref();

View file

@ -6,7 +6,7 @@ import { getAccount, watchContractEvent, watchChainId, watchAccount } from "@wag
import type { WatchChainIdReturnType, WatchAccountReturnType, GetAccountReturnType} from "@wagmi/core";
import { HarbContract } from "@/contracts/harb";
import { bytesToUint256, uint256ToBytes } from "harb-lib";
import { bytesToUint256, uint256ToBytes } from "kraiken-lib";
import { bigInt2Number } from "@/utils/helper";
import { useChain } from "@/composables/useChain";
import { taxRates } from "@/composables/useAdjustTaxRates";