or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Lending Plapp
Overview
This document describes an architcture desgin of lending plapps (plasma apps). I outlined the specification referring to Dharma project functionalities. Special thanks to @ben_chain for review.
Architecture
We defined 2 predicates, swap predicate and collateral predicate based on Plasma Group's specification.
You first use swap predicate to set up a collateral.
Then, lender will execute collateral predicate.
Swap predicate
This is a setup phase of lending. The debtor makes a collateral state described in the next section and swap it for the loaned token.
It's basically the same design as swap predicate, but collateralizer wants to cancel collateral when a swap fails. Hence, requirements are
verifyTransaction
witness
is a signature bypreState.data.owner
postState
is a collateral statepostState
has the ownership of collateralizerCollateral predicate
1. State object specification
2. Methods
There are 2 methods.
refundCollateral
methodRefund collateral. Lender gets a refund on the collateral after debt enters default.
returnCollateral
methodCollateral is returned to the original collateralizer of the debt agreement.
The collateralizer can get collateral in exchange for the "repayment".
3.
verifyTransaction
Refund collateral.
block.number
is bigger thanpreState.data.grace_period
witness
is a signature bypreState.data.lender
block.number
is bigger thanpreState.data.grace_period
postState.range
has the same amount astransaction.range
postState
is a ownership state ofprestate.data.lender
block.number
is smaller thanpreState.data.grace_period
witness
is a signature bypreState.data.collateralizer
(Alice)preState.data.amount
postState.range
has the same amount astransaction.range
postState
has the ownership state of collateralizerQuestions
- Can Alice use tokenA after the repayment?
I think she can, as far as she proves that her "repayment" is valid. It means recievers of tokenA should verify tokenB's history. It requires addtional amount of history.
When operator withholds a block, Alice should be able to exit her collateral state. The grace period should be added for its upcoming challenge period.
- Can Bob use tokenA after debt enters default?
Bob can keep using tokenA after its grace period. When Bob attempts to use tokenA maliciously, for example when he (and colluded operator) transfers tokenA to someone before the grace period ends, Alice should be able to exit tokenA as soon as possible.