Marlowe Pioneer
 
w0802f_cbg
20220924

The Coupon Bond Guaranteed contract as-is

The run that fails

This is the run with the unmodified contract (or original contract), as described on w0802_cbg

My ref: output of a run of the scripts in daedtest:~/work/20220923_marlowe_gcb_take4

export FUND_CONTRACT=3000000                    # the amount to fund the contract with 
export MINIMUM_ADA=2000000                      # the minimum lovelace to be included with native token output.

export PRINCIPAL_AMOUNT=50000000                # the principal is 50₳
export INTEREST_INSTALLMENT=4000000             # the interest is 4₳

The overall result, comparing before/after run:

======================================
     ALIAS    START   CHANGE      END
    lender   100.00   -47.56    52.44
  borrower   100.00    38.37   138.37
 guarantor   100.00   -56.27    43.73
  contract             57.00    57.00
    payout                           
     TOTAL   300.00    -8.47   291.53
======================================

Note: the run failed in step 402, and there is a balance remaining in the contract.

The details

104_lender_funds_contract.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender    -3.21    96.79
  borrower            100.00
 guarantor            100.00
  contract     3.00     3.00
    payout                  
     TOTAL    -0.21   299.79
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    96.79 |
* 4a2ead9b75abba50f177dc3c71d4319b23c7ec953d2bfb1a96c87c523240d490#1    | +     2.00 | [ "Lender"×1 ]
* 5fa298efbcc819217eb984df7ecc878e74e075647697e5dc4f072a82c5f97095#0    | +    92.60 | Greatest Pure Ada
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   100.00 |
* 72e37e37f34f00b51f811c7f79c4a5aa6439e48369a5be61cda5f509f16f830f#0    | +    95.81 | Greatest Pure Ada
* 72e37e37f34f00b51f811c7f79c4a5aa6439e48369a5be61cda5f509f16f830f#1    | +     2.00 | [ "Borrower"×1 ]
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =   100.00 |
* 7c7bbd8fd032eb600c3e676297b9373a40f18b41be0be87c34aa892de20956f8#0    | +    95.81 | Greatest Pure Ada
* 7c7bbd8fd032eb600c3e676297b9373a40f18b41be0be87c34aa892de20956f8#1    | +     2.00 | [ "Guarantor"×1 ]
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =     3.00 |
* 5fa298efbcc819217eb984df7ecc878e74e075647697e5dc4f072a82c5f97095#1    | +     3.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     0.00 |

106_guarantor_deposit.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender             96.79
  borrower            100.00
 guarantor   -63.42    36.58
  contract    62.00    65.00
    payout                  
     TOTAL    -1.42   298.36
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    96.79 |
* 4a2ead9b75abba50f177dc3c71d4319b23c7ec953d2bfb1a96c87c523240d490#1    | +     2.00 | [ "Lender"×1 ]
* 5fa298efbcc819217eb984df7ecc878e74e075647697e5dc4f072a82c5f97095#0    | +    92.60 | Greatest Pure Ada
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   100.00 |
* 72e37e37f34f00b51f811c7f79c4a5aa6439e48369a5be61cda5f509f16f830f#0    | +    95.81 | Greatest Pure Ada
* 72e37e37f34f00b51f811c7f79c4a5aa6439e48369a5be61cda5f509f16f830f#1    | +     2.00 | [ "Borrower"×1 ]
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    36.58 |
* a357d131b9bced4fd21a12276ae9dd3f8c24254da0f494bfa0fe651d613e15d4#0    | +    32.39 | Greatest Pure Ada
* a357d131b9bced4fd21a12276ae9dd3f8c24254da0f494bfa0fe651d613e15d4#2    | +     2.00 | [ "Guarantor"×1 ]
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    65.00 |
* a357d131b9bced4fd21a12276ae9dd3f8c24254da0f494bfa0fe651d613e15d4#1    | +    65.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     0.00 |

The marlowe file produced by executing the script.
Note: annotated json (shortened hex-strings, translated posix-time).

