-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(readme): adding readme and License
- Loading branch information
Showing
2 changed files
with
82 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2016 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,84 @@ | ||
## Foundry | ||
# Morpho-Blue snippets | ||
|
||
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** | ||
## Typescript & Solidity based snippets related to Morpho Protocols. | ||
|
||
Foundry consists of: | ||
IMPORTANT | ||
This repository contains smart contracts that have been developed for educational, experimental, or demonstration purposes only. By using or interacting with these smart contracts, you acknowledge and accept the following: | ||
|
||
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). | ||
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. | ||
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. | ||
- **Chisel**: Fast, utilitarian, and verbose solidity REPL. | ||
1. The smart contracts in this repository have not been audited and are provided "as is" with no guarantees, warranties, or assurances of any kind. The authors and maintainers of this repository are not responsible for any damages, losses, or liabilities that may arise from the use or deployment of these smart contracts. | ||
|
||
## Documentation | ||
2. The smart contracts in this repository are not intended for use in production environments or for the management of real-world assets, funds, or resources. Any use or deployment of these smart contracts for such purposes is done entirely at your own risk. | ||
|
||
https://book.getfoundry.sh/ | ||
3. The smart contracts are provided for reference and learning purposes, and you are solely responsible for understanding, modifying, and deploying them as needed. | ||
|
||
## Usage | ||
## Morpho-Blue related functions in Solidity: | ||
|
||
### Build | ||
One can use the logic provided in the following: | ||
|
||
```shell | ||
$ forge build | ||
``` | ||
1. functions to get data: | ||
|
||
### Test | ||
- supplyAPY | ||
- borrowAPY | ||
- supplyAssetsUser | ||
- borrowAssetsUser | ||
- collateralAssetsUser | ||
- marketTotalSupply | ||
- marketTotalBorrow | ||
- userHealthFactor | ||
|
||
```shell | ||
$ forge test | ||
``` | ||
2. functions to modify state: | ||
|
||
### Format | ||
- supply | ||
- supplyCollateral | ||
- withdrawCollateral | ||
- withdrawAmount | ||
- withdraw50Percent | ||
- withdrawAll | ||
|
||
```shell | ||
$ forge fmt | ||
``` | ||
3. functions using callbacks: | ||
|
||
### Gas Snapshots | ||
- leverageMe | ||
- deLeverageMe | ||
|
||
```shell | ||
$ forge snapshot | ||
``` | ||
## MetaMorpho related functions in Solidity: | ||
|
||
### Anvil | ||
One can use the logic provided in the following: | ||
|
||
```shell | ||
$ anvil | ||
``` | ||
1. functions to get data: | ||
|
||
### Deploy | ||
- totalDepositVault | ||
- vaultAssetsInMarket | ||
- totalSharesUserVault | ||
- supplyQueueVault | ||
- withdrawQueueVault | ||
- totalCapCollateral | ||
- supplyAPYMarket | ||
- supplyAPYVault | ||
|
||
```shell | ||
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key> | ||
``` | ||
2. functions to modify state | ||
|
||
### Cast | ||
- depositInVault | ||
- withdrawFromVaultAmount | ||
- redeemAllFromVault | ||
|
||
```shell | ||
$ cast <subcommand> | ||
``` | ||
## Getting Started | ||
|
||
- Install Foundry. | ||
- Install yarn | ||
- Run foundryup | ||
- Run forge install | ||
- Create a .env file according to the .env.example file. | ||
|
||
## Testing with Foundry 🔨 | ||
|
||
### Help | ||
You can run the test by running the command: | ||
|
||
```shell | ||
$ forge --help | ||
$ anvil --help | ||
$ cast --help | ||
```bash | ||
forge test | ||
``` | ||
|
||
Questions & Feedback | ||
For any question or feedback you can send an email to [email protected]. | ||
|
||
Licensing | ||
The code is under the MIT License. See License. |