systemcontracts

package
v0.33.36-pebble-protocol Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: AGPL-3.0 Imports: 3 Imported by: 20

Documentation

Overview

Package systemcontracts stores canonical address locations for all system smart contracts and service events.

System contracts are special smart contracts controlled by the service account, a Flow account with special privileges to administer the network.

Service events are special events defined within system contracts which are included within execution receipts and processed by the consensus committee to enable message-passing to the protocol state.

For transient networks, all system contracts can be deployed to the service account. For long-lived networks, system contracts are spread across several accounts for historical reasons.

Index

Constants

View Source
const (
	ContractNameEpoch               = "FlowEpoch"
	ContractNameIDTableStaking      = "FlowIDTableStaking"
	ContractNameClusterQC           = "FlowClusterQC"
	ContractNameDKG                 = "FlowDKG"
	ContractNameServiceAccount      = "FlowServiceAccount"
	ContractNameFlowFees            = "FlowFees"
	ContractNameStorageFees         = "FlowStorageFees"
	ContractNameNodeVersionBeacon   = "NodeVersionBeacon"
	ContractNameRandomBeaconHistory = "RandomBeaconHistory"
	ContractNameFungibleToken       = "FungibleToken"
	ContractNameFlowToken           = "FlowToken"
	ContractNameNonFungibleToken    = "NonFungibleToken"
	ContractNameMetadataViews       = "MetadataViews"
	ContractNameViewResolver        = "ViewResolver"
	ContractNameEVM                 = "EVM"

	// AccountNameEVMStorage is not a contract, but a special account that is used to store EVM state
	AccountNameEVMStorage = "EVMStorageAccount"

	EventNameEpochSetup    = "EpochSetup"
	EventNameEpochCommit   = "EpochCommit"
	EventNameVersionBeacon = "VersionBeacon"

	ContractServiceAccountFunction_setupNewAccount                            = "setupNewAccount"
	ContractServiceAccountFunction_defaultTokenBalance                        = "defaultTokenBalance"
	ContractServiceAccountFunction_deductTransactionFee                       = "deductTransactionFee"
	ContractServiceAccountFunction_verifyPayersBalanceForTransactionExecution = "verifyPayersBalanceForTransactionExecution"
	ContractServiceAccountFunction_checkDependencies                          = "checkDependencies"
	ContractStorageFeesFunction_calculateAccountCapacity                      = "calculateAccountCapacity"
	ContractStorageFeesFunction_getAccountsCapacityForTransactionStorageCheck = "getAccountsCapacityForTransactionStorageCheck"
	ContractStorageFeesFunction_defaultTokenAvailableBalance                  = "defaultTokenAvailableBalance"

	FungibleTokenAccountIndex = 2
	FlowTokenAccountIndex     = 3
	FlowFeesAccountIndex      = 4
	EVMStorageAccountIndex    = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceEvent

type ServiceEvent struct {
	Address      flow.Address
	ContractName string
	Name         string
}

ServiceEvent represents a service event on a particular chain.

func (ServiceEvent) EventType

func (se ServiceEvent) EventType() flow.EventType

EventType returns the full event type identifier, including the address, the contract name, and the event type name.

func (ServiceEvent) QualifiedIdentifier

func (se ServiceEvent) QualifiedIdentifier() string

QualifiedIdentifier returns the Cadence qualified identifier of the service event, which includes the contract name and the event type name.

type ServiceEvents

type ServiceEvents struct {
	EpochSetup    ServiceEvent
	EpochCommit   ServiceEvent
	VersionBeacon ServiceEvent
}

ServiceEvents is a container for all service events on a particular chain.

func ServiceEventsForChain

func ServiceEventsForChain(chainID flow.ChainID) *ServiceEvents

ServiceEventsForChain returns the service event confirmation for the given chain. Panics if the chain is unknown.

func (ServiceEvents) All

func (se ServiceEvents) All() []ServiceEvent

All returns all service events as a slice.

type SystemAccount added in v0.33.7

type SystemAccount struct {
	Address flow.Address
	Name    string
}

SystemAccount represents an address used by the system.

type SystemContract

type SystemContract struct {
	Address flow.Address
	Name    string
}

SystemContract represents a system contract on a particular chain.

type SystemContracts

type SystemContracts struct {
	// epoch related contracts
	Epoch          SystemContract
	IDTableStaking SystemContract
	ClusterQC      SystemContract
	DKG            SystemContract

	// service account related contracts
	FlowServiceAccount  SystemContract
	NodeVersionBeacon   SystemContract
	RandomBeaconHistory SystemContract
	FlowStorageFees     SystemContract

	// token related contracts
	FlowFees      SystemContract
	FlowToken     SystemContract
	FungibleToken SystemContract

	// NFT related contracts
	NonFungibleToken SystemContract
	MetadataViews    SystemContract
	ViewResolver     SystemContract

	// EVM related contracts
	EVMContract SystemContract
	EVMStorage  SystemAccount
}

SystemContracts is a container for all system contracts on a particular chain.

func SystemContractsForChain

func SystemContractsForChain(chainID flow.ChainID) *SystemContracts

SystemContractsForChain returns the system contract configuration for the given chain. Panics if the chain is unknown.

func (SystemContracts) All added in v0.33.1

func (c SystemContracts) All() []SystemContract

All returns all system contracts as a slice.

func (SystemContracts) AsTemplateEnv added in v0.33.1

func (c SystemContracts) AsTemplateEnv() templates.Environment

AsTemplateEnv returns a template environment with all system contracts filled in. This is useful for generating Cadence code from templates.

Jump to

Keyboard shortcuts

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