I tried to run Token and Simple Token programs and both returned that error. I didn't make any change to the code.
Go to Leo Playground, select examples, Token. Click Run -> Main and wait for the error
program token.aleo {
// On-chain storage of an `account` map, with `address` as the key,
// and `u64` as the value.
mapping account: address => u64;
record token {
// The token owner.
owner: address,
// The Aleo balance (in gates).
gates: u64,
// The token amount.
amount: u64,
}
/* 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) {
// Mint the tokens publicly by invoking the computation on-chain.
return then finalize(receiver, amount);
}
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.
increment(account, receiver, amount);
}
// The function `mint_private` initializes a new record with the specified amount of tokens for the receiver.
transition mint_private(receiver: address, amount: u64) -> token {
return token {
owner: receiver,
gates: 0u64,
amount: amount,
};
}
/* Transfer */
transition transfer_public(public receiver: address, public amount: u64) {
// Transfer the tokens publicly, by invoking the computation on-chain.
return then finalize(self.caller, receiver, amount);
}
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.
decrement(account, sender, amount);
// Increments `account[receiver]` by `amount`.
// If `account[receiver]` does not exist, it will be created.
// If `account[receiver] + amount` overflows, `transfer_public` is reverted.
increment(account, receiver, amount);
}
// The function `transfer_private` sends the specified token amount to the token receiver from the specified token record.
transition transfer_private(sender: token, receiver: address, amount: u64) -> (token, token) {
// Checks the given token record has sufficient balance.
// This `sub` operation is safe, and the proof will fail if an overflow occurs.
// `difference` holds the change amount to be returned to sender.
let difference: u64 = sender.amount - amount;
// Produce a token record with the change amount for the sender.
let remaining: token = token {
owner: sender.owner,
gates: sender.gates,
amount: difference,
};
// Produce a token record for the specified receiver.
let transferred: token = token {
owner: receiver,
gates: 0u64,
amount: amount,
};
// Output the sender's change record and the receiver's record.
return (remaining, transferred);
}
// 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 {
// 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.
let difference: u64 = sender.amount - amount;
// Produces a token record with the change amount for the caller.
let remaining: token = token {
owner: sender.owner,
gates: sender.gates,
amount: difference,
};
// Output the sender's change record.
// Increment the token amount publicly for the token receiver.
return remaining then finalize(receiver, amount);
}
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.
increment(account, receiver, amount);
}
// 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 {
// Produces a token record for the token receiver.
let transferred: token = token {
owner: receiver,
gates: 0u64,
amount: amount,
};
// Output the receiver's record.
// Decrement the token amount of the caller publicly.
return transferred then finalize(self.caller, amount);
}
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.
decrement(account, sender, amount);
}
}
Leo Compiled 'main.leo' into Aleo instructions
⏳ Compiling 'token.aleo'...
• Loaded universal setup (in 17 ms)
• Built 'mint_public' (in 2216 ms)
• Built 'mint_private' (in 4426 ms)
• Built 'transfer_public' (in 2398 ms)
• Built 'transfer_private' (in 7839 ms)
• Built 'transfer_private_to_public' (in 6888 ms)
• Built 'transfer_public_to_private' (in 4101 ms)
Leo ✅ Built 'token.aleo' (in "/usr/playground-projects/adorable_succinct_breezy_beauty/build")
Error [ECLI0377010]: Failed to execute the `aleo run` command.
SnarkVM Error: Function 'main' does not exist.