This commit is contained in:
Pranav Gaddamadugu 2024-05-18 16:43:53 -07:00
parent 6f39bc9ad8
commit f7e0352500
19 changed files with 1319 additions and 3795 deletions

View File

@ -1,3 +1,4 @@
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH

View File

@ -11,14 +11,14 @@ function place_bid:
input r0 as address.private;
input r1 as u64.private;
assert.eq self.caller r0;
cast aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh r0 r1 false into r2 as Bid.record;
cast aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg r0 r1 false into r2 as Bid.record;
output r2 as Bid.record;
function resolve:
input r0 as Bid.record;
input r1 as Bid.record;
assert.eq self.caller aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh;
assert.eq self.caller aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg;
gte r0.amount r1.amount into r2;
ternary r2 r0.owner r1.owner into r3;
ternary r2 r0.bidder r1.bidder into r4;
@ -30,6 +30,6 @@ function resolve:
function finish:
input r0 as Bid.record;
assert.eq self.caller aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh;
assert.eq self.caller aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg;
cast r0.bidder r0.bidder r0.amount true into r1 as Bid.record;
output r1 as Bid.record;

View File

@ -82,8 +82,8 @@ leo run place_bid aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4
# Swap in the private key and address of the auctioneer to .env.
echo "
# NETWORK=mainnet
# PRIVATE_KEY=APrivateKey1zkp2GUmKbVsuc1NSj28pa1WTQuZaK5f1DQJAT6vPcHyWokG
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp2GUmKbVsuc1NSj28pa1WTQuZaK5f1DQJAT6vPcHyWokG
" > .env
# Have the auctioneer select the winning bid.
@ -118,7 +118,7 @@ leo run resolve "{
echo "
###############################################################################
######## ########
######## STEP 3: The auctioneer completes the auction. ########
######## STEP 4: The auctioneer completes the auction. ########
######## ########
######## ------------------------------- ########
######## | CLOSE | A | → B ← | ########
@ -137,6 +137,13 @@ leo run finish "{
}" || exit
# Restore the .env file to its original state.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
" > .env

View File

