Can you provide examples of usage of Predicates?

Hi guys. Can you provide please examples of usage of Predicates in defi?

4 Likes

A good example is OTC Swap built on Fuel.

This predicate serves as an “order” that anyone can fill. The order maker transfers a coin to the predicate root which can be unlocked by any transaction which has an output that satisfies the conditions of the order : the spending transaction must transfer ask_amount of ask_token to the receiver . These constants are hard-coded in the predicate itself, so that the bytecode root commits to this specific set of conditions.

2 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.