Most messages sent from the base chain to Fuel will use a predicate as the message recipient. These predicates allow anyone to spend the InputMessage but verifies that a specific script is used in the transaction to ensure security and reliability that the message is handled appropriately.
The Message to Contract Predicate is for messages that are trying to send a data payload to a designated Fuel contract. This predicate verifies that the script bytecode hash for the transaction matches for the designated Message to Contract Script and that there are no other InputMessages with data in the transaction other than the first input. If these conditions are met, then the predicate evaluates as true.
The message to contract predicate relies on a script that performs only the following operation:
- Call the function
process_messageon the contract with ID that matches the first 32 bytes in the message data field, while forwarding the exact amount of base asset specified in theInputMessageamountfield
| dep | version |
|---|---|
| Forc | 0.35.0 |
Build:
forc build
cargo runRun tests:
cargo testCode must be formatted.
forc fmt
cargo fmtThe primary license for this repo is Apache 2.0, see LICENSE.