Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
d0cd committed May 16, 2024
1 parent 61a98cb commit 6f39bc9
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 223 deletions.
37 changes: 19 additions & 18 deletions examples/auction/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ fi

# The private key and address of the first bidder.
# Swap these into program.json, when running transactions as the first bidder.
# "private_key": "APrivateKey1zkpG9Af9z5Ha4ejVyMCqVFXRKknSm8L1ELEwcc4htk9YhVK"
# "address": aleo1yzlta2q5h8t0fqe0v6dyh9mtv4aggd53fgzr068jvplqhvqsnvzq7pj2ke
# NETWORK=mainnet
# PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH

# The private key and address of the second bidder.
# Swap these into program.json, when running transactions as the second bidder.
# "private_key": "APrivateKey1zkpAFshdsj2EqQzXh5zHceDapFWVCwR6wMCJFfkLYRKupug"
# "address": aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4
# NETWORK=mainnet
# PRIVATE_KEY=APrivateKey1zkp2RWGDcde3efb89rjhME1VYA8QMxcxep5DShNBR6n8Yjh


# The private key and address of the auctioneer.
# Swap these into program.json, when running transactions as the auctioneer.
# "private_key": "APrivateKey1zkp5wvamYgK3WCAdpBQxZqQX8XnuN2u11Y6QprZTriVwZVc",
# "address": "aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh"
# NETWORK=mainnet
# PRIVATE_KEY=APrivateKey1zkp2GUmKbVsuc1NSj28pa1WTQuZaK5f1DQJAT6vPcHyWokG


echo "
Expand All @@ -38,7 +39,7 @@ echo "
# Swap in the private key and address of the first bidder to .env.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkpG9Af9z5Ha4ejVyMCqVFXRKknSm8L1ELEwcc4htk9YhVK
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
" > .env

# Have the first bidder place a bid of 10.
Expand All @@ -55,12 +56,12 @@ echo "
######## ########
###############################################################################
"
leo run place_bid aleo1yzlta2q5h8t0fqe0v6dyh9mtv4aggd53fgzr068jvplqhvqsnvzq7pj2ke 10u64 || exit
leo run place_bid aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px 10u64 || exit

# Swap in the private key and address of the second bidder to .env.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkpAFshdsj2EqQzXh5zHceDapFWVCwR6wMCJFfkLYRKupug
PRIVATE_KEY=APrivateKey1zkp2RWGDcde3efb89rjhME1VYA8QMxcxep5DShNBR6n8Yjh
" > .env

# Have the second bidder place a bid of 90.
Expand All @@ -77,12 +78,12 @@ echo "
######## ########
###############################################################################
"
leo run place_bid aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4 90u64 || exit
leo run place_bid aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t 90u64 || exit

# Swap in the private key and address of the auctioneer to .env.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp5wvamYgK3WCAdpBQxZqQX8XnuN2u11Y6QprZTriVwZVc
# NETWORK=mainnet
# PRIVATE_KEY=APrivateKey1zkp2GUmKbVsuc1NSj28pa1WTQuZaK5f1DQJAT6vPcHyWokG
" > .env

