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

[WIP] MetaLamp/lending pool/development #15

Open
wants to merge 195 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
e2af94c
cp plutus-starter template
stanislav-az Apr 26, 2021
86e851e
cp analogous uniswap impl
stanislav-az Apr 28, 2021
737afba
rename aave
stanislav-az Apr 28, 2021
5e763b4
rename script
stanislav-az Apr 29, 2021
54b6cae
change lending pool link
stanislav-az Apr 30, 2021
0943616
add aToken into aave link
stanislav-az Apr 30, 2021
09e2532
forge aTokens
stanislav-az Apr 30, 2021
e1dc6ba
wip add aave pab server
stanislav-az May 3, 2021
99e6716
update plutus && rm example code
stanislav-az May 4, 2021
67ba034
fix contract errors
stanislav-az May 4, 2021
04bbfcd
fix pab server errors
stanislav-az May 4, 2021
faea233
change pab initialization
stanislav-az May 5, 2021
4a0bec6
use asset class instead of coin
stanislav-az May 5, 2021
7c36b2f
wip forge aave tokens for a pool
stanislav-az May 5, 2021
1de0a01
rm close endpoints
stanislav-az May 7, 2021
b93eab7
wip fix create endpoint
stanislav-az May 7, 2021
5ffafe0
fix infinite pool creation
stanislav-az May 7, 2021
6f096fc
fix create endpoint
stanislav-az May 7, 2021
f516559
rm not used functions
stanislav-az May 7, 2021
34cc66d
fix readme
stanislav-az May 7, 2021
ea13ca3
Merge pull request #4 from input-output-hk/MetaLamp/lending-pool/Feat…
stanislav-az May 7, 2021
edd886d
add fmt command
stanislav-az May 11, 2021
82b86f8
run fmt
stanislav-az May 11, 2021
0ef48e8
Add deposit/withdraw logic
performanceArtist May 14, 2021
89dd728
Merge pull request #8 from input-output-hk/MetaLamp/lending-pool/Use-…
stanislav-az May 14, 2021
b9cb31c
Merge formatter
performanceArtist May 14, 2021
719d004
add inlineable pragmas
stanislav-az May 14, 2021
67c23a8
Merge formatting
performanceArtist May 14, 2021
ae461b4
Finish burnATokensFrom - send liqudity to the caller
performanceArtist May 14, 2021
1e361af
Rename LendingPool->Reserve, add Datum and Redeemer postfixes
performanceArtist May 14, 2021
2214941
Split burnATokensFrom into two submits
performanceArtist May 14, 2021
70b92e6
Use IsString instance to simplify toAsset definition
performanceArtist May 14, 2021
c7614ac
Fix state validator, pass through aave token
performanceArtist May 17, 2021
109328c
Abstract away state management from aave implementation
performanceArtist May 17, 2021
f0ef46f
Rename Factory, remove ids
performanceArtist May 17, 2021
9b40ca3
Add inlineable, plutus prelude
performanceArtist May 18, 2021
a2e5cb8
Naming, split state handles and only allow forge from the owner
performanceArtist May 19, 2021
ad97f32
Use maps for reserves and user configs
performanceArtist May 19, 2021
c2cb42e
Add error logging
performanceArtist May 20, 2021
fe18d48
Remove aave function duplicate
performanceArtist May 20, 2021
8d7e163
Add TxUtils
performanceArtist May 21, 2021
3102eb6
Rename StateOutput -> OutputValue, move it to a separate module
performanceArtist May 21, 2021
3cb34ea
Use uncurry
performanceArtist May 21, 2021
a3ccf54
Merge pull request #10 from input-output-hk/MetaLamp/lending-pool/dep…
stanislav-az May 21, 2021
709ac31
add borrow params
stanislav-az May 23, 2021
7c5f395
add borrow logic
stanislav-az May 24, 2021
f93e3fb
add repay endpoint logic
stanislav-az May 26, 2021
6ba6df1
add endpoint calls
stanislav-az May 26, 2021
e40134e
fix borrow and repay logic
stanislav-az May 26, 2021
03860ef
rm redundant pure
stanislav-az May 27, 2021
7fe80fe
run fmt
stanislav-az May 27, 2021
0f818b4
Merge pull request #14 from input-output-hk/Metalamp/lending-pool/Add…
performanceArtist May 27, 2021
86b2f58
add aToken validator
stanislav-az May 28, 2021
570e0a7
merge forge and spend txs in deposit
stanislav-az May 30, 2021
8ce6ca4
submit burn tx correctly
stanislav-az May 30, 2021
a352ebc
add reserves and users wrappers
stanislav-az May 31, 2021
aaaf5de
refactor redeemer and datum types
stanislav-az Jun 1, 2021
b9d31c1
add prisms
stanislav-az Jun 2, 2021
6a99101
combine use cases transactions into one
stanislav-az Jun 2, 2021
ac131fd
submit state minting transactions one by one
stanislav-az Jun 2, 2021
4855cbc
validate putting state is authorized by pool operator
stanislav-az Jun 3, 2021
b309512
refactor error msgs
stanislav-az Jun 4, 2021
ba9df72
wip user configs validation
stanislav-az Jun 4, 2021
a8ad71c
add user configs validator for deposit
stanislav-az Jun 4, 2021
ad72f79
wip add reserves validator for deposit
stanislav-az Jun 5, 2021
bcadd1a
validate reserves in deposit
stanislav-az Jun 7, 2021
648c16d
Initial commit
performanceArtist Jun 7, 2021
556650f
Split simulation into two executables
performanceArtist Jun 7, 2021
35594c1
refactor error msgs
stanislav-az Jun 7, 2021
1d6a81c
separate parse datum function
stanislav-az Jun 7, 2021
bddaeaa
simplify datum type
stanislav-az Jun 7, 2021
28d2ff8
add user config id to withdraw
stanislav-az Jun 7, 2021
3450dd3
add validate withdraw
stanislav-az Jun 7, 2021
a6c27d3
Cleanup
performanceArtist Jun 7, 2021
0873943
check funds state in withdraw
stanislav-az Jun 7, 2021
09b2ad0
add borrow validator
stanislav-az Jun 7, 2021
4089ea8
abstract similar validators
stanislav-az Jun 7, 2021
1f48df7
add repay validator
stanislav-az Jun 7, 2021
7114314
check amounts are positive
stanislav-az Jun 7, 2021
3566ceb
check some state fields are not changed
stanislav-az Jun 7, 2021
59313b6
fix state forging policy
stanislav-az Jun 8, 2021
9485293
Fix purescript generation
performanceArtist Jun 8, 2021
2de9931
fix aave tokens validator
stanislav-az Jun 8, 2021
0112665
run fmt
stanislav-az Jun 8, 2021
dbfa0d9
Simplify getAaveResponseWith
performanceArtist Jun 8, 2021
8f1e8d6
remove unused code
stanislav-az Jun 9, 2021
ad13f49
Merge pull request #17 from input-output-hk/Metalamp/lending-pool/add…
performanceArtist Jun 9, 2021
397c65e
Resolve conflicts
performanceArtist Jun 9, 2021
b1b8bc2
Run formatter
performanceArtist Jun 9, 2021
9257069
Merge pull request #18 from input-output-hk/MetaLamp/lending-pool/fro…
stanislav-az Jun 9, 2021
a719484
Abstract contract polling
performanceArtist Jun 9, 2021
ca32682
Improve remoteData/error handling
performanceArtist Jun 9, 2021
05006b5
Redo remoteData handling
performanceArtist Jun 10, 2021
90f51f2
Display pool users
performanceArtist Jun 10, 2021
deee075
fix debt change in borrow
stanislav-az Jun 10, 2021
0f41a27
fix repay validator
stanislav-az Jun 11, 2021
abd238b
Merge pull request #19 from input-output-hk/MetaLamp/lending-pool/fro…
stanislav-az Jun 11, 2021
134d517
Update platform, fix errors
performanceArtist Jun 11, 2021
b0e3957
Merge pull request #24 from input-output-hk/MetaLamp/lending-pool/pla…
stanislav-az Jun 14, 2021
596ad39
fix funds outputs spending
stanislav-az Jun 14, 2021
2d465c3
increase retries count
stanislav-az Jun 14, 2021
18ff764
fmt haskell
stanislav-az Jun 14, 2021
fb0ee92
add todos
stanislav-az Jun 14, 2021
de02d6d
Rough cut
performanceArtist Jun 14, 2021
780a327
refactor datum
stanislav-az Jun 15, 2021
8c69865
wip refactor user config
stanislav-az Jun 15, 2021
674c866
Split aave into two contracts, handle multiple contract types on fron…
performanceArtist Jun 15, 2021
d0966a7
fix user config updates
stanislav-az Jun 16, 2021
ffb0f1f
Merge pull request #26 from input-output-hk/Metalamp/lending-pool/bac…
performanceArtist Jun 16, 2021
d99fc9a
Resolve conflicts
performanceArtist Jun 16, 2021
2100415
Fix simulation, add mock error for ui
performanceArtist Jun 16, 2021
2e59531
add provideCollateral endpoint
stanislav-az Jun 16, 2021
7d10774
Merge pull request #28 from input-output-hk/MetaLamp/lending-pool/fro…
stanislav-az Jun 16, 2021
3bfb0f8
Merge remote-tracking branch 'origin/MetaLamp/lending-pool/developmen…
stanislav-az Jun 16, 2021
e7caf00
add revokeCollateral endpoint
stanislav-az Jun 16, 2021
7df188a
add collateral filter
stanislav-az Jun 16, 2021
6352145
fix lending pool readme
stanislav-az Jun 17, 2021
198fef4
fix client readme
stanislav-az Jun 17, 2021
1c1c101
add troubleshooting
stanislav-az Jun 17, 2021
8964417
add functions description
stanislav-az Jun 17, 2021
f82f5fc
add logs for completing initialization
stanislav-az Jun 17, 2021
ec40066
fix typos
stanislav-az Jun 17, 2021
37f6eb0
add collateral endpoints into schema
stanislav-az Jun 17, 2021
841ef40
Fix client README, replace literally with strictly
performanceArtist Jun 17, 2021
e092477
fix collateral payment transactions
stanislav-az Jun 17, 2021
0fea720
add collateral endpoints to simulation
stanislav-az Jun 17, 2021
b4abd0d
Merge pull request #31 from input-output-hk/Metalamp/lending-pool/cod…
stanislav-az Jun 17, 2021
60fd37d
Merge remote-tracking branch 'origin/MetaLamp/lending-pool/developmen…
stanislav-az Jun 17, 2021
0852982
add collateralized investment in user config
stanislav-az Jun 17, 2021
3e29e82
add provide collateral validator
stanislav-az Jun 18, 2021
9536907
add user configs validator for revoke
stanislav-az Jun 18, 2021
0049731
add revoke funds validator
stanislav-az Jun 18, 2021
4e2d1cd
Use uniform way of handling contract endpoints for owner contract
performanceArtist Jun 18, 2021
4f54a21
calculate total collateral
stanislav-az Jun 18, 2021
b077656
update old user configs validators
stanislav-az Jun 18, 2021
e1fd10a
prohibit borrowing with the same collateral
stanislav-az Jun 18, 2021
428701e
prohibit depositing without repaying
stanislav-az Jun 18, 2021
31898fd
add collateral on chain logic
stanislav-az Jun 21, 2021
ed85093
cp oracle module
stanislav-az Jun 21, 2021
bd92e4b
add oracle into reserve
stanislav-az Jun 21, 2021
558a4e3
add use oracle function
stanislav-az Jun 21, 2021
dfd0009
add oracles tx into borrow
stanislav-az Jun 22, 2021
911c739
add oracle start at initialization
stanislav-az Jun 22, 2021
87043cd
combine multiple scripts tx pairs
stanislav-az Jun 22, 2021
d2747f1
fix use oracle function
stanislav-az Jun 22, 2021
8baefbc
add oracle lookup
stanislav-az Jun 22, 2021
7f7514b
add oracle fee into use function
stanislav-az Jun 23, 2021
362dd1b
add oracle consistency check
stanislav-az Jun 23, 2021
ac4450b
wip add collateral logic
stanislav-az Jun 23, 2021
3ebcf1c
fix oracle values error throwing
stanislav-az Jun 23, 2021
a4f3d25
add trusted oracles validation
stanislav-az Jun 23, 2021
67297d2
Add baisc test cases for deposit/withdraw
performanceArtist Jun 23, 2021
cc67ee6
add oracles to revoke collateral
stanislav-az Jun 24, 2021
7894f39
check that enough collateral remains during revoke
stanislav-az Jun 24, 2021
e8d9a39
Cleanup
performanceArtist Jun 24, 2021
223396a
fix purs types
stanislav-az Jun 24, 2021
7d75e36
fmt haskell
stanislav-az Jun 24, 2021
737eca1
add client endpoints
stanislav-az Jun 24, 2021
c3e25dc
rm ToSchema instance
stanislav-az Jun 24, 2021
903c0e5
add code comments
stanislav-az Jun 24, 2021
cbbb126
Merge pull request #40 from input-output-hk/Metalamp/lending-pool/bac…
performanceArtist Jun 24, 2021
cc6e88c
Split tests into separate cases, utils and fixtures
performanceArtist Jun 24, 2021
18a8f50
Resolve conflicts, add mock oracles to tests
performanceArtist Jun 25, 2021
34239a3
Add tests for the remaning cases
performanceArtist Jun 27, 2021
88129b9
Move getPubKey
performanceArtist Jun 28, 2021
939c7a5
add forM import
stanislav-az Jun 28, 2021
05e3da4
Add user config and borrower wallet checks
performanceArtist Jun 28, 2021
9032667
Merge pull request #41 from input-output-hk/Metalamp/lending-pool/bac…
stanislav-az Jun 28, 2021
6eece47
Add preloader for submit forms, remove logs for submit
performanceArtist Jun 29, 2021
291164f
Remove Last monoid from contract Writer type
performanceArtist Jun 29, 2021
7fbae32
Merge pull request #46 from input-output-hk/Metalamp/lending-pool/fro…
stanislav-az Jun 29, 2021
7c1214b
Merge remote-tracking branch 'origin/MetaLamp/lending-pool/developmen…
stanislav-az Jun 29, 2021
58ccc2c
Merge pull request #47 from input-output-hk/MetaLamp/lending-pool/rem…
stanislav-az Jun 29, 2021
7d5ef7a
Change folder structure
performanceArtist Jul 1, 2021
4cde967
Fix frontend imports
performanceArtist Jul 1, 2021
6367a55
Remove unused pragmas
performanceArtist Jul 2, 2021
5057326
Merge pull request #52 from input-output-hk/MetaLamp/lending-pool/cha…
stanislav-az Jul 2, 2021
5af8ecb
Use type synonyms
performanceArtist Jul 2, 2021
bf474c7
Merge pull request #53 from input-output-hk/MetaLamp/lending-pool/use…
stanislav-az Jul 2, 2021
5b26e63
add nix config from plutus-starter
Jul 12, 2021
ba6fec5
update generate-purs
Jul 12, 2021
38288ed
setup nix for client
Jul 13, 2021
1baae03
change readme
Jul 13, 2021
1af1315
use commit sha in fetch-plutus-purs script
Jul 13, 2021
7d6e2c7
add nodejs to nix shell
Jul 19, 2021
26563e5
add purty, fix-purty. fix-stylish-haskell
Jul 20, 2021
2a19866
remove package-lock
Jul 20, 2021
95a6742
Merge pull request #60 from input-output-hk/MetaLamp/lending-pool/upd…
performanceArtist Jul 20, 2021
6278826
update backend
Sep 14, 2021
f5f99f4
update client
Sep 15, 2021
e08682b
make fmt
Sep 15, 2021
a1c067e
remove mogus mock currency
Sep 15, 2021
8243253
remove unused packages
Sep 18, 2021
a5ad83c
make fmt and update Makefile
Sep 18, 2021
7a9ab6d
Merge pull request #75 from input-output-hk/MetaLamp/lending-pool/upd…
stanislav-az Sep 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions MetaLamp/lending-pool/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
dist
dist-*
cabal-dev
*.o
*.hi
*.hie
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*
.psc-ide-port
201 changes: 201 additions & 0 deletions MetaLamp/lending-pool/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
4 changes: 4 additions & 0 deletions MetaLamp/lending-pool/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fmt:
fix-stylish-haskell
fix-purty

