generated from gretzke/foundry-template
-
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.
* Add additional documentation
- Loading branch information
Showing
37 changed files
with
429 additions
and
120 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
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,69 @@ | ||
<mxfile host="65bd71144e" scale="1" border="5"> | ||
<diagram id="TrCcAzhzWdwAyr-SGnU9" name="Page-1"> | ||
<mxGraphModel dx="400" dy="947" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" background="#ffffff" math="0" shadow="0"> | ||
<root> | ||
<mxCell id="0"/> | ||
<mxCell id="1" parent="0"/> | ||
<mxCell id="2" value="Pocket<br>(Base)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> | ||
<mxGeometry x="160" y="480" width="120" height="60" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="12" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="3" target="7" edge="1"> | ||
<mxGeometry relative="1" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="14" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="3" target="8" edge="1"> | ||
<mxGeometry relative="1" as="geometry"> | ||
<Array as="points"> | ||
<mxPoint x="380" y="440"/> | ||
<mxPoint x="540" y="440"/> | ||
</Array> | ||
</mxGeometry> | ||
</mxCell> | ||
<mxCell id="15" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="3" target="2" edge="1"> | ||
<mxGeometry relative="1" as="geometry"> | ||
<Array as="points"> | ||
<mxPoint x="380" y="440"/> | ||
<mxPoint x="220" y="440"/> | ||
</Array> | ||
</mxGeometry> | ||
</mxCell> | ||
<mxCell id="3" value="Vault<br>(ETH)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> | ||
<mxGeometry x="320" y="340" width="120" height="60" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="4" value="Vault<br>(USDC)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> | ||
<mxGeometry x="120" y="340" width="120" height="60" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="5" value="Vault<br>(...)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> | ||
<mxGeometry x="520" y="340" width="120" height="60" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="9" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="6" target="3" edge="1"> | ||
<mxGeometry relative="1" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="10" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="6" target="5" edge="1"> | ||
<mxGeometry relative="1" as="geometry"> | ||
<Array as="points"> | ||
<mxPoint x="380" y="300"/> | ||
<mxPoint x="580" y="300"/> | ||
</Array> | ||
</mxGeometry> | ||
</mxCell> | ||
<mxCell id="11" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="6" target="4" edge="1"> | ||
<mxGeometry relative="1" as="geometry"> | ||
<Array as="points"> | ||
<mxPoint x="380" y="300"/> | ||
<mxPoint x="180" y="300"/> | ||
</Array> | ||
</mxGeometry> | ||
</mxCell> | ||
<mxCell id="6" value="TCAP" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> | ||
<mxGeometry x="320" y="200" width="120" height="60" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="7" value="Pocket<br>(Aave)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> | ||
<mxGeometry x="320" y="480" width="120" height="60" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="8" value="Pocket<br>(...)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> | ||
<mxGeometry x="480" y="480" width="120" height="60" as="geometry"/> | ||
</mxCell> | ||
</root> | ||
</mxGraphModel> | ||
</diagram> | ||
</mxfile> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,3 +1,17 @@ | ||
# Documentation | ||
|
||
The auto-generated documentation from the natspec comments in the contracts can be found [here](./autogen/src/SUMMARY.md). | ||
|
||
--- | ||
|
||
The TCAP token is an overcollateralized ERC20 token that aims to be pegged to the market cap of the crypto market. Users can mint TCAP by depositing ERC20 tokens into vaults as collateral. When collateral is deposited into a vault, the user can pick a "pocket" to deposit the collateral into. | ||
|
||
 | ||
