-
Notifications
You must be signed in to change notification settings - Fork 30
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: ✨ liq-src: kyber-pmm #624
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: thanhpp <[email protected]>
Test coverage changes:
|
Signed-off-by: thanhpp <[email protected]>
…s://github.com/KyberNetwork/kyberswap-dex-lib into TRD-759-kyberswap-dex-lib-create-kyber-pmm-v-2
"github.com/KyberNetwork/logger" | ||
"github.com/dgraph-io/ristretto" | ||
|
||
kyberpmm "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/kyber-pmm" |
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.
"github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/kyber-pmm"
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.
updated in 3df5a23
@@ -0,0 +1,21 @@ | |||
package client |
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.
Minor: I don't see any major changes in client
pkg. Can we re-use the client pkg in source/kyber-pmm
?
If eventually, we remove the source/kyber-pmm
, then it's ok to add client
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.
hmm, i think we should move to a new pkg and remove the old one
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.
hmm, i think we should move to a new pkg and remove the old one
inventoryLimitIn = limit.GetLimit(param.TokenAmountIn.Token) | ||
) | ||
if param.TokenAmountIn.Amount.Cmp(inventoryLimitIn) > 0 { | ||
return nil, errors.New("not enough inventory in") |
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.
We can move the error into error.go
(same as CalcAmountIn PR)
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.
updated in 3df5a23
if slices.ContainsFunc(staticExtra.QuoteTokenAddresses, func(s string) bool { | ||
return strings.EqualFold(s, entityPool.Tokens[i].Address) | ||
}) { | ||
quoteTokens = append(quoteTokens, *entityPool.Tokens[i]) | ||
} |
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.
Minor: Can we create a map first to check if the token exists?
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.
updated in 3df5a23
timestamp: entityPool.Timestamp, | ||
}, nil | ||
} | ||
|
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.
We need to write custom CanSwapFrom(baseToken)
and CanSwapTo(quoteToken)
functions 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.
updated in 3df5a23
Signed-off-by: thanhpp <[email protected]>
Signed-off-by: thanhpp <[email protected]>
return result | ||
} | ||
|
||
return []string{p.baseToken.Address} |
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.
You should check if the input
address is in quoteTokens
, then return the baseToken
, otherwise, this should return nil
.
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.
updated in 25bf1f3
Signed-off-by: thanhpp <[email protected]>
…-lib-create-kyber-pmm-v-2
Why did we need it?
Related Issue
Release Note
How Has This Been Tested?
Screenshots (if appropriate):