stacks-archive / hackathons

Blockstack Hackathons
MIT License
0 stars 1 forks source link

[$400 to Top 5 Contracts | $1,000 for Grand Prize] Level 2 - ADVANCED: Develop an Advanced Smart Contract in the Clarity Programming Language for the Stacks 2.0 Blockchain #3

Closed jdbender66 closed 3 years ago

jdbender66 commented 4 years ago

[$200] Level 2 - ADVANCED: Develop an Advanced Smart Contract in the Clarity Programming Language for the Stacks 2.0 Blockchain

Prize Bounty

$400 USD to the top 5 projects submitted. $1,000 USD Grand Prize to best overall submission. Winners will be contacted by Blockstack for payment.

Challenge Description

In Level 2 - ADVANCED, developers will build robust, complex, fully-functional smart contracts. The goal is for these contracts to demonstrate key features of Clarity and provide the community with a tangible first-look at what’s possible using the language.

To get started, we recommend heading to the "Resources" section of the Clarity Hackathon homepage.

Get to meet other hackers in our Discord community! We set up a dedicated #hackathon support thread for all your hacking queries.

Level 2 Overview

This level is for those devs that wanna dive right into the deep end. Submissions will be powerful, robust, fully-functional smart contracts. Exhibits creative & novel use of the Clarity language. Well-designed, logically structured, with real-world applicability. Implements a comprehensive testing suite. Well-commented code describing all events in accessible language. Accompanying documentation. Could potentially be used in a production-grade application. Makes full use of the Clarity Language reference, experimenting with complex use of the type system, public/private functions, contract calls, return statements, keywords, etc.

Submission Deadline

The entry and submission period for Hackathon Phase 1: Contracts: commences on May 14, 2020 at 10:00 a.m. E.D.T. and ends on May 29, 2020 at 11:45 pm E.D.T. ("Phase 1")

Submission Requirements

  1. The contract and tools must be built for Blockstack's Clarity smart contracting language;
  2. The contract and tools must be the original work of the individual participant or the participating team; and
  3. Any third-party technology used by the individual participant or the participating team must be subject to valid perpetual, irrevocable licenses.

Judging Criteria

Category Description
Design Is the smart contract well-structured, and broken into logical functions?
Functionality How powerful or robust is the functionality the smart contract provides?
Use of Clarity Reference How many different Clarity functions, keywords, or design principles are used?
Originality/Creativity How unique or innovative is the mechanism smart contract? Has it been implemented before?
Real World Viability How applicable is the smart contract to use in real world situations?
Documentation/Commenting Does the project come accompanied by a comprehensive documentation or README? Is the code commented thoroughly so anyone could read through and discern its functionality?

Winner Announcement Date

Our judges, Diwaker Gupta, Blockstack PBC Head of Engineering, and Aaron Blankenstein, Blockstack PBC Core Engineer, will select the winners before the start of the second phase of the hackathon on June 3, 2020. The winning participant or participating team will be notified within approximately one (1) week following selection of the winner, by message sent to the e-mail address used at the time of registration on Gitcoin. Blockstack will also make an announcement of the winner on twitter at twitter.com/blockstack.

gitcoinbot commented 4 years ago

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


This issue now has a funding of 0.001 ETH (0.2 USD @ $201.62/ETH) attached to it as part of the blockstack fund.

gitcoinbot commented 4 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 1 year, 9 months ago. Please review their action plans below:

1) x5engine has started work.

I will try to make a small web app that uses Clarity on the Stacks 2.0 2) dotrungkien has started work.

try to build really useful extendable smart contract, will apply to my own game in blockstack. 3) ennea8 has started work.

I want to build a smart contract for trade https://github.com/ennea8/blockstack-hackathon-clarity.git 4) friedger has started work.

Start from a simple use case and build on top of it. 5) mustafa201611 has started work.

;; copyright: (c) 2013-2019 by Blockstack PBC, a public benefit corporation.

;; This file is part of Blockstack.

;; Blockstack is free software. You may redistribute or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License or ;; (at your option) any later version.

;; Blockstack is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY, including without the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License ;; along with Blockstack. If not, see http://www.gnu.org/licenses/.

;; Non Fungible Token, modeled after ERC-721 (define-non-fungible-token non-fungible-token int)

;; Storage (define-map tokens-spender ((token-id int)) ((spender principal))) (define-map tokens-count ((owner principal)) ((count int))) (define-map accounts-operator ((operator principal) (account principal)) ((is-approved bool)))

;; Internals

;; Gets the amount of tokens owned by the specified address. (define-private (balance-of (account principal)) (default-to 0 (get count (map-get? tokens-count ((owner account))))))

;; Gets the owner of the specified token ID. (define-private (owner-of? (token-id int)) (nft-get-owner? non-fungible-token token-id) )

;; Gets the approved address for a token ID, or zero if no address set (approved method in ERC721) (define-private (is-spender-approved (spender principal) (token-id int)) (let ((approved-spender (unwrap! (get spender (map-get? tokens-spender ((token-id token-id)))) false))) ;; return false if no specified spender (is-eq spender approved-spender)))

;; Tells whether an operator is approved by a given owner (isApprovedForAll method in ERC721) (define-private (is-operator-approved (account principal) (operator principal)) (default-to false (get is-approved (map-get? accounts-operator ((operator operator) (account account))))))

(define-private (is-owner (actor principal) (token-id int)) (is-eq actor ;; if no owner, return false (unwrap! (owner-of? token-id) false)))

;; Returns whether the given actor can transfer a given token ID. ;; To be optimized (define-private (can-transfer (actor principal) (token-id int)) (or (is-owner actor token-id) (is-spender-approved actor token-id) (is-operator-approved (unwrap! (owner-of? token-id) false) actor)))

;; Internal - Register token (define-private (register-token (new-owner principal) (token-id int)) (let ((current-balance (balance-of new-owner))) (begin (nft-mint? non-fungible-token token-id new-owner) (map-set tokens-count ((owner new-owner)) ((count (+ 1 current-balance)))) true)))

;; Internal - Release token (define-private (release-token (owner principal) (token-id int)) (let ((current-balance (balance-of owner))) (begin (map-delete tokens-spender ((token-id token-id))) (map-set tokens-count ((owner owner)) ((count (- current-balance 1)))) true)))

;; Public functions

(define-constant same-spender-err (err 1)) (define-constant not-approved-spender-err (err 2)) (define-constant failed-to-move-token-err (err 3)) (define-constant unauthorized-transfer-err (err 4)) (define-constant failed-to-mint-err (err 5))

;; Approves another address to transfer the given token ID (approve method in ERC721) ;; To be optimized (define-public (set-spender-approval (spender principal) (token-id int)) (if (is-eq spender tx-sender) same-spender-err (if (or (is-owner tx-sender token-id) (is-operator-approved (unwrap! (owner-of? token-id) not-approved-spender-err) tx-sender)) (begin (map-set tokens-spender ((token-id token-id)) ((spender spender))) (ok token-id)) not-approved-spender-err)))

;; Sets or unsets the approval of a given operator (setApprovalForAll method in ERC721) (define-public (set-operator-approval (operator principal) (is-approved bool)) (if (is-eq operator tx-sender) same-spender-err (begin (map-set accounts-operator ((operator operator) (account tx-sender)) ((is-approved is-approved))) (ok true))))

;; Transfers the ownership of a given token ID to another address. (define-public (transfer-from (owner principal) (recipient principal) (token-id int)) (if (and (can-transfer tx-sender token-id) (is-owner owner token-id) (not (is-eq recipient owner))) (if (and (release-token owner token-id) (register-token recipient token-id)) (ok token-id) failed-to-move-token-err) unauthorized-transfer-err))

;; Transfers tokens to a specified principal. (define-public (transfer (recipient principal) (token-id int)) (transfer-from tx-sender recipient token-id))

;; Mint new tokens. (define-private (mint (owner principal) (token-id int)) (if (register-token owner token-id) (ok token-id) failed-to-mint-err))

;; Initialize the contract (begin (mint 'ST398K1WZTBVY6FE2YEHM6HP20VSNVSSPJTW0D53M 10001) (mint 'ST398K1WZTBVY6FE2YEHM6HP20VSNVSSPJTW0D53M 10002) (mint 'ST1JDEC841ZDWN9CKXKJMDQGP5TW1AM10B7EV0DV9 10003)) 6) hozzjss has started work.

I'm implementing a smart contract version of a real world property rental contract 7) xmakina has started work.

Expand on the endless list, add a new process to gather and then distribute funds 8) psq has started work.

Implement a contract that allows clients to swap a token for an other in a trustless fashion, in a fashion similar to what Uniswap does in the ETH world by having a liquidity pool that earns transaction fees taken on what others exchanges. 9) zexxlin has started work.

Plan to build a smart contract that enables users to host anonymous polls with token rewards as incentives. 10) lketchersid has started work.

Taking the Level 1 solution which uses tasks status with block time and integrating with @friedger's escrow contract. In other words - if task is complete, signal a release of escrow. if task is cancelled, signal a cancel of escrow. Time permitting, would signal if work was done faster than a prescribed SLA. 11) dale-q has started work.

I send my contract to 50$ already, but today got an email that I can send my work in all three issues. So I'll try my luck. 12) harsh-98 has started work.

This escrow contract has functionalities designed for various use-cases. The main idea behind it, is importance of the consensus of atleast M participants among N for moving the funds in a transparent way. People providing donation to NGOs and relief committee, put their trust in its members. But due to bureaucracy, most members doesn't have say in how money is used. By bringing m-of-n escrow contract in picture, consensus is required for spending money. It can also be used for children' banking account, where atleast one of the parent consent is required for spending fund.
Millennials have poor savings option (401k or IRA), which doesn't have good yield. Also in crypto due to volatility, FUD happens and even hodlers make wrong decisions. Having a escrow crypto account with let's say 5 friends that require alteast 3 to liquidate 10% crypto to fait.

Other benefit of this escrow contract is participants can decided how to spend money. Funds can be divided in small chunks and participants as a group can decide where to spent them, like 30% on health, 40% on lifestyle and 30% on saving.

Learn more on the Gitcoin Issue Details page.

gitcoinbot commented 4 years ago

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


Work for 0.001 ETH (0.22 USD @ $224.93/ETH) has been submitted by:

  1. @friedger
  2. @hozzjss
  3. @xmakina
  4. @dotrungkien
  5. @zexxlin
  6. @lketchersid
  7. @psq
  8. @dale-q
  9. @harsh-98

@jdbender66 please take a look at the submitted work:


hozzjss commented 4 years ago

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

Work for 0.001 ETH (0.21 USD @ $208.81/ETH) has been submitted by:

  1. @friedger
  2. @hozzjss

@jdbender66 please take a look at the submitted work:

This is my contract's repo as gitcoinbot didn't provide it for some reason https://github.com/hozzjss/clarity-property-rental

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 years ago

This issue has been automatically closed. Please reopen if needed.