Classic Wrapper for extended asset behavior #1528
Replies: 3 comments 3 replies
-
On custom tokens you say:
Wrt the enforced wrapper approach (I'm still trying to wrap my head around the value prop of the optional variant) it seems to me that all of this still holds because to do anything meaningful with the asset you need to call the wrapper. The only advantage I can think of is that legacy systems that only know stellar assets (and no soroban) will be able to view balances of this wrapped asset, but not really do anything with it. Am I missing anything? |
Beta Was this translation helpful? Give feedback.
-
Nice idea. Would love to see this implemented as a standard contract. However, the contract-based approach expands this idea further, making it possible to define and execute the logic on-chain. |
Beta Was this translation helpful? Give feedback.
-
I'm a big fan of this idea because removes the need for read-only applications such as block explorers like stellar.expert and data analytics platforms like rwa.xyz to update their implementations in order to support custom tokens. I would like to make some suggestions though. Wrapper InterfaceSEP-41 CompatibilityIn order to maximize the chances of this proposal getting adopted by read-write applications (wallets, exchanges, defi protocols, etc.), I think the wrapper interface (enforced & optional) needs to be SEP41-compatible, meaning, clients shouldn't need to know they're interacting with an SAC wrapper to use the token contract. The only difference between interacting with an SAC and a SAC wrapper should be that the functions that update state ( Activate / DeactivateI'm not sure I totally understand the purpose of having activate / deactivate functions. The wrapper contract's admin should have the ability to allow or reject any transaction that updates the SAC's state from within the relevant SEP41-compatible function, so these functions seem redundant. MetadataIn the spirit of wrappers being indistinguishable from their underlying SAC's, I'm not sure if we need the metadata function. Why would a client need to know the information returned from the proposed function? Clients should either be required to use the wrapper, in which case it doesn't matter what the underlying SAC address is, or want to use the wrapper, in which case they also don't care about the underlying SAC address. Clients also wouldn't call the admin/controller contract directly so I don't see why the wrapper would need to provide that info. Wrapper ImplementationI'm not sure we need to standardize how these wrapper contracts are implemented as long as they're SEP41-compatible. Wrappers could contain all the business logic themselves if they wanted to. For example, if transfers above a certain amount should be disallowed, that validation could be implemented within the I think the only thing we need to be opinionated about is authorization. Wrapper contracts should make use of the soroban auth framework by calling DiscoveryI do think we need to standardize how clients determine that an SAC has a required wrapper. Providing the wrapper address in the |
Beta Was this translation helpful? Give feedback.
-
Hey everyone!
I've been sitting on this concept for a while and took the opportunity of the 'Build Better on Stellar: Smart Contract Challenge' to implement these ideas and test out in practice to validate feasibility as well as to get a sense of how it could mature to benefit the ecosystem.
Below you'll find the draft I've been writing on it and I would like to get some feedback before moving forward, especially to brainstorm how such a standard could benefit both asset issuers and other builders in the ecosystem.
I would love to further discuss and experiment with these ideas. If you'd like to dive a bit deeper on the experimentation We've been doing, you can have a look at:
Git repository : Here I've implemented different viewpoints to explore the use cases. There contracts for each wrapper type as well as different asset controller and a node project to experiment with them in testnet.
Interactive demos: Here we have two demos that explore this standard, one that implements Probation rules with an Enforced Wrapper and another one with a fun Campaign combined with an Optional Wrapper to distribute prizes. These control every aspect in a simple way, from initializing accounts, configuring the contracts, testing everything from scratch, and keeping track of the historical transactions to analyze each step of the use case.
Videos: As part of the challenge, we recorded this series, in which we produced four videos. The first one covers the overall idea of the proposed standard. The second one explores the probation demo and implementation in depth. The third one explores the campaign demo and implementation in depth. The last one implements from scratch a very simple controller contract of a counter that integrates with this standard approach.
I'm looking forward to getting some feedback and discussing potential ways for these ideas to evolve into a broader standard.
DRAFT:
Summary:
The object of this proposal is to discuss a standardized approach to extending capabilities for classic assets to:
Motivation:
Classic assets are versatile in nature, and with the release of Soroban, they have become more flexible. They can act as the critical bridge between Classic and Soroban, using the SAC contract. Since the SAC contracts are a default implementation that follows the classic native behavior, they can’t be customized by design, which raises some limitations on how much the asset capabilities can be customized with on-chain logic.
Currently, asset issuers have two main options when looking for more granular control:
Both are valid approaches but have some downsides. While the first approach limits the asset to be used only through soroban, asset holders won’t have access to other classic advantages such as higher throughput, cheaper transactions, and native decentralized markets. The second approach relies on a centralized external(off-chain) service to verify and approve each individual transaction, jeopardizing transparency and creating a bottleneck. It also introduces a central point of vulnerability for the asset operation, such as the server being down, which could render the asset unusable no matter the state of the network.
With scenarios like these in mind, there is room for a third hybrid approach, which could be helpful in certain specific scenarios. By combining certain classic configurations with a standardized soroban implementation, it would be possible to greatly extend classic assets' capabilities with on-chain granular control while still keeping the classic nature and capabilities of the asset when the desired transaction doesn't require the programmability layer.
With a well-defined standard for this approach, builders in the ecosystem can benefit by ensuring a clear integration of these assets in their solutions, leveraging common implementation among the ecosystem, and providing a way for programmatic verification of an asset implementation on-chain(through contract functions) and off-chain(through the .toml file)
Approach
The proposal is divided into two different approaches, aiming at both use cases that require a tight set of rules to be enforced upon an asset and more flexible and simple logic to be applied as an optional way of interacting with the asset.
Enforced Wrapper
Inspired by SEP08, the enforced approach is focused on entities, DAOs, and/or consortiums that control an asset and desire to enforce more custom and granular behavior upon their asset usage. It would contain the following main characteristics:
auth_required
andauth_revocable
.With this approach, by default, any account that creates a trustline won’t be able to transact with the asset using both classic and SAC. The wrapper contract will manage this authorization by transaction similarly to SEP8 but fully on-chain. This would introduce a transaction execution flow like the following:
Such a workflow enables the implementation of use cases such as:
Optional Wrapper
Borrowing from the approach above while simplifying the implementation, any builder that would like to provide custom integrated behavior to a classic asset can offer an optional route for users or specific clients. This approach still implements a Wrapper contract and an Asset Controller contract, although no flag customization or locks are set for the underlying classic asset, rendering the Wrapper optional. Specific limits to which accounts can access the Wrapper can be applied to limit this custom behavior to a group of clients or accounts but wouldn't affect the ability to use the classic asset or SAC directly.
The objective of the Optional Wrapper is to focus on an on-chain approach to share custom rules across different applications as well as standardized implementation for the common portions of the solution. This would introduce a transaction execution flow like the following:
In step 2, we can still consider restrictive rules that asset holders or applications such as wallets choose to be subject to. Such a workflow enables the implementation of use cases such as:
Specification
Here, I see the most room for discussion. There are multiple key points that might be very helpful, but at the same time, I believe that a minimal requirement with optional variations is always preferred. Here are a few selected items so far for discussion
Wrapper:
Enforced only
The wrapper should have mechanisms/functions that can be safely activated and deactivated. This means making it operant while delegating the asset administration to it or recovering from it. It also means adding administration capabilities to the Wrapper for safe maintainability.Asset Controller:
Informational:
is_enforced: boolean
wrapped_asset: address
wrapper: address
admin: address
asset_controller: address
Beta Was this translation helpful? Give feedback.
All reactions