diff --git a/auction/build/abi.json b/auction/build/abi.json deleted file mode 100644 index 6e32f60..0000000 --- a/auction/build/abi.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "program": "auction.aleo", - "structs": [], - "records": [ - { - "path": [ - "Bid" - ], - "fields": [ - { - "name": "owner", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "bidder", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - }, - { - "name": "is_winner", - "ty": { - "Primitive": "Boolean" - }, - "mode": "None" - } - ] - } - ], - "mappings": [], - "storage_variables": [], - "functions": [ - { - "name": "place_bid", - "is_final": false, - "inputs": [ - { - "name": "bidder", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Bid" - ], - "program": "auction.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "resolve", - "is_final": false, - "inputs": [ - { - "name": "first", - "ty": { - "Record": { - "path": [ - "Bid" - ], - "program": "auction.aleo" - } - }, - "mode": "None" - }, - { - "name": "second", - "ty": { - "Record": { - "path": [ - "Bid" - ], - "program": "auction.aleo" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Bid" - ], - "program": "auction.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "finish", - "is_final": false, - "inputs": [ - { - "name": "bid", - "ty": { - "Record": { - "path": [ - "Bid" - ], - "program": "auction.aleo" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Bid" - ], - "program": "auction.aleo" - } - }, - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/auction/build/auction/abi.json b/auction/build/auction/abi.json new file mode 100644 index 0000000..21280df --- /dev/null +++ b/auction/build/auction/abi.json @@ -0,0 +1,134 @@ +{ + "program": "auction.aleo", + "structs": [], + "records": [ + { + "path": [ + "Bid" + ], + "fields": [ + { + "name": "owner", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, + { + "name": "bidder", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, + { + "name": "amount", + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + }, + { + "name": "is_winner", + "ty": { + "Primitive": "Boolean" + }, + "mode": "Private" + } + ] + } + ], + "mappings": [], + "storage_variables": [], + "functions": [ + { + "name": "place_bid", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Bid" + ], + "program": "auction.aleo" + } + } + ] + }, + { + "name": "resolve", + "inputs": [ + { + "Record": { + "path": [ + "Bid" + ], + "program": "auction.aleo" + } + }, + { + "Record": { + "path": [ + "Bid" + ], + "program": "auction.aleo" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Bid" + ], + "program": "auction.aleo" + } + } + ] + }, + { + "name": "finish", + "inputs": [ + { + "Record": { + "path": [ + "Bid" + ], + "program": "auction.aleo" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Bid" + ], + "program": "auction.aleo" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/auction/build/main.aleo b/auction/build/auction/auction.aleo similarity index 100% rename from auction/build/main.aleo rename to auction/build/auction/auction.aleo diff --git a/auction/build/program.json b/auction/build/program.json deleted file mode 100644 index c15b3f8..0000000 --- a/auction/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "auction.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/auction/leo.lock b/auction/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/auction/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/auction/src/main.leo b/auction/src/main.leo index 31fe0d3..c6c6753 100644 --- a/auction/src/main.leo +++ b/auction/src/main.leo @@ -20,7 +20,7 @@ program auction.aleo { // The address of the auction runner is aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg. fn place_bid(bidder: address, amount: u64) -> Bid { // Ensure the caller is the auction bidder. - assert_eq(self.caller, bidder); + assert_eq(std::ctx::caller(), bidder); // Return a new 'Bid' record for the auction bidder. return Bid { owner: aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg, @@ -38,7 +38,7 @@ program auction.aleo { // In the event of a tie, the first bid is selected. fn resolve(first: Bid, second: Bid) -> Bid { // Ensure the caller is the auctioneer. - assert_eq(self.caller, aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg); + assert_eq(std::ctx::caller(), aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg); // Resolve the winner of the auction. if (first.amount >= second.amount) { return first; @@ -53,7 +53,7 @@ program auction.aleo { // Assumes that the function is invoked only after all bids have been resolved. fn finish(bid: Bid) -> Bid { // Ensure the caller is the auctioneer. - assert_eq(self.caller, aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg); + assert_eq(std::ctx::caller(), aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg); // Return 'is_winner' as 'true' in the winning 'Bid'. return Bid { owner: bid.bidder, diff --git a/basic_bank/build/abi.json b/basic_bank/build/abi.json deleted file mode 100644 index ff0d11a..0000000 --- a/basic_bank/build/abi.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "program": "basic_bank.aleo", - "structs": [], - "records": [ - { - "path": [ - "Token" - ], - "fields": [ - { - "name": "owner", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - } - ] - } - ], - "mappings": [ - { - "name": "balances", - "key": { - "Primitive": "Field" - }, - "value": { - "Primitive": { - "UInt": "U64" - } - } - } - ], - "storage_variables": [], - "functions": [ - { - "name": "issue", - "is_final": false, - "inputs": [ - { - "name": "owner", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "basic_bank.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "deposit", - "is_final": true, - "inputs": [ - { - "name": "token", - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "basic_bank.aleo" - } - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "basic_bank.aleo" - } - }, - "mode": "None" - }, - { - "ty": "Final", - "mode": "None" - } - ] - }, - { - "name": "withdraw", - "is_final": true, - "inputs": [ - { - "name": "recipient", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "rate", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "periods", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "basic_bank.aleo" - } - }, - "mode": "None" - }, - { - "ty": "Final", - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/basic_bank/build/basic_bank/abi.json b/basic_bank/build/basic_bank/abi.json new file mode 100644 index 0000000..adad8b4 --- /dev/null +++ b/basic_bank/build/basic_bank/abi.json @@ -0,0 +1,166 @@ +{ + "program": "basic_bank.aleo", + "structs": [], + "records": [ + { + "path": [ + "Token" + ], + "fields": [ + { + "name": "owner", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, + { + "name": "amount", + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + ] + } + ], + "mappings": [ + { + "name": "balances", + "key": { + "Primitive": "Field" + }, + "value": { + "Primitive": { + "UInt": "U64" + } + } + } + ], + "storage_variables": [], + "functions": [ + { + "name": "issue", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "basic_bank.aleo" + } + } + ] + }, + { + "name": "deposit", + "inputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "basic_bank.aleo" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "basic_bank.aleo" + } + }, + "Final" + ] + }, + { + "name": "withdraw", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "basic_bank.aleo" + } + }, + "Final" + ] + } + ] +} \ No newline at end of file diff --git a/basic_bank/build/main.aleo b/basic_bank/build/basic_bank/basic_bank.aleo similarity index 100% rename from basic_bank/build/main.aleo rename to basic_bank/build/basic_bank/basic_bank.aleo diff --git a/basic_bank/build/program.json b/basic_bank/build/program.json deleted file mode 100644 index b2dafd4..0000000 --- a/basic_bank/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "basic_bank.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/basic_bank/leo.lock b/basic_bank/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/basic_bank/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/basic_bank/src/main.leo b/basic_bank/src/main.leo index f3fa1c8..593c112 100644 --- a/basic_bank/src/main.leo +++ b/basic_bank/src/main.leo @@ -17,7 +17,7 @@ program basic_bank.aleo { // Requires that the function caller is the bank. // The bank's address is aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px. fn issue(owner: address, amount: u64) -> Token { - assert_eq(self.caller, aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px); + assert_eq(std::ctx::caller(), aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px); return Token { owner: owner, amount: amount, @@ -57,7 +57,7 @@ program basic_bank.aleo { // - `periods` : The number of periods to compound the interest over. // Requires that the function caller is the bank. fn withdraw(recipient: address, amount: u64, rate: u64, periods: u64) -> (Token, Final) { - assert_eq(self.caller, aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px); + assert_eq(std::ctx::caller(), aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px); let hash: field = BHP256::hash_to_field(recipient); let total: u64 = calculate_interest(amount, rate, periods); diff --git a/battleship/board/build/abi.json b/battleship/board/build/abi.json deleted file mode 100644 index c3c4cf2..0000000 --- a/battleship/board/build/abi.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "program": "board.aleo", - "structs": [], - "records": [ - { - "path": [ - "BoardState" - ], - "fields": [ - { - "name": "owner", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "hits_and_misses", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - }, - { - "name": "played_tiles", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - }, - { - "name": "ships", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - }, - { - "name": "player_1", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "player_2", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "game_started", - "ty": { - "Primitive": "Boolean" - }, - "mode": "None" - } - ] - } - ], - "mappings": [], - "storage_variables": [], - "functions": [ - { - "name": "new_board_state", - "is_final": false, - "inputs": [ - { - "name": "ships", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "opponent", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "start_board", - "is_final": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "update_played_tiles", - "is_final": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - }, - { - "name": "shoot", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "update_hits_and_misses", - "is_final": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - }, - { - "name": "hit_or_miss", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/battleship/board/build/board/abi.json b/battleship/board/build/board/abi.json new file mode 100644 index 0000000..d3ebb01 --- /dev/null +++ b/battleship/board/build/board/abi.json @@ -0,0 +1,194 @@ +{ + "program": "board.aleo", + "structs": [], + "records": [ + { + "path": [ + "BoardState" + ], + "fields": [ + { + "name": "owner", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, + { + "name": "hits_and_misses", + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + }, + { + "name": "played_tiles", + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + }, + { + "name": "ships", + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + }, + { + "name": "player_1", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, + { + "name": "player_2", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, + { + "name": "game_started", + "ty": { + "Primitive": "Boolean" + }, + "mode": "Private" + } + ] + } + ], + "mappings": [], + "storage_variables": [], + "functions": [ + { + "name": "new_board_state", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ] + }, + { + "name": "start_board", + "inputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ] + }, + { + "name": "update_played_tiles", + "inputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ] + }, + { + "name": "update_hits_and_misses", + "inputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/battleship/build/imports/board.aleo b/battleship/board/build/board/board.aleo similarity index 100% rename from battleship/build/imports/board.aleo rename to battleship/board/build/board/board.aleo diff --git a/battleship/board/build/program.json b/battleship/board/build/program.json deleted file mode 100644 index 02a617d..0000000 --- a/battleship/board/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "board.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/battleship/board/leo.lock b/battleship/board/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/battleship/board/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/battleship/board/src/main.leo b/battleship/board/src/main.leo index db7e6d2..d4a099a 100644 --- a/battleship/board/src/main.leo +++ b/battleship/board/src/main.leo @@ -25,11 +25,11 @@ program board.aleo { opponent: address, ) -> BoardState { return BoardState { - owner: self.caller, + owner: std::ctx::caller(), hits_and_misses: 0u64, played_tiles: 0u64, ships, - player_1: self.caller, + player_1: std::ctx::caller(), player_2: opponent, game_started: false, }; diff --git a/battleship/build/abi.json b/battleship/build/abi.json deleted file mode 100644 index 8c21d6d..0000000 --- a/battleship/build/abi.json +++ /dev/null @@ -1,242 +0,0 @@ -{ - "program": "battleship.aleo", - "structs": [], - "records": [], - "mappings": [], - "storage_variables": [], - "functions": [ - { - "name": "initialize_board", - "is_final": false, - "inputs": [ - { - "name": "carrier", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "battleship", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "cruiser", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "destroyer", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "player", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "offer_battleship", - "is_final": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - }, - { - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "start_battleship", - "is_final": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - }, - { - "name": "move_start", - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move.aleo" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - }, - { - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "play", - "is_final": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - }, - { - "name": "move_incoming", - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move.aleo" - } - }, - "mode": "None" - }, - { - "name": "shoot", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - }, - { - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move.aleo" - } - }, - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/battleship/build/battleship/abi.json b/battleship/build/battleship/abi.json new file mode 100644 index 0000000..82f3fc2 --- /dev/null +++ b/battleship/build/battleship/abi.json @@ -0,0 +1,191 @@ +{ + "program": "battleship.aleo", + "structs": [], + "records": [], + "mappings": [], + "storage_variables": [], + "functions": [ + { + "name": "initialize_board", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ] + }, + { + "name": "offer_battleship", + "inputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + }, + { + "Record": { + "path": [ + "Move" + ], + "program": "move.aleo" + } + } + ] + }, + { + "name": "start_battleship", + "inputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + }, + { + "Record": { + "path": [ + "Move" + ], + "program": "move.aleo" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + }, + { + "Record": { + "path": [ + "Move" + ], + "program": "move.aleo" + } + } + ] + }, + { + "name": "play", + "inputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + }, + { + "Record": { + "path": [ + "Move" + ], + "program": "move.aleo" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + }, + { + "Record": { + "path": [ + "Move" + ], + "program": "move.aleo" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/battleship/build/main.aleo b/battleship/build/battleship/battleship.aleo similarity index 100% rename from battleship/build/main.aleo rename to battleship/build/battleship/battleship.aleo diff --git a/battleship/build/board/abi.json b/battleship/build/board/abi.json new file mode 100644 index 0000000..d3ebb01 --- /dev/null +++ b/battleship/build/board/abi.json @@ -0,0 +1,194 @@ +{ + "program": "board.aleo", + "structs": [], + "records": [ + { + "path": [ + "BoardState" + ], + "fields": [ + { + "name": "owner", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, + { + "name": "hits_and_misses", + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + }, + { + "name": "played_tiles", + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + }, + { + "name": "ships", + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + }, + { + "name": "player_1", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, + { + "name": "player_2", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, + { + "name": "game_started", + "ty": { + "Primitive": "Boolean" + }, + "mode": "Private" + } + ] + } + ], + "mappings": [], + "storage_variables": [], + "functions": [ + { + "name": "new_board_state", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ] + }, + { + "name": "start_board", + "inputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ] + }, + { + "name": "update_played_tiles", + "inputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ] + }, + { + "name": "update_hits_and_misses", + "inputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "BoardState" + ], + "program": "board.aleo" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/battleship/board/build/main.aleo b/battleship/build/board/board.aleo similarity index 100% rename from battleship/board/build/main.aleo rename to battleship/build/board/board.aleo diff --git a/battleship/build/imports/board.abi.json b/battleship/build/imports/board.abi.json deleted file mode 100644 index fd2a135..0000000 --- a/battleship/build/imports/board.abi.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "program": "board.aleo", - "structs": [], - "records": [ - { - "path": [ - "BoardState" - ], - "fields": [ - { - "name": "owner", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "hits_and_misses", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - }, - { - "name": "played_tiles", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - }, - { - "name": "ships", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - }, - { - "name": "player_1", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "player_2", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "game_started", - "ty": { - "Primitive": "Boolean" - }, - "mode": "None" - } - ] - } - ], - "mappings": [], - "storage_variables": [], - "transitions": [ - { - "name": "new_board_state", - "is_async": false, - "inputs": [ - { - "name": "ships", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "opponent", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board" - } - }, - "mode": "None" - } - ] - }, - { - "name": "start_board", - "is_async": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board" - } - }, - "mode": "None" - } - ] - }, - { - "name": "update_played_tiles", - "is_async": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board" - } - }, - "mode": "None" - }, - { - "name": "shoot", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board" - } - }, - "mode": "None" - } - ] - }, - { - "name": "update_hits_and_misses", - "is_async": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board" - } - }, - "mode": "None" - }, - { - "name": "hit_or_miss", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board" - } - }, - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/battleship/build/imports/board.aleo.abi.json b/battleship/build/imports/board.aleo.abi.json deleted file mode 100644 index c3c4cf2..0000000 --- a/battleship/build/imports/board.aleo.abi.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "program": "board.aleo", - "structs": [], - "records": [ - { - "path": [ - "BoardState" - ], - "fields": [ - { - "name": "owner", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "hits_and_misses", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - }, - { - "name": "played_tiles", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - }, - { - "name": "ships", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - }, - { - "name": "player_1", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "player_2", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "game_started", - "ty": { - "Primitive": "Boolean" - }, - "mode": "None" - } - ] - } - ], - "mappings": [], - "storage_variables": [], - "functions": [ - { - "name": "new_board_state", - "is_final": false, - "inputs": [ - { - "name": "ships", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "opponent", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "start_board", - "is_final": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "update_played_tiles", - "is_final": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - }, - { - "name": "shoot", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "update_hits_and_misses", - "is_final": false, - "inputs": [ - { - "name": "board", - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - }, - { - "name": "hit_or_miss", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "BoardState" - ], - "program": "board.aleo" - } - }, - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/battleship/build/imports/move.abi.json b/battleship/build/imports/move.abi.json deleted file mode 100644 index 4347b32..0000000 --- a/battleship/build/imports/move.abi.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "program": "move.aleo", - "structs": [], - "records": [ - { - "path": [ - "Move" - ], - "fields": [ - { - "name": "owner", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "incoming_fire_coordinate", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - }, - { - "name": "player_1", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "player_2", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "prev_hit_or_miss", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - } - ] - } - ], - "mappings": [], - "storage_variables": [], - "transitions": [ - { - "name": "create_move", - "is_async": false, - "inputs": [ - { - "name": "move_record", - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move" - } - }, - "mode": "None" - }, - { - "name": "incoming_fire_coordinate", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "prev_hit_or_miss", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move" - } - }, - "mode": "None" - } - ] - }, - { - "name": "start_game", - "is_async": false, - "inputs": [ - { - "name": "player_2", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move" - } - }, - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/battleship/build/imports/verify.abi.json b/battleship/build/imports/verify.abi.json deleted file mode 100644 index b7bdba6..0000000 --- a/battleship/build/imports/verify.abi.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "program": "verify.aleo", - "structs": [], - "records": [], - "mappings": [], - "storage_variables": [], - "transitions": [ - { - "name": "validate_ship", - "is_async": false, - "inputs": [ - { - "name": "ship", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "length", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "horizontal", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "vertical", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Plaintext": { - "Primitive": "Boolean" - } - }, - "mode": "None" - } - ] - }, - { - "name": "create_board", - "is_async": false, - "inputs": [ - { - "name": "carrier", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "battleship", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "cruiser", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "destroyer", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/battleship/build/imports/verify.aleo.abi.json b/battleship/build/imports/verify.aleo.abi.json deleted file mode 100644 index 20fb3bb..0000000 --- a/battleship/build/imports/verify.aleo.abi.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "program": "verify.aleo", - "structs": [], - "records": [], - "mappings": [], - "storage_variables": [], - "functions": [ - { - "name": "validate_ship", - "is_final": false, - "inputs": [ - { - "name": "ship", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "length", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "horizontal", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "vertical", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Plaintext": { - "Primitive": "Boolean" - } - }, - "mode": "None" - } - ] - }, - { - "name": "create_board", - "is_final": false, - "inputs": [ - { - "name": "carrier", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "battleship", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "cruiser", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "destroyer", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/battleship/move/build/abi.json b/battleship/build/move/abi.json similarity index 53% rename from battleship/move/build/abi.json rename to battleship/build/move/abi.json index 9b23d0a..c7da197 100644 --- a/battleship/move/build/abi.json +++ b/battleship/build/move/abi.json @@ -12,7 +12,7 @@ "ty": { "Primitive": "Address" }, - "mode": "None" + "mode": "Private" }, { "name": "incoming_fire_coordinate", @@ -21,21 +21,21 @@ "UInt": "U64" } }, - "mode": "None" + "mode": "Private" }, { "name": "player_1", "ty": { "Primitive": "Address" }, - "mode": "None" + "mode": "Private" }, { "name": "player_2", "ty": { "Primitive": "Address" }, - "mode": "None" + "mode": "Private" }, { "name": "prev_hit_or_miss", @@ -44,7 +44,7 @@ "UInt": "U64" } }, - "mode": "None" + "mode": "Private" } ] } @@ -52,84 +52,69 @@ "mappings": [], "storage_variables": [], "functions": [ + { + "name": "start_game", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Move" + ], + "program": "move.aleo" + } + } + ] + }, { "name": "create_move", - "is_final": false, "inputs": [ { - "name": "move_record", - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move.aleo" - } - }, - "mode": "None" + "Record": { + "path": [ + "Move" + ], + "program": "move.aleo" + } }, { - "name": "incoming_fire_coordinate", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U64" } - } - }, - "mode": "None" + }, + "mode": "Private" + } }, { - "name": "prev_hit_or_miss", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U64" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "start_game", - "is_final": false, - "inputs": [ - { - "name": "player_2", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move.aleo" - } - }, - "mode": "None" + "Record": { + "path": [ + "Move" + ], + "program": "move.aleo" + } } ] } diff --git a/battleship/move/build/main.aleo b/battleship/build/move/move.aleo similarity index 100% rename from battleship/move/build/main.aleo rename to battleship/build/move/move.aleo index e78466c..0e552ab 100644 --- a/battleship/move/build/main.aleo +++ b/battleship/build/move/move.aleo @@ -7,6 +7,11 @@ record Move: player_2 as address.private; prev_hit_or_miss as u64.private; +function start_game: + input r0 as address.private; + cast r0 0u64 self.caller r0 0u64 into r1 as Move.record; + output r1 as Move.record; + function create_move: input r0 as Move.record; input r1 as u64.private; @@ -16,10 +21,5 @@ function create_move: cast r4 r1 r0.player_2 r0.player_1 r2 into r5 as Move.record; output r5 as Move.record; -function start_game: - input r0 as address.private; - cast r0 0u64 self.caller r0 0u64 into r1 as Move.record; - output r1 as Move.record; - constructor: assert.eq edition 0u16; diff --git a/battleship/build/program.json b/battleship/build/program.json deleted file mode 100644 index 5fdff53..0000000 --- a/battleship/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "battleship.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/battleship/build/verify/abi.json b/battleship/build/verify/abi.json new file mode 100644 index 0000000..b61953c --- /dev/null +++ b/battleship/build/verify/abi.json @@ -0,0 +1,121 @@ +{ + "program": "verify.aleo", + "structs": [], + "records": [], + "mappings": [], + "storage_variables": [], + "functions": [ + { + "name": "validate_ship", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Boolean" + }, + "mode": "Private" + } + } + ] + }, + { + "name": "create_board", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/battleship/verify/build/main.aleo b/battleship/build/verify/verify.aleo similarity index 100% rename from battleship/verify/build/main.aleo rename to battleship/build/verify/verify.aleo index e59cc57..9b1e782 100644 --- a/battleship/verify/build/main.aleo +++ b/battleship/build/verify/verify.aleo @@ -1,33 +1,5 @@ program verify.aleo; -closure bitcount: - input r0 as u64; - div r0 2u64 into r1; - div r0 4u64 into r2; - div r0 8u64 into r3; - and r1 8608480567731124087u64 into r4; - and r2 3689348814741910323u64 into r5; - and r3 1229782938247303441u64 into r6; - sub r0 r4 into r7; - sub r7 r5 into r8; - sub r8 r6 into r9; - div r9 16u64 into r10; - add r9 r10 into r11; - and r11 1085102592571150095u64 into r12; - rem r12 255u64 into r13; - output r13 as u64; - -closure adjacency_check: - input r0 as u64; - input r1 as u64; - div r0 r1 into r2; - is.eq r2 0u64 into r3; - ternary r3 3u64 r2 into r4; - sub r4 1u64 into r5; - and r5 r4 into r6; - is.eq r6 0u64 into r7; - output r7 as boolean; - function validate_ship: input r0 as u64.private; input r1 as u64.private; @@ -60,5 +32,33 @@ function create_board: assert.eq r7 14u64; output r6 as u64.private; +closure bitcount: + input r0 as u64; + div r0 2u64 into r1; + div r0 4u64 into r2; + div r0 8u64 into r3; + and r1 8608480567731124087u64 into r4; + and r2 3689348814741910323u64 into r5; + and r3 1229782938247303441u64 into r6; + sub r0 r4 into r7; + sub r7 r5 into r8; + sub r8 r6 into r9; + div r9 16u64 into r10; + add r9 r10 into r11; + and r11 1085102592571150095u64 into r12; + rem r12 255u64 into r13; + output r13 as u64; + +closure adjacency_check: + input r0 as u64; + input r1 as u64; + div r0 r1 into r2; + is.eq r2 0u64 into r3; + ternary r3 3u64 r2 into r4; + sub r4 1u64 into r5; + and r5 r4 into r6; + is.eq r6 0u64 into r7; + output r7 as boolean; + constructor: assert.eq edition 0u16; diff --git a/battleship/build/imports/move.aleo.abi.json b/battleship/move/build/move/abi.json similarity index 53% rename from battleship/build/imports/move.aleo.abi.json rename to battleship/move/build/move/abi.json index 9b23d0a..8202618 100644 --- a/battleship/build/imports/move.aleo.abi.json +++ b/battleship/move/build/move/abi.json @@ -12,7 +12,7 @@ "ty": { "Primitive": "Address" }, - "mode": "None" + "mode": "Private" }, { "name": "incoming_fire_coordinate", @@ -21,21 +21,21 @@ "UInt": "U64" } }, - "mode": "None" + "mode": "Private" }, { "name": "player_1", "ty": { "Primitive": "Address" }, - "mode": "None" + "mode": "Private" }, { "name": "player_2", "ty": { "Primitive": "Address" }, - "mode": "None" + "mode": "Private" }, { "name": "prev_hit_or_miss", @@ -44,7 +44,7 @@ "UInt": "U64" } }, - "mode": "None" + "mode": "Private" } ] } @@ -54,82 +54,67 @@ "functions": [ { "name": "create_move", - "is_final": false, "inputs": [ { - "name": "move_record", - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move.aleo" - } - }, - "mode": "None" + "Record": { + "path": [ + "Move" + ], + "program": "move.aleo" + } }, { - "name": "incoming_fire_coordinate", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U64" } - } - }, - "mode": "None" + }, + "mode": "Private" + } }, { - "name": "prev_hit_or_miss", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U64" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move.aleo" - } - }, - "mode": "None" + "Record": { + "path": [ + "Move" + ], + "program": "move.aleo" + } } ] }, { "name": "start_game", - "is_final": false, "inputs": [ { - "name": "player_2", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Address" - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Record": { - "path": [ - "Move" - ], - "program": "move.aleo" - } - }, - "mode": "None" + "Record": { + "path": [ + "Move" + ], + "program": "move.aleo" + } } ] } diff --git a/battleship/build/imports/move.aleo b/battleship/move/build/move/move.aleo similarity index 100% rename from battleship/build/imports/move.aleo rename to battleship/move/build/move/move.aleo diff --git a/battleship/move/build/program.json b/battleship/move/build/program.json deleted file mode 100644 index 536455c..0000000 --- a/battleship/move/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "move.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/battleship/move/leo.lock b/battleship/move/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/battleship/move/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/battleship/move/src/main.leo b/battleship/move/src/main.leo index 27d7805..f1c0ffd 100644 --- a/battleship/move/src/main.leo +++ b/battleship/move/src/main.leo @@ -36,7 +36,7 @@ program move.aleo { return Move { owner: player_2, incoming_fire_coordinate: 0u64, - player_1: self.caller, + player_1: std::ctx::caller(), player_2: player_2, prev_hit_or_miss: 0u64, }; diff --git a/battleship/verify/build/abi.json b/battleship/verify/build/abi.json deleted file mode 100644 index 20fb3bb..0000000 --- a/battleship/verify/build/abi.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "program": "verify.aleo", - "structs": [], - "records": [], - "mappings": [], - "storage_variables": [], - "functions": [ - { - "name": "validate_ship", - "is_final": false, - "inputs": [ - { - "name": "ship", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "length", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "horizontal", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "vertical", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Plaintext": { - "Primitive": "Boolean" - } - }, - "mode": "None" - } - ] - }, - { - "name": "create_board", - "is_final": false, - "inputs": [ - { - "name": "carrier", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "battleship", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "cruiser", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - }, - { - "name": "destroyer", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/battleship/verify/build/program.json b/battleship/verify/build/program.json deleted file mode 100644 index fb2cbe9..0000000 --- a/battleship/verify/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "verify.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/battleship/verify/build/verify/abi.json b/battleship/verify/build/verify/abi.json new file mode 100644 index 0000000..b61953c --- /dev/null +++ b/battleship/verify/build/verify/abi.json @@ -0,0 +1,121 @@ +{ + "program": "verify.aleo", + "structs": [], + "records": [], + "mappings": [], + "storage_variables": [], + "functions": [ + { + "name": "validate_ship", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Boolean" + }, + "mode": "Private" + } + } + ] + }, + { + "name": "create_board", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/battleship/build/imports/verify.aleo b/battleship/verify/build/verify/verify.aleo similarity index 100% rename from battleship/build/imports/verify.aleo rename to battleship/verify/build/verify/verify.aleo diff --git a/battleship/verify/leo.lock b/battleship/verify/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/battleship/verify/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/bubblesort/build/abi.json b/bubblesort/build/bubblesort/abi.json similarity index 73% rename from bubblesort/build/abi.json rename to bubblesort/build/bubblesort/abi.json index f65490a..029ee9d 100644 --- a/bubblesort/build/abi.json +++ b/bubblesort/build/bubblesort/abi.json @@ -7,12 +7,10 @@ "functions": [ { "name": "bubble_sort", - "is_final": false, "inputs": [ { - "name": "xs", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Array": { "element": { "Primitive": { @@ -21,15 +19,15 @@ }, "length": 8 } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Array": { "element": { "Primitive": { @@ -38,9 +36,9 @@ }, "length": 8 } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/bubblesort/build/main.aleo b/bubblesort/build/bubblesort/bubblesort.aleo similarity index 100% rename from bubblesort/build/main.aleo rename to bubblesort/build/bubblesort/bubblesort.aleo diff --git a/bubblesort/build/program.json b/bubblesort/build/program.json deleted file mode 100644 index 7efa6c8..0000000 --- a/bubblesort/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "bubblesort.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/bubblesort/leo.lock b/bubblesort/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/bubblesort/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/core/build/abi.json b/core/build/core/abi.json similarity index 57% rename from core/build/abi.json rename to core/build/core/abi.json index 6da596b..207d901 100644 --- a/core/build/abi.json +++ b/core/build/core/abi.json @@ -7,26 +7,24 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "a", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Field" - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Field" - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/core/build/main.aleo b/core/build/core/core.aleo similarity index 100% rename from core/build/main.aleo rename to core/build/core/core.aleo diff --git a/core/build/program.json b/core/build/program.json deleted file mode 100644 index 914e89f..0000000 --- a/core/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "core.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/core/leo.lock b/core/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/core/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/example_with_test/build/abi.json b/example_with_test/build/example_program/abi.json similarity index 56% rename from example_with_test/build/abi.json rename to example_with_test/build/example_program/abi.json index b2f4f50..33d4f31 100644 --- a/example_with_test/build/abi.json +++ b/example_with_test/build/example_program/abi.json @@ -12,14 +12,14 @@ "ty": { "Primitive": "Address" }, - "mode": "None" + "mode": "Private" }, { "name": "x", "ty": { "Primitive": "Field" }, - "mode": "None" + "mode": "Private" } ] } @@ -39,91 +39,78 @@ "functions": [ { "name": "simple_addition", - "is_final": false, "inputs": [ { - "name": "a", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } }, { - "name": "b", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] }, { "name": "mint_record", - "is_final": false, "inputs": [ { - "name": "x", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Field" - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Record": { - "path": [ - "Example" - ], - "program": "example_program.aleo" - } - }, - "mode": "None" + "Record": { + "path": [ + "Example" + ], + "program": "example_program.aleo" + } } ] }, { "name": "set_mapping", - "is_final": true, "inputs": [ { - "name": "x", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Field" - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ - { - "ty": "Final", - "mode": "None" - } + "Final" ] } ] diff --git a/example_with_test/build/main.aleo b/example_with_test/build/example_program/example_program.aleo similarity index 100% rename from example_with_test/build/main.aleo rename to example_with_test/build/example_program/example_program.aleo diff --git a/example_with_test/build/imports/test_example_program.aleo b/example_with_test/build/imports/test_example_program.aleo deleted file mode 100644 index 61c64ea..0000000 --- a/example_with_test/build/imports/test_example_program.aleo +++ /dev/null @@ -1,14 +0,0 @@ -import example_program.aleo; -program test_example_program.aleo; - -function test_simple_addition_fail: - call example_program.aleo/simple_addition 2u32 3u32 into r0; - assert.eq r0 3u32; - -function test_simple_addition: - call example_program.aleo/simple_addition 2u32 3u32 into r0; - assert.eq r0 5u32; - -function test_record_maker: - call example_program.aleo/mint_record 0field into r0; - assert.eq r0.x 0field; diff --git a/example_with_test/build/program.json b/example_with_test/build/program.json deleted file mode 100644 index 0c4ac1e..0000000 --- a/example_with_test/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "example_program.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/example_with_test/main.leo b/example_with_test/main.leo index 169f8b5..0bc126d 100644 --- a/example_with_test/main.leo +++ b/example_with_test/main.leo @@ -13,7 +13,7 @@ program example_program.aleo { fn mint_record(x: field) -> Example { return Example { - owner: self.signer, + owner: std::ctx::signer(), x, }; } diff --git a/example_with_test/src/main.leo b/example_with_test/src/main.leo index 252cbaa..ebce0d3 100644 --- a/example_with_test/src/main.leo +++ b/example_with_test/src/main.leo @@ -14,7 +14,7 @@ program example_program.aleo { fn mint_record(x: field) -> Example { return Example { - owner: self.signer, + owner: std::ctx::signer(), x, }; } diff --git a/fibonacci/build/abi.json b/fibonacci/build/fibonacci/abi.json similarity index 63% rename from fibonacci/build/abi.json rename to fibonacci/build/fibonacci/abi.json index abd0fac..05f61cb 100644 --- a/fibonacci/build/abi.json +++ b/fibonacci/build/fibonacci/abi.json @@ -7,30 +7,28 @@ "functions": [ { "name": "fibonacci", - "is_final": false, "inputs": [ { - "name": "n", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U128" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/fibonacci/build/main.aleo b/fibonacci/build/fibonacci/fibonacci.aleo similarity index 100% rename from fibonacci/build/main.aleo rename to fibonacci/build/fibonacci/fibonacci.aleo diff --git a/fibonacci/build/program.json b/fibonacci/build/program.json deleted file mode 100644 index b007389..0000000 --- a/fibonacci/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "fibonacci.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/fibonacci/leo.lock b/fibonacci/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/fibonacci/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/groups/build/abi.json b/groups/build/groups/abi.json similarity index 57% rename from groups/build/abi.json rename to groups/build/groups/abi.json index 08ddf2f..14f1aab 100644 --- a/groups/build/abi.json +++ b/groups/build/groups/abi.json @@ -7,26 +7,24 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "a", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Group" - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Group" - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/groups/build/main.aleo b/groups/build/groups/groups.aleo similarity index 100% rename from groups/build/main.aleo rename to groups/build/groups/groups.aleo diff --git a/groups/build/program.json b/groups/build/program.json deleted file mode 100644 index a2ba706..0000000 --- a/groups/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "groups.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/groups/leo.lock b/groups/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/groups/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/hackers-delight/ntzdebruijn/build/abi.json b/hackers-delight/ntzdebruijn/build/ntzdebruijn/abi.json similarity index 62% rename from hackers-delight/ntzdebruijn/build/abi.json rename to hackers-delight/ntzdebruijn/build/ntzdebruijn/abi.json index 0449efc..9a1a71e 100644 --- a/hackers-delight/ntzdebruijn/build/abi.json +++ b/hackers-delight/ntzdebruijn/build/ntzdebruijn/abi.json @@ -7,30 +7,28 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "x", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/hackers-delight/ntzdebruijn/build/main.aleo b/hackers-delight/ntzdebruijn/build/ntzdebruijn/ntzdebruijn.aleo similarity index 100% rename from hackers-delight/ntzdebruijn/build/main.aleo rename to hackers-delight/ntzdebruijn/build/ntzdebruijn/ntzdebruijn.aleo diff --git a/hackers-delight/ntzdebruijn/build/program.json b/hackers-delight/ntzdebruijn/build/program.json deleted file mode 100644 index 45c3aab..0000000 --- a/hackers-delight/ntzdebruijn/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "ntzdebruijn.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/hackers-delight/ntzdebruijn/leo.lock b/hackers-delight/ntzdebruijn/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/hackers-delight/ntzdebruijn/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/hackers-delight/ntzgaudet/build/abi.json b/hackers-delight/ntzgaudet/build/ntzgaudet/abi.json similarity index 62% rename from hackers-delight/ntzgaudet/build/abi.json rename to hackers-delight/ntzgaudet/build/ntzgaudet/abi.json index 7c6d6ba..d16efd4 100644 --- a/hackers-delight/ntzgaudet/build/abi.json +++ b/hackers-delight/ntzgaudet/build/ntzgaudet/abi.json @@ -7,30 +7,28 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "x", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/hackers-delight/ntzgaudet/build/main.aleo b/hackers-delight/ntzgaudet/build/ntzgaudet/ntzgaudet.aleo similarity index 100% rename from hackers-delight/ntzgaudet/build/main.aleo rename to hackers-delight/ntzgaudet/build/ntzgaudet/ntzgaudet.aleo diff --git a/hackers-delight/ntzgaudet/build/program.json b/hackers-delight/ntzgaudet/build/program.json deleted file mode 100644 index a8cc983..0000000 --- a/hackers-delight/ntzgaudet/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "ntzgaudet.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/hackers-delight/ntzgaudet/leo.lock b/hackers-delight/ntzgaudet/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/hackers-delight/ntzgaudet/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/hackers-delight/ntzloops/build/abi.json b/hackers-delight/ntzloops/build/ntzloops/abi.json similarity index 62% rename from hackers-delight/ntzloops/build/abi.json rename to hackers-delight/ntzloops/build/ntzloops/abi.json index 71dc0b8..a221c32 100644 --- a/hackers-delight/ntzloops/build/abi.json +++ b/hackers-delight/ntzloops/build/ntzloops/abi.json @@ -7,30 +7,28 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "x", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/hackers-delight/ntzloops/build/main.aleo b/hackers-delight/ntzloops/build/ntzloops/ntzloops.aleo similarity index 100% rename from hackers-delight/ntzloops/build/main.aleo rename to hackers-delight/ntzloops/build/ntzloops/ntzloops.aleo diff --git a/hackers-delight/ntzloops/build/program.json b/hackers-delight/ntzloops/build/program.json deleted file mode 100644 index 842e163..0000000 --- a/hackers-delight/ntzloops/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "ntzloops.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/hackers-delight/ntzloops/leo.lock b/hackers-delight/ntzloops/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/hackers-delight/ntzloops/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/hackers-delight/ntzmasks/build/abi.json b/hackers-delight/ntzmasks/build/ntzmasks/abi.json similarity index 62% rename from hackers-delight/ntzmasks/build/abi.json rename to hackers-delight/ntzmasks/build/ntzmasks/abi.json index 07aee63..4484f0d 100644 --- a/hackers-delight/ntzmasks/build/abi.json +++ b/hackers-delight/ntzmasks/build/ntzmasks/abi.json @@ -7,30 +7,28 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "x", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/hackers-delight/ntzmasks/build/main.aleo b/hackers-delight/ntzmasks/build/ntzmasks/ntzmasks.aleo similarity index 100% rename from hackers-delight/ntzmasks/build/main.aleo rename to hackers-delight/ntzmasks/build/ntzmasks/ntzmasks.aleo diff --git a/hackers-delight/ntzmasks/build/program.json b/hackers-delight/ntzmasks/build/program.json deleted file mode 100644 index bbb0376..0000000 --- a/hackers-delight/ntzmasks/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "ntzmasks.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/hackers-delight/ntzmasks/leo.lock b/hackers-delight/ntzmasks/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/hackers-delight/ntzmasks/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/hackers-delight/ntzreisers/build/abi.json b/hackers-delight/ntzreisers/build/ntzreisers/abi.json similarity index 62% rename from hackers-delight/ntzreisers/build/abi.json rename to hackers-delight/ntzreisers/build/ntzreisers/abi.json index 469fb28..5336234 100644 --- a/hackers-delight/ntzreisers/build/abi.json +++ b/hackers-delight/ntzreisers/build/ntzreisers/abi.json @@ -7,30 +7,28 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "x", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/hackers-delight/ntzreisers/build/main.aleo b/hackers-delight/ntzreisers/build/ntzreisers/ntzreisers.aleo similarity index 100% rename from hackers-delight/ntzreisers/build/main.aleo rename to hackers-delight/ntzreisers/build/ntzreisers/ntzreisers.aleo diff --git a/hackers-delight/ntzreisers/build/program.json b/hackers-delight/ntzreisers/build/program.json deleted file mode 100644 index 6a3483a..0000000 --- a/hackers-delight/ntzreisers/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "ntzreisers.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/hackers-delight/ntzreisers/leo.lock b/hackers-delight/ntzreisers/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/hackers-delight/ntzreisers/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/hackers-delight/ntzseals/build/abi.json b/hackers-delight/ntzseals/build/ntzseals/abi.json similarity index 62% rename from hackers-delight/ntzseals/build/abi.json rename to hackers-delight/ntzseals/build/ntzseals/abi.json index f09c629..d29f577 100644 --- a/hackers-delight/ntzseals/build/abi.json +++ b/hackers-delight/ntzseals/build/ntzseals/abi.json @@ -7,30 +7,28 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "x", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/hackers-delight/ntzseals/build/main.aleo b/hackers-delight/ntzseals/build/ntzseals/ntzseals.aleo similarity index 100% rename from hackers-delight/ntzseals/build/main.aleo rename to hackers-delight/ntzseals/build/ntzseals/ntzseals.aleo diff --git a/hackers-delight/ntzseals/build/program.json b/hackers-delight/ntzseals/build/program.json deleted file mode 100644 index 31fa3f4..0000000 --- a/hackers-delight/ntzseals/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "ntzseals.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/hackers-delight/ntzseals/leo.lock b/hackers-delight/ntzseals/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/hackers-delight/ntzseals/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/hackers-delight/ntzsearchtree/build/abi.json b/hackers-delight/ntzsearchtree/build/ntzsearchtree/abi.json similarity index 62% rename from hackers-delight/ntzsearchtree/build/abi.json rename to hackers-delight/ntzsearchtree/build/ntzsearchtree/abi.json index 41d6eb5..af61ed1 100644 --- a/hackers-delight/ntzsearchtree/build/abi.json +++ b/hackers-delight/ntzsearchtree/build/ntzsearchtree/abi.json @@ -7,30 +7,28 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "x", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/hackers-delight/ntzsearchtree/build/main.aleo b/hackers-delight/ntzsearchtree/build/ntzsearchtree/ntzsearchtree.aleo similarity index 100% rename from hackers-delight/ntzsearchtree/build/main.aleo rename to hackers-delight/ntzsearchtree/build/ntzsearchtree/ntzsearchtree.aleo diff --git a/hackers-delight/ntzsearchtree/build/program.json b/hackers-delight/ntzsearchtree/build/program.json deleted file mode 100644 index 0bbf25e..0000000 --- a/hackers-delight/ntzsearchtree/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "ntzsearchtree.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/hackers-delight/ntzsearchtree/leo.lock b/hackers-delight/ntzsearchtree/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/hackers-delight/ntzsearchtree/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/hackers-delight/ntzsmallvals/build/abi.json b/hackers-delight/ntzsmallvals/build/ntzsmallvals/abi.json similarity index 62% rename from hackers-delight/ntzsmallvals/build/abi.json rename to hackers-delight/ntzsmallvals/build/ntzsmallvals/abi.json index 6b57cd7..44c1dde 100644 --- a/hackers-delight/ntzsmallvals/build/abi.json +++ b/hackers-delight/ntzsmallvals/build/ntzsmallvals/abi.json @@ -7,30 +7,28 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "x", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/hackers-delight/ntzsmallvals/build/main.aleo b/hackers-delight/ntzsmallvals/build/ntzsmallvals/ntzsmallvals.aleo similarity index 100% rename from hackers-delight/ntzsmallvals/build/main.aleo rename to hackers-delight/ntzsmallvals/build/ntzsmallvals/ntzsmallvals.aleo diff --git a/hackers-delight/ntzsmallvals/build/program.json b/hackers-delight/ntzsmallvals/build/program.json deleted file mode 100644 index cc7b30e..0000000 --- a/hackers-delight/ntzsmallvals/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "ntzsmallvals.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/hackers-delight/ntzsmallvals/leo.lock b/hackers-delight/ntzsmallvals/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/hackers-delight/ntzsmallvals/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/helloworld/build/abi.json b/helloworld/build/helloworld/abi.json similarity index 58% rename from helloworld/build/abi.json rename to helloworld/build/helloworld/abi.json index 178994e..edafcce 100644 --- a/helloworld/build/abi.json +++ b/helloworld/build/helloworld/abi.json @@ -7,41 +7,38 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "a", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } }, { - "name": "b", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/helloworld/build/main.aleo b/helloworld/build/helloworld/helloworld.aleo similarity index 100% rename from helloworld/build/main.aleo rename to helloworld/build/helloworld/helloworld.aleo diff --git a/helloworld/build/program.json b/helloworld/build/program.json deleted file mode 100644 index 7ed1038..0000000 --- a/helloworld/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "helloworld.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/helloworld/hello/build/abi.json b/helloworld/hello/build/hello/abi.json similarity index 58% rename from helloworld/hello/build/abi.json rename to helloworld/hello/build/hello/abi.json index 2e452e9..639c39b 100644 --- a/helloworld/hello/build/abi.json +++ b/helloworld/hello/build/hello/abi.json @@ -7,41 +7,38 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "a", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } }, { - "name": "b", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/helloworld/hello/build/main.aleo b/helloworld/hello/build/hello/hello.aleo similarity index 100% rename from helloworld/hello/build/main.aleo rename to helloworld/hello/build/hello/hello.aleo diff --git a/helloworld/hello/build/program.json b/helloworld/hello/build/program.json deleted file mode 100644 index 5ea3961..0000000 --- a/helloworld/hello/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "hello.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/helloworld/leo.lock b/helloworld/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/helloworld/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/interest/build/abi.json b/interest/build/interest/abi.json similarity index 53% rename from interest/build/abi.json rename to interest/build/interest/abi.json index 4a5463e..874cce0 100644 --- a/interest/build/abi.json +++ b/interest/build/interest/abi.json @@ -7,92 +7,85 @@ "functions": [ { "name": "fixed_iteration_interest", - "is_final": false, "inputs": [ { - "name": "capital", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } }, { - "name": "rate", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] }, { "name": "bounded_iteration_interest", - "is_final": false, "inputs": [ { - "name": "capital", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } }, { - "name": "rate", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } }, { - "name": "iterations", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/interest/build/main.aleo b/interest/build/interest/interest.aleo similarity index 100% rename from interest/build/main.aleo rename to interest/build/interest/interest.aleo diff --git a/interest/build/program.json b/interest/build/program.json deleted file mode 100644 index f1e6c52..0000000 --- a/interest/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "interest.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/interest/leo.lock b/interest/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/interest/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/lottery/build/abi.json b/lottery/build/lottery/abi.json similarity index 66% rename from lottery/build/abi.json rename to lottery/build/lottery/abi.json index 366bd95..0ce435f 100644 --- a/lottery/build/abi.json +++ b/lottery/build/lottery/abi.json @@ -12,7 +12,7 @@ "ty": { "Primitive": "Address" }, - "mode": "None" + "mode": "Private" } ] } @@ -36,24 +36,17 @@ "functions": [ { "name": "play", - "is_final": true, "inputs": [], "outputs": [ { - "ty": { - "Record": { - "path": [ - "Ticket" - ], - "program": "lottery.aleo" - } - }, - "mode": "None" + "Record": { + "path": [ + "Ticket" + ], + "program": "lottery.aleo" + } }, - { - "ty": "Final", - "mode": "None" - } + "Final" ] } ] diff --git a/lottery/build/main.aleo b/lottery/build/lottery/lottery.aleo similarity index 100% rename from lottery/build/main.aleo rename to lottery/build/lottery/lottery.aleo diff --git a/lottery/build/program.json b/lottery/build/program.json deleted file mode 100644 index 6d5d13b..0000000 --- a/lottery/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "lottery.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/lottery/leo.lock b/lottery/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/lottery/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/lottery/src/main.leo b/lottery/src/main.leo index a4ea7e2..9ab978b 100644 --- a/lottery/src/main.leo +++ b/lottery/src/main.leo @@ -9,11 +9,11 @@ program lottery.aleo { fn play() -> (Ticket, Final) { let ticket: Ticket = Ticket { - owner: self.caller, + owner: std::ctx::caller(), }; return (ticket, final { // Check that the lottery has not expired. - assert(block.height <= 1000u32); + assert(std::ctx::block_height() <= 1000u32); // Randomly select whether or not the ticket is a winner. assert(ChaCha::rand_bool()); diff --git a/message/build/abi.json b/message/build/message/abi.json similarity index 75% rename from message/build/abi.json rename to message/build/message/abi.json index 9443b83..3188337 100644 --- a/message/build/abi.json +++ b/message/build/message/abi.json @@ -27,31 +27,29 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "m", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Struct": { "path": [ "Message" ], "program": "message.aleo" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Field" - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/message/build/main.aleo b/message/build/message/message.aleo similarity index 59% rename from message/build/main.aleo rename to message/build/message/message.aleo index a8fbf6e..8eda752 100644 --- a/message/build/main.aleo +++ b/message/build/message/message.aleo @@ -6,9 +6,8 @@ struct Message: function main: input r0 as Message.private; - cast r0.first r0.second into r1 as Message; - add r1.first r1.second into r2; - output r2 as field.private; + add r0.first r0.second into r1; + output r1 as field.private; constructor: assert.eq edition 0u16; diff --git a/message/build/program.json b/message/build/program.json deleted file mode 100644 index 9121f33..0000000 --- a/message/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "message.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/message/leo.lock b/message/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/message/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/simple_token/build/abi.json b/simple_token/build/abi.json deleted file mode 100644 index cf83f9f..0000000 --- a/simple_token/build/abi.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "program": "simple_token.aleo", - "structs": [], - "records": [ - { - "path": [ - "Token" - ], - "fields": [ - { - "name": "owner", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - } - ] - } - ], - "mappings": [], - "storage_variables": [], - "functions": [ - { - "name": "mint", - "is_final": false, - "inputs": [ - { - "name": "owner", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "simple_token.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "transfer", - "is_final": false, - "inputs": [ - { - "name": "token", - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "simple_token.aleo" - } - }, - "mode": "None" - }, - { - "name": "to", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "simple_token.aleo" - } - }, - "mode": "None" - }, - { - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "simple_token.aleo" - } - }, - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/simple_token/build/program.json b/simple_token/build/program.json deleted file mode 100644 index 069623a..0000000 --- a/simple_token/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "simple_token.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/simple_token/build/simple_token/abi.json b/simple_token/build/simple_token/abi.json new file mode 100644 index 0000000..2a9762d --- /dev/null +++ b/simple_token/build/simple_token/abi.json @@ -0,0 +1,115 @@ +{ + "program": "simple_token.aleo", + "structs": [], + "records": [ + { + "path": [ + "Token" + ], + "fields": [ + { + "name": "owner", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, + { + "name": "amount", + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + ] + } + ], + "mappings": [], + "storage_variables": [], + "functions": [ + { + "name": "mint", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "simple_token.aleo" + } + } + ] + }, + { + "name": "transfer", + "inputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "simple_token.aleo" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "simple_token.aleo" + } + }, + { + "Record": { + "path": [ + "Token" + ], + "program": "simple_token.aleo" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/simple_token/build/main.aleo b/simple_token/build/simple_token/simple_token.aleo similarity index 100% rename from simple_token/build/main.aleo rename to simple_token/build/simple_token/simple_token.aleo diff --git a/simple_token/leo.lock b/simple_token/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/simple_token/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/tictactoe/build/program.json b/tictactoe/build/program.json deleted file mode 100644 index 58f8e17..0000000 --- a/tictactoe/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "tictactoe.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/tictactoe/build/abi.json b/tictactoe/build/tictactoe/abi.json similarity index 74% rename from tictactoe/build/abi.json rename to tictactoe/build/tictactoe/abi.json index 5771863..01b23d6 100644 --- a/tictactoe/build/abi.json +++ b/tictactoe/build/tictactoe/abi.json @@ -79,99 +79,93 @@ "functions": [ { "name": "new", - "is_final": false, "inputs": [], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Struct": { "path": [ "Board" ], "program": "tictactoe.aleo" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] }, { "name": "make_move", - "is_final": false, "inputs": [ { - "name": "player", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } }, { - "name": "row", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } }, { - "name": "col", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } }, { - "name": "board", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Struct": { "path": [ "Board" ], "program": "tictactoe.aleo" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Struct": { "path": [ "Board" ], "program": "tictactoe.aleo" } - } - }, - "mode": "None" + }, + "mode": "Private" + } }, { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/tictactoe/build/main.aleo b/tictactoe/build/tictactoe/tictactoe.aleo similarity index 100% rename from tictactoe/build/main.aleo rename to tictactoe/build/tictactoe/tictactoe.aleo diff --git a/tictactoe/leo.lock b/tictactoe/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/tictactoe/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/token/build/abi.json b/token/build/abi.json deleted file mode 100644 index 06c6d53..0000000 --- a/token/build/abi.json +++ /dev/null @@ -1,308 +0,0 @@ -{ - "program": "token.aleo", - "structs": [], - "records": [ - { - "path": [ - "Token" - ], - "fields": [ - { - "name": "owner", - "ty": { - "Primitive": "Address" - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Primitive": { - "UInt": "U64" - } - }, - "mode": "None" - } - ] - } - ], - "mappings": [ - { - "name": "account", - "key": { - "Primitive": "Address" - }, - "value": { - "Primitive": { - "UInt": "U64" - } - } - } - ], - "storage_variables": [], - "functions": [ - { - "name": "mint_public", - "is_final": true, - "inputs": [ - { - "name": "receiver", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "Public" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "Public" - } - ], - "outputs": [ - { - "ty": "Final", - "mode": "None" - } - ] - }, - { - "name": "mint_private", - "is_final": false, - "inputs": [ - { - "name": "receiver", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "token.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "transfer_public", - "is_final": true, - "inputs": [ - { - "name": "receiver", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "Public" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "Public" - } - ], - "outputs": [ - { - "ty": "Final", - "mode": "None" - } - ] - }, - { - "name": "transfer_private", - "is_final": false, - "inputs": [ - { - "name": "sender", - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "token.aleo" - } - }, - "mode": "None" - }, - { - "name": "receiver", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "None" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "token.aleo" - } - }, - "mode": "None" - }, - { - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "token.aleo" - } - }, - "mode": "None" - } - ] - }, - { - "name": "transfer_private_to_public", - "is_final": true, - "inputs": [ - { - "name": "sender", - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "token.aleo" - } - }, - "mode": "None" - }, - { - "name": "receiver", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "Public" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "Public" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "token.aleo" - } - }, - "mode": "None" - }, - { - "ty": "Final", - "mode": "None" - } - ] - }, - { - "name": "transfer_public_to_private", - "is_final": true, - "inputs": [ - { - "name": "receiver", - "ty": { - "Plaintext": { - "Primitive": "Address" - } - }, - "mode": "Public" - }, - { - "name": "amount", - "ty": { - "Plaintext": { - "Primitive": { - "UInt": "U64" - } - } - }, - "mode": "Public" - } - ], - "outputs": [ - { - "ty": { - "Record": { - "path": [ - "Token" - ], - "program": "token.aleo" - } - }, - "mode": "None" - }, - { - "ty": "Final", - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/token/build/program.json b/token/build/program.json deleted file mode 100644 index a2bc557..0000000 --- a/token/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "token.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/token/build/token/abi.json b/token/build/token/abi.json new file mode 100644 index 0000000..e999931 --- /dev/null +++ b/token/build/token/abi.json @@ -0,0 +1,255 @@ +{ + "program": "token.aleo", + "structs": [], + "records": [ + { + "path": [ + "Token" + ], + "fields": [ + { + "name": "owner", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, + { + "name": "amount", + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + ] + } + ], + "mappings": [ + { + "name": "account", + "key": { + "Primitive": "Address" + }, + "value": { + "Primitive": { + "UInt": "U64" + } + } + } + ], + "storage_variables": [], + "functions": [ + { + "name": "mint_public", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Public" + } + } + ], + "outputs": [ + "Final" + ] + }, + { + "name": "mint_private", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "token.aleo" + } + } + ] + }, + { + "name": "transfer_public", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Public" + } + } + ], + "outputs": [ + "Final" + ] + }, + { + "name": "transfer_private", + "inputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "token.aleo" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "token.aleo" + } + }, + { + "Record": { + "path": [ + "Token" + ], + "program": "token.aleo" + } + } + ] + }, + { + "name": "transfer_private_to_public", + "inputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "token.aleo" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Public" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "token.aleo" + } + }, + "Final" + ] + }, + { + "name": "transfer_public_to_private", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Public" + } + } + ], + "outputs": [ + { + "Record": { + "path": [ + "Token" + ], + "program": "token.aleo" + } + }, + "Final" + ] + } + ] +} \ No newline at end of file diff --git a/token/build/main.aleo b/token/build/token/token.aleo similarity index 100% rename from token/build/main.aleo rename to token/build/token/token.aleo diff --git a/token/leo.lock b/token/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/token/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/token/src/main.leo b/token/src/main.leo index 61750c1..ebc34af 100644 --- a/token/src/main.leo +++ b/token/src/main.leo @@ -35,7 +35,7 @@ program token.aleo { /* Transfer */ fn transfer_public(public receiver: address, public amount: u64) -> Final { // Transfer the tokens publicly, by invoking the computation on-chain. - let caller = self.caller; + let caller = std::ctx::caller(); return final { // Decrements `account[sender]` by `amount`. // If `account[sender]` does not exist, it will be created. @@ -106,7 +106,7 @@ program token.aleo { owner: receiver, amount: amount, }; - let caller = self.caller; + let caller = std::ctx::caller(); // Output the receiver's record. // Decrement the token amount of the caller publicly. diff --git a/twoadicity/build/program.json b/twoadicity/build/program.json deleted file mode 100644 index b11b683..0000000 --- a/twoadicity/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "twoadicity.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/twoadicity/build/abi.json b/twoadicity/build/twoadicity/abi.json similarity index 60% rename from twoadicity/build/abi.json rename to twoadicity/build/twoadicity/abi.json index d653724..b026438 100644 --- a/twoadicity/build/abi.json +++ b/twoadicity/build/twoadicity/abi.json @@ -7,28 +7,26 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "n", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Field" - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U8" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/twoadicity/build/main.aleo b/twoadicity/build/twoadicity/twoadicity.aleo similarity index 100% rename from twoadicity/build/main.aleo rename to twoadicity/build/twoadicity/twoadicity.aleo diff --git a/twoadicity/leo.lock b/twoadicity/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/twoadicity/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/upgrades/admin/build/abi.json b/upgrades/admin/build/admin_example/abi.json similarity index 58% rename from upgrades/admin/build/abi.json rename to upgrades/admin/build/admin_example/abi.json index dcf616f..e30a579 100644 --- a/upgrades/admin/build/abi.json +++ b/upgrades/admin/build/admin_example/abi.json @@ -7,41 +7,38 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "a", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } }, { - "name": "b", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/upgrades/admin/build/main.aleo b/upgrades/admin/build/admin_example/admin_example.aleo similarity index 100% rename from upgrades/admin/build/main.aleo rename to upgrades/admin/build/admin_example/admin_example.aleo diff --git a/upgrades/admin/build/program.json b/upgrades/admin/build/program.json deleted file mode 100644 index 240722a..0000000 --- a/upgrades/admin/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "admin_example.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/upgrades/noupgrade/build/abi.json b/upgrades/noupgrade/build/noupgrade_example/abi.json similarity index 58% rename from upgrades/noupgrade/build/abi.json rename to upgrades/noupgrade/build/noupgrade_example/abi.json index 038f3ce..bd7a633 100644 --- a/upgrades/noupgrade/build/abi.json +++ b/upgrades/noupgrade/build/noupgrade_example/abi.json @@ -7,41 +7,38 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "a", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } }, { - "name": "b", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/upgrades/noupgrade/build/main.aleo b/upgrades/noupgrade/build/noupgrade_example/noupgrade_example.aleo similarity index 100% rename from upgrades/noupgrade/build/main.aleo rename to upgrades/noupgrade/build/noupgrade_example/noupgrade_example.aleo diff --git a/upgrades/noupgrade/build/program.json b/upgrades/noupgrade/build/program.json deleted file mode 100644 index 06f7a69..0000000 --- a/upgrades/noupgrade/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "noupgrade_example.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/upgrades/timelock/build/program.json b/upgrades/timelock/build/program.json deleted file mode 100644 index 23acb82..0000000 --- a/upgrades/timelock/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "timelock_example.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/upgrades/timelock/build/abi.json b/upgrades/timelock/build/timelock_example/abi.json similarity index 58% rename from upgrades/timelock/build/abi.json rename to upgrades/timelock/build/timelock_example/abi.json index d097f6f..4f3bf53 100644 --- a/upgrades/timelock/build/abi.json +++ b/upgrades/timelock/build/timelock_example/abi.json @@ -7,41 +7,38 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "a", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } }, { - "name": "b", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/upgrades/timelock/build/main.aleo b/upgrades/timelock/build/timelock_example/timelock_example.aleo similarity index 100% rename from upgrades/timelock/build/main.aleo rename to upgrades/timelock/build/timelock_example/timelock_example.aleo diff --git a/upgrades/timelock/src/main.leo b/upgrades/timelock/src/main.leo index 8959a80..d728ea0 100644 --- a/upgrades/timelock/src/main.leo +++ b/upgrades/timelock/src/main.leo @@ -2,8 +2,8 @@ program timelock_example.aleo { @custom constructor() { - if self.edition > 0u16 { - assert(block.height >= 1300u32); + if std::ctx::edition() > 0u16 { + assert(std::ctx::block_height() >= 1300u32); } } diff --git a/upgrades/vote/basic_voting/build/abi.json b/upgrades/vote/basic_voting/build/basic_voting/abi.json similarity index 75% rename from upgrades/vote/basic_voting/build/abi.json rename to upgrades/vote/basic_voting/build/basic_voting/abi.json index c797cc0..de107a5 100644 --- a/upgrades/vote/basic_voting/build/abi.json +++ b/upgrades/vote/basic_voting/build/basic_voting/abi.json @@ -60,12 +60,10 @@ "functions": [ { "name": "propose", - "is_final": true, "inputs": [ { - "name": "checksum", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Array": { "element": { "Primitive": { @@ -74,26 +72,21 @@ }, "length": 32 } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ - { - "ty": "Final", - "mode": "None" - } + "Final" ] }, { "name": "vote", - "is_final": true, "inputs": [ { - "name": "checksum", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Array": { "element": { "Primitive": { @@ -102,25 +95,21 @@ }, "length": 32 } - } - }, - "mode": "None" + }, + "mode": "Private" + } }, { - "name": "approved", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Boolean" - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ - { - "ty": "Final", - "mode": "None" - } + "Final" ] } ] diff --git a/upgrades/vote/build/imports/basic_voting.aleo b/upgrades/vote/basic_voting/build/basic_voting/basic_voting.aleo similarity index 100% rename from upgrades/vote/build/imports/basic_voting.aleo rename to upgrades/vote/basic_voting/build/basic_voting/basic_voting.aleo diff --git a/upgrades/vote/basic_voting/build/program.json b/upgrades/vote/basic_voting/build/program.json deleted file mode 100644 index f42c1d1..0000000 --- a/upgrades/vote/basic_voting/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "basic_voting.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/upgrades/vote/basic_voting/src/main.leo b/upgrades/vote/basic_voting/src/main.leo index 9771ef6..19c98a6 100644 --- a/upgrades/vote/basic_voting/src/main.leo +++ b/upgrades/vote/basic_voting/src/main.leo @@ -29,7 +29,7 @@ program basic_voting.aleo { // Vote on a proposed checksum. fn vote(checksum: [u8; 32], approved: bool) -> Final { - let caller = self.caller; + let caller = std::ctx::caller(); return final { // Ensure that the checksum is proposed. assert(proposed_checksum.contains(true)); diff --git a/upgrades/vote/build/imports/basic_voting.aleo.abi.json b/upgrades/vote/build/basic_voting/abi.json similarity index 75% rename from upgrades/vote/build/imports/basic_voting.aleo.abi.json rename to upgrades/vote/build/basic_voting/abi.json index c797cc0..de107a5 100644 --- a/upgrades/vote/build/imports/basic_voting.aleo.abi.json +++ b/upgrades/vote/build/basic_voting/abi.json @@ -60,12 +60,10 @@ "functions": [ { "name": "propose", - "is_final": true, "inputs": [ { - "name": "checksum", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Array": { "element": { "Primitive": { @@ -74,26 +72,21 @@ }, "length": 32 } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ - { - "ty": "Final", - "mode": "None" - } + "Final" ] }, { "name": "vote", - "is_final": true, "inputs": [ { - "name": "checksum", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Array": { "element": { "Primitive": { @@ -102,25 +95,21 @@ }, "length": 32 } - } - }, - "mode": "None" + }, + "mode": "Private" + } }, { - "name": "approved", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Boolean" - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ - { - "ty": "Final", - "mode": "None" - } + "Final" ] } ] diff --git a/upgrades/vote/basic_voting/build/main.aleo b/upgrades/vote/build/basic_voting/basic_voting.aleo similarity index 100% rename from upgrades/vote/basic_voting/build/main.aleo rename to upgrades/vote/build/basic_voting/basic_voting.aleo diff --git a/upgrades/vote/build/imports/basic_voting.abi.json b/upgrades/vote/build/imports/basic_voting.abi.json deleted file mode 100644 index 4eee7e9..0000000 --- a/upgrades/vote/build/imports/basic_voting.abi.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "program": "basic_voting.aleo", - "structs": [], - "records": [], - "mappings": [ - { - "name": "proposed_checksum", - "key": { - "Primitive": "Boolean" - }, - "value": { - "Array": { - "element": { - "Primitive": { - "UInt": "U8" - } - }, - "length": 32 - } - } - }, - { - "name": "approved_checksum", - "key": { - "Primitive": "Boolean" - }, - "value": { - "Array": { - "element": { - "Primitive": { - "UInt": "U8" - } - }, - "length": 32 - } - } - }, - { - "name": "accepting_votes", - "key": { - "Primitive": "Boolean" - }, - "value": { - "Primitive": { - "UInt": "U32" - } - } - }, - { - "name": "voters", - "key": { - "Primitive": "Address" - }, - "value": { - "Primitive": "Boolean" - } - } - ], - "storage_variables": [], - "transitions": [ - { - "name": "propose", - "is_async": true, - "inputs": [ - { - "name": "checksum", - "ty": { - "Plaintext": { - "Array": { - "element": { - "Primitive": { - "UInt": "U8" - } - }, - "length": 32 - } - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": "Future", - "mode": "None" - } - ] - }, - { - "name": "vote", - "is_async": true, - "inputs": [ - { - "name": "checksum", - "ty": { - "Plaintext": { - "Array": { - "element": { - "Primitive": { - "UInt": "U8" - } - }, - "length": 32 - } - } - }, - "mode": "None" - }, - { - "name": "approved", - "ty": { - "Plaintext": { - "Primitive": "Boolean" - } - }, - "mode": "None" - } - ], - "outputs": [ - { - "ty": "Future", - "mode": "None" - } - ] - } - ] -} \ No newline at end of file diff --git a/upgrades/vote/build/program.json b/upgrades/vote/build/program.json deleted file mode 100644 index ebce98a..0000000 --- a/upgrades/vote/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "vote_example.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/upgrades/vote/build/abi.json b/upgrades/vote/build/vote_example/abi.json similarity index 58% rename from upgrades/vote/build/abi.json rename to upgrades/vote/build/vote_example/abi.json index d8e43c8..40865f3 100644 --- a/upgrades/vote/build/abi.json +++ b/upgrades/vote/build/vote_example/abi.json @@ -7,41 +7,38 @@ "functions": [ { "name": "main", - "is_final": false, "inputs": [ { - "name": "a", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } }, { - "name": "b", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ], "outputs": [ { - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": { "UInt": "U32" } - } - }, - "mode": "None" + }, + "mode": "Private" + } } ] } diff --git a/upgrades/vote/build/main.aleo b/upgrades/vote/build/vote_example/vote_example.aleo similarity index 100% rename from upgrades/vote/build/main.aleo rename to upgrades/vote/build/vote_example/vote_example.aleo diff --git a/vote/build/program.json b/vote/build/program.json deleted file mode 100644 index 20b6415..0000000 --- a/vote/build/program.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "program": "vote.aleo", - "version": "0.1.0", - "description": "", - "license": "", - "leo": "4.0.0", - "dependencies": null, - "dev_dependencies": null -} diff --git a/vote/build/abi.json b/vote/build/vote/abi.json similarity index 62% rename from vote/build/abi.json rename to vote/build/vote/abi.json index 1ef0e8f..907657f 100644 --- a/vote/build/abi.json +++ b/vote/build/vote/abi.json @@ -38,14 +38,14 @@ "ty": { "Primitive": "Address" }, - "mode": "None" + "mode": "Private" }, { "name": "id", "ty": { "Primitive": "Field" }, - "mode": "None" + "mode": "Private" }, { "name": "info", @@ -57,7 +57,7 @@ "program": "vote.aleo" } }, - "mode": "None" + "mode": "Private" } ] }, @@ -71,14 +71,14 @@ "ty": { "Primitive": "Address" }, - "mode": "None" + "mode": "Private" }, { "name": "pid", "ty": { "Primitive": "Field" }, - "mode": "None" + "mode": "Private" } ] } @@ -136,128 +136,95 @@ "functions": [ { "name": "propose", - "is_final": true, "inputs": [ { - "name": "info", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Struct": { "path": [ "ProposalInfo" ], "program": "vote.aleo" } - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Record": { - "path": [ - "Proposal" - ], - "program": "vote.aleo" - } - }, - "mode": "None" + "Record": { + "path": [ + "Proposal" + ], + "program": "vote.aleo" + } }, - { - "ty": "Final", - "mode": "None" - } + "Final" ] }, { "name": "new_ticket", - "is_final": true, "inputs": [ { - "name": "pid", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Field" - } - }, - "mode": "Public" + }, + "mode": "Public" + } }, { - "name": "voter", - "ty": { - "Plaintext": { + "Plaintext": { + "ty": { "Primitive": "Address" - } - }, - "mode": "Public" + }, + "mode": "Public" + } } ], "outputs": [ { - "ty": { - "Record": { - "path": [ - "Ticket" - ], - "program": "vote.aleo" - } - }, - "mode": "None" + "Record": { + "path": [ + "Ticket" + ], + "program": "vote.aleo" + } }, - { - "ty": "Final", - "mode": "None" - } + "Final" ] }, { "name": "agree", - "is_final": true, "inputs": [ { - "name": "ticket", - "ty": { - "Record": { - "path": [ - "Ticket" - ], - "program": "vote.aleo" - } - }, - "mode": "None" + "Record": { + "path": [ + "Ticket" + ], + "program": "vote.aleo" + } } ], "outputs": [ - { - "ty": "Final", - "mode": "None" - } + "Final" ] }, { "name": "disagree", - "is_final": true, "inputs": [ { - "name": "ticket", - "ty": { - "Record": { - "path": [ - "Ticket" - ], - "program": "vote.aleo" - } - }, - "mode": "None" + "Record": { + "path": [ + "Ticket" + ], + "program": "vote.aleo" + } } ], "outputs": [ - { - "ty": "Final", - "mode": "None" - } + "Final" ] } ] diff --git a/vote/build/main.aleo b/vote/build/vote/vote.aleo similarity index 100% rename from vote/build/main.aleo rename to vote/build/vote/vote.aleo diff --git a/vote/leo.lock b/vote/leo.lock deleted file mode 100644 index c4293b3..0000000 --- a/vote/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/vote/src/main.leo b/vote/src/main.leo index 6281b2c..0cc6560 100644 --- a/vote/src/main.leo +++ b/vote/src/main.leo @@ -33,7 +33,7 @@ program vote.aleo { // Propose a new proposal to vote on. fn propose(public info: ProposalInfo) -> (Proposal, Final) { // Authenticate proposer. - assert_eq(self.caller, info.proposer); + assert_eq(std::ctx::caller(), info.proposer); // Generate a new proposal id. let id: field = BHP256::hash_to_field(info.title); @@ -41,7 +41,7 @@ program vote.aleo { // Return a new record for the proposal. // Finalize the proposal id. - return (Proposal { owner: self.caller, id, info }, final { + return (Proposal { owner: std::ctx::caller(), id, info }, final { // Create a new proposal in the "tickets" mapping. Mapping::set(tickets, id, 0u64); });