Exploring minimum-enshrined IB20 + wrapper architecture (alternative to variant design)#2
Draft
amiecorso wants to merge 1 commit into
Draft
Exploring minimum-enshrined IB20 + wrapper architecture (alternative to variant design)#2amiecorso wants to merge 1 commit into
amiecorso wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Alternative to the merged variant-based design (#1). Replaces the
Default/Stablecoin/Security variant interfaces (with capability bits,
role splits, two-step transfers, factory) with a single minimum
precompile bound to an EVM wrapper contract at creation.
The architectural unit: precompile + wrapper
Each B-20 token is a pair:
IB20): balance state, raw transfer mechanics,policy hook, pause flag.
product-specific behavior.
The pair is created atomically; the binding is permanent (
wrapper()is immutable on the precompile). Privileged operations (
mint,burn,wrapperTransfer,setPaused,setTransferPolicyId)revert with
OnlyWrapperfor any other caller.Mental model: OZ
_internal/publicsplit, but enforced at theprotocol level rather than by Solidity inheritance.
What's in the precompile (17 external functions)
name,symbol,decimals,totalSupply,balanceOf,allowance,transfer,transferFrom,approve)wrapper,transferPolicyId,paused)mint,burn,wrapperTransfer,setPaused,setTransferPolicyId)What lives in the wrapper
Everything that was in the variant interfaces:
A future PR can add reference wrapper implementations
(
MinimalWrapper.sol,StablecoinWrapper.sol,SecurityTokenWrapper.sol) to make these concrete.Open questions
Captured in DESIGN_NOTES.md:
Files
`ISecurityToken.sol`, `ITokenFactory.sol`
Status
Draft. Posting for team reaction before deciding whether this
direction supersedes #1 or stays as a parallel sketch.