Draft
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.
This change is to help Swig adopt enterprise flow. The idea is to maintain a separate account for Enterprise which will have 3 elements:
Enterprise Handler Program
There is another program that will be used to maintain the Enterprise Account, the program will be used by the swig entity to update once a payment is complete.
https://github.com/anagrambuild/swig-enterprise
Swig program related Flows
Enterprise Wallet creation
Now when an enterprise wants to create a swig wallet for its user, it will invoke the wrapper function
CreateEnterpriseInstructionby passing theEnterpriseAccountin addition. This will create a user swig under the enterprise, with enterprise Account id as the role 0 authority.Signing
Now, during the signing, the enterprise account is passed which will check if the enterprise is still active and has paid for the usage. If all the enterprise related checks pass, then
Adding new authority
When the user swig wants to add a new authority, the permissions will be limited by the permission that the enterprise support. Instead of storing all the permission in the enterprise account, the permissions are flattened as bitmask. A simple & operation between the new permission and allow list will ensure no unpaid permission will be added to the new authority.
Additionally, this change also supports global roles