keeper

package
v4.2.1-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	False = "false"
	True  = "true"
)
View Source
const (
	Rounds = 20
)

Variables

This section is empty.

Functions

func MakeCid

func MakeCid(data []byte) (string, error)

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey sdk.StoreKey,
	ps paramtypes.Subspace,
	bankKeeper types.BankKeeper,
	accountKeeper types.AccountKeeper,
	oracleKeeper types.OracleKeeper,
	rnsKeeper types.RnsKeeper,
	feeCollectorName string,
) *Keeper

func (Keeper) AddCollectedFees

func (k Keeper) AddCollectedFees(ctx sdk.Context, fees sdk.Coins) error

func (Keeper) AllFiles

func (Keeper) AllProofs

func (Keeper) AllReports

func (Keeper) Attest

func (k Keeper) Attest(ctx sdk.Context, prover string, merkle []byte, owner string, start int64, creator string) error

func (Keeper) Attestation

func (Keeper) AvailableSpace added in v4.1.0

func (Keeper) DoReport

func (k Keeper) DoReport(ctx sdk.Context, prover string, merkle []byte, owner string, start int64, creator string) error

func (Keeper) File

func (Keeper) FindFile

func (Keeper) FreeSpace

func (Keeper) Gauges

func (Keeper) GetActiveProviders

func (k Keeper) GetActiveProviders(ctx sdk.Context, filterAddress string) []types.ActiveProviders

GetActiveProviders returns a list of recently active providers in a random order

func (Keeper) GetAllActiveProviders

func (k Keeper) GetAllActiveProviders(ctx sdk.Context) (list []types.ActiveProviders)

GetAllActiveProviders returns all providers

func (Keeper) GetAllAttestation

func (k Keeper) GetAllAttestation(ctx sdk.Context) (list []types.AttestationForm)

GetAllAttestation returns all attestations

func (Keeper) GetAllCollateral

func (k Keeper) GetAllCollateral(ctx sdk.Context) (list []types.Collateral)

GetAllCollateral returns all collaterals

func (Keeper) GetAllFileByMerkle

func (k Keeper) GetAllFileByMerkle(ctx sdk.Context) (list []types.UnifiedFile)

GetAllFileByMerkle returns all File

func (Keeper) GetAllFileByOwner

func (k Keeper) GetAllFileByOwner(ctx sdk.Context) (list []types.UnifiedFile)

GetAllFileByOwner returns all File

func (Keeper) GetAllFilesWithMerkle

func (k Keeper) GetAllFilesWithMerkle(ctx sdk.Context, merkle []byte) (list []types.UnifiedFile)

GetAllFilesWithMerkle returns all Files that start with a specific merkle

func (Keeper) GetAllLegacyActiveDeals

func (k Keeper) GetAllLegacyActiveDeals(ctx sdk.Context) (list []types.LegacyActiveDeals)

GetAllActiveDeals returns all activeDeals

func (Keeper) GetAllPaymentGauges

func (k Keeper) GetAllPaymentGauges(ctx sdk.Context) (list []types.PaymentGauge)

GetAllPaymentGauges returns all payment gauges

func (Keeper) GetAllProofs

func (k Keeper) GetAllProofs(ctx sdk.Context) (list []types.FileProof)

GetAllProofs returns all File

func (Keeper) GetAllProofsForProver

func (k Keeper) GetAllProofsForProver(ctx sdk.Context, prover string) ([]types.FileProof, error)

GetAllProofsForProver returns all Proofs for the given prover

func (Keeper) GetAllProviders

func (k Keeper) GetAllProviders(ctx sdk.Context) (list []types.Providers)

GetAllProviders returns all providers

func (Keeper) GetAllReport

func (k Keeper) GetAllReport(ctx sdk.Context) (list []types.ReportForm)

GetAllReport returns all reports

func (Keeper) GetAllStoragePaymentInfo

