developer-grants icon indicating copy to clipboard operation
developer-grants copied to clipboard

AssetHandover | Sample Dapp

Open AmarildoGrembi opened this issue 3 years ago • 7 comments

AssetHandover | Sample Dapp

Grant Category

  • Open-source maintenance
  • Educational material

Description

The AssetHandover Dapp allows account holders to transfer ownership of their assets to a trusted recipient, at a specified release date.

Problem statement

One of the best ways to learn the fundamental concepts of a new technology, is by looking at the implementation of practical examples. So far, except the KittyItems repo, there is no other fully open source practical example out there with good documentation to showcase how you could leverage the various smart contracts and smart contract interfaces provided by the Flow team and integrate them to create a fully functional Dapp. At BuildSquad, to better familiarize ourselves with Flow and the fundamental concepts of Fungible/NonFungible tokens, we decided to start working on a side project which attempts to tackle a real-world problem. Our objective was to understand the internals of some smart contracts which are the building blocks for almost any type of Dapp on Flow. Namely the FungibleToken, NonFungibleToken smart contract interfaces, and some of their concrete implementations. It helped a lot and we believe it will help many developers on the Flow ecosystem. We would like to open source its implementation, to serve the same purpose as kitty items.

  • Target audience: Web3 Builders aiming to build on Flow, who are:

    • Looking for practical examples on how to build a Dapp related to:
      • FungibleToken Interface
      • FungibleToken implementation (besides Flow token)
      • NonFungibleToken Interface
      • NonFungibleToken implementation
      • FungibleTokenSwitchboard
    • Looking to build a Dapp by linking the aforementioned integral parts together, while understanding their internals.
  • Evidence for the need:

    This sample app will cover partially or fully 4 items that are currently found on the wishlist, specifically:

    Generally speaking, it is a fully-functional open-source project that showcases functionalities for the above-mentioned items, while following best practices and providing documentation/explanation for the reason behind the implementation.

    We plan to post this proposal on the Flow forum so we could pinpoint more specifically what the developer ecosystem would prefer. Edited: we posted the proposal and currently awaiting feedback

Proposed solution

AssetHandover is a Dapp where account holders can grant a recipient the ability to withdraw specific tokens that they own (both Fungible and NonFungible), at a future release date. Each account can only declare one recipient, as this removes the complexity of handling race conditions upon withdrawals. However, an account can be the recipient of multiple handovers. The account holder can specify which Fungible tokens will be handed over, as well as a maximum amount for each token. It is also possible to specify which NonFungible tokens will be handed over, as well as a specific list of NFT IDs from each NFT Collection. The above tokens are not locked for the account holder, meaning that they can still be utilized/transferred. The recipient (or any other account) can attempt to withdraw them, at any given time, however this will only be successful after the release date has passed, and only for the authorized recipient. One real-world scenario would be to create a digital "will" for one's account, or to simply add another account as a backup, in case the account holder loses access to his/her account, or is no longer able to interact with it.

More specifically the Dapp would include:

  • Backend:

    • AssetHandover smart contract (core functionality of the Dapp, following best practices and showcasing important concepts, such as access modifiers, admin functionality, token vault best practices, capabilities, withdrawals/deposits of FungibleToken and NonFungibleToken. etc.).
    • BlpToken smart contract (a custom FungibleToken implementation used to showcase the functionality of the Dapp, but also to showcase how you could create and mint your own FungibleToken).
    • Domains smart contract (a custom NonFungibleToken implementation used to showcase the functionality of the Dapp, but also to showcase how you could create and mint your NFTs, we decided to re-use the tutorial created by the amazing team at learnweb3.io so that anyone could also focus on this part if they like, we highly recommend it).
    • All the necessary scripts and transactions to facilitate the described functionality.
  • Frontend:

    We are thinking of two main personas, holder and recipient.

    The holder would be able to:

    • Login.
    • View owned assets (FlowToken/BlpToken/Domains for the time being).
    • Create a LockUp by specifying the recipient, release date and the assets.
    • View/Edit the LockUp.

    The recipient would be able to:

    • Login.
    • View assigned LockUps and some public information about it.
    • Withdraw specific assets or everything from each LockUp.

(* LockUp is the name of the resource which contains all the information about the asset handover for an account holder. As described above, the assets are not really locked, what is locked is the capability to withdraw them, given that it is only possible from the authorized recipient and after the release date.)

It is important to note that the Admin (account where the AssetHandover contract deployed) is responsible for adding more tokens to the custom registry of tokens allowed for handover. This is done with a transaction, which removes the need for updating the smart contract itself.

Later on, we would like to include NFTCatalog and FungibleTokenMetadataViews smart contracts, in order to showcase the level of interoperability these contracts bring on Flow.

Impact

  • We believe that this Sample Dapp will have a positive impact for the wider Flow developer ecosystem and specifically new developers that aim to focus on Flow. They could use this example as a stepping stone for bootstrapping a specific solution or brainstorming. Generally speaking, this Dapp could be used as a stepping stone for every possible solution as it covers some of the most integral parts of core Flow functionalities.

Milestones and funding

We have already finished the backend side of things and would be keen to showcase it to every interested party. We would like to receive your support so we could finalize mostly the API & frontend and some details, so we could offer it to the community as the go-to educational material, alongside KittyItems.

Milestone Deliverables Timeline Risks USD proposal
1 - API & Frontend Fully functional, includes all the aforementioned functionalities. 6 weeks - 14,400
2 - Maintenance Keep the sample app fully functional and up to date with the latest upgrades and best practices. 3 months - 3,000
3 - Adoption 5 projects using the template repository 3 months - continuously, if needed - 3,000

Team

BuildSquad (a startup that launched recently) is a curated squad of web3 builders that aim to enrich the web3 ecosystem by developing products, tools, prototypes, and tutorials in the form of open-source public goods.

Name Role Bio Contact
Amarildo Co-Founder Software Engineer Experienced in full-stack web development and blockchain integrations (including Flow), and, a successful track record in early phase start-ups. Dreaming of full adoption since late 2018. [email protected] amarildo#3686
Matthias Co-Founder Regulatory lawyer advising major international DeFi and CeFi platforms on their market entry in Europe, product compliance, governance, and AML frameworks. [email protected] Matthias Winter#3465

AmarildoGrembi avatar Nov 21 '22 14:11 AmarildoGrembi

Hi @AmarildoGrembi, thanks for submitting this proposal! We're reviewing and will get back to you soon.

chrisackermann avatar Nov 22 '22 16:11 chrisackermann

Thanks, @chrisackermann. This proposal does not hinder us from working on the BackStore. Let me know if you have any questions or want to look at the backend we have built.

AmarildoGrembi avatar Nov 22 '22 18:11 AmarildoGrembi

Hello @chrisackermann, hope you are doing well. Quick update: Asset-Handover has now been open-sourced! It includes the full backend work, a thorough readme, and a detailed guide. We are currently showcasing our repository to the community and awaiting feedback.

AmarildoGrembi avatar Nov 29 '22 16:11 AmarildoGrembi

hello @chrisackermann - milestones updated. Thanks for the feedback!

AmarildoGrembi avatar Dec 11 '22 21:12 AmarildoGrembi

Just updated the Milestones and funding section with a cost estimation.

AmarildoGrembi avatar Jan 19 '23 16:01 AmarildoGrembi

Hi @AmarildoGrembi! Thanks for your patiences, we've approved this proposal and will be reaching out directly with next steps. Thanks!

chrisackermann avatar Jan 27 '23 20:01 chrisackermann

Thanks @chrisackermann! Excited to make the AssetHandover an integral part of the Flow dev journey, with the recent addition of Flow super commands this should definitely be one of the scaffold options (adding it on our todo list).

AmarildoGrembi avatar Jan 30 '23 12:01 AmarildoGrembi