-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add Unizen DEX #360
Add Unizen DEX #360
Conversation
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.
Approved, but there are some questions and worries.
src/swap/defi/unizen.ts
Outdated
|
||
const UNIZEN_CONTRACTS: { | ||
[version: string]: StringMap | ||
} = JSON.parse(JSON.stringify(contracts)) |
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 round-trip this?
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.
Oops! will fix before merging
const crossChain = asMaybe(asCrossChainSwapQuote)(rawQuote) | ||
if (crossChain != null) { | ||
const memos: EdgeMemo[] = [] | ||
const memoValue = crossChain[0].transactionData.memo |
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.
The asCrossChainSwapQuote
is defined using asArray
, but here we only access crossChain[0]
. What if there are multiple tx's in the quote? Would the customer lose money, because the funds don't get fully swapped? I would feel safer either using asTuple
to enforce a single item in the array, or somehow looping over the tx's to handle the weird case.
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.
It's an array of quotes and the best one is the first one. I'll change improve the cleaner name and change to asTuple to enforce it's existance
93e377f
to
2dbba5d
Compare
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneDescription
none