Skip to content
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

feat: adds conditional balance with check for swap #259

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

R-K-H
Copy link
Member

@R-K-H R-K-H commented Jan 14, 2025

This extends the mint and swap functionality to accept a conditional balance to be passed and either assigns a mint transaction or does not.

It is optional to pass this parameter, but if it does then it will ensure do dynamically mint if necessary.

@R-K-H R-K-H requested a review from metaproph3t January 14, 2025 16:16
@R-K-H R-K-H force-pushed the feat/extend-mint-swap-multi-balance branch 2 times, most recently from cdc9081 to a2df969 Compare January 14, 2025 16:27
Copy link
Collaborator

@Dodecahedr0x Dodecahedr0x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

// Check to see if we need to mint conditional tokens
// If conditionalAmount is not passed we will mint all of the input amount
// If conditionalAmount is passed we will mint the difference between the input amount and the conditional amount
if (!conditionalAmount || (conditionalAmount && conditionalAmount.lt(inputAmount))) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be simplified to !conditionalAmount || conditionalAmount < inputAmount because if the first part evaluates to true the evaluation stops because it's an OR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks! I was curious about that given null or undefined.

@R-K-H R-K-H force-pushed the feat/extend-mint-swap-multi-balance branch from a2df969 to d01e8c6 Compare January 15, 2025 02:40
@metaproph3t
Copy link
Member

LGTM

@metaproph3t metaproph3t merged commit 23a0039 into develop Feb 14, 2025
1 check passed
@metaproph3t metaproph3t deleted the feat/extend-mint-swap-multi-balance branch February 14, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants