-
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
Add Liquidity Pools methods #19
Conversation
* Extract setup of Centrifuge and TenderlyFork into context accessed via withContext * Keep virtual network alive if test fails * Export context directly and introduce debug flag to prevent vn being deleted
this.investmentCurrency(), | ||
this.shareCurrency(), | ||
this.network._investmentManager(), | ||
this._restrictionManager(), |
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.
Will this be somehow magically combined into 1 big multicall, or will it be 4 separate calls?
If the latter, would it be worth combining more of these read calls into 1 method?
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.
Viem has the option to automatically batch these, which is awesome, so these will be done as a multicall 🥳
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.
That is wild! 🔥
client, | ||
}) | ||
|
||
const [isAllowedToInvest, maxDeposit, maxRedeem, investment] = await Promise.all([ |
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.
I assume this will be multicall, right?
shareCurrency, | ||
} | ||
}).pipe( | ||
repeatOnEvents( |
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.
Nice :)
src/Vault.ts
Outdated
|
||
if (investment.pendingInvestCurrency.isZero()) throw new Error('No order to cancel') | ||
|
||
yield* doTransaction('Cancel Invest Order', publicClient, () => |
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.
Will these tx descriptions be passed through and shown in the UI? If so, I would stick to our pattern of not capitalizing:
yield* doTransaction('Cancel Invest Order', publicClient, () => | |
yield* doTransaction('Cancel invest order', publicClient, () => |
src/Vault.ts
Outdated
* Place an order to invest funds in the vault. If an order exists, it will increase the amount. | ||
* @param investAmount - The amount to invest in the vault | ||
*/ | ||
increaseInvestOrder(investAmount: bigint | number) { |
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.
Nit: param name here is investAmount
, while for increaseRedeemOrder
it is shares
.
Would either use assets
here, or redeemAmount
in increaseRedeemOrder
src/Vault.ts
Outdated
* Claim any outstanding fund shares after an investment has gone through, or funds after an redemption has gone through. | ||
* @param receiver - The address that should receive the funds. If not provided, the investor's address is used. | ||
*/ | ||
claim(receiver?: 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.
Would be good to also add an optional controller
param here, so we can actually use the SDK to build a bot to claim for others
import { context } from './tests/setup.js' | ||
import { Vault } from './Vault.js' | ||
|
||
const poolId = '2779829532' |
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.
Really love these impersonated fork tests!!
Description
Adds a Vault entity with methods to query investments and place invest/redeem orders.
#17