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

refactor: router #431

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

refactor: router #431

wants to merge 13 commits into from

Conversation

notJoon
Copy link
Member

@notJoon notJoon commented Dec 10, 2024

Description

Refactor

  • Refactored route file mainly.

Remove

  • Removed unused compute_routes and gno_helper files
  • Removed underscore prefix from _swap functions and renamed them to swapInner
  • Remove DrySwapRoute function and related methods

Update

  • Modified to use enum values instead of hardcoded "EXACT_IN", "EXACT_OUT" strings. Additionally replace other hardcoded values with constants
  • Add _helper_test file for testing purpose

Functions that use Pool currently doesn't have tests yet. This is because there's no way to directly access and initialize the pool's state for now.

@notJoon notJoon added refactoring router router related works labels Dec 10, 2024
@notJoon notJoon self-assigned this Dec 10, 2024
@notJoon notJoon marked this pull request as ready for review December 11, 2024 13:22
@notJoon notJoon requested review from onlyhyde and r3v4s December 11, 2024 13:22
Copy link
Member

@dongwon8247 dongwon8247 left a comment

Choose a reason for hiding this comment

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

@notJoon Please add a unit test for swap_multi.gno, swap_single.gno and wrap_unwrap.gno.

Functions that use Pool currently doesn't have tests yet. This is because there's no way to directly access and initialize the pool's state for now.

Can you create mockup data in pool that you can use for testing purposes in router? This seems essential tests. Think about a way to complete tests for this please.

router/router.gno Show resolved Hide resolved
Copy link

sonarcloud bot commented Dec 12, 2024

Comment on lines +97 to +110
func i256Min(x, y *i256.Int) *i256.Int {
if x.Lt(y) {
return x
}
return y
}

func i256Max(x, y *i256.Int) *i256.Int {
if x.Gt(y) {
return x
}
return y
}

Copy link
Member Author

Choose a reason for hiding this comment

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

needs to be moved to the common package. maybe common/math?

Copy link
Member

Choose a reason for hiding this comment

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

How about we make gnsmath and gnsutils in the root folder and put math related files to gnsmath, util related files to gnsutils?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring router router related works
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants