You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/leo/10_basic_bank.md
+44-5Lines changed: 44 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Note that the program can be easily extended to include additional features such
16
16
17
17
## Bugs
18
18
19
-
You may have already guessed that this program has a few bugs. We list some of them below:
19
+
You may have already guessed that this program has a few bugs. We list some of them below:
20
20
-`withdraw` can only be invoked by the bank. A malicious bank could lock users' tokens by not invoking `withdraw`.
21
21
-`withdraw` fails if the sum of the interest and principal is greater than the user's balance.
22
22
- Users can increase their principal by depositing tokens multiple times, including immediately before withdrawal.
@@ -42,7 +42,7 @@ Follow the [Leo Installation Instructions](https://developer.aleo.org/leo/instal
42
42
This basic bank program can be run using the following bash script. Locally, it will execute Leo program functions to issue, deposit, and withdraw tokens between a bank and a user.
You'll see that the output contains a new private record belonging to the user with 50 credits, and a `Future` indicating code to be run on-chain and its associated inputs.
124
+
You'll see that the output contains a new private record belonging to the user with 50 credits, and a `Future` indicating code to be run on-chain and its associated inputs.
101
125
102
126
## <aid="wait"></a> Wait
103
127
104
128
With the 50 token deposit, let's say 15 periods of time pass with compounding interest at a rate of 12.34% on the principal amount.
105
129
106
-
You can run the calculation yourself, it comes out to 266 tokens accrued using those numbers.
130
+
You can run the calculation yourself, it comes out to 266 tokens accrued using those numbers.
You'll see here the withdrawal function creates a new private record for the user containing all 266 withdrawn tokens, and then outputs a `Future` which will be run on-chain.
0 commit comments