func (k Keeper) GetAllStoragePaymentInfo(ctx sdk.Context) (list []types.StoragePaymentInfo)

GetAllStoragePaymentInfo returns all payBlocks

func (Keeper) GetAttestationForm

func (k Keeper) GetAttestationForm(
	ctx sdk.Context,
	prover string,
	merkle []byte,
	owner string,
	start int64,
) (val types.AttestationForm, found bool)

GetAttestationForm returns an attestation from its index

func (Keeper) GetClientFreeSpace

func (Keeper) GetCollateral

func (k Keeper) GetCollateral(
	ctx sdk.Context,
	address string,
) (val types.Collateral, found bool)

GetCollateral returns a collateral from its index

func (Keeper) GetFile

func (k Keeper) GetFile(
	ctx sdk.Context,
	merkle []byte,
	owner string,
	start int64,
) (val types.UnifiedFile, found bool)

GetFile returns a File from its index

func (Keeper) GetJklPrice

func (k Keeper) GetJklPrice(ctx sdk.Context) (price sdk.Dec)

GetJklPrice uses oracle module to get jkl price Returns 0.20 if feed doesn't exist or failed to unmarshal data Unmarshal failure is logged

func (Keeper) GetLegacyActiveDeals

func (k Keeper) GetLegacyActiveDeals(
	ctx sdk.Context,
	cid string,
) (val types.LegacyActiveDeals, found bool)

GetActiveDeals returns a activeDeals from its index

func (Keeper) GetPaidAmount

func (k Keeper) GetPaidAmount(ctx sdk.Context, address string) int64

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (p types.Params)

GetParams get all parameters as types.Params

func (Keeper) GetPayData

func (k Keeper) GetPayData(goCtx context.Context, req *types.QueryPayData) (*types.QueryPayDataResponse, error)

func (Keeper) GetProof

func (k Keeper) GetProof(
	ctx sdk.Context,
	prover string,
	merkle []byte,
	owner string,
	start int64,
) (val types.FileProof, found bool)

GetProof returns a Proof from its index

func (Keeper) GetProofWithBuiltKey

func (k Keeper) GetProofWithBuiltKey(
	ctx sdk.Context,
	key []byte,
) (val types.FileProof, found bool)

GetProofWithBuiltKey returns a Proof from its index using an already built key (for example from the internal file proof list)

func (Keeper) GetProviderDeals

func (k Keeper) GetProviderDeals(ctx sdk.Context, provider string) int64

func (Keeper) GetProviderUsing

func (k Keeper) GetProviderUsing(ctx sdk.Context, provider string) int64

func (Keeper) GetProviders

func (k Keeper) GetProviders(
	ctx sdk.Context,
	address string,
) (val types.Providers, found bool)

GetProviders returns a providers from its index

func (Keeper) GetRandomizedProviders

func (k Keeper) GetRandomizedProviders(ctx sdk.Context) []types.Providers

GetRandomizedProviders returns a list of providers in a random order

func (Keeper) GetReportForm

func (k Keeper) GetReportForm(
	ctx sdk.Context,
	prover string,
	merkle []byte,
	owner string,
	start int64,
) (val types.ReportForm, found bool)

GetReportForm returns a report from its index

func (Keeper) GetStorageCost

func (k Keeper) GetStorageCost(ctx sdk.Context, gbs int64, hours int64) sdk.Int

GetStorageCost calculates storage cost in ujkl Uses gigabytes and months to calculate how much user has to pay

func (Keeper) GetStorageCostKbs

func (k Keeper) GetStorageCostKbs(ctx sdk.Context, kbs int64, hours int64) sdk.Int

GetStorageCostKbs calculates storage cost in ujkl Uses kilobytes and months to calculate how much user has to pay

func (Keeper) GetStorageCostKbsWithPrice

func (k Keeper) GetStorageCostKbsWithPrice(ctx sdk.Context, kbs int64, hours int64, pricePerTBMonth int64) sdk.Int

