Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing committed Mar 8, 2024
1 parent 124714c commit 936cc61
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions x/storage/keeper/payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,20 +520,28 @@ func (k Keeper) GetObjectLockFee(ctx sdk.Context, priceTime int64, payloadSize u
return amount, fmt.Errorf("get charge size failed: %d %w", priceTime, err)
}

fmt.Println("price", price.PrimaryStorePrice, price.SecondaryStorePrice)

primaryRate := price.PrimaryStorePrice.MulInt(sdkmath.NewIntFromUint64(chargeSize)).TruncateInt()

secondarySPNum := int64(k.GetExpectSecondarySPNumForECObject(ctx, priceTime))
secondaryRate := price.SecondaryStorePrice.MulInt(sdkmath.NewIntFromUint64(chargeSize)).TruncateInt()
secondaryRate = secondaryRate.MulRaw(int64(secondarySPNum))

fmt.Println("rate", primaryRate, secondarySPNum, secondaryRate)

versionedParams, err := k.paymentKeeper.GetVersionedParamsWithTs(ctx, priceTime)
if err != nil {
return amount, fmt.Errorf("get versioned reserve time error: %w", err)
}
validatorTaxRate := versionedParams.ValidatorTaxRate.MulInt(primaryRate.Add(secondaryRate)).TruncateInt()

fmt.Println("params", versionedParams.ValidatorTaxRate, versionedParams.ReserveTime)

rate := primaryRate.Add(secondaryRate).Add(validatorTaxRate) // should also lock for validator tax pool
amount = rate.Mul(sdkmath.NewIntFromUint64(versionedParams.ReserveTime))

fmt.Println("final amount", rate, amount)
return amount, nil
}

Expand Down

0 comments on commit 936cc61

Please sign in to comment.