Marlowe Pioneer
 
w0802s_cbg
20220924

The Coupon Bond Guaranteed contract, modified

The run that succeeds

This is the run with the modified 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     9.00   109.00
  borrower   100.00   -16.99    83.01
 guarantor   100.00    -2.71    97.29
  contract                           
    payout                           
     TOTAL   300.00   -10.70   289.30
======================================

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 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* 664dfcc1c292799eb4893d683d73782cb69e9f358dcb47927e4eaaecbc5ba21b#1    | +     2.00 | [ "Lender"×1 ]
* da4cabbcdb664e1e25f0b76bf27317c31e55421391b6ecb2283fe24ed4c65c29#0    | +    92.61 | Greatest Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   100.00 |
* 3745050644634d83a7514c68c05d40fac9af52f2c2c776fd490f6e78c56c5ae2#0    | +    95.82 | Greatest Pure Ada
* 3745050644634d83a7514c68c05d40fac9af52f2c2c776fd490f6e78c56c5ae2#1    | +     2.00 | [ "Borrower"×1 ]
* c4b0d0d06f41230971089a608ffdc25b0791245840fe2b51d341ae81008eabf9#1    | +     2.18 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =   100.00 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* 7903a8a9fa15cbb1104d5746e05bafe731940849de4e04a58c9231edd0a46e3a#0    | +    95.82 | Greatest Pure Ada
* 7903a8a9fa15cbb1104d5746e05bafe731940849de4e04a58c9231edd0a46e3a#1    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =     3.00 |
* da4cabbcdb664e1e25f0b76bf27317c31e55421391b6ecb2283fe24ed4c65c29#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.43    36.57
  contract    62.00    65.00
    payout                  
     TOTAL    -1.43   298.36
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    96.79 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* 664dfcc1c292799eb4893d683d73782cb69e9f358dcb47927e4eaaecbc5ba21b#1    | +     2.00 | [ "Lender"×1 ]
* da4cabbcdb664e1e25f0b76bf27317c31e55421391b6ecb2283fe24ed4c65c29#0    | +    92.61 | Greatest Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   100.00 |
* 3745050644634d83a7514c68c05d40fac9af52f2c2c776fd490f6e78c56c5ae2#0    | +    95.82 | Greatest Pure Ada
* 3745050644634d83a7514c68c05d40fac9af52f2c2c776fd490f6e78c56c5ae2#1    | +     2.00 | [ "Borrower"×1 ]
* c4b0d0d06f41230971089a608ffdc25b0791245840fe2b51d341ae81008eabf9#1    | +     2.18 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    36.57 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* cec22297e4c9b0ad82bb65cc847ceb1d9c3b8b94dcf1a895500152f20c6e424d#0    | +    32.39 | Greatest Pure Ada
* cec22297e4c9b0ad82bb65cc847ceb1d9c3b8b94dcf1a895500152f20c6e424d#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    65.00 |
* cec22297e4c9b0ad82bb65cc847ceb1d9c3b8b94dcf1a895500152f20c6e424d#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": 1664089598000 [[2022-09-25 07:06:38 +0000 UTC]]
    },
    "payments": [],
    "contract": {
        "timeout": 1664133376000 [[2022-09-25 19:16:16 +0000 UTC]],
        "when": [
            {
                "then": {
                    "then": {
                        "timeout": 1664136976000 [[2022-09-25 20:16:16 +0000 UTC]],
                        "when": [
                            {
                                "then": {
                                    "then": {
                                        "then": {
                                            "timeout": 1664140576000 [[2022-09-25 21:16:16 +0000 UTC]],
                                            "when": [
                                                {
                                                    "then": {
                                                        "then": {
                                                            "then": {
                                                                "timeout": 1664144176000 [[2022-09-25 22:16:16 +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": 3000000,
                                                                                "add": {
                                                                                    "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": [
        14139967,
        14144167
    ],
    "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.51    45.28
  borrower            100.00
 guarantor             36.57
  contract             65.00
    payout    50.00    50.00
     TOTAL    -1.51   296.85
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    45.28 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* 7339c6a0e4e2c6c948ab16a29ee52f31873d4c2b2bfcf67617dc193caf12f72d#0    | +    41.09 | Greatest Pure Ada
* 7339c6a0e4e2c6c948ab16a29ee52f31873d4c2b2bfcf67617dc193caf12f72d#3    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   100.00 |
* 3745050644634d83a7514c68c05d40fac9af52f2c2c776fd490f6e78c56c5ae2#0    | +    95.82 | Greatest Pure Ada
* 3745050644634d83a7514c68c05d40fac9af52f2c2c776fd490f6e78c56c5ae2#1    | +     2.00 | [ "Borrower"×1 ]
* c4b0d0d06f41230971089a608ffdc25b0791245840fe2b51d341ae81008eabf9#1    | +     2.18 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    36.57 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* cec22297e4c9b0ad82bb65cc847ceb1d9c3b8b94dcf1a895500152f20c6e424d#0    | +    32.39 | Greatest Pure Ada
* cec22297e4c9b0ad82bb65cc847ceb1d9c3b8b94dcf1a895500152f20c6e424d#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    65.00 |
* 7339c6a0e4e2c6c948ab16a29ee52f31873d4c2b2bfcf67617dc193caf12f72d#1    | +    65.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =    50.00 |
* 7339c6a0e4e2c6c948ab16a29ee52f31873d4c2b2bfcf67617dc193caf12f72d#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": 1664089655000 [[2022-09-25 07:07:35 +0000 UTC]]
    },
    "payments": [
        {
            "payee": {
                "party": {
                    "role_token": "Borrower"
                }
            },
            "accountId": {
                "role_token": "Borrower"
            },
            "money": {
                "getValue": [
                    [
                        {
                            "unCurrencySymbol": ""
                        },
                        [
                            [
                                {
                                    "unTokenName": ""
                                },
                                50000000
                            ]
                        ]
                    ]
                ]
            }
        }
    ],
    "contract": {
        "timeout": 1664136976000 [[2022-09-25 20:16:16 +0000 UTC]],
        "when": [
            {
                "then": {
                    "then": {
                        "then": {
                            "timeout": 1664140576000 [[2022-09-25 21:16:16 +0000 UTC]],
                            "when": [
                                {
                                    "then": {
                                        "then": {
                                            "then": {
                                                "timeout": 1664144176000 [[2022-09-25 22:16:16 +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": 3000000,
                                                                "add": {
                                                                    "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": [
        14140024,
        14144224
    ],
    "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.57
  contract             65.00
    payout   -50.00         
     TOTAL    -0.42   296.42
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    45.28 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* 7339c6a0e4e2c6c948ab16a29ee52f31873d4c2b2bfcf67617dc193caf12f72d#0    | +    41.09 | Greatest Pure Ada
* 7339c6a0e4e2c6c948ab16a29ee52f31873d4c2b2bfcf67617dc193caf12f72d#3    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   149.58 |
* 4127eef11fd4407477ecb5e72faf9f77d8a01bb06e4c8bb8f9a8e591fa53f47b#0    | +    95.40 | Greatest Pure Ada
* 4127eef11fd4407477ecb5e72faf9f77d8a01bb06e4c8bb8f9a8e591fa53f47b#1    | +    50.00 | Pure Ada
* 4127eef11fd4407477ecb5e72faf9f77d8a01bb06e4c8bb8f9a8e591fa53f47b#2    | +     2.00 | [ "Borrower"×1 ]
* c4b0d0d06f41230971089a608ffdc25b0791245840fe2b51d341ae81008eabf9#1    | +     2.18 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    36.57 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* cec22297e4c9b0ad82bb65cc847ceb1d9c3b8b94dcf1a895500152f20c6e424d#0    | +    32.39 | Greatest Pure Ada
* cec22297e4c9b0ad82bb65cc847ceb1d9c3b8b94dcf1a895500152f20c6e424d#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    65.00 |
* 7339c6a0e4e2c6c948ab16a29ee52f31873d4c2b2bfcf67617dc193caf12f72d#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.63   143.95
 guarantor             36.57
  contract    -4.00    61.00
    payout     8.00     8.00
     TOTAL    -1.63   294.80
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    45.28 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* 7339c6a0e4e2c6c948ab16a29ee52f31873d4c2b2bfcf67617dc193caf12f72d#0    | +    41.09 | Greatest Pure Ada
* 7339c6a0e4e2c6c948ab16a29ee52f31873d4c2b2bfcf67617dc193caf12f72d#3    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   143.95 |
* 4127eef11fd4407477ecb5e72faf9f77d8a01bb06e4c8bb8f9a8e591fa53f47b#1    | +    50.00 | Pure Ada
* c4b0d0d06f41230971089a608ffdc25b0791245840fe2b51d341ae81008eabf9#1    | +     2.18 | Pure Ada
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#0    | +    89.77 | Greatest Pure Ada
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#4    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    36.57 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* cec22297e4c9b0ad82bb65cc847ceb1d9c3b8b94dcf1a895500152f20c6e424d#0    | +    32.39 | Greatest Pure Ada
* cec22297e4c9b0ad82bb65cc847ceb1d9c3b8b94dcf1a895500152f20c6e424d#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    61.00 |
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#1    | +    61.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     8.00 |
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#2    | +     4.00 | GreatestByTxHavingDatum
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#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": 1664089707000 [[2022-09-25 07:08:27 +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": 1664140576000 [[2022-09-25 21:16:16 +0000 UTC]],
        "when": [
            {
                "then": {
                    "then": {
                        "then": {
                            "timeout": 1664144176000 [[2022-09-25 22:16:16 +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": 3000000,
                                            "add": {
                                                "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": [
        14140076,
        14144276
    ],
    "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.58    48.85
  borrower            143.95
 guarantor             36.57
  contract             61.00
    payout    -4.00     4.00
     TOTAL    -0.42   294.37
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    48.85 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#0    | +    40.67 | Greatest Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#1    | +     4.00 | Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#2    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   143.95 |
* 4127eef11fd4407477ecb5e72faf9f77d8a01bb06e4c8bb8f9a8e591fa53f47b#1    | +    50.00 | Pure Ada
* c4b0d0d06f41230971089a608ffdc25b0791245840fe2b51d341ae81008eabf9#1    | +     2.18 | Pure Ada
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#0    | +    89.77 | Greatest Pure Ada
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#4    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    36.57 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* cec22297e4c9b0ad82bb65cc847ceb1d9c3b8b94dcf1a895500152f20c6e424d#0    | +    32.39 | Greatest Pure Ada
* cec22297e4c9b0ad82bb65cc847ceb1d9c3b8b94dcf1a895500152f20c6e424d#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    61.00 |
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#1    | +    61.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     4.00 |
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#3    | +     4.00 | GreatestByTxHavingDatum

206_guarantor_withdraws.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender             48.85
  borrower            143.95
 guarantor     3.58    40.15
  contract             61.00
    payout    -4.00         
     TOTAL    -0.42   293.95
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    48.85 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#0    | +    40.67 | Greatest Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#1    | +     4.00 | Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#2    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   143.95 |
* 4127eef11fd4407477ecb5e72faf9f77d8a01bb06e4c8bb8f9a8e591fa53f47b#1    | +    50.00 | Pure Ada
* c4b0d0d06f41230971089a608ffdc25b0791245840fe2b51d341ae81008eabf9#1    | +     2.18 | Pure Ada
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#0    | +    89.77 | Greatest Pure Ada
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#4    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    40.15 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#0    | +    31.97 | Greatest Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#1    | +     4.00 | Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    61.00 |
* e059c7aa3c61380e791e877e4ec3ebf44465ce2331937a9473cc4c3cd1a79ef1#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.85
  borrower    -5.59   138.36
 guarantor             40.15
  contract    -4.00    57.00
    payout     8.00     8.00
     TOTAL    -1.59   292.36
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    48.85 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#0    | +    40.67 | Greatest Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#1    | +     4.00 | Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#2    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   138.36 |
* 4127eef11fd4407477ecb5e72faf9f77d8a01bb06e4c8bb8f9a8e591fa53f47b#1    | +    50.00 | Pure Ada
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#0    | +    84.18 | Greatest Pure Ada
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#4    | +     2.00 | [ "Borrower"×1 ]
* c4b0d0d06f41230971089a608ffdc25b0791245840fe2b51d341ae81008eabf9#1    | +     2.18 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    40.15 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#0    | +    31.97 | Greatest Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#1    | +     4.00 | Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    57.00 |
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#1    | +    57.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     8.00 |
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#2    | +     4.00 | GreatestByTxHavingDatum
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#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": 1664089815000 [[2022-09-25 07:10: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": 1664144176000 [[2022-09-25 22:16:16 +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": 3000000,
                        "add": {
                            "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": [
        14140184,
        14144384
    ],
    "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.57    52.43
  borrower            138.36
 guarantor             40.15
  contract             57.00
    payout    -4.00     4.00
     TOTAL    -0.43   291.93
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    52.43 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#1    | +     4.00 | Pure Ada
* e802c647b767e82c2a9fdd265d1611b4da6e74629db73dff1607c1c0311a360b#0    | +    40.25 | Greatest Pure Ada
* e802c647b767e82c2a9fdd265d1611b4da6e74629db73dff1607c1c0311a360b#1    | +     4.00 | Pure Ada
* e802c647b767e82c2a9fdd265d1611b4da6e74629db73dff1607c1c0311a360b#2    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   138.36 |
* 4127eef11fd4407477ecb5e72faf9f77d8a01bb06e4c8bb8f9a8e591fa53f47b#1    | +    50.00 | Pure Ada
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#0    | +    84.18 | Greatest Pure Ada
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#4    | +     2.00 | [ "Borrower"×1 ]
* c4b0d0d06f41230971089a608ffdc25b0791245840fe2b51d341ae81008eabf9#1    | +     2.18 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    40.15 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#0    | +    31.97 | Greatest Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#1    | +     4.00 | Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    57.00 |
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#1    | +    57.00 | GreatestByTxHavingDatum
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =     4.00 |
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#3    | +     4.00 | GreatestByTxHavingDatum

306_guarantor_withdraws.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender             52.43
  borrower            138.36
 guarantor     3.57    43.72
  contract             57.00
    payout    -4.00         
     TOTAL    -0.43   291.51
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    52.43 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#1    | +     4.00 | Pure Ada
* e802c647b767e82c2a9fdd265d1611b4da6e74629db73dff1607c1c0311a360b#0    | +    40.25 | Greatest Pure Ada
* e802c647b767e82c2a9fdd265d1611b4da6e74629db73dff1607c1c0311a360b#1    | +     4.00 | Pure Ada
* e802c647b767e82c2a9fdd265d1611b4da6e74629db73dff1607c1c0311a360b#2    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =   138.36 |
* 4127eef11fd4407477ecb5e72faf9f77d8a01bb06e4c8bb8f9a8e591fa53f47b#1    | +    50.00 | Pure Ada
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#0    | +    84.18 | Greatest Pure Ada
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#4    | +     2.00 | [ "Borrower"×1 ]
* c4b0d0d06f41230971089a608ffdc25b0791245840fe2b51d341ae81008eabf9#1    | +     2.18 | Pure Ada
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    43.72 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#1    | +     4.00 | Pure Ada
* e05d08d44135a00937d7e739efb911865b1861c00412f797b3c12f2895d8bf72#0    | +    31.54 | Greatest Pure Ada
* e05d08d44135a00937d7e739efb911865b1861c00412f797b3c12f2895d8bf72#1    | +     4.00 | Pure Ada
* e05d08d44135a00937d7e739efb911865b1861c00412f797b3c12f2895d8bf72#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =    57.00 |
* 42429375117c9ceea5d53cf6bb5daeab0c9f2b681d949d68aa4bf0b631fb1c04#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.43
  borrower   -55.35    83.01
 guarantor             43.72
  contract   -57.00         
    payout   111.00   111.00
     TOTAL    -1.35   290.16
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =    52.43 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#1    | +     4.00 | Pure Ada
* e802c647b767e82c2a9fdd265d1611b4da6e74629db73dff1607c1c0311a360b#0    | +    40.25 | Greatest Pure Ada
* e802c647b767e82c2a9fdd265d1611b4da6e74629db73dff1607c1c0311a360b#1    | +     4.00 | Pure Ada
* e802c647b767e82c2a9fdd265d1611b4da6e74629db73dff1607c1c0311a360b#2    | +     2.00 | [ "Lender"×1 ]
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =    83.01 |
* 6345c833db7153e3540512ccec9d3a9a8fd45af5da20377f6e5560b0c3f2d4e9#0    | +    81.01 | Greatest Pure Ada
* 6345c833db7153e3540512ccec9d3a9a8fd45af5da20377f6e5560b0c3f2d4e9#3    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    43.72 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#1    | +     4.00 | Pure Ada
* e05d08d44135a00937d7e739efb911865b1861c00412f797b3c12f2895d8bf72#0    | +    31.54 | Greatest Pure Ada
* e05d08d44135a00937d7e739efb911865b1861c00412f797b3c12f2895d8bf72#1    | +     4.00 | Pure Ada
* e05d08d44135a00937d7e739efb911865b1861c00412f797b3c12f2895d8bf72#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =     0.00 |
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =   111.00 |
* 6345c833db7153e3540512ccec9d3a9a8fd45af5da20377f6e5560b0c3f2d4e9#1    | +    57.00 | GreatestByTxHavingDatum
* 6345c833db7153e3540512ccec9d3a9a8fd45af5da20377f6e5560b0c3f2d4e9#2    | +    54.00 | Datum

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

{
    "state": {
        "choices": [],
        "boundValues": [],
        "accounts": [],
        "minTime": 1664089933000 [[2022-09-25 07:12:13 +0000 UTC]]
    },
    "payments": [
        {
            "payee": {
                "party": {
                    "role_token": "Lender"
                }
            },
            "accountId": {
                "role_token": "Lender"
            },
            "money": {
                "getValue": [
                    [
                        {
                            "unCurrencySymbol": ""
                        },
                        [
                            [
                                {
                                    "unTokenName": ""
                                },
                                57000000
                            ]
                        ]
                    ]
                ]
            }
        },
        {
            "payee": {
                "party": {
                    "role_token": "Guarantor"
                }
            },
            "accountId": {
                "role_token": "Lender"
            },
            "money": {
                "getValue": [
                    [
                        {
                            "unCurrencySymbol": ""
                        },
                        [
                            [
                                {
                                    "unTokenName": ""
                                },
                                54000000
                            ]
                        ]
                    ]
                ]
            }
        }
    ],
    "contract": "close",
    "rolesValidator": {
        "hash": "9a9794917d8e831be5110e3a5897bf474b7f8bc1830dbb420da538c2",
        "size": 2469,
        "address": "addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t",
        "cost": {
            "exBudgetMemory": 14600,
            "exBudgetCPU": 4317185
        },
        "script": {
            "type": "PlutusScriptV1",
            "cborHex": "5909a55909a201000033232332232323⋯⋯₄₉₄₄⋯⋯49576c1dcc7b7c90fef20aa870860001",
            "description": ""
        }
    },
    "range": [
        14140302,
        14144502
    ],
    "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    56.57   109.00
  borrower             83.01
 guarantor             43.72
  contract                  
    payout   -57.00    54.00
     TOTAL    -0.43   289.73
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =   109.00 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* 600822aee63d3fe581a568d44ad4ab0fe2132e3f412ffc1c7e9a7156649e1860#0    | +    39.82 | Pure Ada
* 600822aee63d3fe581a568d44ad4ab0fe2132e3f412ffc1c7e9a7156649e1860#1    | +    57.00 | Greatest Pure Ada
* 600822aee63d3fe581a568d44ad4ab0fe2132e3f412ffc1c7e9a7156649e1860#2    | +     2.00 | [ "Lender"×1 ]
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#1    | +     4.00 | Pure Ada
* e802c647b767e82c2a9fdd265d1611b4da6e74629db73dff1607c1c0311a360b#1    | +     4.00 | Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =    83.01 |
* 6345c833db7153e3540512ccec9d3a9a8fd45af5da20377f6e5560b0c3f2d4e9#0    | +    81.01 | Greatest Pure Ada
* 6345c833db7153e3540512ccec9d3a9a8fd45af5da20377f6e5560b0c3f2d4e9#3    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    43.72 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#1    | +     4.00 | Pure Ada
* e05d08d44135a00937d7e739efb911865b1861c00412f797b3c12f2895d8bf72#0    | +    31.54 | Greatest Pure Ada
* e05d08d44135a00937d7e739efb911865b1861c00412f797b3c12f2895d8bf72#1    | +     4.00 | Pure Ada
* e05d08d44135a00937d7e739efb911865b1861c00412f797b3c12f2895d8bf72#2    | +     2.00 | [ "Guarantor"×1 ]
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =     0.00 |
--- payout       -----------------------------------------------------------------------------------------------
addr_test1wzdf09y30k8gxxl9zy8r5kyhhar5klutcxpsmw6zpkjn3ssnkal7t         | =    54.00 |
* 6345c833db7153e3540512ccec9d3a9a8fd45af5da20377f6e5560b0c3f2d4e9#2    | +    54.00 | GreatestByTxHavingDatum

406_guarantor_withdraws.sh

Output of the script:

The balance after the script run:


==============================
     ALIAS   CHANGE  BALANCE
    lender            109.00
  borrower             83.01
 guarantor    53.57    97.29
  contract                  
    payout   -54.00         
     TOTAL    -0.43   289.30
==============================

Snapshot taken after the script run:


--- lender       -----------------------------------------------------------------------------------------------
addr_test1vr5cvgswyma5s53k76rpf7uzcuq3u3d0hvcc86lr3wyvy9qze26h0         | =   109.00 |
* 0c3de9c7483461fa58d5f352113ec0664dcd3468b4fcfaf0c8550e5e3b6a8a45#1    | +     2.18 | Pure Ada
* 600822aee63d3fe581a568d44ad4ab0fe2132e3f412ffc1c7e9a7156649e1860#0    | +    39.82 | Pure Ada
* 600822aee63d3fe581a568d44ad4ab0fe2132e3f412ffc1c7e9a7156649e1860#1    | +    57.00 | Greatest Pure Ada
* 600822aee63d3fe581a568d44ad4ab0fe2132e3f412ffc1c7e9a7156649e1860#2    | +     2.00 | [ "Lender"×1 ]
* a196600a12f9b075187f028691b156fd060afd64d1f9f993769b0f2deccaaa52#1    | +     4.00 | Pure Ada
* e802c647b767e82c2a9fdd265d1611b4da6e74629db73dff1607c1c0311a360b#1    | +     4.00 | Pure Ada
--- borrower     -----------------------------------------------------------------------------------------------
addr_test1vz0at5gehvrkektqx0vv2ylthqkzazzjvc5e5y2wh7md8hcffsn35         | =    83.01 |
* 6345c833db7153e3540512ccec9d3a9a8fd45af5da20377f6e5560b0c3f2d4e9#0    | +    81.01 | Greatest Pure Ada
* 6345c833db7153e3540512ccec9d3a9a8fd45af5da20377f6e5560b0c3f2d4e9#3    | +     2.00 | [ "Borrower"×1 ]
--- guarantor    -----------------------------------------------------------------------------------------------
addr_test1vp4cfg7trshc4rcrs6l67azqws05c8u4x9w6ggpqzg4893s7m3qsk         | =    97.29 |
* 73a3382fd68654ace9d3ed7b740bff549c237f7e2d55fb1e7fb1fcbef07f71c1#1    | +     2.18 | Pure Ada
* 80701578b1a908070c3e30ad3589724e3a97eb95ca987f7858f6cba6bb38d5ab#0    | +    31.11 | Pure Ada
* 80701578b1a908070c3e30ad3589724e3a97eb95ca987f7858f6cba6bb38d5ab#1    | +    54.00 | Greatest Pure Ada
* 80701578b1a908070c3e30ad3589724e3a97eb95ca987f7858f6cba6bb38d5ab#2    | +     2.00 | [ "Guarantor"×1 ]
* 995a9f762d0b2f7d3637b3648327071b04f1b2829aa30c42c7313ee150468b61#1    | +     4.00 | Pure Ada
* e05d08d44135a00937d7e739efb911865b1861c00412f797b3c12f2895d8bf72#1    | +     4.00 | Pure Ada
--- contract     -----------------------------------------------------------------------------------------------
addr_test1wrypmfptlhelpv9u9ce47wudqevqep269ytyhyksgp6frscvpnejt         | =     0.00 |
--- 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