sui-explorer-local
Version:
Local Sui Explorer
19 lines (13 loc) • 646 B
text/typescript
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
import { type EndOfEpochInfo } from '@mysten/sui.js/client';
export function getEpochStorageFundFlow(endOfEpochInfo: EndOfEpochInfo | null) {
const fundInflow = endOfEpochInfo
? BigInt(endOfEpochInfo.storageFundReinvestment) +
BigInt(endOfEpochInfo.storageCharge) +
BigInt(endOfEpochInfo.leftoverStorageFundInflow)
: null;
const fundOutflow = endOfEpochInfo ? BigInt(endOfEpochInfo.storageRebate) : null;
const netInflow = fundInflow !== null && fundOutflow !== null ? fundInflow - fundOutflow : null;
return { netInflow, fundInflow, fundOutflow };
}