Documentation ¶
Index ¶
- Constants
- func GetAddressFromPub(pub string) sdk.AccAddress
- func GetTestDataSource() types.DataSource
- func GetTestOracleScript(path string) types.OracleScript
- func NewPubKey(pk string) crypto.PubKey
- func NewQuerier(keeper Keeper) sdk.Querier
- func NewUBandCoins(amount int64) sdk.Coins
- func ParamKeyTable() params.KeyTable
- func SetBech32AddressPrefixesAndBip44CoinType(config *sdk.Config)
- func SetupTestValidator(ctx sdk.Context, keeper Keeper, pk string, power int64) sdk.ValAddress
- type Keeper
- func (k Keeper) AddDataSource(ctx sdk.Context, owner sdk.AccAddress, name string, description string, ...) (types.DataSourceID, sdk.Error)
- func (k Keeper) AddNewRawDataRequest(ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID, ...) sdk.Error
- func (k Keeper) AddOracleScript(ctx sdk.Context, owner sdk.AccAddress, name string, description string, ...) (types.OracleScriptID, sdk.Error)
- func (k Keeper) AddPendingRequest(ctx sdk.Context, requestID types.RequestID) sdk.Error
- func (k Keeper) AddReport(ctx sdk.Context, requestID types.RequestID, ...) sdk.Error
- func (k Keeper) AddRequest(ctx sdk.Context, oracleScriptID types.OracleScriptID, calldata []byte, ...) (types.RequestID, sdk.Error)
- func (k Keeper) AddResult(ctx sdk.Context, requestID types.RequestID, ...) sdk.Error
- func (k Keeper) CheckDataSourceExists(ctx sdk.Context, id types.DataSourceID) bool
- func (k Keeper) CheckOracleScriptExists(ctx sdk.Context, id types.OracleScriptID) bool
- func (k Keeper) CheckRawDataRequestExists(ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID) bool
- func (k Keeper) CheckRequestExists(ctx sdk.Context, id types.RequestID) bool
- func (k Keeper) EditDataSource(ctx sdk.Context, dataSourceID types.DataSourceID, owner sdk.AccAddress, ...) sdk.Error
- func (k Keeper) EditOracleScript(ctx sdk.Context, oracleScriptID types.OracleScriptID, owner sdk.AccAddress, ...) sdk.Error
- func (keeper Keeper) EndBlockExecuteGasLimit(ctx sdk.Context) (res uint64)
- func (keeper Keeper) GasPerRawDataRequestPerValidator(ctx sdk.Context) (res uint64)
- func (k Keeper) GetAllDataSources(ctx sdk.Context) []types.DataSource
- func (k Keeper) GetAllOracleScripts(ctx sdk.Context) []types.OracleScript
- func (k Keeper) GetDataSource(ctx sdk.Context, id types.DataSourceID) (types.DataSource, sdk.Error)
- func (k Keeper) GetDataSourceCount(ctx sdk.Context) int64
- func (k Keeper) GetDataSourceIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetNextDataSourceID(ctx sdk.Context) types.DataSourceID
- func (k Keeper) GetNextOracleScriptID(ctx sdk.Context) types.OracleScriptID
- func (k Keeper) GetNextRequestID(ctx sdk.Context) types.RequestID
- func (k Keeper) GetOracleScript(ctx sdk.Context, id types.OracleScriptID) (types.OracleScript, sdk.Error)
- func (k Keeper) GetOracleScriptCount(ctx sdk.Context) int64
- func (k Keeper) GetOracleScriptIterator(ctx sdk.Context) sdk.Iterator
- func (keeper Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetPendingResolveList(ctx sdk.Context) []types.RequestID
- func (k Keeper) GetRawDataReport(ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID, ...) (types.RawDataReport, sdk.Error)
- func (k Keeper) GetRawDataReportsIterator(ctx sdk.Context, requestID types.RequestID) sdk.Iterator
- func (k Keeper) GetRawDataRequest(ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID) (types.RawDataRequest, sdk.Error)
- func (k Keeper) GetRawDataRequestCount(ctx sdk.Context, requestID types.RequestID) int64
- func (k Keeper) GetRawDataRequestIterator(ctx sdk.Context, requestID types.RequestID) sdk.Iterator
- func (k Keeper) GetRawDataRequestWithExternalIDs(ctx sdk.Context, requestID types.RequestID) []types.RawDataRequestWithExternalID
- func (k Keeper) GetRawDataRequests(ctx sdk.Context, requestID types.RequestID) []types.RawDataRequest
- func (k Keeper) GetRequest(ctx sdk.Context, id types.RequestID) (types.Request, sdk.Error)
- func (k Keeper) GetRequestCount(ctx sdk.Context) int64
- func (k Keeper) GetResult(ctx sdk.Context, requestID types.RequestID, ...) (types.Result, sdk.Error)
- func (k Keeper) HasResult(ctx sdk.Context, requestID types.RequestID, ...) bool
- func (keeper Keeper) MaxCalldataSize(ctx sdk.Context) (res int64)
- func (keeper Keeper) MaxDataSourceCountPerRequest(ctx sdk.Context) (res int64)
- func (keeper Keeper) MaxDataSourceExecutableSize(ctx sdk.Context) (res int64)
- func (keeper Keeper) MaxDescriptionLength(ctx sdk.Context) (res int64)
- func (keeper Keeper) MaxNameLength(ctx sdk.Context) (res int64)
- func (keeper Keeper) MaxOracleScriptCodeSize(ctx sdk.Context) (res int64)
- func (keeper Keeper) MaxRawDataReportSize(ctx sdk.Context) (res int64)
- func (keeper Keeper) MaxResultSize(ctx sdk.Context) (res int64)
- func (k Keeper) PayDataSourceFees(ctx sdk.Context, id types.RequestID, sender sdk.AccAddress) sdk.Error
- func (k Keeper) SetDataSource(ctx sdk.Context, id types.DataSourceID, dataSource types.DataSource)
- func (keeper Keeper) SetEndBlockExecuteGasLimit(ctx sdk.Context, value uint64)
- func (keeper Keeper) SetGasPerRawDataRequestPerValidator(ctx sdk.Context, value uint64)
- func (keeper Keeper) SetMaxCalldataSize(ctx sdk.Context, value int64)
- func (keeper Keeper) SetMaxDataSourceCountPerRequest(ctx sdk.Context, value int64)
- func (keeper Keeper) SetMaxDataSourceExecutableSize(ctx sdk.Context, value int64)
- func (keeper Keeper) SetMaxDescriptionLength(ctx sdk.Context, value int64)
- func (keeper Keeper) SetMaxNameLength(ctx sdk.Context, value int64)
- func (keeper Keeper) SetMaxOracleScriptCodeSize(ctx sdk.Context, value int64)
- func (keeper Keeper) SetMaxRawDataReportSize(ctx sdk.Context, value int64)
- func (keeper Keeper) SetMaxResultSize(ctx sdk.Context, value int64)
- func (k Keeper) SetOracleScript(ctx sdk.Context, id types.OracleScriptID, oracleScript types.OracleScript)
- func (k Keeper) SetPendingResolveList(ctx sdk.Context, reqIDs []types.RequestID)
- func (k Keeper) SetRawDataReport(ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID, ...)
- func (k Keeper) SetRawDataRequest(ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID, ...)
- func (k Keeper) SetRequest(ctx sdk.Context, id types.RequestID, request types.Request)
- func (k Keeper) SetResolve(ctx sdk.Context, id types.RequestID, resolveStatus types.ResolveStatus) sdk.Error
- func (k Keeper) SetResult(ctx sdk.Context, requestID types.RequestID, ...)
- func (k Keeper) ShouldBecomePendingResolve(ctx sdk.Context, id types.RequestID) bool
- func (k Keeper) ValidateDataSourceCount(ctx sdk.Context, id types.RequestID) sdk.Error
Constants ¶
const Bech32MainPrefix = "band"
const Bip44CoinType = 494
Variables ¶
This section is empty.
Functions ¶
func GetAddressFromPub ¶
func GetAddressFromPub(pub string) sdk.AccAddress
func GetTestDataSource ¶
func GetTestDataSource() types.DataSource
func GetTestOracleScript ¶
func GetTestOracleScript(path string) types.OracleScript
func NewQuerier ¶
NewQuerier is the module level router for state queries.
func NewUBandCoins ¶
func ParamKeyTable ¶
ParamKeyTable returns the parameter key table for zoracle module.
func SetupTestValidator ¶
Types ¶
type Keeper ¶
type Keeper struct { CoinKeeper bank.Keeper StakingKeeper staking.Keeper SupplyKeeper supply.Keeper ParamSpace params.Subspace // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, coinKeeper bank.Keeper, stakingKeeper staking.Keeper, supplyKeeper supply.Keeper, paramSpace params.Subspace) Keeper
NewKeeper creates a new zoracle Keeper instance.
func (Keeper) AddDataSource ¶
func (k Keeper) AddDataSource( ctx sdk.Context, owner sdk.AccAddress, name string, description string, fee sdk.Coins, executable []byte, ) (types.DataSourceID, sdk.Error)
AddDataSource adds the given data source to the storage.
func (Keeper) AddNewRawDataRequest ¶
func (k Keeper) AddNewRawDataRequest( ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID, dataSourceID types.DataSourceID, calldata []byte, ) sdk.Error
AddNewRawDataRequest checks all conditions before saving a new raw data request to the store.
func (Keeper) AddOracleScript ¶
func (k Keeper) AddOracleScript( ctx sdk.Context, owner sdk.AccAddress, name string, description string, code []byte, ) (types.OracleScriptID, sdk.Error)
AddOracleScript adds the given oracle script to the storage.
func (Keeper) AddPendingRequest ¶
AddPendingRequest checks and append new request id to list if id already existed in list, it will return error.
func (Keeper) AddRequest ¶
func (k Keeper) AddRequest( ctx sdk.Context, oracleScriptID types.OracleScriptID, calldata []byte, requestedValidatorCount, sufficientValidatorCount, expiration int64, executeGas uint64, ) (types.RequestID, sdk.Error)
AddRequest attempts to create a new request. An error is returned if some conditions failed.
func (Keeper) AddResult ¶
func (k Keeper) AddResult( ctx sdk.Context, requestID types.RequestID, oracleScriptID types.OracleScriptID, calldata []byte, result []byte, ) sdk.Error
AddResult is a function to validate result size and set to store.
func (Keeper) CheckDataSourceExists ¶
CheckDataSourceExists checks if the data source of this ID exists in the storage.
func (Keeper) CheckOracleScriptExists ¶
CheckOracleScriptExists checks if the oracle script of this ID exists in the storage.
func (Keeper) CheckRawDataRequestExists ¶
func (k Keeper) CheckRawDataRequestExists(ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID) bool
CheckRawDataRequestExists checks if the raw request data at this request id and external id presents in the store or not.
func (Keeper) CheckRequestExists ¶
CheckRequestExists checks if the request at this id is present in the store or not.
func (Keeper) EditDataSource ¶
func (k Keeper) EditDataSource(ctx sdk.Context, dataSourceID types.DataSourceID, owner sdk.AccAddress, name string, description string, fee sdk.Coins, executable []byte) sdk.Error
EditDataSource edits the given data source by given data source id to the storage.
func (Keeper) EditOracleScript ¶
func (k Keeper) EditOracleScript(ctx sdk.Context, oracleScriptID types.OracleScriptID, owner sdk.AccAddress, name string, description string, code []byte) sdk.Error
EditOracleScript edits the given oracle script by given oracle script id to the storage.
func (Keeper) EndBlockExecuteGasLimit ¶
func (Keeper) GasPerRawDataRequestPerValidator ¶
func (Keeper) GetAllDataSources ¶
func (k Keeper) GetAllDataSources(ctx sdk.Context) []types.DataSource
GetAllDataSources returns list of all data sources.
func (Keeper) GetAllOracleScripts ¶
func (k Keeper) GetAllOracleScripts(ctx sdk.Context) []types.OracleScript
GetAllOracleScripts returns list of all oracle scripts.
func (Keeper) GetDataSource ¶
func (k Keeper) GetDataSource(ctx sdk.Context, id types.DataSourceID) (types.DataSource, sdk.Error)
GetDataSource returns the entire DataSource struct for the given ID.
func (Keeper) GetDataSourceCount ¶
GetDataSourceCount returns the current number of all data sources ever exist.
func (Keeper) GetDataSourceIterator ¶
GetDataSourceIterator returns an iterator for all data sources in the store.
func (Keeper) GetNextDataSourceID ¶
func (k Keeper) GetNextDataSourceID(ctx sdk.Context) types.DataSourceID
GetNextDataSourceID increments and returns the current number of data source. If the global data source count is not set, it initializes the value and returns 1.
func (Keeper) GetNextOracleScriptID ¶
func (k Keeper) GetNextOracleScriptID(ctx sdk.Context) types.OracleScriptID
GetNextOracleScriptID increments and returns the current number of oracle script. If the global oracle script count is not set, it initializes the value and returns 1.
func (Keeper) GetNextRequestID ¶
GetNextRequestID increments and returns the current number of requests. If the global request count is not set, it initializes it with value 0.
func (Keeper) GetOracleScript ¶
func (k Keeper) GetOracleScript(ctx sdk.Context, id types.OracleScriptID) (types.OracleScript, sdk.Error)
GetOracleScript returns the entire OracleScript struct for the given ID.
func (Keeper) GetOracleScriptCount ¶
GetOracleScriptCount returns the current number of all oracle scripts ever exist.
func (Keeper) GetOracleScriptIterator ¶
GetOracleScriptIterator returns an iterator for all oracle scripts in the store.
func (Keeper) GetPendingResolveList ¶
GetPendingResolveList returns the list of pending request.
func (Keeper) GetRawDataReport ¶
func (k Keeper) GetRawDataReport( ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID, validatorAddress sdk.ValAddress, ) (types.RawDataReport, sdk.Error)
GetRawDataReport is a function that gets a raw data report from store.
func (Keeper) GetRawDataReportsIterator ¶
GetRawDataReportsIterator returns an iterator for all reports for a specific request ID.
func (Keeper) GetRawDataRequest ¶
func (k Keeper) GetRawDataRequest( ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID, ) (types.RawDataRequest, sdk.Error)
GetRawDataRequest is a function to get raw data request detail by the given request id and external id.
func (Keeper) GetRawDataRequestCount ¶
GetRawDataRequestCount returns amount of raw data requests in given request.
func (Keeper) GetRawDataRequestIterator ¶
GetRawDataRequestIterator is a function to get iterator on all raw data request that belong to given request id
func (Keeper) GetRawDataRequestWithExternalIDs ¶
func (k Keeper) GetRawDataRequestWithExternalIDs( ctx sdk.Context, requestID types.RequestID, ) []types.RawDataRequestWithExternalID
GetRawDataRequestWithExternalIDs returns a list of raw data requests with external id in given request.
func (Keeper) GetRawDataRequests ¶
func (k Keeper) GetRawDataRequests(ctx sdk.Context, requestID types.RequestID) []types.RawDataRequest
GetRawDataRequests returns a list of raw data requests in given request.
func (Keeper) GetRequest ¶
GetRequest returns the entire Request metadata struct.
func (Keeper) GetRequestCount ¶
GetRequestCount returns the current number of all requests ever exist.
func (Keeper) GetResult ¶
func (k Keeper) GetResult( ctx sdk.Context, requestID types.RequestID, oracleScriptID types.OracleScriptID, calldata []byte, ) (types.Result, sdk.Error)
GetResult returns the result bytes in store.
func (Keeper) HasResult ¶
func (k Keeper) HasResult(ctx sdk.Context, requestID types.RequestID, oracleScriptID types.OracleScriptID, calldata []byte) bool
HasResult checks if the result at this request id is present in the store or not.
func (Keeper) MaxDataSourceCountPerRequest ¶
func (Keeper) MaxDataSourceExecutableSize ¶
func (Keeper) MaxDescriptionLength ¶
func (Keeper) MaxOracleScriptCodeSize ¶
func (Keeper) MaxRawDataReportSize ¶
func (Keeper) PayDataSourceFees ¶
func (k Keeper) PayDataSourceFees(ctx sdk.Context, id types.RequestID, sender sdk.AccAddress) sdk.Error
PayDataSourceFees sends fees to the owners of the requested data sources.
func (Keeper) SetDataSource ¶
func (k Keeper) SetDataSource(ctx sdk.Context, id types.DataSourceID, dataSource types.DataSource)
SetDataSource saves the given data source with the given ID to the storage. WARNING: This function doesn't perform any check on ID.
func (Keeper) SetEndBlockExecuteGasLimit ¶
func (Keeper) SetGasPerRawDataRequestPerValidator ¶
func (Keeper) SetMaxCalldataSize ¶
func (Keeper) SetMaxDataSourceCountPerRequest ¶
func (Keeper) SetMaxDataSourceExecutableSize ¶
func (Keeper) SetMaxDescriptionLength ¶
func (Keeper) SetMaxNameLength ¶
func (Keeper) SetMaxOracleScriptCodeSize ¶
func (Keeper) SetMaxRawDataReportSize ¶
func (Keeper) SetMaxResultSize ¶
func (Keeper) SetOracleScript ¶
func (k Keeper) SetOracleScript(ctx sdk.Context, id types.OracleScriptID, oracleScript types.OracleScript)
SetOracleScript saves the given oracle script with the given ID to the storage. WARNING: This function doesn't perform any check on ID.
func (Keeper) SetPendingResolveList ¶
SetPendingResolveList saves the list of pending request that will be resolved at end block.
func (Keeper) SetRawDataReport ¶
func (k Keeper) SetRawDataReport( ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID, validatorAddress sdk.ValAddress, rawDataReport types.RawDataReport, )
SetRawDataReport is a function that saves a raw data report to store.
func (Keeper) SetRawDataRequest ¶
func (k Keeper) SetRawDataRequest( ctx sdk.Context, requestID types.RequestID, externalID types.ExternalID, rawDataRequest types.RawDataRequest, )
SetRawDataRequest is a function to save raw data request detail to the given request id and external id.
func (Keeper) SetRequest ¶
SetRequest is a function to save request to the given ID.
func (Keeper) SetResolve ¶
func (Keeper) SetResult ¶
func (k Keeper) SetResult( ctx sdk.Context, requestID types.RequestID, oracleScriptID types.OracleScriptID, calldata []byte, result types.Result, )
SetResult is a function to save result of execute code to store.
func (Keeper) ShouldBecomePendingResolve ¶
ShouldBecomePendingResolve checks and returns whether the given request should be moved to the pending resolve list, which will be resolved during the EndBlock call. The move will happen exactly when the request receives sufficient raw reports from the validators.