Skip to content

Commit

Permalink
Merge pull request ProvableHQ#44 from KyryloKilin/master
Browse files Browse the repository at this point in the history
Fix typos
  • Loading branch information
collinc97 authored and predator005 committed Mar 14, 2024
2 parents f1738a7 + d272c15 commit f454167
Show file tree
Hide file tree
Showing 19 changed files with 111 additions and 4 deletions.
1 change: 1 addition & 0 deletions .build/SnarkOS
Submodule SnarkOS added at bb7664
5 changes: 5 additions & 0 deletions app1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.env
*.avm
*.prover
*.verifier
outputs/
14 changes: 14 additions & 0 deletions app1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# app1.aleo

## Build Guide

To compile this Aleo program, run:
```bash
snarkvm build
```

To execute this Aleo program, run:
```bash
snarkvm run hello
```
validguseinoff
9 changes: 9 additions & 0 deletions app1/build/main.aleo
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
program app1.aleo;



function main:
input r0 as u32.public;
input r1 as u32.private;
add r0 r1 into r2;
output r2 as u32.private;
6 changes: 6 additions & 0 deletions app1/build/program.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"program": "app1.aleo",
"version": "0.0.0",
"description": "",
"license": "MIT"
}
1 change: 1 addition & 0 deletions app1/leo.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package = []
6 changes: 6 additions & 0 deletions app1/program.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"program": "app1.aleo",
"version": "0.0.0",
"description": "",
"license": "MIT"
}
18 changes: 18 additions & 0 deletions app1/src/main.leo
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// The 'app1' program.
program app1.aleo {

record token {
owner: address,
gates: u64,
amount: u32
}

transition mint (receiver: address, amount: u64) -> {
return token {
owner: receiver,
gates: 0u64,
amount
}

}
}
5 changes: 5 additions & 0 deletions app2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.env
*.avm
*.prover
*.verifier
outputs/
13 changes: 13 additions & 0 deletions app2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# app2.aleo

## Build Guide

To compile this Aleo program, run:
```bash
snarkvm build
```

To execute this Aleo program, run:
```bash
snarkvm run hello
```
9 changes: 9 additions & 0 deletions app2/build/main.aleo
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
program app2.aleo;



function main:
input r0 as u32.public;
input r1 as u32.private;
add r0 r1 into r2;
output r2 as u32.private;
6 changes: 6 additions & 0 deletions app2/build/program.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"program": "app2.aleo",
"version": "0.0.0",
"description": "",
"license": "MIT"
}
Empty file added app2/inputs/inputs.in
Empty file.
1 change: 1 addition & 0 deletions app2/leo.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package = []
6 changes: 6 additions & 0 deletions app2/program.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"program": "app2.aleo",
"version": "0.0.0",
"description": "",
"license": "MIT"
}
7 changes: 7 additions & 0 deletions app2/src/main.leo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// The 'app2' program.
program app2.aleo {
transition main(public a: u32, b: u32) -> u32 {
let c: u32 = a + b;
return c;
}
}
4 changes: 2 additions & 2 deletions basic_bank/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Note that the program can be easily extended to include addition features such a
You may have already guessed that this program has a few bugs. We list some of them below:
- `withdraw` can only be invoked by the bank. A malicious bank could lock users' tokens by not invoking `withdraw`.
- `withdraw` fails if the sum of the interest and principal is greater than the user's balance.
- User's can increase their principal by depositing tokens multiple times, including immediately before withdrawl.
- User's can increase their principal by depositing tokens multiple times, including immediately before withdrawal.
- Integer division rounds down; if the calculated interest is too small, then it will be rounded down to zero.

Can you find any others?
Expand Down Expand Up @@ -116,4 +116,4 @@ PRIVATE_KEY=APrivateKey1zkpHtqVWT6fSHgUMNxsuVf7eaR6id2cj7TieKY1Z8CP5rCD
leo run withdraw aleo1zeklp6dd8e764spe74xez6f8w27dlua3w7hl4z2uln03re52egpsv46ngg 50u64 1234u64 15u64
```

You'll see here the withdrawal function creates a new private record for the user containing all 266 withdrawn tokens, and then calls the finalize `withdraw` function with arguments (address, amount), which will update the public balance of the bank back to 0. The public mapping will be queryable on-chain.
You'll see here the withdrawal function creates a new private record for the user containing all 266 withdrawn tokens, and then calls the finalize `withdraw` function with arguments (address, amount), which will update the public balance of the bank back to 0. The public mapping will be queryable on-chain.
2 changes: 1 addition & 1 deletion battleship/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ We can make the observation that the original bitstring is always shifted by a p

To ensure that the remaining number is a power of 2, we can use a bit trick. See the bit trick for ensuring a bitstring is a power of 2 section.

In the code, you'll notice one extra step. Dividing a ship placement bitstring by a ship bitstring representation could result in 0, and then subtracting by 1 will result in an underflow. In that case, we know the ship placement is not valid, so we can set a number which is gauranteed to not be a power of 2.
In the code, you'll notice one extra step. Dividing a ship placement bitstring by a ship bitstring representation could result in 0, and then subtracting by 1 will result in an underflow. In that case, we know the ship placement is not valid, so we can set a number which is guaranteed to not be a power of 2.


### Splitting a row or column
Expand Down
2 changes: 1 addition & 1 deletion token/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ PRIVATE_KEY=APrivateKey1zkp1w8PTxrRgGfAtfKUSq43iQyVbdQHfhGbiNPEg2LVSEXR
leo run transfer_public aleo17vy26rpdhqx4598y5gp7nvaa9rk7tnvl6ufhvvf4calsrrqdaqyshdsf5z 10u64
```

Again, we see the arguments used for the finzalize function of `transfer_public` - Alice's address, Bob's address, and the amount to transfer. The public mapping will be queryable on-chain.
Again, we see the arguments used for the finalize function of `transfer_public` - Alice's address, Bob's address, and the amount to transfer. The public mapping will be queryable on-chain.

## <a id="step3"></a> Private Transfer

Expand Down

0 comments on commit f454167

Please sign in to comment.