priceoracle

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Decimals = uint8(18)

Decimals denotes the decimal places of the precision used to represent the price. E.g. if decimals is 18, the price is represented with the 10^18 precision.

View Source
const DecimalsMethodName = "decimals"

DecimalsMethodName is the name of the decimals method. It matches the name of the method in the contract ABI.

EvmAddress is the EVM address of the Price Oracle precompile. The address is prefixed with 0x7b7c which was used to derive Mezo chain ID. This prefix is used to avoid potential collisions with EVM native precompiles.

View Source
const EvmByteCode = "" /* 1170-byte string literal not displayed */

EvmByteCode is the EVM bytecode of the Price Oracle precompile. This code is returned by eth_getCode and ensures the precompile address is detected as a smart contract by external services. note: It should NOT contain a 0x prefix

WARNING! This value is used in the InitChain ABCI hook and affects the app state hash. DO NOT change this value on a live chain, instead, use `setPrecompileByteCode` provided by the `Maintenance` precompile

This bytecode was generated by compiling the PriceOracleCaller contract found in the precompile/hardhat package. Then extracting `deployedBytecode` from the build artifacts

View Source
const LatestRoundDataMethodName = "latestRoundData"

LatestRoundDataMethodName is the name of the latestRoundData method. It matches the name of the method in the contract ABI.

Variables

This section is empty.

Functions

func NewPrecompile

func NewPrecompile(
	oracleQueryServer OracleQueryServer,
) (*precompile.Contract, error)

NewPrecompile creates a new Price Oracle precompile.

func NewPrecompileVersionMap

func NewPrecompileVersionMap(
	oracleQueryServer OracleQueryServer,
) (*precompile.VersionMap, error)

NewPrecompileVersionMap creates a new version map for the price oracle precompile.

Types

type DecimalsMethod

type DecimalsMethod struct{}

DecimalsMethod is the implementation of the decimals method.

func (*DecimalsMethod) MethodName

func (m *DecimalsMethod) MethodName() string

func (*DecimalsMethod) MethodType

func (m *DecimalsMethod) MethodType() precompile.MethodType

func (*DecimalsMethod) Payable

func (m *DecimalsMethod) Payable() bool

func (*DecimalsMethod) RequiredGas

func (m *DecimalsMethod) RequiredGas(_ []byte) (uint64, bool)

func (*DecimalsMethod) Run

type LatestRoundDataMethod

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

func (*LatestRoundDataMethod) MethodName

func (m *LatestRoundDataMethod) MethodName() string

func (*LatestRoundDataMethod) MethodType

func (*LatestRoundDataMethod) Payable

func (m *LatestRoundDataMethod) Payable() bool

func (*LatestRoundDataMethod) RequiredGas

func (m *LatestRoundDataMethod) RequiredGas(_ []byte) (uint64, bool)

func (*LatestRoundDataMethod) Run

type OracleQueryServer

type OracleQueryServer interface {
	GetPrice(
		ctx context.Context,
		req *oracletypes.GetPriceRequest,
	) (*oracletypes.GetPriceResponse, error)
}

Jump to

Keyboard shortcuts

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