diff --git a/examples/bubblesort/src/main.leo b/examples/bubblesort/src/main.leo index c04a4ffc38..cea3b988aa 100644 --- a/examples/bubblesort/src/main.leo +++ b/examples/bubblesort/src/main.leo @@ -16,6 +16,7 @@ // Note that the implementation below uses tuples instead of arrays. // The implementation also manually unrolls the loop. +@program function bubble_sort( arr0: u32, arr1: u32, diff --git a/examples/core/src/main.leo b/examples/core/src/main.leo index 5c8f69ed01..41dda2c694 100644 --- a/examples/core/src/main.leo +++ b/examples/core/src/main.leo @@ -2,6 +2,7 @@ // Core circuit functions are built-in to the Leo language and call handwritten, optimized circuits in the AVM. // To call a core circuit function, use the correct capitalized circuit identifier followed by two colons // and then the function. Example: `Pedersen64::hash()`. +@program function main(a: field) -> field { let b: field = BHP256::hash(a); let c: field = Poseidon2::hash(b); diff --git a/examples/groups/src/main.leo b/examples/groups/src/main.leo index 0ae3755555..6de733fecb 100644 --- a/examples/groups/src/main.leo +++ b/examples/groups/src/main.leo @@ -1,5 +1,7 @@ // This function takes a group coordinate as input `a` and performs several operations which should output the `0group`. // Note that the operations can be called as associated functions on the `a` variable. + +@program function main(a: group) -> group { // unary let e: group = a.double(); // 2a diff --git a/examples/helloworld/src/main.leo b/examples/helloworld/src/main.leo index a1f61ec20c..cca0070c39 100644 --- a/examples/helloworld/src/main.leo +++ b/examples/helloworld/src/main.leo @@ -1,7 +1,7 @@ import foo.leo; // The 'helloworld' main function. - +@program function main(public a: u32, b: u32) -> u32 { return a + b; } diff --git a/examples/import_point/src/main.leo b/examples/import_point/src/main.leo index 6196b6a09a..f3e306e86e 100644 --- a/examples/import_point/src/main.leo +++ b/examples/import_point/src/main.leo @@ -3,6 +3,7 @@ import point.leo; // The main function. +@program function main(public a: u32, b: u32) -> u32 { return a + b; } diff --git a/examples/message/src/main.leo b/examples/message/src/main.leo index 38d698af17..b4b522091b 100644 --- a/examples/message/src/main.leo +++ b/examples/message/src/main.leo @@ -11,6 +11,7 @@ circuit Message { // The "main" function of this Leo program takes a "Message" circuit type as input. // To see how to input variable "m" is passed in open up `inputs/message.in`. +@program function main(m: Message) -> field { // 1. Define the "Message" type. diff --git a/examples/token/src/main.leo b/examples/token/src/main.leo index a641e0e510..c0f1c1f24b 100644 --- a/examples/token/src/main.leo +++ b/examples/token/src/main.leo @@ -1,3 +1,6 @@ +// This example demonstrates an example of a minting and transferring a token in Leo. + +// The `Token` record datatype. record Token { // The token owner. owner: address, @@ -9,6 +12,7 @@ record Token { // The `mint` function initializes a new record with the // to the receiver of tokens in `r1` for the receiver in `r0`. +@program function mint(owner: address, amount: u64) -> Token { return Token { owner: owner, @@ -19,6 +23,7 @@ function mint(owner: address, amount: u64) -> Token { // The `transfer` function sends the specified number of tokens // to the receiver from the provided token record. +@program function transfer(token: Token, to: address, amount: u64) -> (Token, Token) { // Checks the given token record has sufficient balance.