-
Notifications
You must be signed in to change notification settings - Fork 4
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
LP management improvements/fixes #18
Conversation
…alizing a position
@@ -1223,13 +1227,18 @@ export function handleTransferLP(event: TransferLPEvent): void { | |||
const oldLendId = getLendId(bucketId, entity.owner) | |||
const newLendId = getLendId(bucketId, entity.newOwner) | |||
|
|||
// If PositionManager generated this event, it means either: |
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 making Lend
's persistent help with 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.
In this branch, I originally tried to preserve the LP amount in the lender's Lend
upon transfer to PositionManager
, and tag the lend with a tokenId
. That breaks as soon as someone calls MoveLiquidity
, because we cannot determine the lender whose liquidity was moved. Also, a single lender can mint multiple position NFTs, yet they only get one Lend
for a bucket.
@@ -27,13 +24,15 @@ export const MAX_PRICE_BI = BigInt.fromString('1004968987606512354182109771') | |||
export const MIN_BUCKET_INDEX = -3232; | |||
export const MAX_BUCKET_INDEX = 4156; | |||
|
|||
// poolInfoUtils contract address per network | |||
// Pool addresses per network | |||
// TODO: rename these something more palatable, like "AddressTable" |
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.
AddressTable sounds good. We probably want to also move these into a separate file at some point.
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'd like to figure out the best practice for handling them in subgraph.yaml
. Would be nice if we could define all the addresses once in the environment or some other central location.
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.
Yeah, I spent a while trying to do something more elegant than the lookup tables, but that was the best I could find at the time. It seems to have issues with reading that network config directly
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.
LGTM. Few minor comments
Changes
pool
toMemorializePosition
, lining it up withRedeemPosition
.Lend
entities in places where we expect them to already exist.Lend
s from being removed.