1 | # Hifi Protocol [![Coverage Status](https://coveralls.io/repos/github/hifi-finance/hifi-protocol/badge.svg?branch=main)](https://coveralls.io/github/hifi-finance/hifi-protocol?branch=main) [![Commitizen Friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![License: LGPL3.0](https://img.shields.io/badge/license-LGPL3.0-yellow.svg)](https://opensource.org/licenses/lgpl-3.0)
|
2 |
|
3 | An implementation of zero-coupon bonds on the Ethereum blockchain. In-depth documentation on Hifi is available at [docs.hifi.finance](https://docs.hifi.finance).
|
4 |
|
5 | The built contract artifacts can be browsed via [unpkg.com](https://unpkg.com/browse/@hifi/v1@latest/).
|
6 |
|
7 | ## Developers
|
8 |
|
9 | Our contracts are written in Solidity and our tests in TypeScript.
|
10 |
|
11 | If you want to contribute, familiarity with [Hardhat](https://github.com/nomiclabs/hardhat), [Ethers](https://github.com/ethers-io/ethers.js),
|
12 | [Waffle](https://github.com/EthWorks/Waffle) and [TypeChain](https://github.com/ethereum-ts/TypeChain) is needed.
|
13 |
|
14 | ### Pre Requisites
|
15 |
|
16 | Before running any command, make sure to install dependencies:
|
17 |
|
18 | ```sh
|
19 | $ yarn install
|
20 | ```
|
21 |
|
22 | ### Compile
|
23 |
|
24 | Compile the smart contracts with Hardhat:
|
25 |
|
26 | ```sh
|
27 | $ yarn compile
|
28 | ```
|
29 |
|
30 | ### TypeChain
|
31 |
|
32 | Compile the smart contracts and generate TypeChain artifacts:
|
33 |
|
34 | ```sh
|
35 | $ yarn typechain
|
36 | ```
|
37 |
|
38 | ### Lint Solidity
|
39 |
|
40 | Lint the Solidity code:
|
41 |
|
42 | ```sh
|
43 | $ yarn lint:sol
|
44 | ```
|
45 |
|
46 | ### Lint TypeScript
|
47 |
|
48 | Lint the TypeScript code:
|
49 |
|
50 | ```sh
|
51 | $ yarn lint:ts
|
52 | ```
|
53 |
|
54 | ### Format Code
|
55 |
|
56 | Run the Prettier formatter:
|
57 |
|
58 | ```sh
|
59 | $ yarn prettier
|
60 | ```
|
61 |
|
62 | ### Test Unit
|
63 |
|
64 | Run the unit tests:
|
65 |
|
66 | ```sh
|
67 | $ yarn test:unit
|
68 | ```
|
69 |
|
70 | ### Test Integration
|
71 |
|
72 | Run the integration tests:
|
73 |
|
74 | ```sh
|
75 | $ yarn test:integration
|
76 | ```
|
77 |
|
78 | ### Coverage
|
79 |
|
80 | Generate the code coverage report:
|
81 |
|
82 | ```sh
|
83 | $ yarn coverage
|
84 | ```
|
85 |
|
86 | ### Clean
|
87 |
|
88 | Delete the smart contract artifacts, the coverage reports and the Hardhat cache:
|
89 |
|
90 | ```sh
|
91 | $ yarn clean
|
92 | ```
|
93 |
|
94 | ## Acknowledgements
|
95 |
|
96 | - Dan Robinson and Allan Niemerg, for their work on [The Yield Protocol: On-Chain Lending With Interest Rate
|
97 | Discovery](https://research.paradigm.xyz/Yield.pdf), which shaped many of our protocol design choices.
|
98 | - Chainlink, for their [Price Feeds](https://docs.chain.link/docs/using-chainlink-reference-contracts).
|
99 | - Compound Finance, for their [Solidity math library](https://compound.finance/docs#protocol-math).
|
100 | - OpenZeppelin, for their [outstanding smart contract library](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts).
|
101 |
|
102 | ## Discussion
|
103 |
|
104 | For any concerns or feedback, open an issue or visit us on [Discord](https://discord.gg/mhtSRz6) to discuss.
|
105 |
|
106 | ## License
|
107 |
|
108 | Everything is released under the [LGPL3.0 license](./LICENSE.md).
|