Skip to content

Top-level blockchain-specific declarations #3

@adlerjohn

Description

@adlerjohn

To support all the functionality of the transaction format supported with Fuel v2 I suggest the following top-level declarations:

  1. contract: defines a list of externally-callable functions that will be part of the contract's ABI, and a list of internally callable functions that are not part of the ABI. The ABI essentially replaces a main function with a giant switch statement to call different functions. Contracts will persist in the FuelVM's state.
contract {}
  1. script: defines a single function that operates at the transaction level. Scripts exist only for the duration of a transaction.
script (input) -> output {}
  1. predicate: defines a single function that must return a bool that operates at the input level. Predicates only exist for the duration of verifying the unlocking condition of an input.
predicate (input) -> bool {}

Smart contract developers will only use the first for writing their contract. Wallet and surrounding tooling can develop scripts and predicates using the latter two. But integration within a single language is important so that calls between them (say, a contract's function being called by a script) are type-safe, etc.

Metadata

Metadata

Assignees

Labels

compilerGeneral compiler. Should eventually become more specific as the issue is triagedteam:compilerCompiler Team

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions