Giter Site home page Giter Site logo

algorand-python-coding-assignment's Introduction

๐ŸŽ“ Become an Algorand Python developer!

๐Ÿšฉ Let's build an NFT marketplace with Algorand Python!

Welcome to your first step to becoming a master in Algorand Python!

In this AlgoKit workspace, there are 2 sub-projects:

  • python-demo
  • coding-assignment

You can see a fully implemented personal bank smart contract written in Algorand Python in the python-demo project folder.

In the coding-assignment project folder, we will implement an NFT marketplace smart contract with Algorand Python

NftMarketplace smart contract explained:

This simple NftMarketplace smart contract let's sellers to list NFTs for sale and let's buyers to buy the NFT.

lifecycle of this app:

  1. The seller deploys the smart contract.
  2. The seller calls the bootstrap method to set the asset ID for sale, unitary price, and opt the contract into the ASA.
  3. The buyer calls the buy method to buy the ASA.
  4. The seller calls the withdraw_and_delete method to withdraw the remaining ASA and profits, and then delete the smart contract.

The coding assignment consists of 4 questions and for each question you can implement your code where it says Write code here

Please carefully read and follow the checkpoints below to properly complete the coding assignment!

Developer Resources:

Checkpoint 1: ๐Ÿงฐ Install prerequisites

  1. Install Docker. It is used to run a local Algorand network for development.
  2. Install Python 3.12+
  3. Install Node.JS / npm
  4. Install AlgoKit.

Checkpoint 2: ๐Ÿ’ป Development environment setup

  1. Fork this repository.
  2. git clone the forked repo.
cd [DIRECTORY_OF_YOUR_CHOICE]
git clone [FORKED_REPO_URL]
  1. Open this project in VSCode
  2. Open the file named algorand-python-coding-assignment.code-workspace and press the open workspace button to activate workspace mode.
  3. 3 VSCode terminal will be auto-created: ROOT python-demo coding-assignment. Now go to the ROOT VSCode terminal and run the following command to install the dependencies required for both sub-projects:
algokit project bootstrap all

If the 3 terminals don't open automatically, Press the + button and select ROOT in VSCode.

If you get Unhandled PermissionError: [Errno 13] Permission denied: '/Users/$name/.config/algokit' error, add sudo in the front and run the following command:

sudo algokit project bootstrap all
  1. Now go to the coding-assignment terminal and run the following command to activate the Python virtual environment:
poetry shell
  • To deactivate the Python virtual environment, run exit in the terminal.
  • After activating the venv, run the following command and if you see various dependencies including algorand-python, you successfully activate the virtual environment!
pip list

๐ŸŽ‰ Now you are ready to crack this assignment! Good luck coding! ๐Ÿ’ป

Tutorial for forking and cloning this repository: https://github.com/algorand-fix-the-bug-campaign/challenge-1/assets/52557585/acde8053-a8dd-4f53-8bad-45de1068bfda

Checkpoint 3: ๐Ÿ“ Solve the problems!

This coding assignment consists of 4 problems in total. Follow the instructions below!

Launch localnet

  1. Open Docker Desktop first and then run the following command in your terminal to launch the local network. Click me for more information on localnet!
algokit localnet start

All code in this repo will be run in localnet.

If there are issues with your localnet run the following command to reset the localnet.

algokit localnet reset

Problem 1-4: Instructions

  1. Make sure Python venv is activated in the coding-assignment terminal.
  2. Go tocoding-assignment/smart_contracts/nft_marketplace/contract.py to find instructions for problems 1-4. Read the instructions and solve the problem!
  3. After solving all 4 problems run the following 2 commands to first build the smart contract and then run the smart_contracts/nft_marketplace/deploy-config.ts script.
algokit project run build
algokit project deploy localnet

deploy-config.ts contains a script written with AlgoKit Utils TypeScript that goes through the entire lifecycle of the nft marketplace contract by simulating a scenario where Taylor Swift concert ticket is being sold. Feel free to check out the code!

If you see something similar in your console, you have successfully solved all 4 questions! ๐Ÿ‘๐Ÿ‘ Congratulations! image

Checkpoint 4: ๐Ÿ’ฏ How to submit your work

let's submit your code so the world knows you are now an Algorand Python developer!

  1. Push your code to the forked Github repo. Then create a PR to the original repository.
  2. Follow the Pull Request template and attach the log of your console after running algokit project deploy localnet

algorand-python-coding-assignment's People

Contributors

iskysun96 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.