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: whitelist LPs #NTRN-442 #799

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

Conversation

jcompagni10
Copy link
Contributor

@jcompagni10 jcompagni10 commented Jan 9, 2025

Create a new dex param for whitelisted LPs. These LPs are able to deposit outside the allowed fee_tiers. This is required for super vaults so they can use special fee_tiers that do no clash with other users.

RELATED PRs
neutron-org/neutron-std#9
neutron-org/neutron-dao#117
neutron-org/neutronjs#11
neutron-org/neutron-integration-tests#372
neutron-org/neutronjsplus#73

@jcompagni10
Copy link
Contributor Author

@@ -18,6 +19,8 @@ var (
DefaultMaxJITsPerBlock uint64 = 25
KeyGoodTilPurgeAllowance = []byte("PurgeAllowance")
DefaultGoodTilPurgeAllowance uint64 = 540_000
KeyWhitelistedLPs = []byte("PurgeAllowance")
Copy link
Contributor

Choose a reason for hiding this comment

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

Error in key name

for _, addr := range whitelistedLPs {
_, err := sdk.AccAddressFromBech32(addr)
if err != nil {
return fmt.Errorf("invalid Reserve address (%s): %w, ", addr, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

why "reserve"?

@@ -18,6 +19,8 @@ var (
DefaultMaxJITsPerBlock uint64 = 25
KeyGoodTilPurgeAllowance = []byte("PurgeAllowance")
DefaultGoodTilPurgeAllowance uint64 = 540_000
KeyWhitelistedLPs = []byte("PurgeAllowance")
DefaultKeyWhitelistedLPs []string
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe assign an empty array to default to be more clear here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

linter does not like assigning an empty array

if err := k.ValidateFee(ctx, fee); err != nil {
return nil, nil, math.ZeroInt(), math.ZeroInt(), nil, nil, nil, err
// Enforce deposits only at valid fee tiers. This does not apply to whitelistedLPs
if !k.IsWhitelistedLP(ctx, callerAddr) {
Copy link
Contributor

@NeverHappened NeverHappened Feb 24, 2025

Choose a reason for hiding this comment

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

can we move this check out of the loop? A small optimization.

@jcompagni10
Copy link
Contributor Author

@jcompagni10
Copy link
Contributor Author

Copy link
Contributor

@NeverHappened NeverHappened left a comment

Choose a reason for hiding this comment

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

Seems good. Not sure if needs a migration to ensure that whitelistedLps has a value after migrating.

@jcompagni10
Copy link
Contributor Author

Seems good. Not sure if needs a migration to ensure that whitelistedLps has a value after migrating.

@NicholasDotSol do we have contract addresses now? Or do we wanna just use chainmanager dao after upgrade?

@jcompagni10
Copy link
Contributor Author

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