{
    "state": {
        "choices": [],
        "boundValues": [],
        "accounts": [
            [
                [
                    {
                        "role_token": "Lender"
                    },
                    {
                        "currency_symbol": "",
                        "token_name": ""
                    }
                ],
                65000000
            ]
        ],
        "minTime": 1664092732000 [[2022-09-25 07:58:52 +0000 UTC]]
    },
    "payments": [],
    "contract": {
        "timeout": 1664136515000 [[2022-09-25 20:08:35 +0000 UTC]],
        "when": [
            {
                "then": {
                    "then": {
                        "timeout": 1664140115000 [[2022-09-25 21:08:35 +0000 UTC]],
                        "when": [
                            {
                                "then": {
                                    "then": {
                                        "then": {
                                            "timeout": 1664143715000 [[2022-09-25 22:08:35 +0000 UTC]],
                                            "when": [
                                                {
                                                    "then": {
                                                        "then": {
                                                            "then": {
                                                                "timeout": 1664147315000 [[2022-09-25 23:08:35 +0000 UTC]],
                                                                "when": [
                                                                    {
                                                                        "then": {
                                                                            "then": {
                                                                                "then": "close",
                                                                                "to": {
                                                                                    "party": {
                                                                                        "role_token": "Guarantor"
                                                                                    }
                                                                                },
                                                                                "from_account": {
                                                                                    "role_token": "Lender"
                                                                                },
                                                                                "pay": {
                                                                                    "and": 50000000,
                                                                                    "add": 4000000
                                                                                },
                                                                                "token": {
                                                                                    "currency_symbol": "",
                                                                                    "token_name": ""
                                                                                }
                                                                            },
                                                                            "to": {
                                                                                "party": {
                                                                                    "role_token": "Lender"
                                                                                }
                                                                            },
                                                                            "from_account": {
                                                                                "role_token": "Lender"
                                                                            },
                                                                            "pay": {
                                                                                "and": 50000000,
                                                                                "add": 4000000
                                                                            },
                                                                            "token": {
                                                                                "currency_symbol": "",
                                                                                "token_name": ""
                                                                            }
                                                                        },
                                                                        "case": {
                                                                            "deposits": {
                                                                                "and": 50000000,
                                                                                "add": 4000000
                                                                            },
                                                                            "into_account": {
                                                                                "role_token": "Lender"
                                                                            },
                                                                            "of_token": {
                                                                                "currency_symbol": "",
                                                                                "token_name": ""
                                                                            },
                                                                            "party": {
                                                                                "role_token": "Borrower"
                                                                            }
                                                                        }
                                                                    }
                                                                ],
                                                                "timeout_continuation": "close"
                                                            },
                                                            "to": {
                                                                "party": {
                                                                    "role_token": "Guarantor"
                                                                }
                                                            },
                                                            "from_account": {
                                                                "role_token": "Lender"
                                                            },
                                                            "pay": 4000000,
                                                            "token": {
                                                                "currency_symbol": "",
                                                                "token_name": ""
                                                            }
                                                        },
                                                        "to": {
                                                            "party": {
                                                                "role_token": "Lender"
                                                            }
                                                        },
                                                        "from_account": {
                                                            "role_token": "Lender"
                                                        },
                                                        "pay": 4000000,
                                                        "token": {
                                                            "currency_symbol": "",
                                                            "token_name": ""
                                                        }
                                                    },
                                                    "case": {
                                                        "deposits": 4000000,
                                                        "into_account": {
                                                            "role_token": "Lender"
                                                        },
                                                        "of_token": {
                                                            "currency_symbol": "",
                                                            "token_name": ""
                                                        },
                                                        "party": {
                                                            "role_token": "Borrower"
                                                        }
                                                    }
                                                }
                                            ],
                                            "timeout_continuation": "close"
                                        },
                                        "to": {
                                            "party": {
                                                "role_token": "Guarantor"
                                            }
                                        },
                                        "from_account": {
                                            "role_token": "Lender"
                                        },
                                        "pay": 4000000,
                                        "token": {
                                            "currency_symbol": "",
                                            "token_name": ""
                                        }
                                    },
                                    "to": {
                                        "party": {
                                            "role_token": "Lender"
                                        }
                                    },
                                    "from_account": {
                                        "role_token": "Lender"
                                    },
                                    "pay": 4000000,
                                    "token": {
                                        "currency_symbol": "",
                                        "token_name": ""
                                    }
                                },
                                "case": {
                                    "deposits": 4000000,
                                    "into_account": {
                                        "role_token": "Lender"
                                    },
                                    "of_token": {
                                        "currency_symbol": "",
                                        "token_name": ""
                                    },
                                    "party": {
                                        "role_token": "Borrower"
                                    }
                                }
                            }
                        ],
                        "timeout_continuation": "close"
                    },
                    "to": {
                        "party": {
                            "role_token": "Borrower"
                        }
                    },
                    "from_account": {
                        "role_token": "Borrower"
                    },
                    "pay": 50000000,
                    "token": {
                        "currency_symbol": "",
                        "token_name": ""
                    }
                },
                "case": {
                    "deposits": 50000000,
                    "into_account": {
                        "role_token": "Borrower"
                    },
                    "of_token": {
                        "currency_symbol": "",
                        "token_name": ""
                    },
                    "party": {
                        "role_token": "Lender"
                    }
                }
            }
        ],
        "timeout_continuation": {
            "then": "close",
            "to": {
                "party": {
                    "role_token": "Guarantor"
                }
            },
            "from_account": {
                "role_token": "Lender"
            },
            "pay": {
                "and": 50000000,
                "add": {
                    "multiply": 3,
                    "times": 4000000
                }
            },
            "token": {
                "currency_symbol": "",
                "token_name": ""
            }
        }
    },
    "rolesValidator": {
        "hash": "9a9794917d8e831be5110e3a5897bf474b7f8bc1830dbb420da538c2",
        "size": 2469,
        "address": "addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t",
        "cost": {
            "exBudgetMemory": 14600,
            "exBudgetCPU": 4317185
        },
        "script": {
            "type": "PlutusScriptV1",
            "cborHex": "5909a55909a201000033232332232323⋯⋯₄₉₄₄⋯⋯49576c1dcc7b7c90fef20aa870860001",
            "description": ""
        }
    },
    "range": [
        14143101,
        14147301
    ],
    "marloweValidator": {
        "hash": "c81da42bfdf3f0b0bc2e335f3b8d06580c855a29164b92d0407491c3",
        "size": 12415,
        "address": "addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt",
        "cost": {
            "exBudgetMemory": 82900,
            "exBudgetCPU": 24652144
        },
        "script": {
            "type": "PlutusScriptV1",
            "cborHex": "59307f59307c01000033232323322323⋯⋯₂₄₈₃₆⋯⋯f20aa870860022123300100300220011",
            "description": ""
        }
    },
    "inputs": [
        {
            "input_from_party": {
                "role_token": "Guarantor"
            },
            "into_account": {
                "role_token": "Lender"
            },
            "of_token": {
                "currency_symbol": "",
                "token_name": ""
            },
            "that_deposits": 62000000
        }
    ],
    "roles": {
        "unCurrencySymbol": "10e1ba7f0c7dfe42ed6736da9c3749576c1dcc7b7c90fef20aa87086"
    },
    "slotConfig": {
        "scSlotLength": 1000,
        "scSlotZeroTime": 1649949631000 [[2022-04-14 15:20:31 +0000 UTC]]
    }
}

108_lender_deposit.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender   -51.50    45.28
  borrower            100.00
 guarantor             36.58
  contract             65.00
    payout    50.00    50.00
     TOTAL    -1.50   296.86
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    45.28 |
* 96ad72bd861ec36067082d98c6f8d87bad5b01644a349aa4c4abb5606bf5eff7#0    | +    41.10 | Greatest Pure Ada
* 96ad72bd861ec36067082d98c6f8d87bad5b01644a349aa4c4abb5606bf5eff7#3    | +     2.00 | [ "Lender"×1 ]
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   100.00 |
* 72e37e37f34f00b51f811c7f79c4a5aa6439e48369a5be61cda5f509f16f830f#0    | +    95.81 | Greatest Pure Ada
* 72e37e37f34f00b51f811c7f79c4a5aa6439e48369a5be61cda5f509f16f830f#1    | +     2.00 | [ "Borrower"×1 ]
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    36.58 |
* a357d131b9bced4fd21a12276ae9dd3f8c24254da0f494bfa0fe651d613e15d4#0    | +    32.39 | Greatest Pure Ada
* a357d131b9bced4fd21a12276ae9dd3f8c24254da0f494bfa0fe651d613e15d4#2    | +     2.00 | [ "Guarantor"×1 ]
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    65.00 |
* 96ad72bd861ec36067082d98c6f8d87bad5b01644a349aa4c4abb5606bf5eff7#1    | +    65.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =    50.00 |
* 96ad72bd861ec36067082d98c6f8d87bad5b01644a349aa4c4abb5606bf5eff7#2    | +    50.00 | GreatestByTxHavingDatum

The marlowe file produced by executing the script.
Note: annotated json (shortened hex-strings, translated posix-time).

{
    "state": {
        "choices": [],
        "boundValues": [],
        "accounts": [
            [
                [
                    {
                        "role_token": "Lender"
                    },
                    {
                        "currency_symbol": "",
                        "token_name": ""
                    }
                ],
                65000000
            ]
        ],
        "minTime": 1664092813000 [[2022-09-25 08:00:13 +0000 UTC]]
    },
    "payments": [
        {
            "payee": {
                "party": {
                    "role_token": "Borrower"
                }
            },
            "accountId": {
                "role_token": "Borrower"
            },
            "money": {
                "getValue": [
                    [
                        {
                            "unCurrencySymbol": ""
                        },
                        [
                            [
                                {
                                    "unTokenName": ""
                                },
                                50000000
                            ]
                        ]
                    ]
                ]
            }
        }
    ],
    "contract": {
        "timeout": 1664140115000 [[2022-09-25 21:08:35 +0000 UTC]],
        "when": [
            {
                "then": {
                    "then": {
                        "then": {
                            "timeout": 1664143715000 [[2022-09-25 22:08:35 +0000 UTC]],
                            "when": [
                                {
                                    "then": {
                                        "then": {
                                            "then": {
                                                "timeout": 1664147315000 [[2022-09-25 23:08:35 +0000 UTC]],
                                                "when": [
                                                    {
                                                        "then": {
                                                            "then": {
                                                                "then": "close",
                                                                "to": {
                                                                    "party": {
                                                                        "role_token": "Guarantor"
                                                                    }
                                                                },
                                                                "from_account": {
                                                                    "role_token": "Lender"
                                                                },
                                                                "pay": {
                                                                    "and": 50000000,
                                                                    "add": 4000000
                                                                },
                                                                "token": {
                                                                    "currency_symbol": "",
                                                                    "token_name": ""
                                                                }
                                                            },
                                                            "to": {
                                                                "party": {
                                                                    "role_token": "Lender"
                                                                }
                                                            },
                                                            "from_account": {
                                                                "role_token": "Lender"
                                                            },
                                                            "pay": {
                                                                "and": 50000000,
                                                                "add": 4000000
                                                            },
                                                            "token": {
                                                                "currency_symbol": "",
                                                                "token_name": ""
                                                            }
                                                        },
                                                        "case": {
                                                            "deposits": {
                                                                "and": 50000000,
                                                                "add": 4000000
                                                            },
                                                            "into_account": {
                                                                "role_token": "Lender"
                                                            },
                                                            "of_token": {
                                                                "currency_symbol": "",
                                                                "token_name": ""
                                                            },
                                                            "party": {
                                                                "role_token": "Borrower"
                                                            }
                                                        }
                                                    }
                                                ],
                                                "timeout_continuation": "close"
                                            },
                                            "to": {
                                                "party": {
                                                    "role_token": "Guarantor"
                                                }
                                            },
                                            "from_account": {
                                                "role_token": "Lender"
                                            },
                                            "pay": 4000000,
                                            "token": {
                                                "currency_symbol": "",
                                                "token_name": ""
                                            }
                                        },
                                        "to": {
                                            "party": {
                                                "role_token": "Lender"
                                            }
                                        },
                                        "from_account": {
                                            "role_token": "Lender"
                                        },
                                        "pay": 4000000,
                                        "token": {
                                            "currency_symbol": "",
                                            "token_name": ""
                                        }
                                    },
                                    "case": {
                                        "deposits": 4000000,
                                        "into_account": {
                                            "role_token": "Lender"
                                        },
                                        "of_token": {
                                            "currency_symbol": "",
                                            "token_name": ""
                                        },
                                        "party": {
                                            "role_token": "Borrower"
                                        }
                                    }
                                }
                            ],
                            "timeout_continuation": "close"
                        },
                        "to": {
                            "party": {
                                "role_token": "Guarantor"
                            }
                        },
                        "from_account": {
                            "role_token": "Lender"
                        },
                        "pay": 4000000,
                        "token": {
                            "currency_symbol": "",
                            "token_name": ""
                        }
                    },
                    "to": {
                        "party": {
                            "role_token": "Lender"
                        }
                    },
                    "from_account": {
                        "role_token": "Lender"
                    },
                    "pay": 4000000,
                    "token": {
                        "currency_symbol": "",
                        "token_name": ""
                    }
                },
                "case": {
                    "deposits": 4000000,
                    "into_account": {
                        "role_token": "Lender"
                    },
                    "of_token": {
                        "currency_symbol": "",
                        "token_name": ""
                    },
                    "party": {
                        "role_token": "Borrower"
                    }
                }
            }
        ],
        "timeout_continuation": "close"
    },
    "rolesValidator": {
        "hash": "9a9794917d8e831be5110e3a5897bf474b7f8bc1830dbb420da538c2",
        "size": 2469,
        "address": "addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t",
        "cost": {
            "exBudgetMemory": 14600,
            "exBudgetCPU": 4317185
        },
        "script": {
            "type": "PlutusScriptV1",
            "cborHex": "5909a55909a201000033232332232323⋯⋯₄₉₄₄⋯⋯49576c1dcc7b7c90fef20aa870860001",
            "description": ""
        }
    },
    "range": [
        14143182,
        14147382
    ],
    "marloweValidator": {
        "hash": "c81da42bfdf3f0b0bc2e335f3b8d06580c855a29164b92d0407491c3",
        "size": 12415,
        "address": "addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt",
        "cost": {
            "exBudgetMemory": 82900,
            "exBudgetCPU": 24652144
        },
        "script": {
            "type": "PlutusScriptV1",
            "cborHex": "59307f59307c01000033232323322323⋯⋯₂₄₈₃₆⋯⋯f20aa870860022123300100300220011",
            "description": ""
        }
    },
    "inputs": [
        {
            "input_from_party": {
                "role_token": "Lender"
            },
            "into_account": {
                "role_token": "Borrower"
            },
            "of_token": {
                "currency_symbol": "",
                "token_name": ""
            },
            "that_deposits": 50000000
        }
    ],
    "roles": {
        "unCurrencySymbol": "10e1ba7f0c7dfe42ed6736da9c3749576c1dcc7b7c90fef20aa87086"
    },
    "slotConfig": {
        "scSlotLength": 1000,
        "scSlotZeroTime": 1649949631000 [[2022-04-14 15:20:31 +0000 UTC]]
    }
}

110_borrower_withdraws.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender             45.28
  borrower    49.58   149.58
 guarantor             36.58
  contract             65.00
    payout   -50.00         
     TOTAL    -0.42   296.44
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    45.28 |
* 96ad72bd861ec36067082d98c6f8d87bad5b01644a349aa4c4abb5606bf5eff7#0    | +    41.10 | Greatest Pure Ada
* 96ad72bd861ec36067082d98c6f8d87bad5b01644a349aa4c4abb5606bf5eff7#3    | +     2.00 | [ "Lender"×1 ]
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   149.58 |
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#0    | +    95.39 | Greatest Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#1    | +    50.00 | Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#2    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    36.58 |
* a357d131b9bced4fd21a12276ae9dd3f8c24254da0f494bfa0fe651d613e15d4#0    | +    32.39 | Greatest Pure Ada
* a357d131b9bced4fd21a12276ae9dd3f8c24254da0f494bfa0fe651d613e15d4#2    | +     2.00 | [ "Guarantor"×1 ]
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    65.00 |
* 96ad72bd861ec36067082d98c6f8d87bad5b01644a349aa4c4abb5606bf5eff7#1    | +    65.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     0.00 |

202_borrower_pays_installment1.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender             45.28
  borrower    -5.62   143.95
 guarantor             36.58
  contract    -4.00    61.00
    payout     8.00     8.00
     TOTAL    -1.62   294.81
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    45.28 |
* 96ad72bd861ec36067082d98c6f8d87bad5b01644a349aa4c4abb5606bf5eff7#0    | +    41.10 | Greatest Pure Ada
* 96ad72bd861ec36067082d98c6f8d87bad5b01644a349aa4c4abb5606bf5eff7#3    | +     2.00 | [ "Lender"×1 ]
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   143.95 |
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#0    | +    89.77 | Greatest Pure Ada
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#4    | +     2.00 | [ "Borrower"×1 ]
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#1    | +    50.00 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    36.58 |
* a357d131b9bced4fd21a12276ae9dd3f8c24254da0f494bfa0fe651d613e15d4#0    | +    32.39 | Greatest Pure Ada
* a357d131b9bced4fd21a12276ae9dd3f8c24254da0f494bfa0fe651d613e15d4#2    | +     2.00 | [ "Guarantor"×1 ]
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    61.00 |
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#1    | +    61.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     8.00 |
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#2    | +     4.00 | GreatestByTxHavingDatum
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#3    | +     4.00 | Datum

The marlowe file produced by executing the script.
Note: annotated json (shortened hex-strings, translated posix-time).

{
    "state": {
        "choices": [],
        "boundValues": [],
        "accounts": [
            [
                [
                    {
                        "role_token": "Lender"
                    },
                    {
                        "currency_symbol": "",
                        "token_name": ""
                    }
                ],
                61000000
            ]
        ],
        "minTime": 1664092935000 [[2022-09-25 08:02:15 +0000 UTC]]
    },
    "payments": [
        {
            "payee": {
                "party": {
                    "role_token": "Lender"
                }
            },
            "accountId": {
                "role_token": "Lender"
            },
            "money": {
                "getValue": [
                    [
                        {
                            "unCurrencySymbol": ""
                        },
                        [
                            [
                                {
                                    "unTokenName": ""
                                },
                                4000000
                            ]
                        ]
                    ]
                ]
            }
        },
        {
            "payee": {
                "party": {
                    "role_token": "Guarantor"
                }
            },
            "accountId": {
                "role_token": "Lender"
            },
            "money": {
                "getValue": [
                    [
                        {
                            "unCurrencySymbol": ""
                        },
                        [
                            [
                                {
                                    "unTokenName": ""
                                },
                                4000000
                            ]
                        ]
                    ]
                ]
            }
        }
    ],
    "contract": {
        "timeout": 1664143715000 [[2022-09-25 22:08:35 +0000 UTC]],
        "when": [
            {
                "then": {
                    "then": {
                        "then": {
                            "timeout": 1664147315000 [[2022-09-25 23:08:35 +0000 UTC]],
                            "when": [
                                {
                                    "then": {
                                        "then": {
                                            "then": "close",
                                            "to": {
                                                "party": {
                                                    "role_token": "Guarantor"
                                                }
                                            },
                                            "from_account": {
                                                "role_token": "Lender"
                                            },
                                            "pay": {
                                                "and": 50000000,
                                                "add": 4000000
                                            },
                                            "token": {
                                                "currency_symbol": "",
                                                "token_name": ""
                                            }
                                        },
                                        "to": {
                                            "party": {
                                                "role_token": "Lender"
                                            }
                                        },
                                        "from_account": {
                                            "role_token": "Lender"
                                        },
                                        "pay": {
                                            "and": 50000000,
                                            "add": 4000000
                                        },
                                        "token": {
                                            "currency_symbol": "",
                                            "token_name": ""
                                        }
                                    },
                                    "case": {
                                        "deposits": {
                                            "and": 50000000,
                                            "add": 4000000
                                        },
                                        "into_account": {
                                            "role_token": "Lender"
                                        },
                                        "of_token": {
                                            "currency_symbol": "",
                                            "token_name": ""
                                        },
                                        "party": {
                                            "role_token": "Borrower"
                                        }
                                    }
                                }
                            ],
                            "timeout_continuation": "close"
                        },
                        "to": {
                            "party": {
                                "role_token": "Guarantor"
                            }
                        },
                        "from_account": {
                            "role_token": "Lender"
                        },
                        "pay": 4000000,
                        "token": {
                            "currency_symbol": "",
                            "token_name": ""
                        }
                    },
                    "to": {
                        "party": {
                            "role_token": "Lender"
                        }
                    },
                    "from_account": {
                        "role_token": "Lender"
                    },
                    "pay": 4000000,
                    "token": {
                        "currency_symbol": "",
                        "token_name": ""
                    }
                },
                "case": {
                    "deposits": 4000000,
                    "into_account": {
                        "role_token": "Lender"
                    },
                    "of_token": {
                        "currency_symbol": "",
                        "token_name": ""
                    },
                    "party": {
                        "role_token": "Borrower"
                    }
                }
            }
        ],
        "timeout_continuation": "close"
    },
    "rolesValidator": {
        "hash": "9a9794917d8e831be5110e3a5897bf474b7f8bc1830dbb420da538c2",
        "size": 2469,
        "address": "addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t",
        "cost": {
            "exBudgetMemory": 14600,
            "exBudgetCPU": 4317185
        },
        "script": {
            "type": "PlutusScriptV1",
            "cborHex": "5909a55909a201000033232332232323⋯⋯₄₉₄₄⋯⋯49576c1dcc7b7c90fef20aa870860001",
            "description": ""
        }
    },
    "range": [
        14143304,
        14147504
    ],
    "marloweValidator": {
        "hash": "c81da42bfdf3f0b0bc2e335f3b8d06580c855a29164b92d0407491c3",
        "size": 12415,
        "address": "addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt",
        "cost": {
            "exBudgetMemory": 82900,
            "exBudgetCPU": 24652144
        },
        "script": {
            "type": "PlutusScriptV1",
            "cborHex": "59307f59307c01000033232323322323⋯⋯₂₄₈₃₆⋯⋯f20aa870860022123300100300220011",
            "description": ""
        }
    },
    "inputs": [
        {
            "input_from_party": {
                "role_token": "Borrower"
            },
            "into_account": {
                "role_token": "Lender"
            },
            "of_token": {
                "currency_symbol": "",
                "token_name": ""
            },
            "that_deposits": 4000000
        }
    ],
    "roles": {
        "unCurrencySymbol": "10e1ba7f0c7dfe42ed6736da9c3749576c1dcc7b7c90fef20aa87086"
    },
    "slotConfig": {
        "scSlotLength": 1000,
        "scSlotZeroTime": 1649949631000 [[2022-04-14 15:20:31 +0000 UTC]]
    }
}