GetStorageCostKbs calculates storage cost in ujkl Uses kilobytes and months to calculate how much user has to pay

func (Keeper) GetStoragePaymentInfo

func (k Keeper) GetStoragePaymentInfo(
	ctx sdk.Context,
	address string,
) (val types.StoragePaymentInfo, found bool)

GetStoragePaymentInfo returns StoragePaymentInfo from its address

func (Keeper) IterateAndParseFilesByMerkle added in v4.1.0

func (k Keeper) IterateAndParseFilesByMerkle(ctx sdk.Context, reverse bool, fn func(key []byte, val types.UnifiedFile) bool)

IterateAndParseFilesByMerkle iterates through every file and parses them for you

func (Keeper) IterateFilesByMerkle

func (k Keeper) IterateFilesByMerkle(ctx sdk.Context, reverse bool, fn func(key []byte, val []byte) bool)

IterateFilesByMerkle iterates through every file

func (Keeper) IterateGauges

func (k Keeper) IterateGauges(ctx sdk.Context, fn func(pg types.PaymentGauge))

IterateGauges iterates and runs `fn` for every gauge

func (Keeper) ListFileLocations

func (k Keeper) ListFileLocations(ctx sdk.Context, merkle []byte) []string

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) ManageRewards

func (k Keeper) ManageRewards(ctx sdk.Context)

ManageRewards loops through every file on the network and manages it in some way.

func (Keeper) NetworkSize added in v4.1.0

func (Keeper) NewGauge

func (k Keeper) NewGauge(ctx sdk.Context, coins sdk.Coins, end time.Time) types.PaymentGauge

func (Keeper) OpenFiles

OpenFiles returns a paginated list of files with space that providers have yet to fill

TODO: Create unit-test cases for this

func (Keeper) Params

func (Keeper) PriceCheck

func (Keeper) Proof

func (Keeper) Provider

func (Keeper) RemoveAllActiveProviders

func (k Keeper) RemoveAllActiveProviders(
	ctx sdk.Context,
)

RemoveAllActiveProviders removes all active providers

func (Keeper) RemoveAllAttestation

func (k Keeper) RemoveAllAttestation(ctx sdk.Context)

RemoveAllAttestation removes all attestations

func (Keeper) RemoveAttestation

func (k Keeper) RemoveAttestation(
	ctx sdk.Context,
	prover string,
	merkle []byte,
	owner string,
	start int64,
)

RemoveAttestation removes an attestation from the store

func (Keeper) RemoveCollateral

func (k Keeper) RemoveCollateral(
	ctx sdk.Context,
	address string,
)

RemoveCollateral removes a collateral from the store

func (Keeper) RemoveFile

func (k Keeper) RemoveFile(
	ctx sdk.Context,
	merkle []byte,
	owner string,
	start int64,
)

RemoveFile removes a File from the store

func (Keeper) RemoveGauge

func (k Keeper) RemoveGauge(
	ctx sdk.Context,
	id []byte,
)

RemoveGauge removes a PaymentGauge from the store

func (Keeper) RemoveLegacyActiveDeals

func (k Keeper) RemoveLegacyActiveDeals(
	ctx sdk.Context,
	cid string,
)

RemoveActiveDeals removes a activeDeals from the store

func (Keeper) RemoveProof

func (k Keeper) RemoveProof(
	ctx sdk.Context,
	prover string,
	merkle []byte,
	owner string,
	start int64,
)

func (Keeper) RemoveProofWithBuiltKey

func (k Keeper) RemoveProofWithBuiltKey(
	ctx sdk.Context,
	key []byte,
)

func (Keeper) RemoveProviders

func (k Keeper) RemoveProviders(
	ctx sdk.Context,
	address string,
)

RemoveProviders removes a providers from the store

func (Keeper) RemoveReport

