addresses issue 27
This commit is contained in:
parent
26a8771848
commit
327e2c1308
16 changed files with 384 additions and 322 deletions
|
|
@ -28,10 +28,13 @@ vi.mock('../useAdjustTaxRates', () => ({
|
|||
useAdjustTaxRate: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('kraiken-lib', () => ({
|
||||
vi.mock('kraiken-lib/staking', () => ({
|
||||
calculateSnatchShortfall: vi.fn((outstandingStake, stakingShares, stakeTotalSupply) => {
|
||||
return stakingShares > outstandingStake ? 0n : outstandingStake - stakingShares
|
||||
}),
|
||||
})
|
||||
}))
|
||||
|
||||
vi.mock('kraiken-lib/snatch', () => ({
|
||||
selectSnatchPositions: vi.fn((candidates, options) => {
|
||||
if (candidates.length === 0) {
|
||||
return { selected: [], remainingShortfall: options.shortfallShares }
|
||||
|
|
@ -271,4 +274,4 @@ describe('useSnatchSelection', () => {
|
|||
// Position has taxRateIndex: 1, so nextIndex = 2, taxRates[2] = { year: 3 }
|
||||
expect(floorTax.value).toBe(3)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -4,7 +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";
|
||||
import { TAX_RATE_OPTIONS } from "kraiken-lib/taxRates";
|
||||
|
||||
const contractToast = useContractToast();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ import { useStake } from './useStake'
|
|||
import { useWallet } from './useWallet'
|
||||
import { useStatCollection } from './useStatCollection'
|
||||
import { useAdjustTaxRate } from './useAdjustTaxRates'
|
||||
import { calculateSnatchShortfall } from 'kraiken-lib/staking'
|
||||
import {
|
||||
calculateSnatchShortfall,
|
||||
selectSnatchPositions,
|
||||
minimumTaxRate,
|
||||
type SnatchablePosition,
|
||||
} from 'kraiken-lib'
|
||||
} from 'kraiken-lib/snatch'
|
||||
|
||||
/**
|
||||
* Converts Kraiken token assets to shares using the same formula as Stake.sol:
|
||||
|
|
@ -177,4 +177,4 @@ export function useSnatchSelection(demo = false) {
|
|||
floorTax,
|
||||
openPositionsAvailable,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue