Skip to content
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

Closed
wants to merge 11 commits into from

Conversation

matthewjablack
Copy link
Contributor

@matthewjablack matthewjablack commented May 19, 2019

Description

Atomic Loans additions such as LoanFund Provider and Loan Provider

Introduce getMempoolBalance

Submission Checklist 馃摑

  • LoanFund Provider

Copy link
Collaborator

@monokh monokh left a 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",
Copy link
Collaborator

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) {
Copy link
Collaborator

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?

Copy link
Member

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 () {
Copy link
Collaborator

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 () {
Copy link
Collaborator

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.

@harshjv
Copy link
Member

harshjv commented May 20, 2019

@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 liquality to atomicloans. @mattBlackDesign can you first fix it? It will be easy to review then and we can quickly move forward.

@monokh
Copy link
Collaborator

monokh commented May 20, 2019

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
Loans contributors shouldn't be required to go through approval to get code merged into the repo. Similarly, the other contributors shouldn't be distracted with changes that don't concern them, however small that may be.

Code responsibility
Every independent module of CAL should be free to tag, release, branch on their own schedule. This one repo system not only accumulates a lot of unrelated components, it also slows down the concerning teams with delivering.
What happens when a loan module fails the build? Who is responsible?
What happens when there is a new version release required immediately but core contributors are not there?
What happens when a non core contributor releases a version of the library which breaks certain things. Who is responsible?

Infrastructure responsibility
Infrastructure (building, deploying) has been setup on the repo for the project in a way that suits a given team. The build system and it's components (docs, releases etc.) may change with no notice to a party. At the same time, a party may want to customise these details, at which point, the infrastructure can become messy.

Discussion and content
Things like READMes, PRs, issues and github pages are unique content between loans and the rest of the project. Mixing it will make everything hard to find and organise.

@matthewjablack
Copy link
Contributor Author

@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) {
Copy link
Member

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?

Copy link
Contributor Author

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 馃槀

Copy link
Contributor Author

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) {
Copy link
Member

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) {
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants