You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently working on designing the "BuyKitty" functionality, I am investigating on how to handle transactions involving two independent runtime modules—MoneyPiece and KittyPiece.
The "Buy" operation involves the buyer sending money to the seller and, upon successful validation of constraints in Money piece, transferring the kitty to the buyer based on the successful validation of constraints in Kitty piece.
However, I'm faced with the challenge of incorporating both Money and Kitty transactions within the same transaction.
/// Existing pieces of state to be read and consumed from storage
pubinputs:Vec<Input>,
/// Existing state to be read, but not consumed, from storage
pubpeeks:Vec<OutputRef>,
/// New state to be placed into storage
puboutputs:Vec<Output<V>>,
/// Which piece of constraint checking logic is used to determine whether this transaction is valid
pubchecker:C,
}
Given that OuterConstraintChecker serves as the constraint checker for the entire transaction,
I'm exploring the best approach to include both Money and Kitty inputs and execute them atomically.
Approach with Separate Constraint Checkers: One idea is to add the coin to the KittyPiece.
Maintain separate constraint checkers for Money and Kitty transactions.
This involves duplicating the Money spending constraint checker in the Buy constraint checker of KittyPiece.
I would greatly appreciate your insights on the following:
How would you recommend handling the "Buy" operation involving both Money and Kitty transactions?
What best practices should I consider ensuring atomic execution and maintain consistency during the transaction?
The text was updated successfully, but these errors were encountered:
Advice from @muraca :
One option might be to have a PaidKittyConstraintChecker<const ID: u8> that consumes Coin<ID> to produce a Kitty. This would require the Kitties crate to depend on the Money crate.
Advice from @JoshOrndorff :
Make a new crate that depends on money and kitties Ex: a "BuyableKittyPiece or TradableKittyPiece".
I'm currently working on designing the "BuyKitty" functionality, I am investigating on how to handle transactions involving two independent runtime modules—MoneyPiece and KittyPiece.
The "Buy" operation involves the buyer sending money to the seller and, upon successful validation of constraints in Money piece, transferring the kitty to the buyer based on the successful validation of constraints in Kitty piece.
However, I'm faced with the challenge of incorporating both Money and Kitty transactions within the same transaction.
The structure of the transaction is
Tuxedo/tuxedo-core/src/types.rs
Lines 20 to 45 in 36d7bac
Given that OuterConstraintChecker serves as the constraint checker for the entire transaction,
I'm exploring the best approach to include both Money and Kitty inputs and execute them atomically.
Approach with Separate Constraint Checkers:
One idea is to add the coin to the KittyPiece.
Maintain separate constraint checkers for Money and Kitty transactions.
This involves duplicating the Money spending constraint checker in the Buy constraint checker of KittyPiece.
I would greatly appreciate your insights on the following:
How would you recommend handling the "Buy" operation involving both Money and Kitty transactions?
What best practices should I consider ensuring atomic execution and maintain consistency during the transaction?
The text was updated successfully, but these errors were encountered: