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 ¶
const ( ContractNameEpoch = "FlowEpoch" ContractNameIDTableStaking = "FlowIDTableStaking" ContractNameClusterQC = "FlowClusterQC" ContractNameDKG = "FlowDKG" ContractNameServiceAccount = "FlowServiceAccount" ContractNameFlowFees = "FlowFees" ContractNameStorageFees = "FlowStorageFees" ContractNameFlowCallbackScheduler = "FlowCallbackScheduler" ContractNameNodeVersionBeacon = "NodeVersionBeacon" ContractNameRandomBeaconHistory = "RandomBeaconHistory" ContractNameFungibleToken = "FungibleToken" ContractNameFlowToken = "FlowToken" ContractNameFungibleTokenSwitchboard = "FungibleTokenSwitchboard" ContractNameFungibleTokenMetadataViews = "FungibleTokenMetadataViews" ContractNameNonFungibleToken = "NonFungibleToken" ContractNameMetadataViews = "MetadataViews" ContractNameViewResolver = "ViewResolver" ContractNameCrossVMMetadataViews = "CrossVMMetadataViews" ContractNameEVM = "EVM" ContractNameBurner = "Burner" ContractNameCrypto = "Crypto" ContractNameMigration = "Migration" // AccountNameEVMStorage is not a contract, but a special account that is used to store EVM state AccountNameEVMStorage = "EVMStorageAccount" // AccountNameExecutionParametersAccount is not a contract, but a special account that is used to store execution parameters // It is a separate account on all networks in order to separate it away // from the frequently changing data on the service account. AccountNameExecutionParametersAccount = "ExecutionParametersAccount" EventNameEpochSetup = "EpochSetup" EventNameEpochCommit = "EpochCommit" EventNameEpochRecover = "EpochRecover" EventNameVersionBeacon = "VersionBeacon" // VersionBeacon only controls version of ENs, describing software compatability via semantic versioning EventNameProtocolStateVersionUpgrade = "ProtocolStateVersionUpgrade" // Protocol State version applies to all nodes and uses an _integer version_ of the _protocol state_ ContractServiceAccountFunction_setupNewAccount = "setupNewAccount" ContractServiceAccountFunction_defaultTokenBalance = "defaultTokenBalance" ContractServiceAccountFunction_deductTransactionFee = "deductTransactionFee" ContractServiceAccountFunction_verifyPayersBalanceForTransactionExecution = "verifyPayersBalanceForTransactionExecution" ContractStorageFeesFunction_calculateAccountCapacity = "calculateAccountCapacity" ContractStorageFeesFunction_getAccountsCapacityForTransactionStorageCheck = "getAccountsCapacityForTransactionStorageCheck" ContractStorageFeesFunction_defaultTokenAvailableBalance = "defaultTokenAvailableBalance" FungibleTokenAccountIndex = 2 FlowTokenAccountIndex = 3 FlowFeesAccountIndex = 4 EVMStorageAccountIndex = 5 // LastSystemAccountIndex is the last index of a system accounts. // Other addresses will be created after this one. LastSystemAccountIndex = EVMStorageAccountIndex )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceEvent ¶
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
EpochRecover ServiceEvent
VersionBeacon ServiceEvent
ProtocolStateVersionUpgrade 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
SystemAccount represents an address used by the system.
type SystemContract ¶
SystemContract represents a system contract on a particular chain.
func (SystemContract) Location ¶ added in v0.36.3
func (c SystemContract) Location() common.AddressLocation
type SystemContracts ¶
type SystemContracts struct {
// epoch related contracts
Epoch SystemContract
IDTableStaking SystemContract
ClusterQC SystemContract
DKG SystemContract
// service account related contracts
FlowServiceAccount SystemContract
FlowCallbackScheduler SystemContract
NodeVersionBeacon SystemContract
RandomBeaconHistory SystemContract
FlowStorageFees SystemContract
ExecutionParametersAccount SystemContract
// token related contracts
FlowFees SystemContract
FlowToken SystemContract
FungibleToken SystemContract
FungibleTokenSwitchboard SystemContract
FungibleTokenMetadataViews SystemContract
// NFT related contracts
NonFungibleToken SystemContract
MetadataViews SystemContract
ViewResolver SystemContract
CrossVMMetadataViews SystemContract
// EVM related contracts
EVMContract SystemContract
EVMStorage SystemAccount
// Utility contracts
Burner SystemContract
Crypto SystemContract
// Migration contracts
Migration SystemContract
}
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.