204_lender_withdraws.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender     3.57    48.86
  borrower            143.95
 guarantor             36.58
  contract             61.00
    payout    -4.00     4.00
     TOTAL    -0.43   294.39
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    48.86 |
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#0    | +    40.67 | Greatest Pure Ada
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#1    | +     4.00 | Pure Ada
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#2    | +     2.00 | [ "Lender"×1 ]
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   143.95 |
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#0    | +    89.77 | Greatest Pure Ada
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#4    | +     2.00 | [ "Borrower"×1 ]
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#1    | +    50.00 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    36.58 |
* a357d131b9bced4fd21a12276ae9dd3f8c24254da0f494bfa0fe651d613e15d4#0    | +    32.39 | Greatest Pure Ada
* a357d131b9bced4fd21a12276ae9dd3f8c24254da0f494bfa0fe651d613e15d4#2    | +     2.00 | [ "Guarantor"×1 ]
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    61.00 |
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#1    | +    61.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     4.00 |
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#3    | +     4.00 | GreatestByTxHavingDatum

206_guarantor_withdraws.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender             48.86
  borrower            143.95
 guarantor     3.57    40.15
  contract             61.00
    payout    -4.00         
     TOTAL    -0.43   293.96
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    48.86 |
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#0    | +    40.67 | Greatest Pure Ada
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#1    | +     4.00 | Pure Ada
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#2    | +     2.00 | [ "Lender"×1 ]
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   143.95 |
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#0    | +    89.77 | Greatest Pure Ada
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#4    | +     2.00 | [ "Borrower"×1 ]
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#1    | +    50.00 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    40.15 |
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#0    | +    31.96 | Greatest Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#1    | +     4.00 | Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    61.00 |
* 6198db3c3ae4ce6f9abc373704a2d90f93bce4907064d8c7a0887207bed3f933#1    | +    61.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     0.00 |

302_borrower_pays_installment2.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender             48.86
  borrower    -5.58   138.37
 guarantor             40.15
  contract    -4.00    57.00
    payout     8.00     8.00
     TOTAL    -1.58   292.38
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    48.86 |
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#0    | +    40.67 | Greatest Pure Ada
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#1    | +     4.00 | Pure Ada
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#2    | +     2.00 | [ "Lender"×1 ]
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   138.37 |
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#1    | +    50.00 | Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#0    | +    84.18 | Greatest Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#4    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    40.15 |
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#0    | +    31.96 | Greatest Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#1    | +     4.00 | Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    57.00 |
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#1    | +    57.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     8.00 |
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#2    | +     4.00 | GreatestByTxHavingDatum
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#3    | +     4.00 | Datum

The marlowe file produced by executing the script.
Note: annotated json (shortened hex-strings, translated posix-time).

