Skip to content

Commit d307498

Browse files
Updated contract docs for synchronize pull request develop
1 parent 776e9d0 commit d307498

52 files changed

Lines changed: 253 additions & 227 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/developer-guide/contracts/AmmalgamPair.sol/contract.AmmalgamPair.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# AmmalgamPair
2-
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/AmmalgamPair.sol)
2+
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/1cc9b790c0f0942d82915a25875fbc4d4fdeff47/contracts/AmmalgamPair.sol)
33

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

370370

371371
```solidity
372-
function resetSaturation(
373-
Validation.InputParams memory inputParams,
374-
address borrower,
375-
address to,
376-
uint256 depositLToBeTransferredInLAssets,
377-
uint256 depositXToBeTransferredInXAssets,
378-
uint256 depositYToBeTransferredInYAssets
379-
) private;
372+
function resetSaturation(Validation.InputParams memory inputParams, address borrower, address to) private;
380373
```
381374
**Parameters**
382375

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

392382

393383
### liquidateLeverage
@@ -510,12 +500,27 @@ function validateOnUpdate(address validate, address update, bool alwaysUpdate) p
510500
function validateSolvency(address validate, bool alwaysUpdate) private;
511501
```
512502

513-
### getInputParamsAndUpdateSaturation
503+
### updateSaturationIfNeeded
504+
505+
Update saturation state for an account if it already exists in saturation.
506+
507+
*Note that during a repay of debt, we may not have an entry in saturation if
508+
1. The position is a straddle with a payout that never reaches zero
509+
2. Repay is occurring during a callback of a flash loan, saturation will not be updated
510+
until the end of the borrow call after the callback concludes.*
514511

515512

516513
```solidity
517-
function getInputParamsAndUpdateSaturation(address toUpdate, bool alwaysUpdate) private;
514+
function updateSaturationIfNeeded(
515+
address toUpdate
516+
) private;
518517
```
518+
**Parameters**
519+
520+
|Name|Type|Description|
521+
|----|----|-----------|
522+
|`toUpdate`|`address`|The account to update saturation for.|
523+
519524

520525
### getInputParams
521526

docs/developer-guide/contracts/SaturationAndGeometricTWAPState.sol/contract.SaturationAndGeometricTWAPState.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SaturationAndGeometricTWAPState
2-
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/SaturationAndGeometricTWAPState.sol)
2+
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/1cc9b790c0f0942d82915a25875fbc4d4fdeff47/contracts/SaturationAndGeometricTWAPState.sol)
33

44
**Inherits:**
55
Initializable, [ISaturationAndGeometricTWAPState](/docs/developer-guide/contracts/interfaces/ISaturationAndGeometricTWAPState.sol/interface.ISaturationAndGeometricTWAPState.md), OwnableUpgradeable
@@ -151,6 +151,28 @@ function getAccount(
151151
) external view returns (Saturation.Account memory);
152152
```
153153

154+
### accountExistsInSaturation
155+
156+
Check if an account exists in either netX or netY saturation tree
157+
158+
159+
```solidity
160+
function accountExistsInSaturation(address pairAddress, address accountAddress) external view returns (bool exists);
161+
```
162+
**Parameters**
163+
164+
|Name|Type|Description|
165+
|----|----|-----------|
166+
|`pairAddress`|`address`|The address of the pair|
167+
|`accountAddress`|`address`|The address of the account to check|
168+
169+
**Returns**
170+
171+
|Name|Type|Description|
172+
|----|----|-----------|
173+
|`exists`|`bool`|True if the account exists in either tree|
174+
175+
154176
### update
155177

