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

Morpho allocator #36

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

Morpho allocator #36

wants to merge 2 commits into from

Conversation

MatijaPojatar
Copy link
Contributor

No description provided.

Copy link
Contributor

@sterlu sterlu left a 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> => {
Copy link
Contributor

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();
Copy link
Contributor

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

Copy link
Contributor

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],
);
Copy link
Contributor

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);
Copy link
Contributor

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?

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.

2 participants