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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Atomic Loans Additions to CAL with LoanFund and Loan Provider #184
Conversation
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.
Some comments.
Since you are now looking to add quite a bit of code to the CAL, I think it's a good time to host the loan related functionality in a self hosted module and then contribute to the existing modules separately. Development should be much more clear in that way.
@@ -1,8 +1,8 @@ | |||
{ | |||
"name": "@liquality/bitcoin-bitcoinjs-lib-swap-provider", |
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 think there are some unneeded changes here? 馃槃
@@ -180,6 +180,14 @@ export default class Chain { | |||
return balance | |||
} | |||
|
|||
async getMempoolBalance (addresses) { |
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.
These methods shouldn't be in the interface as they are not cross chain. Are you having issues accessing them internally in the providers using getMethod
?
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.
@mattBlackDesign are you trying to get to eth_pendingTransactions
or parity_localTransactions
or parity_pendingTransactions
via this method?
With above rpc calls, we can do something similar on eth side.
@@ -148,6 +152,14 @@ export default class Client { | |||
get collateral () { | |||
return this._collateral | |||
} | |||
|
|||
get loan () { |
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.
what's the difference with the collateral
side? It seems we are expanding the namespaces quite quickly for your usecase. Perhaps it could all come under loan
and then you can have sub namespaces like loan.fund.xxxxxx``loan.collateral.xxxxxx
?
return isNaN(balances) ? 0 : balances | ||
} | ||
|
||
async getErc20Name () { |
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.
Not really sure why we need this sort of functionality within the CAL. They cannot be replicated on any other chain therefore I think whichever the standard way of doing this in ethereum world would be a better approach than implementing all of this into the CAL.
@mattBlackDesign @monokh instead of hosting them separately, they can host it here and leverage our build system. If the changes are specifically made to their subpackages, we can let them merge it on their schedule and do a combine review when it is related to the common packages. For now, the diff is very noisy because of unnecessary changes |
Going to be quite blunt here because I think this can prevent a great deal of headaches in the future. There is a clear separation of responsibility between the loan providers and the rest of the codebase. The current set of contributors shouldn't be concerned with maintaining or engaging in any real way with the loan related functionality. There are several areas where disagreements and conflict can and will occur in the future if this github project becomes a playground for every addition to the CAL: Code access writes Code responsibility Infrastructure responsibility Discussion and content |
@harshjv removed scope @AtomicLoans to reduce the number of diffs. This was in place temporarily to allow for those packages to be deployed to npm for atomic loans ui. You have both brought up very good points, and I agree that the loan functionality really has nothing to do with the rest of CAL. This could technically be a completely separate module, in a completely separate repo that is used alongside CAL, however we would need to determine how we want to setup the @liquality/client module to accommodate for that. We'll also need to think about how modules are published. I personally think that in the future all the modules will probably be their own repos, but I don't think we're at that stage yet. |
@@ -176,7 +176,7 @@ export default class BitcoinLedgerProvider extends LedgerProvider { | |||
if (inputs && outputs) { | |||
let change = outputs.filter(output => output.id !== 'main') | |||
|
|||
if (change) { | |||
if (change && change.length > 0) { |
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 catch man!
Did you get any absurdly-high-fee
error without 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.
Sorry for late reply @harshjv.
Yes, in fact it wouldn't actually send the transaction because the fee was too high 馃槀
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 this to separate PR: #186
@@ -180,6 +180,14 @@ export default class Chain { | |||
return balance | |||
} | |||
|
|||
async getMempoolBalance (addresses) { |
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.
@mattBlackDesign are you trying to get to eth_pendingTransactions
or parity_localTransactions
or parity_pendingTransactions
via this method?
With above rpc calls, we can do something similar on eth side.
@@ -226,4 +234,16 @@ export default class Chain { | |||
async getAddressMempool (addresses) { |
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 you explain why getAddressMempool
, getCode
erc20Approve
, getTransactionReceipt
are needed on client.chain object?
Description
Atomic Loans additions such as
LoanFund
Provider andLoan
ProviderIntroduce
getMempoolBalance
Submission Checklist 馃摑