mirror of
https://github.com/pezkuwichain/pezkuwi-subquery.git
synced 2026-06-12 10:11:05 +00:00
Fix prettier formatting
This commit is contained in:
@@ -234,12 +234,11 @@ async function updateStakingApyAndActiveStakers(
|
||||
|
||||
// 2. Get validator commissions
|
||||
const validatorAddresses = validatorExposures.map((v) => v.address);
|
||||
const validatorPrefs = await api.query.staking.validators.multi(
|
||||
validatorAddresses,
|
||||
);
|
||||
const validatorPrefs =
|
||||
await api.query.staking.validators.multi(validatorAddresses);
|
||||
|
||||
const validatorsWithCommission: ValidatorAPYData[] =
|
||||
validatorExposures.map((v, i) => {
|
||||
const validatorsWithCommission: ValidatorAPYData[] = validatorExposures.map(
|
||||
(v, i) => {
|
||||
const prefs = validatorPrefs[i] as any;
|
||||
const commissionPerbill = prefs.commission
|
||||
? Number(prefs.commission.toString())
|
||||
@@ -248,7 +247,8 @@ async function updateStakingApyAndActiveStakers(
|
||||
totalStake: v.total,
|
||||
commission: commissionPerbill / PERBILL_DIVISOR,
|
||||
};
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
// 3. Calculate maxAPY
|
||||
const maxAPY = calculateMaxAPY(totalIssuance, validatorsWithCommission);
|
||||
@@ -284,7 +284,9 @@ async function updateStakingApyAndActiveStakers(
|
||||
await ahPoolApy.save();
|
||||
|
||||
logger.info(
|
||||
`Era ${currentEra}: maxAPY=${(maxAPY * 100).toFixed(2)}% validators=${validatorExposures.length} totalIssuance=${totalIssuance}`,
|
||||
`Era ${currentEra}: maxAPY=${(maxAPY * 100).toFixed(2)}% validators=${
|
||||
validatorExposures.length
|
||||
} totalIssuance=${totalIssuance}`,
|
||||
);
|
||||
|
||||
// 7. Collect all unique nominator addresses from exposures (active stakers)
|
||||
|
||||
+11
-6
@@ -27,10 +27,7 @@ import {
|
||||
cachedController,
|
||||
cachedStakingRewardEraIndex,
|
||||
} from "./Cache";
|
||||
import {
|
||||
PEZKUWI_RELAY_GENESIS,
|
||||
STAKING_TYPE_RELAYCHAIN,
|
||||
} from "./constants";
|
||||
import { PEZKUWI_RELAY_GENESIS, STAKING_TYPE_RELAYCHAIN } from "./constants";
|
||||
|
||||
function isPayoutStakers(call: any): boolean {
|
||||
return call.method == "payoutStakers";
|
||||
@@ -79,7 +76,11 @@ export async function handleReward(rewardEvent: SubstrateEvent): Promise<void> {
|
||||
RewardType.reward,
|
||||
accumulatedReward.amount,
|
||||
);
|
||||
await saveMultiStakingReward(rewardEvent, RewardType.reward, STAKING_TYPE_RELAYCHAIN);
|
||||
await saveMultiStakingReward(
|
||||
rewardEvent,
|
||||
RewardType.reward,
|
||||
STAKING_TYPE_RELAYCHAIN,
|
||||
);
|
||||
}
|
||||
|
||||
async function handleRewardForTxHistory(
|
||||
@@ -226,7 +227,11 @@ export async function handleSlash(slashEvent: SubstrateEvent): Promise<void> {
|
||||
RewardType.slash,
|
||||
accumulatedReward.amount,
|
||||
);
|
||||
await saveMultiStakingReward(slashEvent, RewardType.slash, STAKING_TYPE_RELAYCHAIN);
|
||||
await saveMultiStakingReward(
|
||||
slashEvent,
|
||||
RewardType.slash,
|
||||
STAKING_TYPE_RELAYCHAIN,
|
||||
);
|
||||
}
|
||||
|
||||
async function getValidators(era: number): Promise<Set<string>> {
|
||||
|
||||
@@ -62,7 +62,9 @@ async function createTransfer(
|
||||
await element.save();
|
||||
}
|
||||
|
||||
export async function handleAssetTransfer(event: SubstrateEvent): Promise<void> {
|
||||
export async function handleAssetTransfer(
|
||||
event: SubstrateEvent,
|
||||
): Promise<void> {
|
||||
const [assetId, from, to, amount] = getEventData(event);
|
||||
|
||||
const assetTransferData: AssetTransfer = {
|
||||
@@ -75,8 +77,18 @@ export async function handleAssetTransfer(event: SubstrateEvent): Promise<void>
|
||||
success: true,
|
||||
};
|
||||
|
||||
await createAssetTransferHistory(event, from.toString(), "-from", assetTransferData);
|
||||
await createAssetTransferHistory(event, to.toString(), "-to", assetTransferData);
|
||||
await createAssetTransferHistory(
|
||||
event,
|
||||
from.toString(),
|
||||
"-from",
|
||||
assetTransferData,
|
||||
);
|
||||
await createAssetTransferHistory(
|
||||
event,
|
||||
to.toString(),
|
||||
"-to",
|
||||
assetTransferData,
|
||||
);
|
||||
}
|
||||
|
||||
async function createAssetTransferHistory(
|
||||
|
||||
Reference in New Issue
Block a user