-
Notifications
You must be signed in to change notification settings - Fork 0
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
Rebase to pull in upstream Ambient changes and improvements #3
Open
jkilpatr
wants to merge
63
commits into
main
Choose a base branch
from
jkilpatr/rebase-on-upstream
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.
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
Update README.md
…ke L2s. Add script for printing storage layout
…ecute timelock calls
Addresses existing issue where some swap() calls made with 0 quantity were causing very small payouts to the caller without receiving any tokens. Change to core code in this patch is: Check all swaps for 0 qty or reached limit price at the start of swap call. If swap already meets these terminating conditions, skip entire operation and make zero change to curve and set token flows to 0 instead of carrying out first leg of swap step. This change has no effect for normal swaps with non-zero quantity and non-zero limit order slippage. Add additional assert checks in the swapToLimit() step operation to abort the transaction if any invariants are violated. These assert checks do not alter swap logic, state changes, or value transferred in any way. The only difference is that some swap transctions will revert, but this will not affect any ordinary swap transactions. The addition invariant asserts added are: - Assert limit price direction relative to curve price matches swap's isBuy flag before swapOverCurve() calculates price change and swap flow - Assert the price movement direction of the rollFlow() operation matches the swap's isBuy direction. This assert specifically detects the mismatch that caused some qty=0 to pay instead of receive the rounding collateral. - Assert the price movement of the full swapToLimit() step matches the swap's isBuy direction. Allows the HotProxy sidecar to execute swaps regardless of the hotPathOpen_ flag setting. Since patching existing conracts will require closing the hotPathOpen_ flag this allows for graceful installation and handover on existing deployments.
When hotPathOpen_ && inSafeMode_ it was possible to execute a swap on CrocSwapDex but not on any proxy paths. For safety this has been disabled and will return a "LK" revert message to indicate that the DEX is locked. Several common revert situations now return an error string to aid in debugging. The authority_ and inSafeMode_ variables are exposed through public view authority() and safeMode() functions, respectively
Added InitPool, Swap MintRanged, MintAmbient, BurnRanged, BurnAmbient, and Harvest events to CrocEvents and inserted them in the Hot, Cold, Warm, and Long paths where they take place. In the case of LongPath it is possible for many events to happen on the same block, one event should be created for each swap, mint, burn, etc.
Initially the new events had the absolute value of involved flows and were renamed to e.g. baseQty for ease of consumer understanding. Due to accounting needs these have been changed to the raw flow values, where positive indicates tokens flowing into the pool and negative flowing out.
While it is possible to derive the portion of a proven knockout claim's baseFlow and quoteFlow which came from fees, it is quite hard to do so without perfect context. Instead of reporting that the WithdrawKnockout event was proven, we now report the amount of the baseFlow/quoteFlow which comes from fees (0 for no fees or forfeiture).
This is a yarn project so we should not have a npm lock checked in.
Also restores some transfer checks that where removed.
The solidity upgrade seems to just slot in with no other changes.
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 rebases our current changes onto the upstream crocswap dex repo