{
    "state": {
        "choices": [],
        "boundValues": [],
        "accounts": [
            [
                [
                    {
                        "role_token": "Lender"
                    },
                    {
                        "currency_symbol": "",
                        "token_name": ""
                    }
                ],
                57000000
            ]
        ],
        "minTime": 1664093134000 [[2022-09-25 08:05:34 +0000 UTC]]
    },
    "payments": [
        {
            "payee": {
                "party": {
                    "role_token": "Lender"
                }
            },
            "accountId": {
                "role_token": "Lender"
            },
            "money": {
                "getValue": [
                    [
                        {
                            "unCurrencySymbol": ""
                        },
                        [
                            [
                                {
                                    "unTokenName": ""
                                },
                                4000000
                            ]
                        ]
                    ]
                ]
            }
        },
        {
            "payee": {
                "party": {
                    "role_token": "Guarantor"
                }
            },
            "accountId": {
                "role_token": "Lender"
            },
            "money": {
                "getValue": [
                    [
                        {
                            "unCurrencySymbol": ""
                        },
                        [
                            [
                                {
                                    "unTokenName": ""
                                },
                                4000000
                            ]
                        ]
                    ]
                ]
            }
        }
    ],
    "contract": {
        "timeout": 1664147315000 [[2022-09-25 23:08:35 +0000 UTC]],
        "when": [
            {
                "then": {
                    "then": {
                        "then": "close",
                        "to": {
                            "party": {
                                "role_token": "Guarantor"
                            }
                        },
                        "from_account": {
                            "role_token": "Lender"
                        },
                        "pay": {
                            "and": 50000000,
                            "add": 4000000
                        },
                        "token": {
                            "currency_symbol": "",
                            "token_name": ""
                        }
                    },
                    "to": {
                        "party": {
                            "role_token": "Lender"
                        }
                    },
                    "from_account": {
                        "role_token": "Lender"
                    },
                    "pay": {
                        "and": 50000000,
                        "add": 4000000
                    },
                    "token": {
                        "currency_symbol": "",
                        "token_name": ""
                    }
                },
                "case": {
                    "deposits": {
                        "and": 50000000,
                        "add": 4000000
                    },
                    "into_account": {
                        "role_token": "Lender"
                    },
                    "of_token": {
                        "currency_symbol": "",
                        "token_name": ""
                    },
                    "party": {
                        "role_token": "Borrower"
                    }
                }
            }
        ],
        "timeout_continuation": "close"
    },
    "rolesValidator": {
        "hash": "9a9794917d8e831be5110e3a5897bf474b7f8bc1830dbb420da538c2",
        "size": 2469,
        "address": "addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t",
        "cost": {
            "exBudgetMemory": 14600,
            "exBudgetCPU": 4317185
        },
        "script": {
            "type": "PlutusScriptV1",
            "cborHex": "5909a55909a201000033232332232323⋯⋯₄₉₄₄⋯⋯49576c1dcc7b7c90fef20aa870860001",
            "description": ""
        }
    },
    "range": [
        14143503,
        14147703
    ],
    "marloweValidator": {
        "hash": "c81da42bfdf3f0b0bc2e335f3b8d06580c855a29164b92d0407491c3",
        "size": 12415,
        "address": "addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt",
        "cost": {
            "exBudgetMemory": 82900,
            "exBudgetCPU": 24652144
        },
        "script": {
            "type": "PlutusScriptV1",
            "cborHex": "59307f59307c01000033232323322323⋯⋯₂₄₈₃₆⋯⋯f20aa870860022123300100300220011",
            "description": ""
        }
    },
    "inputs": [
        {
            "input_from_party": {
                "role_token": "Borrower"
            },
            "into_account": {
                "role_token": "Lender"
            },
            "of_token": {
                "currency_symbol": "",
                "token_name": ""
            },
            "that_deposits": 4000000
        }
    ],
    "roles": {
        "unCurrencySymbol": "10e1ba7f0c7dfe42ed6736da9c3749576c1dcc7b7c90fef20aa87086"
    },
    "slotConfig": {
        "scSlotLength": 1000,
        "scSlotZeroTime": 1649949631000 [[2022-04-14 15:20:31 +0000 UTC]]
    }
}

304_lender_withdraws.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender     3.58    52.44
  borrower            138.37
 guarantor             40.15
  contract             57.00
    payout    -4.00     4.00
     TOTAL    -0.42   291.96
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    52.44 |
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#1    | +     4.00 | Pure Ada
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#0    | +    40.25 | Greatest Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#1    | +     4.00 | Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#2    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   138.37 |
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#1    | +    50.00 | Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#0    | +    84.18 | Greatest Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#4    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    40.15 |
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#0    | +    31.96 | Greatest Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#1    | +     4.00 | Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    57.00 |
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#1    | +    57.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     4.00 |
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#3    | +     4.00 | GreatestByTxHavingDatum

306_guarantor_withdraws.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender             52.44
  borrower            138.37
 guarantor     3.58    43.73
  contract             57.00
    payout    -4.00         
     TOTAL    -0.42   291.53
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    52.44 |
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#1    | +     4.00 | Pure Ada
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#0    | +    40.25 | Greatest Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#1    | +     4.00 | Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#2    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   138.37 |
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#1    | +    50.00 | Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#0    | +    84.18 | Greatest Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#4    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    43.73 |
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#0    | +    31.54 | Greatest Pure Ada
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#1    | +     4.00 | Pure Ada
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#2    | +     2.00 | [ "Guarantor"×1 ]
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#1    | +     4.00 | Pure Ada
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    57.00 |
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#1    | +    57.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     0.00 |

402_borrower_pays_installment3.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS CHANGE  BALANCE
    lender           52.44
  borrower          138.37
 guarantor           43.73
  contract           57.00
    payout                
     TOTAL          291.53
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    52.44 |
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#1    | +     4.00 | Pure Ada
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#0    | +    40.25 | Greatest Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#1    | +     4.00 | Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#2    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   138.37 |
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#1    | +    50.00 | Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#0    | +    84.18 | Greatest Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#4    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    43.73 |
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#0    | +    31.54 | Greatest Pure Ada
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#1    | +     4.00 | Pure Ada
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#2    | +     2.00 | [ "Guarantor"×1 ]
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#1    | +     4.00 | Pure Ada
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    57.00 |
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#1    | +    57.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     0.00 |

The marlowe file produced by executing the script.
Note: annotated json (shortened hex-strings, translated posix-time).

