Since we can configure the constants in predicate, is there a way to do it via scripts so that it can be indexed using the indexer, like for tracking of new orders?
A script can log an event, and it should be possible for the indexer to index all these logs. I don’t believe we have an example yet though.
The Spark team created a smart-contract only used for logging these predicate events, but that’s just a short-term solution to make it easier to index.
Furthermore, it should be possible for any Sway code (script, contract, predicate) to “calculate” a predicate address by filling in the constants, but it’s currently infeasible as the code would need to generate the entire code tree to calculate the code root. This is something we’ve discussed improving in the future.
- Currently you cannot “index Predicates”
- We are hopefully releasing support for this soon
- You can follow the tracking issue here Add predicate support · Issue #886 · FuelLabs/fuel-indexer · GitHub
- You can also follow the PR for the work here: enhancement: add predicate support by ra0x3 · Pull Request #1381 · FuelLabs/fuel-indexer · GitHub
- Predicate support will be released in the next version of Fuel’s indexer (v0.22)