Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,17 @@ describe('StakingService', () => {
});

describe('getOnChainStakedBalance', () => {
it('returns total staked and locked balance', async () => {
it('returns total staked balance', async () => {
const address = faker.finance.ethereumAddress();
const stakedAmount = ethers.toBigInt(
faker.number.int({ min: 500, max: 1000000 }),
);
const lockedAmount = ethers.toBigInt(
faker.number.int({ min: 500, max: 999999 }),
);
const mockProvider = {};
mockWeb3Service.getSigner.mockReturnValueOnce({
provider: mockProvider,
} as WalletWithProvider);

const getStakerInfoMock = jest
.fn()
.mockResolvedValue({ stakedAmount, lockedAmount });
const getStakerInfoMock = jest.fn().mockResolvedValue({ stakedAmount });
mockedStakingClient.build.mockResolvedValueOnce({
getStakerInfo: getStakerInfoMock,
} as unknown as StakingClient);
Expand All @@ -193,9 +188,7 @@ describe('StakingService', () => {

expect(mockedStakingClient.build).toHaveBeenCalledWith(mockProvider);
expect(getStakerInfoMock).toHaveBeenCalledWith(address);
expect(result).toBe(
Number(ethers.formatEther(stakedAmount + lockedAmount)),
);
expect(result).toBe(Number(ethers.formatEther(stakedAmount)));
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ export class StakingService {
const stakingClient = await StakingClient.build(provider);
const stakerInfo = await stakingClient.getStakerInfo(address);

const total =
(stakerInfo.stakedAmount ?? 0n) + (stakerInfo.lockedAmount ?? 0n);
return Number(ethers.formatEther(total));
return Number(ethers.formatEther(stakerInfo.stakedAmount ?? 0n));
}

async getStakeSummary(userId: number): Promise<StakeSummaryData> {
Expand Down
Loading