https://github.com/santiellena/air-flatcoin-protocol
Against Inflation Rate Protocol
https://github.com/santiellena/air-flatcoin-protocol
chainlink chainlink-automation chainlink-datafeeds defi flatcoin foundry inflation makefile solidity truflation web3
Last synced: 3 months ago
JSON representation
Against Inflation Rate Protocol
- Host: GitHub
- URL: https://github.com/santiellena/air-flatcoin-protocol
- Owner: santiellena
- Created: 2023-10-03T22:06:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-13T18:36:12.000Z (over 1 year ago)
- Last Synced: 2024-04-24T02:36:38.636Z (about 1 year ago)
- Topics: chainlink, chainlink-automation, chainlink-datafeeds, defi, flatcoin, foundry, inflation, makefile, solidity, truflation, web3
- Language: Solidity
- Homepage:
- Size: 278 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---
description: >-
A flatcoin protocol that sets its price initially at one US dollar and then
updates it daily given the daily inflation data.
---# Against Inflation Rate Protocol (AIR Protocol)
### About
AIR protocol is a flatcoin protocol that sets its price initially at one US dollar and then updates it daily given the daily inflation data provided by Truflation (oracle working with Chainlink) and triggered by Chainlink Automation. This protocol intends to simulate the operation of MakerDao's DAI, only its peg is not fixed.
Air protocol architecture
### Getting Started
#### Requirements:
First of all, install Make:
{% embed url="https://www.geeksforgeeks.org/how-to-install-make-on-ubuntu/" %}
#### Then, install Foundry:
{% embed url="https://github.com/crisgarner/awesome-foundry" %}
To use this code, you need to have installed [foundry](https://github.com/crisgarner/awesome-foundry).
To check if you have it installed:
```shell
# In case you have it installed you will see the version
$ forge --version```
#### Quickstart:
Install the necessary dependencies:
```shell
$ make install
```### Usage
#### Locally:
First of all, add anvil network to Metamask.
1. Go to "Settings> Networks> Add a network> Add a network manually"
How to fill network data
2. Switch to anvil network.
Now add your anvil account to Metamask:
I recommend using the following private key as account to avoid re configuring the environment:
```bash
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
```
Example of adding an account
Then deploy the protocol to start interacting with it.
```bash
$ make deploy
```Printed on the console you will find the following logs:
Logs example
Import the WETH contact as a token on Metamask:
Import a token example
You will immediately see you have balance because the "make deploy" command in addition to deploying the protocol, it minted some tokens for us.
Now, you need to import the AIR token to Metamask (same procedure but use the AIR Contract Address from the logs).
As we still don't have AIR tokens, we need to deposit some collateral to the engine to mint some.
Open the makefile file. There you will find the depositAndMint command. Use the logs to configure it:
Command before configuration
Execute the command:
```bash
$ make depositAndMint
```Your balance on Metamask should be like this:
Metamask status after deposit and mint
**Congrats! You have deployed the protocol and its testing components. Now you can start playing around with some other commands to see how the protocol behaves.**
**Thank you for taking the time to read and use the Anti Inflation Rate protocol!**
Other commands to execute and try the protocol:
```bash
# Add collateral to your account to increase your health factor
$ make deposit# Mint some AIR into your account and decrease your health factor
$ make mint# Burn some AIR to increase your health factor
$ make burn# By asking the mock truflation contract the daily inflation
$ make increaseAirPrice# Liquidate a user whose account has been created when the contract was deployed
$ make liquidate# Get your health factor account
$ make healthFactor# Creates a second account in the protocol with a health factor of 1 (one)
# which is the limit before liquidation is available
$ make depositAndMintSecondAccount
```* **Recommendation:** Deposit a lot of WETH on the protocol so you can use it without breaking the health factor.
#### Testnet:
This option is not yet available through the command line.
**Recommendations:**
* Try executing other commands to update AIR price by inflation, to liquidate a user, to mint some more tokens, etc.
* Audit the protocol! This codebase probably has a couple of security issues I haven't find out.
* Star the project! ⭐