{
    "state": {
        "choices": [],
        "boundValues": [],
        "accounts": [],
        "minTime": 1664093252000 [[2022-09-25 08:07:32 +0000 UTC]]
    },
    "payments": [
        {
            "payee": {
                "party": {
                    "role_token": "Lender"
                }
            },
            "accountId": {
                "role_token": "Lender"
            },
            "money": {
                "getValue": [
                    [
                        {
                            "unCurrencySymbol": ""
                        },
                        [
                            [
                                {
                                    "unTokenName": ""
                                },
                                54000000
                            ]
                        ]
                    ]
                ]
            }
        },
        {
            "payee": {
                "party": {
                    "role_token": "Guarantor"
                }
            },
            "accountId": {
                "role_token": "Lender"
            },
            "money": {
                "getValue": [
                    [
                        {
                            "unCurrencySymbol": ""
                        },
                        [
                            [
                                {
                                    "unTokenName": ""
                                },
                                54000000
                            ]
                        ]
                    ]
                ]
            }
        },
        {
            "payee": {
                "party": {
                    "role_token": "Lender"
                }
            },
            "accountId": {
                "role_token": "Lender"
            },
            "money": {
                "getValue": [
                    [
                        {
                            "unCurrencySymbol": ""
                        },
                        [
                            [
                                {
                                    "unTokenName": ""
                                },
                                3000000
                            ]
                        ]
                    ]
                ]
            }
        }
    ],
    "contract": "close",
    "rolesValidator": {
        "hash": "9a9794917d8e831be5110e3a5897bf474b7f8bc1830dbb420da538c2",
        "size": 2469,
        "address": "addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t",
        "cost": {
            "exBudgetMemory": 14600,
            "exBudgetCPU": 4317185
        },
        "script": {
            "type": "PlutusScriptV1",
            "cborHex": "5909a55909a201000033232332232323⋯⋯₄₉₄₄⋯⋯49576c1dcc7b7c90fef20aa870860001",
            "description": ""
        }
    },
    "range": [
        14143621,
        14147821
    ],
    "marloweValidator": {
        "hash": "c81da42bfdf3f0b0bc2e335f3b8d06580c855a29164b92d0407491c3",
        "size": 12415,
        "address": "addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt",
        "cost": {
            "exBudgetMemory": 82900,
            "exBudgetCPU": 24652144
        },
        "script": {
            "type": "PlutusScriptV1",
            "cborHex": "59307f59307c01000033232323322323⋯⋯₂₄₈₃₆⋯⋯f20aa870860022123300100300220011",
            "description": ""
        }
    },
    "inputs": [
        {
            "input_from_party": {
                "role_token": "Borrower"
            },
            "into_account": {
                "role_token": "Lender"
            },
            "of_token": {
                "currency_symbol": "",
                "token_name": ""
            },
            "that_deposits": 54000000
        }
    ],
    "roles": {
        "unCurrencySymbol": "10e1ba7f0c7dfe42ed6736da9c3749576c1dcc7b7c90fef20aa87086"
    },
    "slotConfig": {
        "scSlotLength": 1000,
        "scSlotZeroTime": 1649949631000 [[2022-04-14 15:20:31 +0000 UTC]]
    }
}

404_lender_withdraws.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS CHANGE  BALANCE
    lender           52.44
  borrower          138.37
 guarantor           43.73
  contract           57.00
    payout                
     TOTAL          291.53
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    52.44 |
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#1    | +     4.00 | Pure Ada
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#0    | +    40.25 | Greatest Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#1    | +     4.00 | Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#2    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   138.37 |
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#1    | +    50.00 | Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#0    | +    84.18 | Greatest Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#4    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    43.73 |
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#0    | +    31.54 | Greatest Pure Ada
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#1    | +     4.00 | Pure Ada
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#2    | +     2.00 | [ "Guarantor"×1 ]
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#1    | +     4.00 | Pure Ada
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    57.00 |
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#1    | +    57.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     0.00 |

406_guarantor_withdraws.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS CHANGE  BALANCE
    lender           52.44
  borrower          138.37
 guarantor           43.73
  contract           57.00
    payout                
     TOTAL          291.53
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    52.44 |
* 47ce23d37f84dc316da1a883ab86a8590fbb6a53856f899d5108b2a050f49056#1    | +     4.00 | Pure Ada
* c924b52ab95f6fd1027d5adafb4c77680321174ab2d6794fdf730ce04602827a#1    | +     2.19 | Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#0    | +    40.25 | Greatest Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#1    | +     4.00 | Pure Ada
* f89a73cab8e95f7689c3923f5328dec169f2e1ed3e24f17be15c4c2c29e4d1cc#2    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   138.37 |
* 7b0dcb9622720572cfe4919727aabb977a5cdcdfc622c3efc6674f9006d9f8f0#1    | +     2.19 | Pure Ada
* d7a2af0eb80fc72c56574be7efcbc53a6a0b03c21be98037d6fc9578d30ea896#1    | +    50.00 | Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#0    | +    84.18 | Greatest Pure Ada
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#4    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    43.73 |
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#0    | +    31.54 | Greatest Pure Ada
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#1    | +     4.00 | Pure Ada
* a1e84aeb927841e1ed9ea9f0db79c059830ffcee0ecb24099fd5e5a9f75be74b#2    | +     2.00 | [ "Guarantor"×1 ]
* c665aefffe5dfffb00d38852aaf218c1df50642aead8c138348afa63989e5932#1    | +     2.19 | Pure Ada
* d0b3028854f8965c88288a431e373cc5d22e6a1eb9bb9444873d7613c8c6ef53#1    | +     4.00 | Pure Ada
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    57.00 |
* fd903facfb5dbf7744112c4d4c089de4aa846a715ec87cb42f3f4e076e576a54#1    | +    57.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     0.00 |
 
Notes by wmoco. Generated on momo:/home/willem/sync/20220806_wmoco_pubcoms/20220806_marlowe_pioneer at 2023-06-14 18:32