feat: update onBeforeMint logic to allow direct DEV staking - #210
Open
yashdesu wants to merge 9 commits into
Open
feat: update onBeforeMint logic to allow direct DEV staking#210yashdesu wants to merge 9 commits into
yashdesu wants to merge 9 commits into
Conversation
aggre
requested changes
Apr 16, 2023
KukretiShubham
approved these changes
Apr 17, 2023
KukretiShubham
left a comment
Member
There was a problem hiding this comment.
Otherwise your approach seems good to me
| } else { | ||
| // This condition validates input `DEV` equivalent `ETH` with required. | ||
| // Fetch the `amount of ETH` the `DEV staked` is equal to. | ||
| uint256 equivalentETHStaked = swapAndStake.getEstimatedEthForDev( |
Member
There was a problem hiding this comment.
I am not sure if we can use this function. Since this uses
quoteExactInputSingle function which is a lens contract by uniswap meant only for off-chain calling since they are gas inefficient. here
Member
There was a problem hiding this comment.
Nice catch. But how else can DEV:ETH equivalence be verified on-chain?
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 changes introduces business logic in SimpleCollections that allows direct staking of DEV. The condition checks whether the DEV staked satisfies the minimum required condition or not.
NOTE: Whenever the user stakes ETH, the ETH is converted into DEV. This DEV is then staked. But the pool price must have changed by now. Even if we consider that there were no external changes to the pool, the swap we just made to stake DEV itself might have moved the pool price by a bit at the least (and more in edge cases). Hence, since we have removed direct comparison of original ETH input by user (via .gatewayOf) and replace it with checking for DEV staked equivalence there might be some transaction failures because of movement of price. Also we can no longer validate
Feehere because there is no swapAndStake contract for direct DEV staking and there is noFeeassociated with directDEVstaking.