From 728cc1a6ba614ec9c19dc7542c6e50465984fd0c Mon Sep 17 00:00:00 2001 From: Damir Shamanaev Date: Wed, 24 Jul 2024 19:35:44 +0400 Subject: [PATCH] Update book/src/programmability/hot-potato-pattern.md Co-authored-by: Ashok Menon --- book/src/programmability/hot-potato-pattern.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/src/programmability/hot-potato-pattern.md b/book/src/programmability/hot-potato-pattern.md index 5ca374f..13e5427 100644 --- a/book/src/programmability/hot-potato-pattern.md +++ b/book/src/programmability/hot-potato-pattern.md @@ -108,15 +108,15 @@ An example usage of this pattern may look like this: # let amount = 100; // Borrow the funds from the lender. -let (asset_a, potato) = loan::borrow(&mut lender, amount); +let (asset_a, potato) = lender.borrow(amount); // Perform some operations with the borrowed funds. -let asset_b = dex::trade(&mut dex, loan); +let asset_b = dex.trade(loan); let proceeds = another_contract::do_something(asset_b); // Keep the commission and return the rest to the lender. -let pay_back = coin::split(proceeds, amount); -loan::repay(&mut lender, pay_back, potato); +let pay_back = proceeds.split(amount, ctx); +lender.repay(pay_back, potato); transfer::public_transfer(proceeds, ctx.sender()); # } ```