keeper

package
v3.2.2-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

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

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.

func VerifyDeal

func VerifyDeal(merkle string, hashList string, num int64, item string) bool

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,
) *Keeper

func (Keeper) Attest

func (k Keeper) Attest(ctx sdk.Context, cid string, creator string) error

func (Keeper) CanContract

func (k Keeper) CanContract(ctx sdk.Context, root string, creator string) error

func (Keeper) ClearDeadFiles

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

func (Keeper) DropDeal

func (k Keeper) DropDeal(ctx sdk.Context, deal types.ActiveDeals, burn bool) error

func (Keeper) FidCid

func (Keeper) FindFile

func (Keeper) Freespace

func (Keeper) GetActiveDeals

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

GetActiveDeals returns a activeDeals from its index

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) GetAllActiveDeals

func (k Keeper) GetAllActiveDeals(ctx sdk.Context) (list []types.ActiveDeals)

GetAllActiveDeals returns all activeDeals

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) GetAllContracts

func (k Keeper) GetAllContracts(ctx sdk.Context) (list []types.Contracts)

GetAllContracts returns all contracts

func (Keeper) GetAllFidCid

func (k Keeper) GetAllFidCid(ctx sdk.Context) (list []types.FidCid)

GetAllFidCid returns all fidCid

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) GetAllStrays

func (k Keeper) GetAllStrays(ctx sdk.Context) (list []types.Strays)

GetAllStrays returns all strays

func (Keeper) GetAttestationForm

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

GetAttestationForm returns an attestation from its index

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) GetContracts

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

GetContracts returns a contracts from its index

func (Keeper) GetFidCid

func (k Keeper) GetFidCid(
	ctx sdk.Context,
	fid string,
) (val types.FidCid, found bool)

GetFidCid returns a fidCid 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) 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 (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) GetReportForm

func (k Keeper) GetReportForm(
	ctx sdk.Context,
	cid string,
) (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) GetStoragePaymentInfo

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

GetStoragePaymentInfo returns StoragePaymentInfo from its address

func (Keeper) GetStrays

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

GetStrays returns a strays from its index

func (Keeper) HandleRewardBlock

func (k Keeper) HandleRewardBlock(ctx sdk.Context) error

func (Keeper) InternalActiveDealsAll added in v3.2.0

func (Keeper) InternalRewards

func (k Keeper) InternalRewards(ctx sdk.Context, allDeals []types.ActiveDeals, address sdk.AccAddress) error

func (Keeper) IterateActiveDeals added in v3.1.3

func (k Keeper) IterateActiveDeals(ctx sdk.Context, fn func(deal types.ActiveDeals) bool)

IterateActiveDeals runs `fn` for each active deal in the store

func (Keeper) IterateLegacyActiveDeals added in v3.2.0

func (k Keeper) IterateLegacyActiveDeals(ctx sdk.Context, fn func(deal types.LegacyActiveDeals) bool)

IterateLegacyActiveDeals runs `fn` for each legacy active deal in the store

func (Keeper) KillOldContracts

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

func (Keeper) ListFiles

func (k Keeper) ListFiles(ctx sdk.Context, fid string) []string

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) RemoveActiveDeals

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

RemoveActiveDeals removes a activeDeals from the store

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,
	cid string,
)

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) RemoveContracts

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

RemoveContracts removes a contracts from the store

func (Keeper) RemoveFidCid

func (k Keeper) RemoveFidCid(
	ctx sdk.Context,
	fid string,
)

RemoveFidCid removes a fidCid from the store

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,
	cid string,
)

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) RemoveStrays

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

RemoveStrays removes a strays from the store

func (Keeper) Report

func (k Keeper) Report(ctx sdk.Context, cid string, creator string) error

func (Keeper) Reports

func (Keeper) RequestAttestation

func (k Keeper) RequestAttestation(ctx sdk.Context, cid string, creator string) ([]string, error)

func (Keeper) RequestReport

func (k Keeper) RequestReport(ctx sdk.Context, cid string) ([]string, error)

func (Keeper) SetActiveDeals

func (k Keeper) SetActiveDeals(ctx sdk.Context, activeDeals types.ActiveDeals)

SetActiveDeals set a specific activeDeals in the store from its index

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) SetContracts

func (k Keeper) SetContracts(ctx sdk.Context, contracts types.Contracts)

SetContracts set a specific contracts in the store from its index

func (Keeper) SetFidCid

func (k Keeper) SetFidCid(ctx sdk.Context, fidCid types.FidCid)

SetFidCid set a specific fidCid 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) 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) SetStrays

func (k Keeper) SetStrays(ctx sdk.Context, strays types.Strays)

SetStrays set a specific strays in the store from its index

func (Keeper) StoreCount

func (Keeper) Strays

func (Keeper) UpgradeStorage

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 added in v3.2.0

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