Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# AmmalgamPair
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/AmmalgamPair.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/AmmalgamPair.sol)

**Inherits:**
[IAmmalgamPair](/docs/developer-guide/contracts/interfaces/IAmmalgamPair.sol/interface.IAmmalgamPair.md), [TokenController](/docs/developer-guide/contracts/tokens/TokenController.sol/contract.TokenController.md)
Expand Down Expand Up @@ -369,14 +369,7 @@ Liquidation based on change of saturation because of time.


```solidity
function resetSaturation(
Validation.InputParams memory inputParams,
address borrower,
address to,
uint256 depositLToBeTransferredInLAssets,
uint256 depositXToBeTransferredInXAssets,
uint256 depositYToBeTransferredInYAssets
) private;
function resetSaturation(Validation.InputParams memory inputParams, address borrower, address to) private;
```
**Parameters**

Expand All @@ -385,9 +378,6 @@ function resetSaturation(
|`inputParams`|`Validation.InputParams`||
|`borrower`|`address`|The account being liquidated.|
|`to`|`address`|The account to send the liquidated deposit to|
|`depositLToBeTransferredInLAssets`|`uint256`|The amount of L to be transferred to the liquidator.|
|`depositXToBeTransferredInXAssets`|`uint256`|The amount of X to be transferred to the liquidator.|
|`depositYToBeTransferredInYAssets`|`uint256`|The amount of Y to be transferred to the liquidator.|


### liquidateLeverage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SaturationAndGeometricTWAPState
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/SaturationAndGeometricTWAPState.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/SaturationAndGeometricTWAPState.sol)

**Inherits:**
Initializable, [ISaturationAndGeometricTWAPState](/docs/developer-guide/contracts/interfaces/ISaturationAndGeometricTWAPState.sol/interface.ISaturationAndGeometricTWAPState.md), OwnableUpgradeable
Expand Down Expand Up @@ -249,7 +249,7 @@ function calcSatChangeRatioBips(
uint256 liqSqrtPriceInYInQ72,
address pairAddress,
address account
) external view virtual isInitialized returns (uint256 ratioNetXBips, uint256 ratioNetYBips);
) external view virtual isInitialized returns (uint256 ratioBips);
```
**Parameters**

Expand All @@ -265,8 +265,7 @@ function calcSatChangeRatioBips(

|Name|Type|Description|
|----|----|-----------|
|`ratioNetXBips`|`uint256`|The ratio representing the change in netX saturation for account.|
|`ratioNetYBips`|`uint256`|The ratio representing the change in netY saturation for account.|
|`ratioBips`|`uint256`|The ratio representing the change saturation for account.|


### getObservations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# AmmalgamFactory
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/factories/AmmalgamFactory.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/factories/AmmalgamFactory.sol)

**Inherits:**
[IAmmalgamFactory](/docs/developer-guide/contracts/interfaces/factories/IAmmalgamFactory.sol/interface.IAmmalgamFactory.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ERC20DebtLiquidityTokenFactory
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/factories/ERC20DebtLiquidityTokenFactory.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/factories/ERC20DebtLiquidityTokenFactory.sol)

**Inherits:**
[ITokenFactory](/docs/developer-guide/contracts/interfaces/factories/ITokenFactory.sol/interface.ITokenFactory.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ERC20LiquidityTokenFactory
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/factories/ERC20LiquidityTokenFactory.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/factories/ERC20LiquidityTokenFactory.sol)

**Inherits:**
[ITokenFactory](/docs/developer-guide/contracts/interfaces/factories/ITokenFactory.sol/interface.ITokenFactory.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ERC4626DebtTokenFactory
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/factories/ERC4626DebtTokenFactory.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/factories/ERC4626DebtTokenFactory.sol)

**Inherits:**
[ITokenFactory](/docs/developer-guide/contracts/interfaces/factories/ITokenFactory.sol/interface.ITokenFactory.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ERC4626DepositTokenFactory
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/factories/ERC4626DepositTokenFactory.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/factories/ERC4626DepositTokenFactory.sol)

**Inherits:**
[ITokenFactory](/docs/developer-guide/contracts/interfaces/factories/ITokenFactory.sol/interface.ITokenFactory.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IAmmalgamPair
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/IAmmalgamPair.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/IAmmalgamPair.sol)

**Inherits:**
[ITransferValidator](/docs/developer-guide/contracts/interfaces/callbacks/ITransferValidator.sol/interface.ITransferValidator.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ISaturationAndGeometricTWAPState
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/ISaturationAndGeometricTWAPState.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/ISaturationAndGeometricTWAPState.sol)


## Functions
Expand Down Expand Up @@ -156,7 +156,7 @@ function calcSatChangeRatioBips(
uint256 liqSqrtPriceInYInQ72,
address pairAddress,
address account
) external view returns (uint256 ratioNetXBips, uint256 ratioNetYBips);
) external view returns (uint256 ratioBips);
```
**Parameters**

Expand All @@ -172,8 +172,7 @@ function calcSatChangeRatioBips(

|Name|Type|Description|
|----|----|-----------|
|`ratioNetXBips`|`uint256`|The ratio representing the change in netX saturation for account.|
|`ratioNetYBips`|`uint256`|The ratio representing the change in netY saturation for account.|
|`ratioBips`|`uint256`|The ratio representing the change in saturation for account.|


### configLongTermInterval
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IBorrowCallback
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/callbacks/IAmmalgamCallee.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/callbacks/IAmmalgamCallee.sol)


## Functions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ICallback
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/callbacks/IAmmalgamCallee.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/callbacks/IAmmalgamCallee.sol)

