-
Notifications
You must be signed in to change notification settings - Fork 79
fix: finalizeSwapFlows
#1210
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
Draft
grasphoper
wants to merge
49
commits into
master
Choose a base branch
from
if/fix-finalizeSwapFlows
base: master
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.
Draft
fix: finalizeSwapFlows
#1210
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
* HyperCoreLib init commit * add functions for submitting and canceling limit orders * clean up function & variable naming * add tokenInfo getter function * split HyperCoreLib into two libraries * rename helper library * add function for bridging to self on Core * Update natspec and naming * fix natspec * combine libraries into single library with MIT license * make all function camelCase * Make tif order types into enum * check tif against tif.max
* HyperCoreLib init commit * add functions for submitting and canceling limit orders * clean up function & variable naming * add tokenInfo getter function * split HyperCoreLib into two libraries * rename helper library * add function for bridging to self on Core * Update natspec and naming * fix natspec * combine libraries into single library with MIT license * make all function camelCase * Make tif order types into enum * check tif against tif.max * add spotPx function * add minimumCoreAmountsToAmounts * clean up decimal conversion functions
* feat: OP Adapter update Signed-off-by: Faisal Usmani <[email protected]> * Undo the branch logic Signed-off-by: Faisal Usmani <[email protected]> * revert formatting Signed-off-by: Faisal Usmani <[email protected]> * Added tests Signed-off-by: Faisal Usmani <[email protected]> * Fixed test Signed-off-by: Faisal Usmani <[email protected]> --------- Signed-off-by: Faisal Usmani <[email protected]>
* feat: eraVM Spoke Pool upgrade Signed-off-by: Faisal Usmani <[email protected]> * Added tests Signed-off-by: Faisal Usmani <[email protected]> --------- Signed-off-by: Faisal Usmani <[email protected]>
* Add function for checking if bridge amount is safe * fix function natspec
* feat: SponsoredCCTPLib Signed-off-by: Faisal Usmani <[email protected]> * Updated stuct hash for sig validation Signed-off-by: Faisal Usmani <[email protected]> * Added src/dst periphery contracts Signed-off-by: Faisal Usmani <[email protected]> * updates const Signed-off-by: Faisal Usmani <[email protected]> * Updated event names and params Signed-off-by: Faisal Usmani <[email protected]> * Updated receive event Signed-off-by: Faisal Usmani <[email protected]> * Added hypercore lib Signed-off-by: Faisal Usmani <[email protected]> * Added safe guards Signed-off-by: Faisal Usmani <[email protected]> * Added wip swap handler Signed-off-by: Faisal Usmani <[email protected]> * Added missing calls Signed-off-by: Faisal Usmani <[email protected]> * Added limit order queue Signed-off-by: Faisal Usmani <[email protected]> * updated simple transfer flow Signed-off-by: Faisal Usmani <[email protected]> * Added hyper core forwarder Signed-off-by: Faisal Usmani <[email protected]> * init hyper core forwarder swap func Signed-off-by: Faisal Usmani <[email protected]> * progress Signed-off-by: Ihor Farion <[email protected]> * complete _initiateSwapFlow2 Signed-off-by: Ihor Farion <[email protected]> * Added finalize pending swaps function Signed-off-by: Faisal Usmani <[email protected]> * removed finalTokenHCoreId Signed-off-by: Faisal Usmani <[email protected]> * correct the limit price, size calculation, and send to SwapHandler logic Signed-off-by: Ihor Farion <[email protected]> * added access control Signed-off-by: Faisal Usmani <[email protected]> * first draft of cancelLimitOrderByCloid + submitNewLimitOrder Signed-off-by: Ihor Farion <[email protected]> * complete the newMinCoreAmountFromLO calculation Signed-off-by: Ihor Farion <[email protected]> * add a check to submitNewLimitOrder that safeguards new params against old calculated token amounts Signed-off-by: Ihor Farion <[email protected]> * add fixes wrt new HyperCoreLib Signed-off-by: Ihor Farion <[email protected]> * adjust functionality using new HyperCoreLib fns Signed-off-by: Ihor Farion <[email protected]> * add _executeFlow + multiple random improvements Signed-off-by: Ihor Farion <[email protected]> * some renamings for consistency Signed-off-by: Ihor Farion <[email protected]> * try to improve donationBox interactions Signed-off-by: Ihor Farion <[email protected]> * added bridge balance check before transfer Signed-off-by: Faisal Usmani <[email protected]> * added fallback to send on evm Signed-off-by: Faisal Usmani <[email protected]> * Updated dst periphery to use executeflow func Signed-off-by: Faisal Usmani <[email protected]> * unified fallback logic Signed-off-by: Faisal Usmani <[email protected]> * updated account activation logic Signed-off-by: Faisal Usmani <[email protected]> * Removed ownable Signed-off-by: Faisal Usmani <[email protected]> * Removed maxBpsToSponsor from sig check Signed-off-by: Faisal Usmani <[email protected]> * check for mint recipient in message validation Signed-off-by: Faisal Usmani <[email protected]> * make the bridge safety buffer configurable; use new isCoreAmountSafeToBridge function Signed-off-by: Ihor Farion <[email protected]> * improve fallback to hyperevm emitted event and logic Signed-off-by: Ihor Farion <[email protected]> * added sweep functions Signed-off-by: Faisal Usmani <[email protected]> * Added min delay between finalizations Signed-off-by: Faisal Usmani <[email protected]> * added commulative funcs Signed-off-by: Faisal Usmani <[email protected]> * rewrite _initiateSwapFlow to support non-sponsored flow Signed-off-by: Ihor Farion <[email protected]> * fallback flows and events Signed-off-by: Ihor Farion <[email protected]> * misc todos Signed-off-by: Ihor Farion <[email protected]> * misc improvements Signed-off-by: Ihor Farion <[email protected]> * misc todos and fixes Signed-off-by: Ihor Farion <[email protected]> * rough draft of correct size calculations Signed-off-by: Ihor Farion <[email protected]> * new calc functions, hook up to swap flow Signed-off-by: Ihor Farion <[email protected]> * fix math in submitUpdatedLimitOrder Signed-off-by: Ihor Farion <[email protected]> * correct the amt calc Signed-off-by: Ihor Farion <[email protected]> * add updated comments Signed-off-by: Ihor Farion <[email protected]> * misc todos Signed-off-by: Ihor Farion <[email protected]> * add _getSuggestedPriceX1e8 and comments Signed-off-by: Ihor Farion <[email protected]> * comments + misc fixes Signed-off-by: Ihor Farion <[email protected]> * improve fallback hyperEVM flow + fix donationBox interactions Signed-off-by: Ihor Farion <[email protected]> * update account activation logic for SwapHandler Signed-off-by: Ihor Farion <[email protected]> * add a comment Signed-off-by: Ihor Farion <[email protected]> * add PX_D to _calcLOAmountsSell Signed-off-by: Ihor Farion <[email protected]> * add maxUserSlippage for CCTP flow; add quote deadline buffer Signed-off-by: Ihor Farion <[email protected]> * feedback Signed-off-by: Faisal Usmani <[email protected]> * Stack too deep, amount less fee & removal of isFinalized Signed-off-by: Faisal Usmani <[email protected]> * fix incorrect calculation of non-sponsored token amount Signed-off-by: Ihor Farion <[email protected]> * internal => extrenal in HyperCoreLib Signed-off-by: Faisal Usmani <[email protected]> * fix incorrect bridge safety check Signed-off-by: Ihor Farion <[email protected]> * change from time-based buffer between fund pulls to block-based buffer Signed-off-by: Ihor Farion <[email protected]> * Update quote lib Signed-off-by: Faisal Usmani <[email protected]> * use safeErc20 in src Signed-off-by: Faisal Usmani <[email protected]> --------- Signed-off-by: Faisal Usmani <[email protected]> Signed-off-by: Ihor Farion <[email protected]> Co-authored-by: Ihor Farion <[email protected]>
* commit before too late Signed-off-by: Ihor Farion <[email protected]> * remove lz deps; reimplement minimal lz options functionality Signed-off-by: Ihor Farion <[email protected]> * some polish and comments Signed-off-by: Ihor Farion <[email protected]> * polish Signed-off-by: Ihor Farion <[email protected]> * move things around Signed-off-by: Ihor Farion <[email protected]> * add event for sponsored sends tracking Signed-off-by: Ihor Farion <[email protected]> * polish Signed-off-by: Ihor Farion <[email protected]> * add barebones DstOFTHandler Signed-off-by: Ihor Farion <[email protected]> * improve lib quality Signed-off-by: Ihor Farion <[email protected]> * added OFTComposeMsgCodec Signed-off-by: Ihor Farion <[email protected]> * progress .. Flow implementaions left Signed-off-by: Ihor Farion <[email protected]> * rough first draft of transfer-only flow Signed-off-by: Ihor Farion <[email protected]> * add AccessControl Signed-off-by: Ihor Farion <[email protected]> * pull account creation funds from donationbox Signed-off-by: Ihor Farion <[email protected]> * remove HyperCoreLib Signed-off-by: Ihor Farion <[email protected]> * first ROUGHEST draft of swap flow implementation Signed-off-by: Ihor Farion <[email protected]> * a more complete implementation Signed-off-by: Ihor Farion <[email protected]> * copy Forwarder + misc helper contracts into this branch Signed-off-by: Ihor Farion <[email protected]> * adjust DstOFTHandler to use HyperCoreForwarder-implemented flows, instead of implementing flows from Handler direcly Signed-off-by: Ihor Farion <[email protected]> * update error messageas Signed-off-by: Ihor Farion <[email protected]> * updates Signed-off-by: Ihor Farion <[email protected]> * added gas limits and max slippage bps Signed-off-by: Faisal Usmani <[email protected]> * polish Signed-off-by: Ihor Farion <[email protected]> * update HyperCoreForwarder import Signed-off-by: Ihor Farion <[email protected]> * add maxUserSlippageBps to emitted event Signed-off-by: Ihor Farion <[email protected]> * polish Signed-off-by: Ihor Farion <[email protected]> * fix typechain oddness Signed-off-by: Ihor Farion <[email protected]> * update HyperCoreFlowExecutor Signed-off-by: Ihor Farion <[email protected]> * Deploy script Signed-off-by: Faisal Usmani <[email protected]> * idk. fixing typechain :) Signed-off-by: Ihor Farion <[email protected]> * deploy + test scripts + fix bugs Signed-off-by: Ihor Farion <[email protected]> * update .gitignore and script Signed-off-by: Ihor Farion <[email protected]> * fix Signed-off-by: Ihor Farion <[email protected]> --------- Signed-off-by: Ihor Farion <[email protected]> Signed-off-by: Faisal Usmani <[email protected]> Co-authored-by: Faisal Usmani <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Ihor Farion <[email protected]>
…ore account existence before allowing to set a final token or deploy a HyperCoreFlowExecutor contract Signed-off-by: Ihor Farion <[email protected]>
Signed-off-by: Ihor Farion <[email protected]>
Signed-off-by: Ihor Farion <[email protected]>
* feat: add arbitrary actions execution to sponsored bridging Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * fix the MIN_COMPOSE_MSG_BYTE_LENGTH Signed-off-by: Ihor Farion <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> --------- Signed-off-by: Matt Rice <[email protected]> Signed-off-by: Ihor Farion <[email protected]> Co-authored-by: Ihor Farion <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Ihor Farion <[email protected]>
* add swapsProcessed return values to finalizePendingsSwaps Signed-off-by: Taylor Webb <[email protected]> * return finalized swap amount & number of swaps remaining Signed-off-by: Taylor Webb <[email protected]> * update var name process to finalize Signed-off-by: Taylor Webb <[email protected]> --------- Signed-off-by: Taylor Webb <[email protected]>
* fix Signed-off-by: Ihor Farion <[email protected]> * a few renames Signed-off-by: Ihor Farion <[email protected]> * remove dedundant maxBpsToSponsor enforcement Signed-off-by: Ihor Farion <[email protected]> * save 1 stack depth. Signed-off-by: Ihor Farion <[email protected]> * add _calcFinalExtraFees Signed-off-by: Ihor Farion <[email protected]> * comment Signed-off-by: Ihor Farion <[email protected]> --------- Signed-off-by: Ihor Farion <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]> Co-authored-by: Ihor Farion <[email protected]>
Signed-off-by: Ihor Farion <[email protected]>
* improve: Move BytesLib to external folder Signed-off-by: Faisal Usmani <[email protected]> * Undo var scoping Signed-off-by: Faisal Usmani <[email protected]> --------- Signed-off-by: Faisal Usmani <[email protected]>
* fix stack too deep - need to verify equivalance Signed-off-by: Taylor Webb <[email protected]> * update comment Signed-off-by: Taylor Webb <[email protected]> * remove confusing comment Signed-off-by: Taylor Webb <[email protected]> * use CommonFlowParams struct Signed-off-by: Taylor Webb <[email protected]> * use CommonFlowParams struct in _executeFlow Signed-off-by: Taylor Webb <[email protected]> * remove confusing comment Signed-off-by: Taylor Webb <[email protected]> * move things around Signed-off-by: Ihor Farion <[email protected]> * remove remappings.txt Signed-off-by: Ihor Farion <[email protected]> * chore: Update solidity and OZ versions (#1156) * chore: Update solidity and OZ versions Signed-off-by: Faisal Usmani <[email protected]> * Upgrade hardhat as well Signed-off-by: Faisal Usmani <[email protected]> * downgrade to 0.8.24 Signed-off-by: Faisal Usmani <[email protected]> --------- Signed-off-by: Faisal Usmani <[email protected]> --------- Signed-off-by: Taylor Webb <[email protected]> Signed-off-by: Ihor Farion <[email protected]> Signed-off-by: Faisal Usmani <[email protected]> Co-authored-by: Ihor Farion <[email protected]> Co-authored-by: Faisal Usmani <[email protected]>
* remove Signed-off-by: Ihor Farion <[email protected]> * polish Signed-off-by: Ihor Farion <[email protected]> * add _finalizeSwapFlows Signed-off-by: Ihor Farion <[email protected]> * complete finalization flow Signed-off-by: Ihor Farion <[email protected]> * add a comment Signed-off-by: Ihor Farion <[email protected]> * add Signed-off-by: Ihor Farion <[email protected]> * Update events (#1159) * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> * WIP Signed-off-by: Matt Rice <[email protected]> --------- Signed-off-by: Matt Rice <[email protected]> * fix cumulativeSponsoredAmount + add event Signed-off-by: Ihor Farion <[email protected]> * update comment Signed-off-by: Ihor Farion <[email protected]> * Update contracts/periphery/mintburn/HyperCoreFlowExecutor.sol Co-authored-by: Matt Rice <[email protected]> --------- Signed-off-by: Ihor Farion <[email protected]> Signed-off-by: Matt Rice <[email protected]> Co-authored-by: Matt Rice <[email protected]>
* fix: Set version to cancun Signed-off-by: Faisal Usmani <[email protected]> * remove evmVersion on overrides Signed-off-by: Faisal Usmani <[email protected]> --------- Signed-off-by: Faisal Usmani <[email protected]>
…ate into audit-oct-20
Signed-off-by: Ihor Farion <[email protected]> Signed-off-by: Matt Rice <[email protected]> Signed-off-by: Faisal Usmani <[email protected]> Signed-off-by: Taylor Webb <[email protected]> Co-authored-by: Matt Rice <[email protected]> Co-authored-by: Faisal Usmani <[email protected]> Co-authored-by: Taylor Webb <[email protected]> Co-authored-by: Taylor Webb <[email protected]>
Signed-off-by: Ihor Farion <[email protected]> Signed-off-by: Matt Rice <[email protected]> Signed-off-by: Faisal Usmani <[email protected]> Signed-off-by: nicholaspai [email protected] Signed-off-by: nicholaspai <[email protected]> Signed-off-by: Taylor Webb <[email protected]> Co-authored-by: Matt Rice <[email protected]> Co-authored-by: Faisal Usmani <[email protected]> Co-authored-by: nicholaspai <[email protected]> Co-authored-by: Taylor Webb <[email protected]> Co-authored-by: Taylor Webb <[email protected]>
…ents (#82) Signed-off-by: Ihor Farion <[email protected]>
Signed-off-by: Ihor Farion <[email protected]>
Signed-off-by: Ihor Farion <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
…ng method Signed-off-by: Ihor Farion <[email protected]>
cd87a32 to
758570a
Compare
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.
Might be required depending on what branch the code follows here https://github.com/circlefin/hyperevm-circle-contracts/blob/master/src/CoreDepositWallet.sol#L593