WIP update examples

This commit is contained in:
Pranav Gaddamadugu 2024-05-15 20:52:30 -07:00
parent ee4bc2f856
commit 61a98cb8f8
3 changed files with 15 additions and 12 deletions

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];

0
.circleci/lottery/run.sh Normal file → Executable file
View File

View File

@ -7,19 +7,20 @@ then
fi
# The private key and address of Alice.
# Swap these into program.json, when running transactions as the first bidder.
# "private_key": "APrivateKey1zkp1w8PTxrRgGfAtfKUSq43iQyVbdQHfhGbiNPEg2LVSEXR",
# "address": "aleo13ssze66adjjkt795z9u5wpq8h6kn0y2657726h4h3e3wfnez4vqsm3008q"
# Swap these into .env, when running transactions as the first bidder.
# NETWORK=mainnet
# PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
# The private key and address of Bob.
# Swap these into program.json, when running transactions as the second bidder.
# "private_key": "APrivateKey1zkpFo72g7N9iFt3JzzeG8CqsS5doAiXyFvNCgk2oHvjRCzF"
# "address": "aleo17vy26rpdhqx4598y5gp7nvaa9rk7tnvl6ufhvvf4calsrrqdaqyshdsf5z"
# NETWORK=mainnet
# PRIVATE_KEY=APrivateKey1zkp2RWGDcde3efb89rjhME1VYA8QMxcxep5DShNBR6n8Yjh
# Swap in the private key of Alice.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp1w8PTxrRgGfAtfKUSq43iQyVbdQHfhGbiNPEg2LVSEXR
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
" > .env
# Publicly mint 100 tokens for Alice.
@ -53,7 +54,7 @@ leo run mint_public aleo13ssze66adjjkt795z9u5wpq8h6kn0y2657726h4h3e3wfnez4vqsm30
# Swap in the private key of Bob.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkpFo72g7N9iFt3JzzeG8CqsS5doAiXyFvNCgk2oHvjRCzF
PRIVATE_KEY=APrivateKey1zkp2RWGDcde3efb89rjhME1VYA8QMxcxep5DShNBR6n8Yjh
" > .env
# Privately mint 100 tokens for Bob.
@ -87,7 +88,7 @@ leo run mint_private aleo17vy26rpdhqx4598y5gp7nvaa9rk7tnvl6ufhvvf4calsrrqdaqyshd
# Swap in the private key of Alice.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp1w8PTxrRgGfAtfKUSq43iQyVbdQHfhGbiNPEg2LVSEXR
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
" > .env
# Publicly transfer 10 tokens from Alice to Bob.
@ -121,7 +122,7 @@ leo run transfer_public aleo17vy26rpdhqx4598y5gp7nvaa9rk7tnvl6ufhvvf4calsrrqdaqy
# Swap in the private key of Bob.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkpFo72g7N9iFt3JzzeG8CqsS5doAiXyFvNCgk2oHvjRCzF
PRIVATE_KEY=APrivateKey1zkp2RWGDcde3efb89rjhME1VYA8QMxcxep5DShNBR6n8Yjh
" > .env
# Privately transfer 20 tokens from Bob to Alice.
@ -159,7 +160,7 @@ leo run transfer_private "{
# Swap in the private key of Alice.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp1w8PTxrRgGfAtfKUSq43iQyVbdQHfhGbiNPEg2LVSEXR
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
" > .env
# Convert 30 public tokens from Alice into 30 private tokens for Bob.
@ -194,7 +195,7 @@ leo run transfer_public_to_private aleo17vy26rpdhqx4598y5gp7nvaa9rk7tnvl6ufhvvf4
# Swap in the private key of Bob.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkpFo72g7N9iFt3JzzeG8CqsS5doAiXyFvNCgk2oHvjRCzF
PRIVATE_KEY=APrivateKey1zkp2RWGDcde3efb89rjhME1VYA8QMxcxep5DShNBR6n8Yjh
" > .env
# Convert 40 private tokens from Bob into 40 public tokens for Alice.
@ -235,5 +236,5 @@ leo run transfer_private_to_public "{
# This is done to ensure that program.json is the same after every execution of ./run.sh.
echo "
NETWORK=mainnet
PRIVATE_KEY=APrivateKey1zkp1w8PTxrRgGfAtfKUSq43iQyVbdQHfhGbiNPEg2LVSEXR
PRIVATE_KEY=APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
" > .env