-
Notifications
You must be signed in to change notification settings - Fork 108
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
base: main
Are you sure you want to change the base?
Conversation
x/dex/types/params.go
Outdated
@@ -18,6 +19,8 @@ var ( | |||
DefaultMaxJITsPerBlock uint64 = 25 | |||
KeyGoodTilPurgeAllowance = []byte("PurgeAllowance") | |||
DefaultGoodTilPurgeAllowance uint64 = 540_000 | |||
KeyWhitelistedLPs = []byte("PurgeAllowance") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error in key name
x/dex/types/params.go
Outdated
for _, addr := range whitelistedLPs { | ||
_, err := sdk.AccAddressFromBech32(addr) | ||
if err != nil { | ||
return fmt.Errorf("invalid Reserve address (%s): %w, ", addr, err) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
x/dex/keeper/deposit.go
Outdated
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
@NicholasDotSol do we have contract addresses now? Or do we wanna just use chainmanager dao after upgrade? |
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