|
||
A pocket manages user assets and isolates them from other deposits. A base pocket simply stores the collateral and does not allow for any lending for example. The Aave pocket is a more complex pocket that lends the deposited collateral on Aave allowing user's capital to be used more efficiently. This mechanism allows a user to chose what level of additional risk they want to take on, as well as isolate their collateral from other deposits. | ||
|
||
## Liquidations | ||
|
||
Should a user's health factor drop below the liquidation threshold the user's collateral can be liquidated. Liquidators can buy TCAP tokens on the open market and call the liquidate function. The liquidation process burns the TCAP tokens and sends the underlying collateral (liquidation reward) back to the liquidator. By default only a portion of a user's position can be liquidated which pushes the user's health factor back above the liquidation threshold. | ||
|
||
The liquidation mechanism is based on the V1 version of the TCAP token. The calculation of the liquidation reward and derivation of the formula can be found [here](https://medium.com/@voithjm1/tokenomics-of-tcap-ce9da45e1be9). A minimum and maximum health factor is enforced after the liquidation. The minimum health factor is enforced after the liquidation to ensure that the user should not be able to be liquidated again immediately after a liquidation. The maximum health factor is enforced to ensure the user does not suffer from a larger than necessary liquidation reward, as the more TCAP tokens are liquidated by the liquidator, the more profitable the liquidation becomes and the more of the underlying collateral the user loses. In cases where the user cannot be liquidated in a way that keeps their health factor between the minimum and maximum health factor, the entire position can be liquidated to mitigate the risk of bad debt. |
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
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
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
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
2 changes: 1 addition & 1 deletion
2
docs/autogen/src/src/interface/IMulticall.sol/interface.IMulticall.md
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
2 changes: 1 addition & 1 deletion
2
docs/autogen/src/src/interface/IOracle.sol/interface.IOracle.md
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
2 changes: 1 addition & 1 deletion
2
docs/autogen/src/src/interface/ITCAPV2.sol/interface.ITCAPV2.md
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
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
2 changes: 1 addition & 1 deletion
2
docs/autogen/src/src/interface/IVersioned.sol/interface.IVersioned.md
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
23 changes: 0 additions & 23 deletions
23
.../autogen/src/src/interface/pockets/IAAVEv3Pocket.sol/interface.IAAVEv3Pocket.md
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
.../autogen/src/src/interface/pockets/IAaveV3Pocket.sol/interface.IAaveV3Pocket.md
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,23 @@ | ||
# IAaveV3Pocket | ||
[Git Source](https://github.com/cryptexfinance/tcapv2.0/blob/6bc13f590e0d259edfc7844b2201ce75ef760a67/src/interface/pockets/IAaveV3Pocket.sol) | ||
|
||
**Inherits:** | ||
[IPocket](/src/interface/pockets/IPocket.sol/interface.IPocket.md) | ||
|
||
Interface for pockets depositing underlying tokens into Aave v3 | ||
|
||
|
||
## Functions | ||
### POOL | ||
|
||
|
||
```solidity | ||
function POOL() external view returns (IPool pool); | ||
``` | ||
**Returns** | ||
|
||
|Name|Type|Description| | ||
|----|----|-----------| | ||
|`pool`|`IPool`|Aave v3 Pool| | ||
|
||
|
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
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,5 +1,5 @@ | ||
|
||
|
||
# Contents | ||
- [IAAVEv3Pocket](IAAVEv3Pocket.sol/interface.IAAVEv3Pocket.md) | ||
- [IAaveV3Pocket](IAaveV3Pocket.sol/interface.IAaveV3Pocket.md) | ||
- [IPocket](IPocket.sol/interface.IPocket.md) |
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
2 changes: 1 addition & 1 deletion
2
docs/autogen/src/src/lib/FeeCalculatorLib.sol/library.FeeCalculatorLib.md
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
2 changes: 1 addition & 1 deletion
2
docs/autogen/src/src/lib/LiquidationLib.sol/library.LiquidationLib.md
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
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
2 changes: 1 addition & 1 deletion
2
.../src/oracle/AggregatedChainlinkOracle.sol/contract.AggregatedChainlinkOracle.md
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
2 changes: 1 addition & 1 deletion
2
docs/autogen/src/src/oracle/BaseOracleUSD.sol/abstract.BaseOracleUSD.md
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
2 changes: 1 addition & 1 deletion
2
docs/autogen/src/src/oracle/TCAPTargetOracle.sol/contract.TCAPTargetOracle.md
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
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
2 changes: 1 addition & 1 deletion
2
docs/autogen/src/src/pockets/BasePocket.sol/contract.BasePocket.md
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
Oops, something went wrong.