Open ra0x3 opened 1 year ago
@lostman
@Voxelot
Address
in a Receipt
, or if like we previously discussed, this "predicate address" would actually be some type of standardized byte-array in the Witness
data of a transaction In this case, it would be filtering predicate inputs by the owner address.
Here's the overall flow that I'm picturing, given that we want to have handlers for specific witnesses and coin owners:
Witness validation procedure:
Here's an example of what I'm thinking this standardized witness format could be to enable validation:
Field | Type | Description |
---|---|---|
PredicateTemplateHash | Bytes32 | The hash of the base predicate template |
OutputIndex | u8 | The output index corresponding to the predicate that was created on this tx |
ConfigurationSchema | Any | The schema of configurable constants that this predicate uses, autogenerated from the abi |
Here's a more concrete description of how this could work, broken down step by step. There's definitely some lower-level details I'm missing but this should give a rough sketch of the general usage & flow.
#[indexer(predicate_created)]
handle_new_market_order(output: Output, order: Order) {
// the output is pulled from the transaction using the output idx specified in the witness data
if order.pair == "ETH-USDC" {
ETH_USDC_BOOK.insert(output.utxo_id(), order);
}
}
// the indexer remembers the utxo id of the predicate and it's associated metadata
// during the predicate_created step so that this corresponding handler can be called
#[indexer(predicate_spent)]
handle_fulfilled_market_order(input: Input, order: Order) {
if order.pair == "ETH-USDC" {
ETH_USDC_BOOK.remove(input.utxo_id());
}
}
Hi guys, I am happy to participate in this discussion in any case, if you need any help tag me 🫡
Temporarily blocked by release of fuels 0.50
Witness
data in aTransaction
- where thisWitness
data can be filtered on aTransaction
level downstream