-
Notifications
You must be signed in to change notification settings - Fork 0
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
Morpho allocator #36
base: main
Are you sure you want to change the base?
Morpho allocator #36
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.
Nitpicks
} | ||
`; | ||
|
||
export const getReallocatableLiquidity = async (marketId: string, network: NetworkNumber = NetworkNumber.Eth): Promise<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.
Može jedan jsdoc koji objašnjava šta fja vraća? Nije mi bilo jasno bez čitanja sledeće funkcije da li je ovo marketId u koji ili iz kog se realocira
const vaultTotalAssets = marketData.publicAllocatorSharedLiquidity.reduce( | ||
(acc: Record<string, string>, item: MorphoBluePublicAllocatorItem) => { | ||
const vaultAddress = item.vault.address; | ||
acc[vaultAddress] = new Dec(acc[vaultAddress] || '0').add(item.assets).toString(); |
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.
da li da pitam uopšte u kom slučaju bi se isti vault našao više puta u listi ovde
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.
Svaki vault radi supply u vise marketa. Inicijalno je allocator bio samo namenjen za vaultove, da moze da se pomera supplied debt asset, u markete sa najvecom utilizacijom
Tako da vise vaultova moze da radi supply u isti market
I svaki vault radi supply u vise marketa
Many to many
const vaults = Object.keys(withdrawalsPerVault); | ||
const withdrawals = vaults.map( | ||
(vaultAddress) => withdrawalsPerVault[vaultAddress], | ||
); |
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.
Object.values?
Nisam siguran ni ovako van konteksta zašto bi želeo povratnu vrednost u ovom obliku. Čak možda i vratiti samo withdrawalsPerVault?
const liquidityToAllocate = '2375842896566685798032'; | ||
const selectedMarket = sdk.markets.MorphoBlueMarkets(network)[sdk.MorphoBlueVersions.MorphoBlueWstEthEth_945]; | ||
|
||
await sdk.helpers.morphoBlueHelpers.getReallocation(selectedMarket.marketId, liquidityToAllocate, network); |
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.
Možda neka validacija responsea ovde ako već pišemo testove, npr da li su vaults i withdrawals iste dužine, da li je suma withdrawala jednaka inputu, tako to.
Možda takođe koristiti return od getReallocatableLiquidity kao param za getReallocation?
No description provided.