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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Deposit Contract #447

Closed
6 tasks done
karlb opened this issue Jan 18, 2019 · 4 comments
Closed
6 tasks done

User Deposit Contract #447

karlb opened this issue Jan 18, 2019 · 4 comments
Assignees

Comments

@karlb
Copy link
Contributor

karlb commented Jan 18, 2019

The Raiden services will ask for payment in RDN. The Monitoring Service and potentially the Pathfinding Service require deposits to be made in advance of service usage. These deposits will be handled by the User Deposit Contract.
Usage of the deposit for payments is not safe from double spending, but measures can be taken to reduce the likelihood to acceptable levels. This is a good trade off as long as the money lost on double spending is less than the savings in gas cost.

Requirements

  • Users can deposit and withdraw tokens.
  • Tokens can be deposited to the benefit of other users. This could facilitate onboarding of new raiden users and allow a MS to defer the monitoring to another MS.
  • Tokens can't be withdrawn immediately, but only after a certain delay. This allows services to claim their deserved payments before the withdraw takes place.
  • Services can read the effective balance of a user (current balance - planned withdrawals)
  • Service contracts are trusted and can claim tokens for the service providers.
  • Services can listen to events which notify them of decreasing user balances. A service can then claim payments before double spending becomes too likely.

Use cases

Monitoring Service rewards

The MS is promised a reward for each settlement in which it took part on behalf of the non-closing participant. Before accepting a monitor request, the MS checks if enough tokens are deposited in the UDC. The MS that has submit the latest BP upon settlement will receive the promised tokens on it's UDC balance.

1-n payments

[This is just a suggestions so far. No decision made.]
The PFS will be paid with signed IOUs, roughly a simplified uRaiden adapted to 1-n payments. The IOU contains the amount of tokens that can be claimed from the signer's UDC balance. See raiden-network/raiden-services#38 for details.

@palango
Copy link
Contributor

palango commented Jan 18, 2019

Nice overview, no requirements I'd add. Some comments below.

Users can deposit and withdraw tokens.

The token will always be the RDN token, right?

Service contracts have permission to transfer tokens in the UDC between users.

What do you mean by that? I'd also add that the service contracts are trusted and can claim tokens for the providers.

Before accepting a monitor request, the MS checks if enough tokens are deposited in the UDC

The MS might also want to check the deposit before sending the update transaction.

@karlb
Copy link
Contributor Author

karlb commented Jan 18, 2019

The token will always be the RDN token, right?

We will use it that way. From a purely technical point, another token address could be passed to the constructor.

Service contracts have permission to transfer tokens in the UDC between users.

What do you mean by that? I'd also add that the service contracts are trusted and can claim tokens for the providers.

In this ticket I meant both end users and services when I said "users". So this point really intended to say what you want to add. I worded it less specific because from a UDC point of view, we probably won't distinguish between end users and providers and just have users/addresses/balances. I'll switch to your wording, which makes the intention more clear.

The MS might also want to check the deposit before sending the update transaction.

Good point, added to https://github.com/raiden-network/raiden-monitoring-service/issues/68

karlb added a commit to karlb/raiden-contracts that referenced this issue Jan 18, 2019
No handling of trusted contracts, no testing of error cases. Should be
enough to see if this is a workable approach.

Implements raiden-network#447
@karlb karlb self-assigned this Jan 21, 2019
@loredanacirstea
Copy link
Contributor

Initial specs on this are here: raiden-network/spec#120. Please check if they still stand and keep the spec repo in sync.

karlb added a commit to karlb/raiden-contracts that referenced this issue Jan 24, 2019
No handling of trusted contracts, no testing of error cases. Should be
enough to see if this is a workable approach.

Implements raiden-network#447
karlb added a commit to karlb/spec that referenced this issue Jan 25, 2019
Goals of this commit:
* Provide basis for more detailed service contract docs
* Incorporate raiden-network#120
* Incorporate raiden-network/raiden-contracts#447
* Allow automatic generation of docs from solidity docstrings
karlb added a commit that referenced this issue Jan 28, 2019
No handling of trusted contracts, no testing of error cases. Should be
enough to see if this is a workable approach.

Implements #447
@karlb
Copy link
Contributor Author

karlb commented Jan 28, 2019

Specification from this ticket is added to the spec repo in raiden-network/spec#202.
Implementation in #448.

@karlb karlb closed this as completed Jan 28, 2019
karlb added a commit to raiden-network/spec that referenced this issue Jan 28, 2019
Goals of this commit:
* Provide basis for more detailed service contract docs
* Incorporate #120
* Incorporate raiden-network/raiden-contracts#447
* Allow automatic generation of docs from solidity docstrings
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

No branches or pull requests

3 participants