Documentation
¶
Index ¶
- Constants
- func NewPrecompile(oracleQueryServer OracleQueryServer) (*precompile.Contract, error)
- func NewPrecompileVersionMap(oracleQueryServer OracleQueryServer) (*precompile.VersionMap, error)
- type DecimalsMethod
- func (m *DecimalsMethod) MethodName() string
- func (m *DecimalsMethod) MethodType() precompile.MethodType
- func (m *DecimalsMethod) Payable() bool
- func (m *DecimalsMethod) RequiredGas(_ []byte) (uint64, bool)
- func (m *DecimalsMethod) Run(_ *precompile.RunContext, inputs precompile.MethodInputs) (precompile.MethodOutputs, error)
- type LatestRoundDataMethod
- func (m *LatestRoundDataMethod) MethodName() string
- func (m *LatestRoundDataMethod) MethodType() precompile.MethodType
- func (m *LatestRoundDataMethod) Payable() bool
- func (m *LatestRoundDataMethod) RequiredGas(_ []byte) (uint64, bool)
- func (m *LatestRoundDataMethod) Run(ctx *precompile.RunContext, inputs precompile.MethodInputs) (precompile.MethodOutputs, error)
- type OracleQueryServer
Constants ¶
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.
const DecimalsMethodName = "decimals"
DecimalsMethodName is the name of the decimals method. It matches the name of the method in the contract ABI.
const EvmAddress = evmtypes.PriceOraclePrecompileAddress
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.
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
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 ¶
func (m *DecimalsMethod) Run( _ *precompile.RunContext, inputs precompile.MethodInputs, ) (precompile.MethodOutputs, error)
type LatestRoundDataMethod ¶
type LatestRoundDataMethod struct {
// contains filtered or unexported fields
}
func (*LatestRoundDataMethod) MethodName ¶
func (m *LatestRoundDataMethod) MethodName() string
func (*LatestRoundDataMethod) MethodType ¶
func (m *LatestRoundDataMethod) MethodType() precompile.MethodType
func (*LatestRoundDataMethod) Payable ¶
func (m *LatestRoundDataMethod) Payable() bool
func (*LatestRoundDataMethod) RequiredGas ¶
func (m *LatestRoundDataMethod) RequiredGas(_ []byte) (uint64, bool)
func (*LatestRoundDataMethod) Run ¶
func (m *LatestRoundDataMethod) Run( ctx *precompile.RunContext, inputs precompile.MethodInputs, ) (precompile.MethodOutputs, error)
type OracleQueryServer ¶
type OracleQueryServer interface {
GetPrice(
ctx context.Context,
req *oracletypes.GetPriceRequest,
) (*oracletypes.GetPriceResponse, error)
}