Skip to content

Commit

Permalink
Merge branch 'mainnet' into fix/remove-snarkos
Browse files Browse the repository at this point in the history
  • Loading branch information
d0cd committed May 15, 2024
2 parents f2f6c19 + 88d035d commit 7c63411
Show file tree
Hide file tree
Showing 804 changed files with 9,159 additions and 8,611 deletions.
6 changes: 3 additions & 3 deletions .circleci/lottery/src/main.leo
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ program lottery.aleo {
owner: address,
}

transition play() -> Ticket {
async transition play() -> (Ticket, Future) {
let ticket: Ticket = Ticket {
owner: self.caller,
};
return ticket then finalize();
return (ticket, finalize_play());
}

finalize play() {
async function finalize_play() {
// Check that the lottery has not expired.
assert(block.height <= 1000u32);

Expand Down
24 changes: 12 additions & 12 deletions .circleci/token/src/main.leo
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ program token.aleo {
/* Mint */

// The function `mint_public` issues the specified token amount for the token receiver publicly on the network.
transition mint_public(public receiver: address, public amount: u64) {
async transition mint_public(public receiver: address, public amount: u64) -> Future {
// Mint the tokens publicly by invoking the computation on-chain.
return then finalize(receiver, amount);
return finalize_mint_public(receiver, amount);
}

finalize mint_public(public receiver: address, public amount: u64) {
async function finalize_mint_public(public receiver: address, public amount: u64) {
// Increments `account[receiver]` by `amount`.
// If `account[receiver]` does not exist, it will be created.
// If `account[receiver] + amount` overflows, `mint_public` is reverted.
Expand All @@ -35,12 +35,12 @@ program token.aleo {
}

/* Transfer */
transition transfer_public(public receiver: address, public amount: u64) {
async transition transfer_public(public receiver: address, public amount: u64) -> Future {
// Transfer the tokens publicly, by invoking the computation on-chain.
return then finalize(self.caller, receiver, amount);
return finalize_transfer_public(self.caller, receiver, amount);
}

finalize transfer_public(public sender: address, public receiver: address, public amount: u64) {
async function finalize_transfer_public(public sender: address, public receiver: address, public amount: u64) {
// Decrements `account[sender]` by `amount`.
// If `account[sender]` does not exist, it will be created.
// If `account[sender] - amount` underflows, `transfer_public` is reverted.
Expand Down Expand Up @@ -78,7 +78,7 @@ program token.aleo {

// The function `transfer_private_to_public` turns a specified token amount from a token record into public tokens for the specified receiver.
// This function preserves privacy for the sender's record, however it publicly reveals the token receiver and the token amount.
transition transfer_private_to_public(sender: token, public receiver: address, public amount: u64) -> token {
async transition transfer_private_to_public(sender: token, public receiver: address, public amount: u64) -> (token, Future) {
// Checks the given token record has a sufficient token amount.
// This `sub` operation is safe, and the proof will fail if an underflow occurs.
// `difference` holds the change amount for the caller.
Expand All @@ -92,10 +92,10 @@ program token.aleo {

// Output the sender's change record.
// Increment the token amount publicly for the token receiver.
return remaining then finalize(receiver, amount);
return (remaining, finalize_transfer_private_to_public(receiver, amount));
}

finalize transfer_private_to_public(public receiver: address, public amount: u64) {
async function finalize_transfer_private_to_public(public receiver: address, public amount: u64) {
// Increments `account[receiver]` by `amount`.
// If `account[receiver]` does not exist, it will be created.
// If `account[receiver] + amount` overflows, `transfer_private_to_public` is reverted.
Expand All @@ -105,7 +105,7 @@ program token.aleo {

// The function `transfer_public_to_private` turns a specified token amount from `account` into a token record for the specified receiver.
// This function preserves privacy for the receiver's record, however it publicly reveals the caller and the specified token amount.
transition transfer_public_to_private(public receiver: address, public amount: u64) -> token {
async transition transfer_public_to_private(public receiver: address, public amount: u64) -> (token, Future) {
// Produces a token record for the token receiver.
let transferred: token = token {
owner: receiver,
Expand All @@ -114,10 +114,10 @@ program token.aleo {

// Output the receiver's record.
// Decrement the token amount of the caller publicly.
return transferred then finalize(self.caller, amount);
return (transferred, finalize_transfer_public_to_private(self.caller, amount));
}

finalize transfer_public_to_private(public sender: address, public amount: u64) {
async function finalize_transfer_public_to_private(public sender: address, public amount: u64) {
// Decrements `account[sender]` by `amount`.
// If `account[sender]` does not exist, it will be created.
// If `account[sender] - amount` underflows, `transfer_public_to_private` is reverted.
Expand Down
2 changes: 1 addition & 1 deletion .resources/release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.11.0
v1.12.0
Loading

0 comments on commit 7c63411

Please sign in to comment.