53 changes: 53 additions & 0 deletions MetaLamp/lending-pool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Lending Pool

Lending Pool is a smart contract application on Plutus Platform.
The smart contract protocol is based on [Aave](https://aave.com/), but does not strictly follow it.

## Setting up

- Install nix
- Clone https://github.com/input-output-hk/plutus
- Set up your machine to build things with Nix, following the Plutus README (make sure to set up the binary cache!)

## The Plutus Application Backend (PAB) usage

We have provided two PAB applications in `./pab` and `./pab-simulation`. The first one is made for real world usage and interaction through frontend [client](client/README.md), the second one is a big test scenario.
With the PAB we can serve and interact with contracts over a web API. You can read more about the PAB here: [PAB Architecture](https://github.com/input-output-hk/plutus/blob/master/plutus-pab/ARCHITECTURE.adoc).

1. Enter the nix shell (from `lending-pool` directory):

```
nix-shell
```

2. Build the PAB executables (cd to plutus-use-cases/MetaLamp/lending-pool):

```
cabal build all
```

3. Run the PAB binary:

```
cabal run pab
```

This will then start up the server on port 9080.

4. To run test simulation do:

```
cabal run pab-simulation
```

## Client

See the client [readme](client/README.md).

## Troubleshooting

See [note](client/README.md/#Troubleshooting).

## Protocol functionality

See the description of user endpoints [here](src/Plutus/Contracts/Endpoints.hs)
Loading