**Inherits:**
[ISwapCallback](/docs/developer-guide/contracts/interfaces/callbacks/IAmmalgamCallee.sol/interface.ISwapCallback.md), [IBorrowCallback](/docs/developer-guide/contracts/interfaces/callbacks/IAmmalgamCallee.sol/interface.IBorrowCallback.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ISwapCallback
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/callbacks/IAmmalgamCallee.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/callbacks/IAmmalgamCallee.sol)

*This interface should be implemented by anyone wishing to use callbacks in the
`swap`, `borrow`, and `borrowLiquidity` functions in the IAmmalgamPair interface.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ITransferValidator
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/callbacks/ITransferValidator.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/callbacks/ITransferValidator.sol)

This interface is intended for validating the solvency of an account when transfers occur.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IAmmalgamFactory
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/factories/IAmmalgamFactory.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/factories/IAmmalgamFactory.sol)

**Inherits:**
[IFactoryCallback](/docs/developer-guide/contracts/interfaces/factories/IFactoryCallback.sol/interface.IFactoryCallback.md), [IBeaconCallback](/docs/developer-guide/contracts/interfaces/factories/IAmmalgamFactory.sol/interface.IBeaconCallback.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IBeaconCallback
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/factories/IAmmalgamFactory.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/factories/IAmmalgamFactory.sol)


## Functions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IFactoryCallback
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/factories/IFactoryCallback.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/factories/IFactoryCallback.sol)

This interface provides methods for getting the token factory configuration.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ITokenFactory
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/factories/ITokenFactory.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/factories/ITokenFactory.sol)


## Functions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IAmmalgamERC20
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/tokens/IAmmalgamERC20.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/tokens/IAmmalgamERC20.sol)

**Inherits:**
IERC20, IERC20Metadata, IERC20Permit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IERC20DebtToken
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/tokens/IERC20DebtToken.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/tokens/IERC20DebtToken.sol)

**Inherits:**
[IAmmalgamERC20](/docs/developer-guide/contracts/interfaces/tokens/IAmmalgamERC20.sol/interface.IAmmalgamERC20.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IHookRegistry
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/tokens/IHookRegistry.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/tokens/IHookRegistry.sol)


## Functions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Constants
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/tokens/ITokenController.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/tokens/ITokenController.sol)

### DEPOSIT_L

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ITokenController
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/tokens/ITokenController.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/interfaces/tokens/ITokenController.sol)

The interface of a ERC20 facade for multiple token types with functionality similar to ERC1155.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Convert
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/libraries/Convert.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/libraries/Convert.sol)


## Functions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# GeometricTWAP
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/libraries/GeometricTWAP.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/libraries/GeometricTWAP.sol)


## State Variables
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Interest
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/libraries/Interest.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/libraries/Interest.sol)

This library is used for calculating and accruing interest.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Liquidation
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/libraries/Liquidation.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/libraries/Liquidation.sol)


## State Variables
Expand Down Expand Up @@ -127,11 +127,8 @@ function calculateNetDebtAndSeizedDeposits(
function checkSaturationPremiums(
ISaturationAndGeometricTWAPState saturationAndGeometricTWAPState,
Validation.InputParams memory inputParams,
address borrower,
uint256 depositLToTransferInLAssets,
uint256 depositXToTransferInXAssets,
uint256 depositYToTransferInYAssets
) external view;
address borrower
) external view returns (uint256 seizeXAssets, uint256 seizeYAssets, uint256 seizeLAssets);
```

### liquidateLeverageCalcDeltaAndPremium
Expand Down Expand Up @@ -268,36 +265,17 @@ function convertLtvToPremium(
|`maxPremiumInBips`|`uint256`|The maximum premium for the liquidator.|


### calcSaturationPremiumBips

Calculate the premium the saturation liquidator is receiving given the borrowers deposit and the depositToTransfer to the liquidator.
The end premium is the max of the premiums in L, X, Y
If no saturation liq is requested (liquidationParams.saturationDepositLToBeTransferred==liquidationParams.saturationDepositXToBeTransferred==liquidationParams.saturationDepositYToBeTransferred==0), the premium will be 0
### calcSaturationSeizedAssets


```solidity
function calcSaturationPremiumBips(
Validation.InputParams memory inputParams,
uint256 depositLToTransferInLAssets,
uint256 depositXToTransferInXAssets,
uint256 depositYToTransferInYAssets
) internal pure returns (uint256 premiumInBips);
function calcSaturationSeizedAssets(
uint256 depositedLAssets,
uint256 depositedXAssets,
uint256 depositedYAssets,
uint256 premiumInBips
) internal pure returns (uint256 seizedLAssets, uint256 seizedXAssets, uint256 seizedYAssets);
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`inputParams`|`Validation.InputParams`|The params containing the position of the borrower.|
|`depositLToTransferInLAssets`|`uint256`||
|`depositXToTransferInXAssets`|`uint256`||
|`depositYToTransferInYAssets`|`uint256`||

**Returns**

|Name|Type|Description|
|----|----|-----------|
|`premiumInBips`|`uint256`|The premium being received by the liquidator.|


### calcSaturationMaxPremiumInBips

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# PartialLiquidations
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/libraries/PartialLiquidations.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/libraries/PartialLiquidations.sol)

We allow liquidations to happen in parts when the position is spread across more than
one tranche. These partial liquidations allow the liquidator to specify how many tranches they
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# QuadraticSwapFees
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/libraries/QuadraticSwapFees.sol)
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2ced318822dafebfff7d67fabcd7025224bffea6/contracts/libraries/QuadraticSwapFees.sol)

**Author:**
Will
Expand Down
Loading