Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
deploy: 928c9e9
Browse files Browse the repository at this point in the history
  • Loading branch information
Deploy from CI committed Oct 24, 2023
1 parent f637a3f commit 4134d0b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -979,14 +979,14 @@ <h2 id="creating-our-lending-smart-contract"><a class="header" href="#creating-o
(let (
(user-deposit (default-to u0 (get amount (map-get? deposits { owner: tx-sender }))))
(allowed-borrow (/ user-deposit u2))
(current-loan-details (default-to { amount: u0, last-interaction-block: u0 } (map-get? loans { owner: tx-sender })))
(current-loan-details (default-to { amount: u0, last-interaction-block: u0 } (map-get? loans tx-sender )))
(accrued-interest (calculate-accrued-interest (get amount current-loan-details) (get last-interaction-block current-loan-details)))
(total-due (+ (get amount current-loan-details) (unwrap! accrued-interest (err u8))))
(new-loan (+ total-due amount))
)
(asserts! (&lt;= amount allowed-borrow) (err u7))
(try! (contract-call? .asset transfer amount (as-contract tx-sender) tx-sender none))
(map-set loans { owner: tx-sender } { amount: new-loan, last-interaction-block: block-height })
(map-set loans tx-sender { amount: new-loan, last-interaction-block: block-height })
(ok true)
)
)
Expand All @@ -1001,13 +1001,13 @@ <h2 id="creating-our-lending-smart-contract"><a class="header" href="#creating-o
<pre><code class="language-clojure">;; Users can repay their sBTC loans
(define-public (repay (amount uint))
(let (
(current-loan-details (default-to { amount: u0, last-interaction-block: u0 } (map-get? loans { owner: tx-sender })))
(current-loan-details (default-to { amount: u0, last-interaction-block: u0 } (map-get? loans tx-sender)))
(accrued-interest (calculate-accrued-interest (get amount current-loan-details) (get last-interaction-block current-loan-details)))
(total-due (+ (get amount current-loan-details) (unwrap! accrued-interest (err u8))))
)
(asserts! (&gt;= total-due amount) (err u4))
(try! (contract-call? .asset transfer amount tx-sender (as-contract tx-sender) none))
(map-set loans { owner: tx-sender } { amount: (- total-due amount), last-interaction-block: block-height })
(map-set loans tx-sender { amount: (- total-due amount), last-interaction-block: block-height })
(var-set total-loans (- (var-get total-loans) amount))
(ok true)
)
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -721,14 +721,14 @@ <h2 id="creating-our-lending-smart-contract"><a class="header" href="#creating-o
(let (
(user-deposit (default-to u0 (get amount (map-get? deposits { owner: tx-sender }))))
(allowed-borrow (/ user-deposit u2))
(current-loan-details (default-to { amount: u0, last-interaction-block: u0 } (map-get? loans { owner: tx-sender })))
(current-loan-details (default-to { amount: u0, last-interaction-block: u0 } (map-get? loans tx-sender )))
(accrued-interest (calculate-accrued-interest (get amount current-loan-details) (get last-interaction-block current-loan-details)))
(total-due (+ (get amount current-loan-details) (unwrap! accrued-interest (err u8))))
(new-loan (+ total-due amount))
)
(asserts! (&lt;= amount allowed-borrow) (err u7))
(try! (contract-call? .asset transfer amount (as-contract tx-sender) tx-sender none))
(map-set loans { owner: tx-sender } { amount: new-loan, last-interaction-block: block-height })
(map-set loans tx-sender { amount: new-loan, last-interaction-block: block-height })
(ok true)
)
)
Expand All @@ -743,13 +743,13 @@ <h2 id="creating-our-lending-smart-contract"><a class="header" href="#creating-o
<pre><code class="language-clojure">;; Users can repay their sBTC loans
(define-public (repay (amount uint))
(let (
(current-loan-details (default-to { amount: u0, last-interaction-block: u0 } (map-get? loans { owner: tx-sender })))
(current-loan-details (default-to { amount: u0, last-interaction-block: u0 } (map-get? loans tx-sender)))
(accrued-interest (calculate-accrued-interest (get amount current-loan-details) (get last-interaction-block current-loan-details)))
(total-due (+ (get amount current-loan-details) (unwrap! accrued-interest (err u8))))
)
(asserts! (&gt;= total-due amount) (err u4))
(try! (contract-call? .asset transfer amount tx-sender (as-contract tx-sender) none))
(map-set loans { owner: tx-sender } { amount: (- total-due amount), last-interaction-block: block-height })
(map-set loans tx-sender { amount: (- total-due amount), last-interaction-block: block-height })
(var-set total-loans (- (var-get total-loans) amount))
(ok true)
)
Expand Down

0 comments on commit 4134d0b

Please sign in to comment.