func (k Keeper) RemoveReport(
	ctx sdk.Context,
	prover string,
	merkle []byte,
	owner string,
	start int64,
)

RemoveReport removes an attestation from the store

func (Keeper) RemoveStoragePaymentInfo

func (k Keeper) RemoveStoragePaymentInfo(
	ctx sdk.Context,
	address string,
)

RemoveStoragePaymentInfo removes a StoragePaymentInfo from the store

func (Keeper) Report

func (Keeper) RequestAttestation

func (k Keeper) RequestAttestation(ctx sdk.Context, merkle []byte, owner string, start int64, creator string) ([]string, error)

func (Keeper) RequestReport

func (k Keeper) RequestReport(ctx sdk.Context, prover string, merkle []byte, owner string, start int64) ([]string, error)

func (Keeper) RunRewardBlock

func (k Keeper) RunRewardBlock(ctx sdk.Context)

func (Keeper) SetActiveProviders

func (k Keeper) SetActiveProviders(ctx sdk.Context, providers types.ActiveProviders)

SetActiveProviders set a specific providers in the store from its index

func (Keeper) SetAttestationForm

func (k Keeper) SetAttestationForm(ctx sdk.Context, attestation types.AttestationForm)

SetAttestationForm sets a specific attestation in the store from its index

func (Keeper) SetCollateral

func (k Keeper) SetCollateral(ctx sdk.Context, collateral types.Collateral)

SetCollateral sets a specific collateral in the store from its index

func (Keeper) SetFile

func (k Keeper) SetFile(ctx sdk.Context, file types.UnifiedFile)

SetFile set a specific File in the store from its index

func (Keeper) SetLegacyActiveDeals

func (k Keeper) SetLegacyActiveDeals(ctx sdk.Context, activeDeals types.LegacyActiveDeals)

SetActiveDeals set a specific activeDeals in the store from its index

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams set the params

func (Keeper) SetPaymentGauge

func (k Keeper) SetPaymentGauge(ctx sdk.Context, gauge types.PaymentGauge)

SetPaymentGauge set a specific payment gauge in the store from its index

func (Keeper) SetProof

func (k Keeper) SetProof(ctx sdk.Context, proof types.FileProof)

SetProof set a specific proof in the store from its index

func (Keeper) SetProviders

func (k Keeper) SetProviders(ctx sdk.Context, providers types.Providers)

SetProviders set a specific providers in the store from its index

func (Keeper) SetReportForm

func (k Keeper) SetReportForm(ctx sdk.Context, report types.ReportForm)

SetReportForm sets a specific report in the store from its index

func (Keeper) SetStoragePaymentInfo

func (k Keeper) SetStoragePaymentInfo(ctx sdk.Context, payInfo types.StoragePaymentInfo)

SetStoragePaymentInfo set a specific payBlocks in the store from its x

func (Keeper) StoreCount

func (Keeper) UpgradeStorage

func (k Keeper) UpgradeStorage(
	ctx sdk.Context,
	bytes int64,
	payInfo types.StoragePaymentInfo,
	duration time.Duration,
	storageCost sdk.Int,
	denom string,
) (sdk.Coin, error)

type Migrator

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper, legacySubspace exported.Subspace) Migrator

NewMigrator returns a new Migrator

func (Migrator) Migrate1to2

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

func (Migrator) Migrate2to3

func (m Migrator) Migrate2to3(ctx sdk.Context) error

Migrate2to3 migrates from version 2 to 3.

func (Migrator) Migrate3to4

func (m Migrator) Migrate3to4(ctx sdk.Context) error

Migrate3to4 migrates from version 3 to 4.

func (Migrator) Migrate4to5

func (m Migrator) Migrate4to5(ctx sdk.Context) error

Migrate4to5 migrates from version 4 to 5.

func (Migrator) Migrate5to6

func (m Migrator) Migrate5to6(ctx sdk.Context) error

Migrate5to6 migrates from version 5 to 6.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL