This content originally appeared on DEV Community and was authored by Fifo
This is a submission for the Build Better on Stellar: Smart Contract Challenge : Build a dApp
The Team
- Fabricius Zatti(Fifo): fazzatti
- Victor Hugo Martins: victorhugo-pmartins
What We Built
This submission is complementary to another tutorial submission in a separate category.
This submission contains two different fully-interactive demos around a proposed standard for extending asset capabilities with classic wrappers. The proposal defines a structured approach to wrap classic assets with unique custom rules that can be either enforced by asset issuers or made option by any ecosystem builder.
#1 - Enforced Wrapper with Probation: This first demo covers the perspective of an asset issuer applying the wrapper approach to enforce custom granular probation rules for the classic asset behavior.
#2 - Optional Wrapper with Campaign: This second demo covers the perspective of an either an asset issuer or simply a builder in the ecosystem applying the wrapper approach to allow asset holder to opt-in and participate in a campaign, accumulating points and earning prizes as they transact with the classic asset.
Both implementations can be broken into two moments:
- Setup phase: Allows the audience to navigate all steps of setup for the demo, since creating the admin account(or user freighter) to deploying and customizing the contract rules
- Interactive Playground: Generate and control new users as well as the admin to interact with the contracts a observe the evolution of the use case as the transactions are executed and recorded in a timeline tree.
Demo
Both demos are also covered in the complementary submission to the tutorial category. The other submission covers a video series, including a deep dive and walkthrough these two demos and the contracts. The two specific videos that cover these demos are linked here as well.
My Code
The main repository with the core implementation is public under oi-fifo-soroban-demos and it contains a collection of different examples and assets. The relevant items for this submission are listed below:
- Rust implementation:
- Standard Traits: A package containing default interfaces exemplifying the proposed standard and common functions.
- Classic Asset Wrapper(Enforced): A contract implementation for the Classic Asset Wrapper following the enforced approach.
- Classic Asset Wrapper (Optional): A contract implementation for the Classic Asset Wrapper following the optional approach.
- Probation: An Asset Controller implementation for enforced use cases applying custom granular limits around a probation period to asset holders.
- Campaign: An Asset Controller implementation for optional use cases enabling asset holders to opt-in and participate in a campaign to collect points and prizes.
- Counter: A simple Asset Controller implementation for optional use cases implementing a counter. (step-by-step tutorial recording)
Journey
We had a blast! It's been a long time since we've been maturing the idea of a classic wrapper, but we didn't have the opportunity(and perhaps the initial "pushing" motivator) to try and validate the de approach. We took the opportunity to work on a standard proposal as we moved through the use cases implementation and a lot(for real, A LOT!) of testing! We kept going back, rethinking, prototyping, testing again, rinse and repeat.
In the past, we have experimented with Soroban in many ways, but we believe that a big key differentiator for Stellar is the ability to combine the best of both worlds(Soroban and classic) into hybrid assets. With that in mind, we wanted to explore structured approaches for extending classic assets' behavior in unique ways and also build something for the community's benefit.
The process was highly focused on prototyping and testing first-handed in testnet to get a feel for how well different designs would support different use cases as well as integration with the front end and wallets. Our approach was mainly around:
- Implement quick rounds of the soroban contracts
- Compile
- Implementing/updating the typescript clients
- Running integration tests for Testnet
- Fail/find gaps
- Repeat
We wanted to write more tests in Rust, but there was a limiting factor. Currently, there is no ready-to-use or simple way of simulating different control flags like auth_revocable
in Rust tests(I think I opened an issue about it months ago). With this in mind, we decided to overcome this by quickly building and testing with the typescript clients and Stellar Plus (Shameless plug). This allowed us to get rapid feedback from the behavior in the testnet, which kept our feedback coming and allowed speedy prototyping and refinement.
We're looking forward to getting feedback from the devs and builders in the community!
This content originally appeared on DEV Community and was authored by Fifo
Fifo | Sciencx (2024-08-18T22:48:11+00:00) A Standard Proposal for Extending Classic Asset’s Behavior – Demos. Retrieved from https://www.scien.cx/2024/08/18/a-standard-proposal-for-extending-classic-assets-behavior-demos/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.