@ -17,13 +17,13 @@ program auction.aleo {
// - `amount` : The amount of the bid.
// Requires that `bidder` matches the function caller.
// The owner of the record is set to the entity responsible for running the auction (auction runner).
// The address of the auction runner is aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.
// The address of the auction runner is aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg.
transition place_bid(bidder: address, amount: u64) -> Bid {
// Ensure the caller is the auction bidder.
assert_eq(self.caller, bidder);
// Return a new 'Bid' record for the auction bidder.
return Bid {
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh,
owner: aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg,
bidder: bidder,
amount: amount,
is_winner: false,
@ -38,7 +38,7 @@ program auction.aleo {
// In the event of a tie, the first bid is selected.
transition resolve(first: Bid, second: Bid) -> Bid {
// Ensure the caller is the auctioneer.
assert_eq(self.caller, aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh);
assert_eq(self.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.
transition finish(bid: Bid) -> Bid {
// Ensure the caller is the auctioneer.
assert_eq(self.caller, aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh);
assert_eq(self.caller, aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg);
// Return 'is_winner' as 'true' in the winning 'Bid'.
return Bid {
owner: bid.bidder,

View File

@ -1,3 +1,4 @@
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH

View File

@ -12,11 +12,12 @@ mapping balances:
function issue:
input r0 as address.private;
input r1 as u64.private;
assert.eq self.caller aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a;
assert.eq self.caller aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px;
cast r0 r1 into r2 as Token.record;
output r2 as Token.record;
function deposit:
input r0 as Token.record;
input r1 as u64.private;
@ -35,6 +36,7 @@ finalize deposit:
set r3 into balances[r0];
closure calculate_interest:
input r0 as u64;
input r1 as u64;
@ -542,12 +544,13 @@ closure calculate_interest:
output r502 as u64;
function withdraw:
input r0 as address.private;
input r1 as u64.private;
input r2 as u64.private;
input r3 as u64.private;
assert.eq self.caller aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a;
assert.eq self.caller aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px;
hash.bhp256 r0 into r4 as field;
call calculate_interest r1 r2 r3 into r5;
cast r0 r5 into r6 as Token.record;
@ -561,3 +564,4 @@ finalize withdraw:
get.or_use balances[r0] 0u64 into r2;
sub r2 r1 into r3;
set r3 into balances[r0];

View File

@ -15,9 +15,9 @@ program basic_bank.aleo {
// - `owner` : The address of the account to issue the token to.
// - `amount`: The amount of tokens to issue.
// Requires that the function caller is the bank.
// The bank's address is aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a.
// The bank's address is aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.
transition issue(owner: address, amount: u64) -> Token {
assert_eq(self.caller, aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a);
assert_eq(self.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.
async transition withdraw(recipient: address, amount: u64, rate: u64, periods: u64) -> (Token, Future) {
assert_eq(self.caller, aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a);
assert_eq(self.caller, aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px);
let hash: field = BHP256::hash_to_field(recipient);
let total: u64 = calculate_interest(amount, rate, periods);

View File

@ -1,3 +1,4 @@
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
PRIVATE_KEY=APrivateKey1zkp2RWGDcde3efb89rjhME1VYA8QMxcxep5DShNBR6n8Yjh

View File

@ -50,12 +50,12 @@ You can use the provided player accounts or [generate your own](https://aleohq.g
Player 1:
Private Key APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
View Key AViewKey1fSyEPXxfPFVgjL6qcM9izWRGrhSHKXyN3c64BNsAjnA6
Address aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy
Address aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px
Player 2:
Private Key APrivateKey1zkp2RWGDcde3efb89rjhME1VYA8QMxcxep5DShNBR6n8Yjh
View Key AViewKey1hh6dvSEgeMdfseP4hfdbNYjX4grETwCuTbKnCftkpMwE
Address aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px
Address aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t
```
Save the keys and addresses. Set the `program.json` private key and address to one of the newly created aleo accounts. We'll refer to this address as Player 1, and the other address as Player 2.
@ -68,7 +68,7 @@ Save the keys and addresses. Set the `program.json` private key and address to o
"development": {
"private_key": "APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH",
"view_key": "AViewKey1fSyEPXxfPFVgjL6qcM9izWRGrhSHKXyN3c64BNsAjnA6",
"address": "aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy"
"address": "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px"
},
"license": "MIT"
}
@ -82,19 +82,19 @@ Initialize a new board as Player 1 with valid ship inputs and Player 2's address
**Run**
```
leo run initialize_board 34084860461056u64 551911718912u64 7u64 1157425104234217472u64 aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px
leo run initialize_board 34084860461056u64 551911718912u64 7u64 1157425104234217472u64 aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t
```
**Output**
```bash
➡️ Output
• {
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
hits_and_misses: 0u64.private,
played_tiles: 0u64.private,
ships: 1157459741006397447u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
game_started: false.private,
_nonce: 3887646704618532506963887075433683846689834495661101507703164090915348189037group.public
}
@ -122,12 +122,12 @@ Now, we can offer a battleship game to player 2. Run `leo run offer_battleship '
**Run**
```
leo run offer_battleship '{
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
hits_and_misses: 0u64.private,
played_tiles: 0u64.private,
ships: 1157459741006397447u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
game_started: false.private,
_nonce: 3887646704618532506963887075433683846689834495661101507703164090915348189037group.public
}'
@ -138,20 +138,20 @@ leo run offer_battleship '{
➡️ Outputs
• {
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
hits_and_misses: 0u64.private,
played_tiles: 0u64.private,
ships: 1157459741006397447u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
game_started: true.private,
_nonce: 6563064852163330630334088854834332804417910882908622526775624018226782316843group.public
}
• {
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
incoming_fire_coordinate: 0u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
prev_hit_or_miss: 0u64.private,
_nonce: 4374626042494973146987320062571809401151262172766172816829659487584978644457group.public
}
@ -178,7 +178,7 @@ We must run the program as Player 2 now, so switch the `program.json` file to us
"development": {
"private_key": "APrivateKey1zkp2RWGDcde3efb89rjhME1VYA8QMxcxep5DShNBR6n8Yjh",
"view_key": "AViewKey1hh6dvSEgeMdfseP4hfdbNYjX4grETwCuTbKnCftkpMwE",
"address": "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px"
"address": "aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t"
},
"license": "MIT"
}
@ -187,7 +187,7 @@ We must run the program as Player 2 now, so switch the `program.json` file to us
We'll create a new and different board for Player 2, and make sure to include Player 1's address as the opponent:
**Run**
```bash
leo run initialize_board 31u64 2207646875648u64 224u64 9042383626829824u64 aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy
leo run initialize_board 31u64 2207646875648u64 224u64 9042383626829824u64 aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px
```
**Output**
@ -195,12 +195,12 @@ leo run initialize_board 31u64 2207646875648u64 224u64 9042383626829824u64 aleo1
➡️ Output
• {
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
hits_and_misses: 0u64.private,
played_tiles: 0u64.private,
ships: 9044591273705727u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
game_started: false.private,
_nonce: 1549419609469324182591325047490602235361156298832591378925133482196483208807group.public
}
@ -224,19 +224,19 @@ Now, we can accept Player 1's offer. Run `leo run start_battleship 'board_state.
**Run**
```bash
leo run start_battleship '{
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
hits_and_misses: 0u64.private,
played_tiles: 0u64.private,
ships: 9044591273705727u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
game_started: false.private,
_nonce: 1549419609469324182591325047490602235361156298832591378925133482196483208807group.public
}' '{
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
incoming_fire_coordinate: 0u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
prev_hit_or_miss: 0u64.private,
_nonce: 4374626042494973146987320062571809401151262172766172816829659487584978644457group.public
}'
@ -247,20 +247,20 @@ leo run start_battleship '{
➡️ Outputs
• {
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
hits_and_misses: 0u64.private,
played_tiles: 0u64.private,
ships: 9044591273705727u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
game_started: true.private,
_nonce: 6222383571142756260765569201308836492199048237638652378826141459336360362251group.public
}
• {
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
incoming_fire_coordinate: 0u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
prev_hit_or_miss: 0u64.private,
_nonce: 3742551407126138397717446975757978589064777004441277005584760115236217735495group.public
}
@ -279,19 +279,19 @@ Player 1 now makes the first real move: `leo run play 'board_state.record' 'move
**Run**
```bash
leo run play '{
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
hits_and_misses: 0u64.private,
played_tiles: 0u64.private,
ships: 1157459741006397447u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
game_started: true.private,
_nonce: 6563064852163330630334088854834332804417910882908622526775624018226782316843group.public
}' '{
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
incoming_fire_coordinate: 0u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
prev_hit_or_miss: 0u64.private,
_nonce: 3742551407126138397717446975757978589064777004441277005584760115236217735495group.public
}' 1u64
@ -301,20 +301,20 @@ leo run play '{
➡️ Outputs
• {
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
hits_and_misses: 0u64.private,
played_tiles: 1u64.private,
ships: 1157459741006397447u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
game_started: true.private,
_nonce: 1474170213684980843727833284550698461565286563122422722760769547002894080093group.public
}
• {
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
incoming_fire_coordinate: 1u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
prev_hit_or_miss: 0u64.private,
_nonce: 5481529266389297320813092061136936339861329677911328036818179854958874588416group.public
}
@ -334,19 +334,19 @@ and they will also let Player 1 know whether their fire coordinate hit or miss P
**Run**
```bash
leo run play '{
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
hits_and_misses: 0u64.private,
played_tiles: 0u64.private,
ships: 9044591273705727u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
game_started: true.private,
_nonce: 6222383571142756260765569201308836492199048237638652378826141459336360362251group.public
}' '{
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
incoming_fire_coordinate: 1u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
prev_hit_or_miss: 0u64.private,
_nonce: 5481529266389297320813092061136936339861329677911328036818179854958874588416group.public
}' 2048u64
@ -358,20 +358,20 @@ leo run play '{
➡️ Outputs
• {
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
hits_and_misses: 0u64.private,
played_tiles: 2048u64.private,
ships: 9044591273705727u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
game_started: true.private,
_nonce: 5254963165391133332409074172682159033621708071536429341861038147524454777097group.public
}
• {
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
incoming_fire_coordinate: 2048u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
prev_hit_or_miss: 1u64.private,
_nonce: 5851606198769770675504009323414373017067582072428989801313256693053765675198group.public
}
@ -400,19 +400,19 @@ For example, running `aleo run play 'board_state.record' 'move.record' 1u64` wil
**Run**
```bash
leo run play '{
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
hits_and_misses: 0u64.private,
played_tiles: 1u64.private,
ships: 1157459741006397447u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
game_started: true.private,
_nonce: 1474170213684980843727833284550698461565286563122422722760769547002894080093group.public
}' '{
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
incoming_fire_coordinate: 2048u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
prev_hit_or_miss: 1u64.private,
_nonce: 5851606198769770675504009323414373017067582072428989801313256693053765675198group.public
}' 2u64
@ -423,20 +423,20 @@ leo run play '{
➡️ Outputs
• {
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
hits_and_misses: 1u64.private,
played_tiles: 3u64.private,
ships: 1157459741006397447u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
game_started: true.private,
_nonce: 853278652528988609827041334083853520436225751739504321439524466875699631772group.public
}
• {
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
incoming_fire_coordinate: 2u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
prev_hit_or_miss: 0u64.private,
_nonce: 710336412388939616658264778971886770861024495941253598683184288448156545822group.public
}
@ -465,19 +465,19 @@ The `board_state` record `hits_and_misses` component has also been updated with
**Run**
```bash
leo run play '{
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
hits_and_misses: 0u64.private,
played_tiles: 2048u64.private,
ships: 9044591273705727u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
game_started: true.private,
_nonce: 5254963165391133332409074172682159033621708071536429341861038147524454777097group.public
}' '{
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
incoming_fire_coordinate: 2u64.private,
player_1: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
prev_hit_or_miss: 0u64.private,
_nonce: 710336412388939616658264778971886770861024495941253598683184288448156545822group.public
}' 4u64
@ -488,20 +488,20 @@ leo run play '{
➡️ Outputs
• {
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
hits_and_misses: 0u64.private,
played_tiles: 2052u64.private,
ships: 9044591273705727u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
game_started: true.private,
_nonce: 1145182747531998766752104305052328886102707397061849372000385383229513301534group.public
}
• {
owner: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
incoming_fire_coordinate: 4u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo15g9c69urtdhvfml0vjl8px07txmxsy454urhgzk57szmcuttpqgq5cvcdy.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
prev_hit_or_miss: 2u64.private,
_nonce: 5958326936461495382488152485080596366937963499216527548334225566230682598418group.public
}

View File

@ -1,20 +1,20 @@
[[package]]
name = "board"
name = "board.aleo"
location = "local"
path = "board"
path = "/Users/pranav/work/Aleo/leo/examples/battleship/board"
checksum = "da94274230d0c0c3deb96d80e07ad9db8bbf53264286c14cc3231b7a8b7ef380"
dependencies = []
[[package]]
name = "move"
name = "move.aleo"
location = "local"
path = "move"
path = "/Users/pranav/work/Aleo/leo/examples/battleship/move"
checksum = "7d9fef5fe083eb24376e63935855e4ec709c17fb5ee46a0bb4594b0f9ef8eb08"
dependencies = []
[[package]]
name = "verify"
name = "verify.aleo"
location = "local"
path = "verify"
path = "/Users/pranav/work/Aleo/leo/examples/battleship/verify"
checksum = "2c2035ebd70500b7e5a9a6198bed1a1163cd1ddfd09128db8f4c16cf23ad2c62"
dependencies = []

View File

@ -97,8 +97,8 @@ leo run start_battleship '{
}' '{
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
incoming_fire_coordinate: 0u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
prev_hit_or_miss: 0u64.private,
_nonce: 4374626042494973146987320062571809401151262172766172816829659487584978644457group.public
}' || exit
@ -131,8 +131,8 @@ leo run play '{
}' '{
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
incoming_fire_coordinate: 0u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
prev_hit_or_miss: 0u64.private,
_nonce: 3742551407126138397717446975757978589064777004441277005584760115236217735495group.public
}' 1u64 || exit
@ -166,8 +166,8 @@ leo run play '{
}' '{
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
incoming_fire_coordinate: 1u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
prev_hit_or_miss: 0u64.private,
_nonce: 5481529266389297320813092061136936339861329677911328036818179854958874588416group.public
}' 2048u64 || exit
@ -201,8 +201,8 @@ leo run play '{
}' '{
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
incoming_fire_coordinate: 2048u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
prev_hit_or_miss: 1u64.private,
_nonce: 5851606198769770675504009323414373017067582072428989801313256693053765675198group.public
}' 2u64 || exit
@ -236,11 +236,18 @@ leo run play '{
}' '{
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
incoming_fire_coordinate: 2u64.private,
player_1: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
player_2: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_1: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
player_2: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
prev_hit_or_miss: 0u64.private,
_nonce: 710336412388939616658264778971886770861024495941253598683184288448156545822group.public
}' 4u64 || exit
echo "
✅ Successfully executed Player 2's turn."
# Restore the .env file to its original state
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
" > .env

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@ mapping num_winners:
key as u8.public;
value as u8.public;
function play:
cast self.caller into r0 as Ticket.record;
async play into r1;
@ -24,3 +25,4 @@ finalize play:
assert.eq r3 true;
add r2 1u8 into r4;
set r4 into num_winners[0u8];

View File

@ -1 +1 @@
aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau 100u64
aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px 100u64

View File

@ -1,7 +1,7 @@
{
owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private,
owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
amount: 100u64.private,
_nonce: 0group.public
}
aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau
aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px
50u64

View File

@ -34,7 +34,7 @@ closure check_for_win:
and r9 r10 into r11;
or r6 r11 into r12;
is.eq r0.r3.c1 r1 into r13;
is.eq r0.r3.c3 r1 into r14;
is.eq r0.r3.c2 r1 into r14;
and r13 r14 into r15;
is.eq r0.r3.c3 r1 into r16;
and r15 r16 into r17;
@ -46,7 +46,7 @@ closure check_for_win:
and r21 r22 into r23;
or r18 r23 into r24;
is.eq r0.r1.c2 r1 into r25;
is.eq r0.r2.c3 r1 into r26;
is.eq r0.r2.c2 r1 into r26;
and r25 r26 into r27;
is.eq r0.r3.c2 r1 into r28;
and r27 r28 into r29;

View File

@ -1,3 +1,4 @@
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH

View File

@ -9,6 +9,7 @@ mapping account:
key as address.public;
value as u64.public;
function mint_public:
input r0 as address.public;
input r1 as u64.public;
@ -23,6 +24,7 @@ finalize mint_public:
set r3 into account[r0];
function mint_private:
input r0 as address.private;
input r1 as u64.private;
@ -30,6 +32,7 @@ function mint_private:
output r2 as token.record;
function transfer_public:
input r0 as address.public;
input r1 as u64.public;
@ -48,6 +51,7 @@ finalize transfer_public:
set r6 into account[r1];
function transfer_private:
input r0 as token.record;
input r1 as address.private;
@ -59,6 +63,7 @@ function transfer_private:
output r5 as token.record;
function transfer_private_to_public:
input r0 as token.record;
input r1 as address.public;
@ -77,6 +82,8 @@ finalize transfer_private_to_public:
set r3 into account[r0];
function transfer_public_to_private:
input r0 as address.public;
input r1 as u64.public;
@ -91,3 +98,4 @@ finalize transfer_public_to_private:
get.or_use account[r0] 0u64 into r2;
sub r2 r1 into r3;
set r3 into account[r0];

View File

@ -34,12 +34,14 @@ mapping disagree_votes:
key as field.public;
value as u64.public;
function propose:
input r0 as ProposalInfo.public;
assert.eq self.caller r0.proposer;
hash.bhp256 r0.title into r1 as field;
cast self.caller r1 r0 into r2 as Proposal.record;
async propose r1 into r3; output r2 as Proposal.record;
async propose r1 into r3;
output r2 as Proposal.record;
output r3 as vote.aleo/propose.future;
finalize propose:
@ -47,11 +49,14 @@ finalize propose:
set 0u64 into tickets[r0];
function new_ticket:
input r0 as field.public;
input r1 as address.public;
cast r1 r0 into r2 as Ticket.record;
async new_ticket r0 into r3; output r2 as Ticket.record;
async new_ticket r0 into r3;
output r2 as Ticket.record;
output r3 as vote.aleo/new_ticket.future;
finalize new_ticket:
@ -61,9 +66,12 @@ finalize new_ticket:
set r2 into tickets[r0];
function agree:
input r0 as Ticket.record;
async agree r0.pid into r1; output r1 as vote.aleo/agree.future;
async agree r0.pid into r1;
output r1 as vote.aleo/agree.future;
finalize agree:
input r0 as field.public;
@ -72,12 +80,16 @@ finalize agree:
set r2 into agree_votes[r0];
function disagree:
input r0 as Ticket.record;
async disagree r0.pid into r1; output r1 as vote.aleo/disagree.future;
async disagree r0.pid into r1;
output r1 as vote.aleo/disagree.future;
finalize disagree:
input r0 as field.public;
get.or_use disagree_votes[r0] 0u64 into r1;
add r1 1u64 into r2;
set r2 into disagree_votes[r0];