-
Notifications
You must be signed in to change notification settings - Fork 69
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
privileged accounts (liquidation) #164
Merged
Merged
Conversation
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
hussein-aitlahcen
force-pushed
the
lending-liquidator
branch
2 times, most recently
from
October 7, 2021 10:17
bf1ccc1
to
d5d5bcf
Compare
dzmitry-lahoda
previously approved these changes
Oct 7, 2021
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.
thanks for fixing doc comments, so i thin need to lint them and generate docs, so i be sure i write correct markup:)
hussein-aitlahcen
force-pushed
the
lending-liquidator
branch
from
October 7, 2021 10:21
d5d5bcf
to
bfbf3a0
Compare
hussein-aitlahcen
force-pushed
the
lending-liquidator
branch
from
October 7, 2021 11:43
bfbf3a0
to
8dce102
Compare
KaiserKarel
reviewed
Oct 7, 2021
KaiserKarel
reviewed
Oct 7, 2021
hussein-aitlahcen
force-pushed
the
lending-liquidator
branch
4 times, most recently
from
October 11, 2021 14:40
ffced31
to
9909fec
Compare
hussein-aitlahcen
force-pushed
the
lending-liquidator
branch
2 times, most recently
from
October 11, 2021 14:54
e777576
to
dccab94
Compare
membership is single map of runtime -> members. not map of any id -> members, so it does not work as i see |
dzmitry-lahoda
previously approved these changes
Oct 11, 2021
hussein-aitlahcen
force-pushed
the
lending-liquidator
branch
2 times, most recently
from
October 11, 2021 15:35
1560d8c
to
1aacf0b
Compare
hussein-aitlahcen
force-pushed
the
lending-liquidator
branch
from
October 11, 2021 15:38
1aacf0b
to
620e19a
Compare
dzmitry-lahoda
previously approved these changes
Oct 11, 2021
dzmitry-lahoda
previously approved these changes
Oct 12, 2021
hussein-aitlahcen
force-pushed
the
lending-liquidator
branch
2 times, most recently
from
October 12, 2021 08:02
a8023a4
to
2f22dcd
Compare
hussein-aitlahcen
force-pushed
the
lending-liquidator
branch
from
October 12, 2021 08:05
2f22dcd
to
60ccd78
Compare
dzmitry-lahoda
previously approved these changes
Oct 12, 2021
* Create SECURITY.md Set up for security protocols. * More guidelines * rewards section Co-authored-by: Filip <[email protected]> Update setup-auto-release Updating github workflow Implement auto update feature using two approaches Implement auto update feature using two approaches Implement auto update feature using two approaches Co-authored-by: Douglas Kuhn <[email protected]>
hussein-aitlahcen
force-pushed
the
lending-liquidator
branch
from
October 12, 2021 11:33
60ccd78
to
ec40025
Compare
Fixed conflicts |
dzmitry-lahoda
approved these changes
Oct 12, 2021
dzmitry-lahoda
added a commit
that referenced
this pull request
Oct 20, 2021
* Refactoring of pallet-lending (#178) * Create SECURITY.md (#111) (#174) * Create SECURITY.md Set up for security protocols. * More guidelines * rewards section Co-authored-by: Filip <[email protected]> Update setup-auto-release Updating github workflow Implement auto update feature using two approaches Implement auto update feature using two approaches Implement auto update feature using two approaches Co-authored-by: Douglas Kuhn <[email protected]> * better naming, comments & documentation * introduce account privilege traits, allowing inspection + mutation * introduce pallet-privilege which implements all the privilege traits * add privilege pallet event triggers * add privilege pallet readme * refactor promote/revoke behavior to be noop over privileged/nonprivileged user Co-authored-by: andor0 <[email protected]> Co-authored-by: Adedayo Akinpelu <[email protected]> Co-authored-by: Douglas Kuhn <[email protected]> # Conflicts: # Cargo.lock # frame/lending/src/lib.rs
dzmitry-lahoda
added a commit
that referenced
this pull request
Oct 21, 2021
* Refactoring of pallet-lending (#178) * Create SECURITY.md (#111) (#174) * Create SECURITY.md Set up for security protocols. * More guidelines * rewards section Co-authored-by: Filip <[email protected]> Update setup-auto-release Updating github workflow Implement auto update feature using two approaches Implement auto update feature using two approaches Implement auto update feature using two approaches Co-authored-by: Douglas Kuhn <[email protected]> * better naming, comments & documentation * introduce account privilege traits, allowing inspection + mutation * introduce pallet-privilege which implements all the privilege traits * add privilege pallet event triggers * add privilege pallet readme * refactor promote/revoke behavior to be noop over privileged/nonprivileged user Co-authored-by: andor0 <[email protected]> Co-authored-by: Adedayo Akinpelu <[email protected]> Co-authored-by: Douglas Kuhn <[email protected]> Signed-off-by: dzmitry-lahoda <[email protected]>
dzmitry-lahoda
added a commit
that referenced
this pull request
Oct 21, 2021
* Refactoring of pallet-lending (#178) * Create SECURITY.md (#111) (#174) * Create SECURITY.md Set up for security protocols. * More guidelines * rewards section Co-authored-by: Filip <[email protected]> Update setup-auto-release Updating github workflow Implement auto update feature using two approaches Implement auto update feature using two approaches Implement auto update feature using two approaches Co-authored-by: Douglas Kuhn <[email protected]> * better naming, comments & documentation * introduce account privilege traits, allowing inspection + mutation * introduce pallet-privilege which implements all the privilege traits * add privilege pallet event triggers * add privilege pallet readme * refactor promote/revoke behavior to be noop over privileged/nonprivileged user Co-authored-by: andor0 <[email protected]> Co-authored-by: Adedayo Akinpelu <[email protected]> Co-authored-by: Douglas Kuhn <[email protected]> Signed-off-by: dzmitry-lahoda <[email protected]>
dzmitry-lahoda
added a commit
that referenced
this pull request
Oct 21, 2021
* Refactoring of pallet-lending (#178) * Create SECURITY.md (#111) (#174) * Create SECURITY.md Set up for security protocols. * More guidelines * rewards section Co-authored-by: Filip <[email protected]> Update setup-auto-release Updating github workflow Implement auto update feature using two approaches Implement auto update feature using two approaches Implement auto update feature using two approaches Co-authored-by: Douglas Kuhn <[email protected]> * better naming, comments & documentation * introduce account privilege traits, allowing inspection + mutation * introduce pallet-privilege which implements all the privilege traits * add privilege pallet event triggers * add privilege pallet readme * refactor promote/revoke behavior to be noop over privileged/nonprivileged user Co-authored-by: andor0 <[email protected]> Co-authored-by: Adedayo Akinpelu <[email protected]> Co-authored-by: Douglas Kuhn <[email protected]> # Conflicts: # Cargo.lock # frame/lending/src/lib.rs Signed-off-by: dzmitry-lahoda <[email protected]>
dzmitry-lahoda
added a commit
that referenced
this pull request
Oct 21, 2021
* Refactoring of pallet-lending (#178) * Create SECURITY.md (#111) (#174) * Create SECURITY.md Set up for security protocols. * More guidelines * rewards section Co-authored-by: Filip <[email protected]> Update setup-auto-release Updating github workflow Implement auto update feature using two approaches Implement auto update feature using two approaches Implement auto update feature using two approaches Co-authored-by: Douglas Kuhn <[email protected]> * Refactoring of pallet-lending (#182) * - Implement dynamic PID controller based interest rate model. See details at https://www.delphidigital.io/reports/dynamic-interest-rate-model-based-on-control-theory/ - Add InterestRate trait which provides get_borrow_rate() method. * start refactor and inline docs (#169) * start refactor and inline docs * added more inline docs * more docs * clean * quick clean * fmt * fmt * polkadot-v0.9.11 (#187) * fix wasm build (#192) * fix wasm build * pin orml to rev * Update off-chain worker of pallet-lending (#190) * remove request id (#194) * test fixes (#195) * Fix release benchmark feature build. * Add cumulus-ping in Runtime (#197) * enable CI on develop branch (#199) * Implement DoubleExponent interest rate model. (#185) * Copy and paste code of cumulus-ping pallet (#198) * Remove unused dependencies (#203) * pallet-assets (#112) * POC of pallet-assets * use Assets in vault::Config * implement ReservableCurrency make event a placeholder * define and implement MultiCurrency trait clippy * use Assets as Currency implementation * add extrinsics to pallet-asset * weights file weights working weights added * implement common orml traits * implement MultiReservableCurrency * Use WeightInfo in extrinsics * fix merge * Update benchmarks of pallet-lending (#148) * Add offchain worker to monitor loans which should be liquidate or warned. (#151) * Add offchain worker to monitor loans which should be liquidate or warned. * Update benchmarks of pallet-lending Co-authored-by: Andrey Orlov <[email protected]> * light refactoring (#152) * simplify traits Prefer the usage of by-value for value parameters such as Balance and the usage of `DispatchResult` instead of custom error. * use try_mutate for mutating the auction order * move `WrappingNext` to composable traits * update gitignore, some tools are not supporting **/ patterns * lending borrow/repay fixes & isolation test & more vault test (#156) * add a note about how we are handling vault<->market * use the more explicit type aliases * `into_sub_account` require >8bytes AccountId * fix borrow_for_collateral, express itself as borrow asset unit instead of $ * introduce vault stock_dilution_rate tests * documentation & more inline pragmas * better error name When we hit a MustLiquidate while borrowing, this probably mean that the market is being closed and waiting for repays to happen. * refactor * avoid setting minimum deposit to let proptest pass with low values * fix borrow/repay tests and introduce market isolation test * auction and lending test fixes (#153) Signed-off-by: dzmitry-lahoda <[email protected]> * Pass InterestRateModel as input to create_new_market() extrinsic. Co-authored-by: Filip <[email protected]> Co-authored-by: andor0 <[email protected]> Co-authored-by: Vivek Pandya <[email protected]> Co-authored-by: Hussein Ait-Lahcen <[email protected]> Co-authored-by: Dzmitry Lahoda <[email protected]> Signed-off-by: dzmitry-lahoda <[email protected]> * privileged accounts (liquidation) (#164) * Refactoring of pallet-lending (#178) * Create SECURITY.md (#111) (#174) * Create SECURITY.md Set up for security protocols. * More guidelines * rewards section Co-authored-by: Filip <[email protected]> Update setup-auto-release Updating github workflow Implement auto update feature using two approaches Implement auto update feature using two approaches Implement auto update feature using two approaches Co-authored-by: Douglas Kuhn <[email protected]> * better naming, comments & documentation * introduce account privilege traits, allowing inspection + mutation * introduce pallet-privilege which implements all the privilege traits * add privilege pallet event triggers * add privilege pallet readme * refactor promote/revoke behavior to be noop over privileged/nonprivileged user Co-authored-by: andor0 <[email protected]> Co-authored-by: Adedayo Akinpelu <[email protected]> Co-authored-by: Douglas Kuhn <[email protected]> # Conflicts: # Cargo.lock # frame/lending/src/lib.rs Signed-off-by: dzmitry-lahoda <[email protected]> * dex docs, groups for lending, api (#183) Signed-off-by: dzmitry-lahoda <[email protected]> # Conflicts: # Cargo.lock # frame/composable-traits/Cargo.toml # frame/composable-traits/src/lending.rs # frame/dutch-auction/src/lib.rs # frame/lending/src/lib.rs # frame/oracle/src/lib.rs * smallest possible unit for currencies + refactor + lending fixes / tests more clear (#186) * make sure we allow liquidation if the source account has zero funds after * introduce PriceableAsset capability * refactor lending pallet + oracle mock to use smallest unit of an asset * fix merge conflicts, make tests more clear * simpler priceable type & upgrade runtime currency to handle it * simplify and better documentation * cleanup unused constraints # Conflicts: # frame/composable-traits/src/currency.rs # frame/composable-traits/src/lending.rs # frame/lending/src/lib.rs # frame/lending/src/tests.rs # frame/liquidations/src/lib.rs # frame/oracle/src/lib.rs # runtime/primitives/src/currency.rs Signed-off-by: dzmitry-lahoda <[email protected]> * Vault-index-configurable (#200) * make VaultId an associated type * Unmanle doc comment # Conflicts: # frame/vault/src/lib.rs Signed-off-by: dzmitry-lahoda <[email protected]> * rent implementation (#189) * implement rent and tombstoning * clean up claim_surcharge Also ensure that tombstoned vaults have funds returned by strategies. * handle deletion_reward * add delete_tombstoned functionality * add add_surcharge * fmt and fix doc comment Signed-off-by: dzmitry-lahoda <[email protected]> * Use NativeCurrency associated type instead of querying for native id (#202) # Conflicts: # Cargo.lock # frame/vault/Cargo.toml Signed-off-by: dzmitry-lahoda <[email protected]> * fixed lending tests and run cargo fmt Signed-off-by: dzmitry-lahoda <[email protected]> * fixes from fmt and clippy Signed-off-by: dzmitry-lahoda <[email protected]> * fixes to benches Signed-off-by: dzmitry-lahoda <[email protected]> Co-authored-by: andor0 <[email protected]> Co-authored-by: Adedayo Akinpelu <[email protected]> Co-authored-by: Douglas Kuhn <[email protected]> Co-authored-by: Vivek Pandya <[email protected]> Co-authored-by: JesseAbram <[email protected]> Co-authored-by: Seun Lanlege <[email protected]> Co-authored-by: Karel L. Kubat <[email protected]> Co-authored-by: Filip <[email protected]> Co-authored-by: Hussein Ait-Lahcen <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In this PR we draft the privilege capability of an account.
I am not familiar enough with low level substrate to tell whether this clash with the
Origin
(if it can cover this use case then perfect !).The idea is to allow a group of privileged users to have access to special features of some pallets.
Let's take the current case: being a privileged liquidator for a lending market.
I implemented a trait that would allow us to handle a set of privileged users, for any combination of privilege.
Instead of handling the state inside every pallet where we will need a set of privileged accounts, we handle it through a single pallet which provide an interface where we can register privileged groups. Whenever an account privilege is revoked, the user is revoked from all groups that expect their member to own the privilege.
Using this pallet, in the liquidation case we would be able to:
NOTE: this might be implemented using the membership pallet? or the election pallet?