algorandfoundation / grow-algorand

Grow Algorand and Earn ALGOs ❤️
90 stars 33 forks source link

Stateful smart contract to create Algorand Standard Asset [$2000] #29

Closed michielmulders closed 3 years ago

michielmulders commented 3 years ago

Overview

Description

What is this task?

This task consists of writing the required code and an associated solution article showing how a stateful smart contract can be used together with a stateless smart contract to create new ASAs.

The goal is educational and the code should be as simple and clean as possible. On the one hand, it should not contain extra features that may make understanding harder. On the other hand, the solution should be secure and well-documented.

In particular, the smart contract should not allow the creation of ASAs with names that do not match the ones specified below, should not allow rekeying, should not allow transfer of Algos, ...

At a high level, the application (aka, stateful smart contract) should keep a counter starting at 0. After initialization (which includes linking the stateful smart contract to an associated stateless smart contract used as an escrow account):

  1. Anyone should be allowed to call the application to create a new ASA with asset name "AppASA-x" where x is a digit corresponding to the counter value. Then the counter value is incremented. The ASA is created from the escrow account. The ASA creation transaction is grouped with the application call (in an atomic transfer).
  2. Anyone should be allowed to call the application to request one unit of one ASA created by the escrow account to be transferred to them. The caller may specify the ASA by its asset ID (as one argument of the application call).

Additional notes:

The two smart contracts (stateful and stateless) should be written in PyTEAL (with TEAL v3). The bounty hunter may use either goal or one of the four official SDKs (Go, Python, JS, Java).

The bounty taker may demonstrate the overall use of a stateful smart contract creating ASAs on another example, after approval by the Algorand Foundation (additional bounty).

What are the requirements for the bounty taker?

The bounty hunter should have knowledge of the goal command line or the chosen SDK. They must have a good understanding of ASA, and Algorand stateful and stateless smart contracts. They must understand the pattern of using a stateless smart contract account as an escrow for a smart contract. This pattern is used, for example, in the following example.

What are the deliverables?

1. GitHub project

Description This deliverable is a GitHub project with PyTEAL smart contracts, scripts as well as detailed README documentation allowing any Algorand-beginner developer to run the project.

Concretely, the following steps should be easy to perform (on TestNet) and well documented:

  1. By a user A: Deployment of a stateful application.
  2. By the same user A: Generation and funding of a stateless smart contract account playing the role of an escrow for the application.
  3. By the same user A: Link of the stateful application with the escrow account. This action should only be allowed to be performed by user A.
  4. By any user B: Submit a group of transactions allowing the creation of a new ASA (see description above).
  5. By any user C: Submit a group of transactions allowing the transfer of a created ASA to user C (see description above).

In case the project is created from a Node.js template or any other templates, the README should include the steps on how to re-generate this template.

Judging Criteria and Metrics (optional)

Submission Procedure

2. Solution article

Description The bounty taker should provide a solution article that is written in markdown that describes how the project was built and how it can be used by developers. This solution article will be posted to the Algorand developer portal.

Judging Criteria and Metrics

Submission Procedure

Other Requirements

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 1999.996 USDCa (2000.0 USD @ $1.0/USDCa) attached to it as part of the algorandfoundation fund.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 265 years, 5 months from now. Please review their action plans below:

1) nullun has been approved to start work.

Hey. This task sounds very similar to a project I've been working on. However in mine the ASAs being created were being created as NFTs (1/1) each with their own unique metadata which I rendered out into a HTML5 canvas. All of ASA names also conformed to a naming scheme of "Unique NFT: #XXX", which was tracked by a stateful smart contract. I'd be happy to clean it all up, cut out anything unnecessary, and write up an explanation on how it works and how to deploy/use it.

Learn more on the Gitcoin Issue Details page.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 1999.996 USDCa (2000.0 USD @ $1.0/USDCa) attached to this issue has been cancelled by the bounty submitter