Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing System Contracts #6211

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions fvm/systemcontracts/system_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const (
ContractNameMetadataViews = "MetadataViews"
ContractNameViewResolver = "ViewResolver"
ContractNameEVM = "EVM"
ContractNameBurner = "Burner"

// AccountNameEVMStorage is not a contract, but a special account that is used to store EVM state
AccountNameEVMStorage = "EVMStorageAccount"
Expand Down Expand Up @@ -155,6 +156,9 @@ type SystemContracts struct {
// EVM related contracts
EVMContract SystemContract
EVMStorage SystemAccount

// Utility contracts
Burner SystemContract
}

// AsTemplateEnv returns a template environment with all system contracts filled in.
Expand All @@ -180,6 +184,8 @@ func (c SystemContracts) AsTemplateEnv() templates.Environment {
MetadataViewsAddress: c.MetadataViews.Address.Hex(),
ViewResolverAddress: c.ViewResolver.Address.Hex(),
FungibleTokenSwitchboardAddress: c.FungibleToken.Address.Hex(),

BurnerAddress: c.Burner.Address.Hex(),
}
}

Expand All @@ -206,6 +212,8 @@ func (c SystemContracts) All() []SystemContract {

c.EVMContract,
// EVMStorage is not included here, since it is not a contract

c.Burner,
}
}

Expand Down Expand Up @@ -328,6 +336,8 @@ func init() {

ContractNameEVM: serviceAddressFunc,
AccountNameEVMStorage: evmStorageEVMFunc,

ContractNameBurner: serviceAddressFunc,
}

getSystemContractsForChain := func(chainID flow.ChainID) *SystemContracts {
Expand Down Expand Up @@ -379,6 +389,8 @@ func init() {

EVMContract: addressOfContract(ContractNameEVM),
EVMStorage: addressOfAccount(AccountNameEVMStorage),

Burner: addressOfContract(ContractNameBurner),
}

return contracts
Expand Down
Loading