add import example, remove directory nesting, improve examples readme

This commit is contained in:
collin 2022-08-01 16:04:00 -07:00
parent 1d734ffa3f
commit bef473b656
19 changed files with 133 additions and 28 deletions

View File

@ -0,0 +1,13 @@
# bubblesort
## Build Guide
To compile this program, run:
```bash
leo build
```
To run this program, run:
```bash
leo run
```

View File

@ -1,5 +1,5 @@
{
"program": "bubblesort_tuple.aleo",
"program": "bubblesort.aleo",
"version": "0.0.0",
"description": "",
"development": {

View File

@ -1,6 +1,13 @@
# core.aleo
# Leo core functions
## Build Guide
To compile this Aleo program, run:
To compile this program, run:
```bash
aleo build
leo build
```
To run this program, run:
```bash
leo run
```

View File

@ -1,6 +1,13 @@
# groups.aleo
# Leo group operations.
## Build Guide
To compile this Aleo program, run:
To compile this program, run:
```bash
aleo build
leo build
```
To run this program, run:
```bash
leo run
```

View File

@ -1,6 +1,13 @@
# helloworld.aleo
# Leo helloworld
## Build Guide
To compile this Aleo program, run:
To compile this program, run:
```bash
aleo build
leo build
```
To run this program, run:
```bash
leo run
```

View File

@ -0,0 +1,8 @@
circuit Foo {
x: u64,
y: u64,
}
function bar(x: u64, y: u64) -> Foo {
return Foo {x, y};
}

View File

@ -1,8 +1,7 @@
import foo.leo;
// The 'helloworld' main function.
function main(public a: u32, b: u32) -> u32 {
return a + b;
}
function foo(x: u64) -> u64 {
return x - x;
}

View File

@ -1,6 +1,14 @@
# message.aleo
# Leo message circuit
A basic example showing how to declare a circuit in the Leo language.
## Build Guide
To compile this Aleo program, run:
To compile this program, run:
```bash
aleo build
leo build
```
To run this program, run:
```bash
leo run
```

2
examples/point/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
outputs/
build/

14
examples/point/README.md Normal file
View File

@ -0,0 +1,14 @@
# Leo import example
An example showing how to import symbols from file `point.leo`.
## Build Guide
To compile this program, run:
```bash
leo build
```
To run this program, run:
```bash
leo run
```

View File

@ -0,0 +1,16 @@
// A (x, y) coordinate point
circuit Point {
x: u32,
y: u32,
}
function new(x: u32, y: u32) -> Point {
return Point {x, y};
}
function add(a: Point, b: Point) -> Point {
return Point {
x: a.x + b.x,
y: a.y + b.y,
}
}

View File

@ -0,0 +1,7 @@
// The program input for point/src/main.leo
[main]
public a: u32 = 1u32;
b: u32 = 2u32; // Input variable `b` is private by default.
[foo]
x: u64 = 5u64;

View File

@ -0,0 +1,10 @@
{
"program": "helloworld.aleo",
"version": "0.0.0",
"description": "",
"development": {
"private_key": "APrivateKey1zkpBvXdKZKaXXcLUnwAVFCQNp41jrX6JqTuJo1JShfPoRfx",
"address": "aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau"
},
"license": "MIT"
}

View File

@ -0,0 +1,8 @@
// Import the circuits and functions from `imports/point.leo`.
// In testnet3, Leo imports all symbols from a file by default.
import point.leo;
// The 'point' main function.
function main(public a: u32, b: u32) -> u32 {
return a + b;
}

View File

@ -1,8 +0,0 @@
# bubblesort_tuple.aleo
## Build Guide
To compile this Aleo program, run:
```bash
aleo build
```

View File

@ -1,6 +1,13 @@
# token.aleo
# token
## Build Guide
To compile this Aleo program, run:
To compile this program, run:
```bash
aleo build
leo build
```
To run this program, run:
```bash
leo run
```