Skip to content

Commit 1ad5937

Browse files
committed
docs: update docs
1 parent 24a3765 commit 1ad5937

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

script/optimized-deployer-meta

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"constant_product_hash": "0x6b37069ad34cca2a7a7d3a8ed052f775eda0bec3d704c9ac5b6f9402c44b4765",
3-
"factory_hash": "0xd8a0495564d5556148a54de0b0074f4171da381bb172a684a90378592e37e0f8",
4-
"oracle_caller_hash": "0x401f8cdddb19e47b49df421d81efc922b706e72f2f7d84af19c3b7ad5cf2b2e1",
5-
"stable_hash": "0x7172144b5b8e564ba70205fa2337a9eab5e081b953d7ca079491221904a402d5"
2+
"constant_product_hash": "0xa0719fd65c4db1b8f15ac06274344fb7c121fa84bcfc2f854a2c7fd3b0a8de13",
3+
"factory_hash": "0xf8f34d4275709774705694daa526ffbb6c91f1c875c3af2049cc1690d9326ffc",
4+
"oracle_caller_hash": "0x2a0f1f77423fb968788cf68a9638c9ed5eb16ab66a050dfde6bf18dfe8bdb2c3",
5+
"stable_hash": "0xff427f388472489d39aaeee6d9f34588d56ca65960369a26e8aa59e36e494078"
66
}

src/ReservoirDeployer.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ contract ReservoirDeployer {
1717
uint256 public step = 0;
1818

1919
// Bytecode hashes.
20-
bytes32 public constant FACTORY_HASH = bytes32(0xd8a0495564d5556148a54de0b0074f4171da381bb172a684a90378592e37e0f8);
20+
bytes32 public constant FACTORY_HASH = bytes32(0xf8f34d4275709774705694daa526ffbb6c91f1c875c3af2049cc1690d9326ffc);
2121
bytes32 public constant CONSTANT_PRODUCT_HASH =
22-
bytes32(0x6b37069ad34cca2a7a7d3a8ed052f775eda0bec3d704c9ac5b6f9402c44b4765);
23-
bytes32 public constant STABLE_HASH = bytes32(0x7172144b5b8e564ba70205fa2337a9eab5e081b953d7ca079491221904a402d5);
22+
bytes32(0xa0719fd65c4db1b8f15ac06274344fb7c121fa84bcfc2f854a2c7fd3b0a8de13);
23+
bytes32 public constant STABLE_HASH = bytes32(0xff427f388472489d39aaeee6d9f34588d56ca65960369a26e8aa59e36e494078);
2424
bytes32 public constant ORACLE_CALLER_HASH =
25-
bytes32(0x401f8cdddb19e47b49df421d81efc922b706e72f2f7d84af19c3b7ad5cf2b2e1);
25+
bytes32(0x2a0f1f77423fb968788cf68a9638c9ed5eb16ab66a050dfde6bf18dfe8bdb2c3);
2626

2727
// Deployment addresses.
2828
GenericFactory public factory;

src/ReservoirPair.sol

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,11 @@ abstract contract ReservoirPair is IAssetManagedPair, ReservoirERC20 {
135135
_writeSlot0Timestamp(sSlot0, aBlockTimestampLast, false);
136136
}
137137

138-
// update reserves with new balances
139-
// on the first call per block, update price oracle using previous reserves
138+
/// @notice update reserves with new balances
139+
/// @notice on the first call per block, accumulate price oracle using previous instant prices and write the new instant prices
140+
/// @dev we write an oracle sample even at the time of pair creation. Also we do not update instant prices for
141+
/// subsequent mint/burn/swaps in the same block. the team has assessed that this is a small risk given the very
142+
/// fast block times on L2s and has decided to make the tradeoff to minimize complexity
140143
function _updateAndUnlock(
141144
Slot0 storage sSlot0,
142145
uint256 aBalance0,
@@ -156,13 +159,8 @@ abstract contract ReservoirPair is IAssetManagedPair, ReservoirERC20 {
156159
lTimeElapsed = lBlockTimestamp - aBlockTimestampLast;
157160

158161
// both balance should never be zero, but necessary to check so we don't pass 0 values into arithmetic operations
159-
// on the first activity of every block, accumulate using previous instant prices and write the current instant prices
160-
// we create a new sample even at the time of pair creation
161-
// this implies that we do not update instant prices for subsequent mint/burn/swaps in the same block
162-
// but the team has assessed that this is a small risk given the very fast block times on L2s
163-
// and has decided to make the tradeoff to minimize complexity
164-
if (lTimeElapsed * aBalance0 * aBalance1 > 0 ) {
165-
162+
// shortcut to calculate lTimeElapsed > 0 && aBalance0 > 0 && aBalance1 > 0
163+
if (lTimeElapsed * aBalance0 * aBalance1 > 0) {
166164
Observation storage lPrevious = _observations[sSlot0.index];
167165
(uint256 lInstantRawPrice, int256 lLogInstantRawPrice) = _calcSpotAndLogPrice(aBalance0, aBalance1);
168166

0 commit comments

Comments
 (0)