156178
update the borrow position of an account and potentially check (and revert) if the
@@ -249,7 +271,7 @@ function calcSatChangeRatioBips(
249271
uint256 liqSqrtPriceInYInQ72,
250272
address pairAddress,
251273
address account
252-
) external view virtual isInitialized returns (uint256 ratioNetXBips, uint256 ratioNetYBips);
274+
) external view virtual isInitialized returns (uint256 ratioBips);
253275
```
254276
**Parameters**
255277

@@ -265,8 +287,7 @@ function calcSatChangeRatioBips(
265287

266288
|Name|Type|Description|
267289
|----|----|-----------|
268-
|`ratioNetXBips`|`uint256`|The ratio representing the change in netX saturation for account.|
269-
|`ratioNetYBips`|`uint256`|The ratio representing the change in netY saturation for account.|
290+
|`ratioBips`|`uint256`|The ratio representing the change saturation for account.|
270291

271292

272293
### getObservations

docs/developer-guide/contracts/factories/AmmalgamFactory.sol/contract.AmmalgamFactory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# AmmalgamFactory
2-
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/factories/AmmalgamFactory.sol)
2+
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/1cc9b790c0f0942d82915a25875fbc4d4fdeff47/contracts/factories/AmmalgamFactory.sol)
33

44
**Inherits:**
55
[IAmmalgamFactory](/docs/developer-guide/contracts/interfaces/factories/IAmmalgamFactory.sol/interface.IAmmalgamFactory.md)

docs/developer-guide/contracts/factories/ERC20DebtLiquidityTokenFactory.sol/contract.ERC20DebtLiquidityTokenFactory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ERC20DebtLiquidityTokenFactory
2-
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/factories/ERC20DebtLiquidityTokenFactory.sol)
2+
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/1cc9b790c0f0942d82915a25875fbc4d4fdeff47/contracts/factories/ERC20DebtLiquidityTokenFactory.sol)
33

44
**Inherits:**
55
[ITokenFactory](/docs/developer-guide/contracts/interfaces/factories/ITokenFactory.sol/interface.ITokenFactory.md)

docs/developer-guide/contracts/factories/ERC20LiquidityTokenFactory.sol/contract.ERC20LiquidityTokenFactory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ERC20LiquidityTokenFactory
2-
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/factories/ERC20LiquidityTokenFactory.sol)
2+
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/1cc9b790c0f0942d82915a25875fbc4d4fdeff47/contracts/factories/ERC20LiquidityTokenFactory.sol)
33

44
**Inherits:**
55
[ITokenFactory](/docs/developer-guide/contracts/interfaces/factories/ITokenFactory.sol/interface.ITokenFactory.md)

docs/developer-guide/contracts/factories/ERC4626DebtTokenFactory.sol/contract.ERC4626DebtTokenFactory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ERC4626DebtTokenFactory
2-
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/factories/ERC4626DebtTokenFactory.sol)
2+
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/1cc9b790c0f0942d82915a25875fbc4d4fdeff47/contracts/factories/ERC4626DebtTokenFactory.sol)
33

44
**Inherits:**
55
[ITokenFactory](/docs/developer-guide/contracts/interfaces/factories/ITokenFactory.sol/interface.ITokenFactory.md)

docs/developer-guide/contracts/factories/ERC4626DepositTokenFactory.sol/contract.ERC4626DepositTokenFactory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ERC4626DepositTokenFactory
2-
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/factories/ERC4626DepositTokenFactory.sol)
2+
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/1cc9b790c0f0942d82915a25875fbc4d4fdeff47/contracts/factories/ERC4626DepositTokenFactory.sol)
33

44
**Inherits:**
55
[ITokenFactory](/docs/developer-guide/contracts/interfaces/factories/ITokenFactory.sol/interface.ITokenFactory.md)

docs/developer-guide/contracts/interfaces/IAmmalgamPair.sol/interface.IAmmalgamPair.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# IAmmalgamPair
2-
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/IAmmalgamPair.sol)
2+
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/1cc9b790c0f0942d82915a25875fbc4d4fdeff47/contracts/interfaces/IAmmalgamPair.sol)
33

44
**Inherits:**
55
[ITransferValidator](/docs/developer-guide/contracts/interfaces/callbacks/ITransferValidator.sol/interface.ITransferValidator.md)

docs/developer-guide/contracts/interfaces/ISaturationAndGeometricTWAPState.sol/interface.ISaturationAndGeometricTWAPState.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ISaturationAndGeometricTWAPState
2-
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/ISaturationAndGeometricTWAPState.sol)
2+
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/1cc9b790c0f0942d82915a25875fbc4d4fdeff47/contracts/interfaces/ISaturationAndGeometricTWAPState.sol)
33

44

55
## Functions
@@ -99,6 +99,28 @@ function getAccount(
9999
) external view returns (Saturation.Account memory);
100100
```
101101

102+
### accountExistsInSaturation
103+
104+
Check if an account exists in either netX or netY saturation tree
105+
106+
107+
```solidity
108+
function accountExistsInSaturation(address pairAddress, address accountAddress) external view returns (bool exists);
109+
```
110+
**Parameters**
111+
112+
|Name|Type|Description|
113+
|----|----|-----------|
114+
|`pairAddress`|`address`|The address of the pair|
115+
|`accountAddress`|`address`|The address of the account to check|
116+
117+
**Returns**
118+
119+
|Name|Type|Description|
120+
|----|----|-----------|
121+
|`exists`|`bool`|True if the account exists in either tree|
122+
123+
102124
### update
103125

104126
update the borrow position of an account and potentially check (and revert) if the
@@ -156,7 +178,7 @@ function calcSatChangeRatioBips(
156178
uint256 liqSqrtPriceInYInQ72,
157179
address pairAddress,
158180
address account
159-
) external view returns (uint256 ratioNetXBips, uint256 ratioNetYBips);
181+
) external view returns (uint256 ratioBips);
160182
```
161183
**Parameters**
162184

@@ -172,8 +194,7 @@ function calcSatChangeRatioBips(
172194

173195
|Name|Type|Description|
174196
|----|----|-----------|
175-
|`ratioNetXBips`|`uint256`|The ratio representing the change in netX saturation for account.|
176-
|`ratioNetYBips`|`uint256`|The ratio representing the change in netY saturation for account.|
197+
|`ratioBips`|`uint256`|The ratio representing the change in saturation for account.|
177198

178199

179200
### configLongTermInterval

docs/developer-guide/contracts/interfaces/callbacks/IAmmalgamCallee.sol/interface.IBorrowCallback.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# IBorrowCallback
2-
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/2b185eab2df708b55f7ffa534655c69f626e73b3/contracts/interfaces/callbacks/IAmmalgamCallee.sol)
2+
[Git Source](https://github.com/Ammalgam-Protocol/core-v1/blob/1cc9b790c0f0942d82915a25875fbc4d4fdeff47/contracts/interfaces/callbacks/IAmmalgamCallee.sol)
33

44

55
## Functions

0 commit comments

Comments
 (0)