-
Notifications
You must be signed in to change notification settings - Fork 2
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
Lend vault messages #125
Lend vault messages #125
Conversation
🦋 Changeset detectedLatest commit: ec570eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
89ad5ef
to
97b030f
Compare
note to self: squash and merge 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.
Nice PR 😎
src/contracts/definitions/lend.ts
Outdated
* @param startingPage The data is paginated and returned | ||
* for the starting page and all pages after. Use 1 to query all vaults. | ||
*/ | ||
const msgGetVaults = (startingPage: 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.
I'd like this to be string and have the casting happen in the services
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.
Also have you tried this query with a string? it could be a u128 type
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.
string works, this is what we do on front end.
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.
changed to string
src/contracts/definitions/lend.ts
Outdated
vaultId, | ||
}: { | ||
borrowAmount: string, | ||
maxBorrowFee: 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.
Should this be optional? maxBorrowFee?:
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.
done
collateralAddress: string, | ||
silkMaxAllowance: string, | ||
silkAllowanceUsed: string, | ||
maxLtv: 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.
Is this a percent?
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.
adding clarity in the docs
lastUpdatedAt: Date, | ||
}, | ||
liquidationFee: { | ||
discount: 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.
Percent?
src/types/contracts/lend/model.ts
Outdated
|
||
type BatchVaults = BatchVaultsItem[] | ||
|
||
type VaultUserData = { |
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 are we adding user data queries?
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.
copy paste from front end, put a note in the services layer that they are Experimental and not tested for production use. I could split them out if you think that makes sense to do.
/** | ||
* Parse lend vault response | ||
*/ | ||
function parseLendVault(vault: VaultResponse, vaultVersion: VaultVersion) { |
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.
Can we make vaultVersion optional and have it default to v3, the most up to date version?
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.
Is there really no way to programatically determine the version?
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.
there is no way to programatically determine, unfortunately.... that would have been a great feature that should have been included when we started making new vaults.
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 rather not set defaults.
// Collateral is expressed differently depending on vault type | ||
collateral: { | ||
total: | ||
(vaultVersion === VaultVersion.V1 || vaultVersion === VaultVersion.V2) |
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.
Is there a reason that V2 is included in this check? Why did V3 get the big change?
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 different math for the collateral display. I don't know why it was such a big change, i wish it would have been consistent.
src/contracts/services/lend.ts
Outdated
}, | ||
debt, | ||
collateral_addr: collateralAddress, | ||
is_protocol: isProtocol, |
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: isProtocol -> isProtocolOnly
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.
done
src/contracts/services/lend.ts
Outdated
...prev, | ||
[vaultId]: parseLendVault(vault, vaultVersion), | ||
}; | ||
}, {} as Vaults); |
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.
Move this type declaration to line 140 please
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.
done
*/ | ||
const parseBatchQueryVaultsInfo = ( | ||
response: BatchQueryParsedResponse, | ||
vaultVersions: VaultVersion[], |
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 really dislike that vaultVersions is a required argument.... we really should find a way to make it work without it
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.
also dislike it, but we have no choice and need to be clear about the differences between the different vaults.
Shade Lend Vault queries, tests, docs (public queries only)