Skip to content

2.1. Contracts#

Syntax#


ContractDefinition = (* abstract_keyword: *) ABSTRACT_KEYWORD? (* Introduced in 0.6.0 *)
(* contract_keyword: *) CONTRACT_KEYWORD
(* name: *) IDENTIFIER
(* inheritance: *) InheritanceSpecifier?
(* open_brace: *) OPEN_BRACE
(* members: *) ContractMembers
(* close_brace: *) CLOSE_BRACE;

InheritanceSpecifier = (* is_keyword: *) IS_KEYWORD
(* types: *) InheritanceTypes;

InheritanceTypes = (* item: *) InheritanceType ((* separator: *) COMMA (* item: *) InheritanceType)*;

InheritanceType = (* type_name: *) IdentifierPath
(* arguments: *) ArgumentsDeclaration?;

ContractMembers = (* item: *) ContractMember*;

ContractMember = (* variant: *) UsingDirective
| (* variant: *) FunctionDefinition
| (* variant: *) ConstructorDefinition (* Introduced in 0.4.22 *)
| (* variant: *) ReceiveFunctionDefinition (* Introduced in 0.6.0 *)
| (* variant: *) FallbackFunctionDefinition (* Introduced in 0.6.0 *)
| (* variant: *) UnnamedFunctionDefinition (* Deprecated in 0.6.0 *)
| (* variant: *) ModifierDefinition
| (* variant: *) StructDefinition
| (* variant: *) EnumDefinition
| (* variant: *) EventDefinition
| (* variant: *) ErrorDefinition (* Introduced in 0.8.4 *)
| (* variant: *) UserDefinedValueTypeDefinition (* Introduced in 0.8.8 *)
| (* variant: *) StateVariableDefinition;

Documentation#

Note

This section is under construction. You are more than welcome to contribute suggestions to our GitHub repository.