The Aleo Monopoly Rebuild II program (version 0.2.0) is a smart contract written in Leo programming language. This smart contract is designed for a game resembling a monopoly where players can interact with tokens, buildings, and various in-game actions
A simple monopoly game in Leo.
Please replace
your address and private key in the code ~ both in the .env
and input
file
This program is a game of owner where each gets 10,000 token to buy buildings of 1,500 token
- Each user in the game is issue 10,000 token to
buy
a property of 1500 token - The owner may buy a property and
rent
to earn by rolling dice. if you roll exact dice, you earn 150 token, otherwise you lose 150 token Sale
of property is possible when the other user send a request to buy off owner property, doubling hisrent
fee ownershipMystery card
Implements actions related to mystery cards, again influenced by a random choice.Mint Reward Transition
: Mints rewards for players based on certain conditions.
Note that the program can be easily extended to include addition features such as a fractional investing
function, which would allow owner to invest partly to other users or owner.
aMONO Token Structure (TokenInfo):
- Represents a custom token named aMONO.
- Contains information such as token name, symbol, decimals, circulating supply, total supply, and admin address.
Building Information Structure (BuildingInfo):
- Describes a building in the Monopoly game.
- Includes a unique building ID, maximum building count, and the receiver's address.
Game Record (Buildings):
- Records the owner's address, the amount of tokens, and the number of buildings owned.
account:
Maps addresses to their respective token balances.get_reward:
Maps addresses to claimable reward amounts.tokens:
Maps token IDs to their corresponding TokenInfo.unique_building:
Maps unique building IDs to their BuildingInfo.
Token Issuance (issue transition):
- Allows the issuance of aMONO tokens to a specified player.
- Checks the caller's address before processing the issuance.
You may have already guessed that this program has a few bugs. We list some of them below:
rent fee after sale maybe a problem since no desired input
Can you find any others?
record declarations
record ownership
struct implementation
mapping data
Leo provides users with a command line interface for compiling and running Leo programs.
Users may either specify input values via the command line or provide an input file in inputs/
.
The program.json
/.env
file contains a private key and address.
This is the account that will be used to sign transactions and is checked for record ownership.
When executing programs as different parties, be sure to set the private_key
and address
fields in program.json
to the appropriate values.
See ./run.sh
for an example of how to run the program as different parties.
The Aleo SDK provides a command line interface for generating new accounts. To generate a new account, run
leo account new
- Modify
inputs/shib.in
with the desired inputs. - Run
leo run <function_name>
For example,
leo run issue
leo run monopoly_buy
leo run monopoly_rent
leo run monopoly_sale
leo run mystery_card
leo run mint_reward => test
#Conclusion This Aleo Monopoly Rebuild II smart contract provides a robust foundation for implementing an intriguing and feature-rich Monopoly game on the Aleo blockchain. It incorporates various game mechanics, including token issuance, building management, and mystery card interactions. Developers can contribute to its evolution and enhancement by following the provided contribution guidelines.
Have fun playing the game...
#Screen record https://github.com/Elexy101/Aleo-Monopoly/assets/24855083/29c474fa-fdf7-4ef9-9036-48dacee79c5e
Any bug or any problem, you can DM me or send @ Discord community @AleoHQ :)