mlabs-haskell / bot-plutus-interface

Unofficial PAB implementation
21 stars 11 forks source link

Issue 89 better collateral - WIP #124

Closed zmrocze closed 2 years ago

zmrocze commented 2 years ago

issue #89

zmrocze commented 2 years ago

I've added the filtering in TxoSetAtAddress, UtxoSetAtAddress, UtxoSetWithCurrency. Not sure about UtxoSetMembership. Not sure how to test this meaningfully in mock.

zmrocze commented 2 years ago

the fail is the added test

IAmPara0x commented 2 years ago

Summary of this collateral mechanism work:

IAmPara0x commented 2 years ago

@samuelWilliams99 @mikekeke I have created an improved version of balanceTxIO, here's the gist of the update: https://gist.github.com/IAmPara0x/4759b84add02dbf455c003545fbb98f4

This now enables us to use various constraints while balancing the transaction, this is very similar to how we create the transaction. Now we can have constraints like : balanceTxIO' [TxWithScript, TxWithSeperateChange], balanceTxIO' [TxWithScript], etc.

For eg: Now we can balance the collateral Tx like using the following constraint: balanceTxIO' [TxWithoutScript, TxWithSeperateChange].

And in future, if we need to add more constraints we can just create those types and append it to the existing list of constraints.

Let me know if this is an improvement and if I should implement it in this PR.

IAmPara0x commented 2 years ago

Updated the collateral handling mechanism as described here: https://github.com/mlabs-haskell/bot-plutus-interface/pull/124#issuecomment-1185896264.

IAmPara0x commented 2 years ago

Sorry, I was too late with my review, I had a few comments, maybe we could address these in a separate PR? @IAmPara0x

Yes, I will create the new PR soon, with the suggested changes