-
Notifications
You must be signed in to change notification settings - Fork 323
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
[CIP-0030] Adding getCollateral
function to the connector API
#208
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
551f09e
Adding `getCollateralUtxos` function
vsubhuman 17998d9
Changed undefined return to null
vsubhuman 950a639
Updated the spec to rename the function and change the arguments to a…
vsubhuman d735e0d
Fixing wording
vsubhuman 0c0ecdf
Update README.md
vsubhuman de5c2e0
Tried to clarify the description a bit more
vsubhuman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Fyi both ccvault and Flint use 5~20 ADA and I think Nami does <50 ADA
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 that really necessary? Since the collateral is a percentage of a fee - can we imagine a transaction with a 20+ ADA fee?
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.
The bottom of the range (5ADA) is what is meant to make sure you have enough collateral to cover any requirement
The upper part of the range (20ADA / 50 ADA) is just because wallets wants to protect users from accidentally losing a lot of ADA due to a poorly programmed dApp and so they don't want to allow using millions of ADA as collateral. 20/50 was picked as an arbitrary cutoff point so that it's not the end of the world if you lose 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.
Sounds like it then can be just the range from 5 ADA min to 5 ADA max. I.e. if we assume 5 ADA should be enough to cover any requirements then why give dapps any idea to ever have more than that at 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.
Because the user may have a 10 ADA utxo entry by chance, and it would be a bit excessive to say to the user "sorry, you can't use your 10 ADA as collateral because it has to be exactly 5 ADA".
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 am confused here. What will happen with the dapp call to
getCollateral
in case they specify they want to get 20 ADA, but there's no UTXO below 50 ADA, for example?The whole point of what I am describing in the spec is that the
amount
parameter limit should be something like 5 ADA, so that DAPPS can NOT request amounts above 5 ADA. But then the wallet is free to return anything as long as it covers the amount the dapp has requested.Example:
Example 2:
[1.4 , 1.4 , 1.4]
total sum of 4.2Example 3:
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.
Main goal is to ENCAPSULATE the logic as much as possible, achieving:
Dapps dont't have to think AT ALL - just specify the minimum total value of collateral you want to get, and don't make it too high
Wallets are free to implement internally anything they want, they can return a 1000 ADA if they want to, the spec doesn't care or control it, as long as it covers the amount requested by the dapp.
The main requirement is that any wallet implementing must either return non-empty array of utxo that is guaranteed to be equal or above the requested amount, OR return no utxos at all, indicating the requested amount is impossible to achieve. So a wallet must never return utxos that would sum up below the requested amount.
@SebastienGllmt what you are talking about is that Flint is returning utxos of AT LEAST 5 ADA, which will mean that it will be automatically compatible with the proposed spec, because the spec proposes that the requested amount is never above 5 ADA, which means Flint will always return same or above