Skip to content

How can I check that a Marlowe Contract has a certain structure? #129

Answered by hrajchert
mikarasv asked this question in Q&A
Discussion options

You must be logged in to vote

Trying to see if a Marlowe contract is "an instance of your contract" is a common problem that doesn't have a general solution yet.

I see three ways of tackling this issue:

1. Recreate the contract and do a deep equality check

The "easiest" way to see if a contract is an exact instance of a contract that you could create is to share the contract creation parameters/schema between the participants, use those to create an instance of the contract and then do a deep equality check.

In other words, assuming that you have:

type ContractSchema {
  partyA: Address;
  partyB: Address;
  amount: bigint;
  deadline: Timeout;
}

mkMyContract(schema: ContractSchema): Contract {
  // ...
}

When you cr…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nhenin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants