-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permissioned pools #83
Open
Luivatra
wants to merge
10
commits into
SundaeSwap-finance:main
Choose a base branch
from
Luivatra:permissioned-pools
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
…ae-contracts into permissioned-pools
rrruko
reviewed
Nov 15, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few minor observations
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 PR introduces the concept of "condition pools".
A condition pool allows for the pool creator to define a condition that needs to be fulfilled for any action to be taken on the pool. To avoid assets becoming stuck liquidity withdrawals are always allowed. A simple example would be a pool that only allows trades to happen between 9 am to 5 pm.
Validators
Pool
The same as the current pool validator, but with added condition logic. The process_orders logic is extended to also keep track of whether all orders are withdrawals or not. If a condition is defined in the pool datum and not all orders are withdrawals we check for the presence of the condition script in the transaction withdrawal scripts.
Conditions
Condition validators are located in the validators/conditions folder.
Trading Hours
Simple condition that requires the transactions validity range to be within a certain window (defined in the pool's condition_datum).
Permissioned
The pool will have a list of supported compliance oracles and using this verifies that each order has a valid compliance token in their datum. This compliance token consists of unique data for this order, including order details and owner and a signature provided by the compliance oracle.
Types
Pool Datum
Has been extended with:
Condition refers to the withdrawal validator that needs to be present. The condtion_datum holds variables required for the functionality in the condition script.
TradingHoursDatum
Holds the open and close time where trading is allowed.
PermissionedDatum
List of Public key hashes for the compliance oracles supported by this pool
TokenData
ComplianceToken
TokenData instance
A signature from the compliance oracle for serialised token data
Tests to cover negative cases and withdrawal only
Check condition manage logic (is it in scope?)