# Have the auctioneer select the winning bid.
Expand All @@ -100,14 +101,14 @@ echo "
###############################################################################
"
leo run resolve "{
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
bidder: aleo1yzlta2q5h8t0fqe0v6dyh9mtv4aggd53fgzr068jvplqhvqsnvzq7pj2ke.private,
owner: aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg.private,
bidder: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
amount: 10u64.private,
is_winner: false.private,
_nonce: 4668394794828730542675887906815309351994017139223602571716627453741502624516group.public
}" "{
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
bidder: aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4.private,
owner: aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg.private,
bidder: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
amount: 90u64.private,
is_winner: false.private,
_nonce: 5952811863753971450641238938606857357746712138665944763541786901326522216736group.public
Expand All @@ -128,8 +129,8 @@ echo "
###############################################################################
"
leo run finish "{
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
bidder: aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4.private,
owner: aleo1ashyu96tjwe63u0gtnnv8z5lhapdu4l5pjsl2kha7fv7hvz2eqxs5dz0rg.private,
bidder: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
amount: 90u64.private,
is_winner: false.private,
_nonce: 5952811863753971450641238938606857357746712138665944763541786901326522216736group.public
Expand Down
45 changes: 23 additions & 22 deletions examples/basic_bank/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ then
fi

# The private key and address of the bank.
# Swap these into program.json, when running transactions as the first bidder.
# "private_key": "APrivateKey1zkpHtqVWT6fSHgUMNxsuVf7eaR6id2cj7TieKY1Z8CP5rCD",
# "address": "aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a"
# Swap these into program.json, when running transactions as the bank.
# NETWORK=mainnet
# PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH

# The private key and address of the user.
# Swap these into program.json, when running transactions as the second bidder.
# "private_key": "APrivateKey1zkp75cpr5NNQpVWc5mfsD9Uf2wg6XvHknf82iwB636q3rtc"
# "address": "aleo1zeklp6dd8e764spe74xez6f8w27dlua3w7hl4z2uln03re52egpsv46ngg"
# Swap these into program.json, when running transactions as the user.
# NETWORK=mainnet
# PRIVATE_KEY=APrivateKey1zkp2RWGDcde3efb89rjhME1VYA8QMxcxep5DShNBR6n8Yjh

# Swap in the private key and address of the bank to .env.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkpHtqVWT6fSHgUMNxsuVf7eaR6id2cj7TieKY1Z8CP5rCD
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
" > .env

# Have the bank issue 100 tokens to the user.
echo "
###############################################################################
######## ########
######## STEP 1: Initialize 100 tokens for aleo1zeklp...v46ngg ########
######## STEP 1: Initialize 100 tokens for aleo1s3ws5...em2u4t ########
######## ########
######## ----------------------------------------- ########
######## | ACTION | AMOUNT | ########
Expand All @@ -40,14 +40,14 @@ echo "
######## ----------------------------------------- ########
######## ########
######## ----------------------------------------- ########
######## | WALLET | aleo1zeklp...v46ngg | ########
######## | WALLET | aleo1s3ws5...em2u4t | ########
######## ----------------------------------------- ########
######## ----------------------------------------- ########
######## | Balance | 100 | ########
######## ----------------------------------------- ########
######## ########
######## ----------------------------------------- ########
######## | BANK | aleo1zeklp...v46ngg | ########
######## | BANK | aleo1rhgdu...vzp9px | ########
######## ----------------------------------------- ########
######## ----------------------------------------- ########
######## | Balance | 0 | ########
Expand All @@ -63,19 +63,20 @@ echo "
######## ########
###############################################################################
"
leo run issue aleo1zeklp6dd8e764spe74xez6f8w27dlua3w7hl4z2uln03re52egpsv46ngg 100u64 || exit
leo run issue aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t 100u64 || exit


# Swap in the private key and address of the user to .env.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp75cpr5NNQpVWc5mfsD9Uf2wg6XvHknf82iwB636q3rtc
PRIVATE_KEY=APrivateKey1zkp2RWGDcde3efb89rjhME1VYA8QMxcxep5DShNBR6n8Yjh
" > .env

# Have the user deposit 50 tokens into the bank.
echo "
###############################################################################
######## ########
######## STEP 2: aleo1zeklp...v46ngg deposits 50 tokens ########
######## STEP 2: aleo1s3ws5...em2u4t deposits 50 tokens ########
######## ########
######## ----------------------------------------- ########
######## | ACTION | AMOUNT | ########
Expand All @@ -89,14 +90,14 @@ echo "
######## ----------------------------------------- ########
######## ########
######## ----------------------------------------- ########
######## | WALLET | aleo1zeklp...v46ngg | ########
######## | WALLET | aleo1s3ws5...em2u4t | ########
######## ----------------------------------------- ########
######## ----------------------------------------- ########
######## | Balance | 50 | ########
######## ----------------------------------------- ########
######## ########
######## ----------------------------------------- ########
######## | BANK | aleo1zeklp...v46ngg | ########
######## | BANK | aleo1rhgdu...vzp9px | ########
######## ----------------------------------------- ########
######## ----------------------------------------- ########
######## | Balance | 50 | ########
Expand All @@ -113,7 +114,7 @@ echo "
###############################################################################
"
leo run deposit "{
owner: aleo1zeklp6dd8e764spe74xez6f8w27dlua3w7hl4z2uln03re52egpsv46ngg.private,
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
amount: 100u64.private,
_nonce: 4668394794828730542675887906815309351994017139223602571716627453741502624516group.public
}" 50u64 || exit
Expand All @@ -135,14 +136,14 @@ echo "
######## ----------------------------------------- ########
######## ########
######## ----------------------------------------- ########
######## | WALLET | aleo1zeklp...v46ngg | ########
######## | WALLET | aleo1s3ws5...em2u4t | ########
######## ----------------------------------------- ########
######## ----------------------------------------- ########
######## | Balance | 50 | ########
######## ----------------------------------------- ########
######## ########
######## ----------------------------------------- ########
######## | BANK | aleo1zeklp...v46ngg | ########
######## | BANK | aleo1rhgdu...vzp9px | ########
######## ----------------------------------------- ########
######## ----------------------------------------- ########
######## | Balance | 266 | ########
Expand All @@ -162,14 +163,14 @@ echo "
# Swap in the private key and address of the bank to .env.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkpHtqVWT6fSHgUMNxsuVf7eaR6id2cj7TieKY1Z8CP5rCD
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
" > .env

# Have the bank withdraw all of the user's tokens with compound interest over 15 periods at 12.34%.
echo "
###############################################################################
######## ########
######## STEP 4: Withdraw tokens of aleo1zeklp...v46ngg w/ interest ########
######## STEP 4: Withdraw tokens of aleo1s3ws5...em2u4t w/ interest ########
######## ########
######## ----------------------------------------- ########
######## | ACTION | AMOUNT | ########
Expand All @@ -183,14 +184,14 @@ echo "
######## ----------------------------------------- ########
######## ########
######## ----------------------------------------- ########
######## | WALLET | aleo1zeklp...v46ngg | ########
######## | WALLET | aleo1s3ws5...em2u4t | ########
######## ----------------------------------------- ########
######## ----------------------------------------- ########
######## | Balance | 316 | ########
######## ----------------------------------------- ########
######## ########
######## ----------------------------------------- ########
######## | BANK | aleo1zeklp...v46ngg | ########
######## | BANK | aleo1rhgdu...vzp9px | ########
######## ----------------------------------------- ########
######## ----------------------------------------- ########
######## | Balance | 0 | ########
Expand Down
Loading

0 comments on commit 6f39bc9

Please sign in to comment.