Documentation
¶
Overview ¶
Package contracts provides contract invocation utilities for the simulation service.
Index ¶
- func GeneratePrice(basePrice int64, variancePercent int) int64
- func GenerateRequestID() string
- type ContractAddresses
- type Invoker
- func (inv *Invoker) Close()
- func (inv *Invoker) GetPriceFeedLatest(ctx context.Context, symbol string) (map[string]interface{}, error)
- func (inv *Invoker) PayToApp(ctx context.Context, appID string, amount int64, memo string) (string, error)
- func (inv *Invoker) RecordRandomness(ctx context.Context, requestID string) (string, error)
- func (inv *Invoker) UpdatePriceFeed(ctx context.Context, symbol string, roundID int64, price int64, ...) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePrice ¶
GeneratePrice generates a simulated price with some variance.
func GenerateRequestID ¶
func GenerateRequestID() string
GenerateRequestID generates a unique request ID for randomness.
Types ¶
type ContractAddresses ¶
type ContractAddresses struct {
PriceFeed string
RandomnessLog string
PaymentHub string
AutomationAnchor string
AppRegistry string
Governance string
}
ContractAddresses holds the addresses of deployed contracts.
type Invoker ¶
type Invoker struct {
// contains filtered or unexported fields
}
Invoker provides methods to invoke smart contracts.
func NewInvoker ¶
NewInvoker creates a new contract invoker.
func (*Invoker) GetPriceFeedLatest ¶
func (inv *Invoker) GetPriceFeedLatest(ctx context.Context, symbol string) (map[string]interface{}, error)
GetPriceFeedLatest gets the latest price for a symbol.
func (*Invoker) PayToApp ¶
func (inv *Invoker) PayToApp(ctx context.Context, appID string, amount int64, memo string) (string, error)
PayToApp makes a payment to a MiniApp via PaymentHub. Returns the transaction hash on success.
func (*Invoker) RecordRandomness ¶
RecordRandomness records a randomness value on-chain. Returns the transaction hash on success.
Click to show internal directories.
Click to hide internal directories.