From dcf7ddb7f50f28b2f90e231fe68f8465bc8b1f3e Mon Sep 17 00:00:00 2001 From: Facu Spagnuolo Date: Thu, 29 Apr 2021 18:23:43 -0300 Subject: [PATCH] docs: fix typos --- contracts/lib/helpers/WordCodec.sol | 4 ++-- contracts/pools/IPriceOracle.sol | 2 +- contracts/pools/oracle/Buffer.sol | 4 ++-- contracts/pools/oracle/PoolPriceOracle.sol | 10 +++++----- contracts/pools/oracle/Samples.sol | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/contracts/lib/helpers/WordCodec.sol b/contracts/lib/helpers/WordCodec.sol index 34f6667ba0..bc029b2bdb 100644 --- a/contracts/lib/helpers/WordCodec.sol +++ b/contracts/lib/helpers/WordCodec.sol @@ -18,8 +18,8 @@ pragma solidity ^0.7.0; * @dev Library for encoding and decoding values stored inside a 256 bit word. Typically used to pack multiple values in * a single storage slot, saving gas by performing less storage accesses. * - * Each value is defined by its size and least significant bit in the word, also known as offset. For example, two 128 - * bit values may be encoded in a word by assigning one an offset of 0, and the other an offset of 128. + * Each value is defined by its size and the least significant bit in the word, also known as offset. For example, two + * 128 bit values may be encoded in a word by assigning one an offset of 0, and the other an offset of 128. */ library WordCodec { // Masks are values with the least significant N bits set. They can be used to extract an encoded value from a word, diff --git a/contracts/pools/IPriceOracle.sol b/contracts/pools/IPriceOracle.sol index d94d1f1467..b7c06a858a 100644 --- a/contracts/pools/IPriceOracle.sol +++ b/contracts/pools/IPriceOracle.sol @@ -22,7 +22,7 @@ pragma experimental ABIEncoderV2; * price of the Pool share token (BPT) and invariant. Since the invariant is a sensible measure of Pool liquidity, it * can be used to compare two different price sources, and choose the most liquid one. * - * Once the oracle is fully initialized, all queries are guaranteed to succeed fail as long as they require no data that + * Once the oracle is fully initialized, all queries are guaranteed to succeed as long as they require no data that * is not older than the largest safe query window. */ interface IPriceOracle { diff --git a/contracts/pools/oracle/Buffer.sol b/contracts/pools/oracle/Buffer.sol index e68efd725a..fc62c36654 100644 --- a/contracts/pools/oracle/Buffer.sol +++ b/contracts/pools/oracle/Buffer.sol @@ -20,14 +20,14 @@ library Buffer { uint256 internal constant SIZE = 1024; /** - * @dev Returns the index of the first element before the one pointed by `index`. + * @dev Returns the index of the element before the one pointed by `index`. */ function prev(uint256 index) internal pure returns (uint256) { return sub(index, 1); } /** - * @dev Returns the index of the first element after the one pointed by `index`. + * @dev Returns the index of the element after the one pointed by `index`. */ function next(uint256 index) internal pure returns (uint256) { return add(index, 1); diff --git a/contracts/pools/oracle/PoolPriceOracle.sol b/contracts/pools/oracle/PoolPriceOracle.sol index 5a915dc2eb..aec005d634 100644 --- a/contracts/pools/oracle/PoolPriceOracle.sol +++ b/contracts/pools/oracle/PoolPriceOracle.sol @@ -26,7 +26,7 @@ import "../IPriceOracle.sol"; * * It uses a 1024 long circular buffer to store past data, where the data within each sample is the result of * accumulating live data for no more than two minutes. Therefore, assuming the worst case scenario where new data is - * updated in every single block block, the oldest samples in the buffer (and therefore largest queryable period) will + * updated in every single block, the oldest samples in the buffer (and therefore largest queryable period) will * be slightly over 34 hours old. * * Usage of this module requires the caller to keep track of two variables: the latest circular buffer index, and the @@ -142,7 +142,7 @@ contract PoolPriceOracle is IWeightedPoolPriceOracle { _require(latestTimestamp > 0, Errors.ORACLE_NOT_INITIALIZED); if (latestTimestamp <= lookUpTime) { - // The accumulator at times ahead the latest one are computed by extrapolating the latest data. This is + // The accumulator at times ahead of the latest one are computed by extrapolating the latest data. This is // equivalent to the instant value not changing between the last timestamp and the look up time. // We can use unchecked arithmetic since the accumulator can be represented in 53 bits, timestamps in 31 @@ -184,7 +184,7 @@ contract PoolPriceOracle is IWeightedPoolPriceOracle { uint256 elapsed = lookUpTime - prev.timestamp(); return prev.accumulator(variable) + ((samplesAccDiff * int256(elapsed)) / int256(samplesTimeDiff)); } else { - // Rarely, one of the samples will the the exact requested look up time, which is indicated by `prev` + // Rarely, one of the samples will have the exact requested look up time, which is indicated by `prev` // and `next` being the same. In this case, we simply return the accumulator at that point in time. return prev.accumulator(variable); } @@ -199,7 +199,7 @@ contract PoolPriceOracle is IWeightedPoolPriceOracle { * timestamp of the latest sample. */ function _findNearestSample(uint256 lookUpDate, uint256 offset) internal view returns (bytes32 prev, bytes32 next) { - // We're going to perform a binary search in the circular buffer, which requires for it to be sorted. To achieve + // We're going to perform a binary search in the circular buffer, which requires it to be sorted. To achieve // this, we offset all buffer accesses by `offset`, making the first element the oldest one. // Auxiliary variables in a typical binary search: we will look at some value `mid` between `low` and `high`, @@ -231,7 +231,7 @@ contract PoolPriceOracle is IWeightedPoolPriceOracle { // If the mid sample is above the look up date, then decrease the high index to start from there. // We can skip checked arithmetic: it is impossible for `high` to ever be 0, as a scenario where `low` - // equals 0 and `high` equals 1 would result in `low` increasing to 1 if the previous `if` clause. + // equals 0 and `high` equals 1 would result in `low` increasing to 1 in the previous `if` clause. high = midWithoutOffset - 1; } else { // sampleTimestamp == lookUpDate diff --git a/contracts/pools/oracle/Samples.sol b/contracts/pools/oracle/Samples.sol index c129a08f88..4f7cc28f3d 100644 --- a/contracts/pools/oracle/Samples.sol +++ b/contracts/pools/oracle/Samples.sol @@ -132,7 +132,7 @@ library Samples { } /** - * @dev Returns `sample`'s accumulator of the the logarithm of the pair price. + * @dev Returns `sample`'s accumulator of the logarithm of the pair price. */ function _accLogPairPrice(bytes32 sample) private pure returns (int256) { return sample.decodeInt53(_ACC_LOG_PAIR_PRICE_OFFSET); @@ -146,7 +146,7 @@ library Samples { } /** - * @dev Returns `sample`'s accumulator of the the logarithm of the BPT price. + * @dev Returns `sample`'s accumulator of the logarithm of the BPT price. */ function _accLogBptPrice(bytes32 sample) private pure returns (int256) { return sample.decodeInt53(_ACC_LOG_BPT_PRICE_OFFSET); @@ -160,7 +160,7 @@ library Samples { } /** - * @dev Returns `sample`'s accumulator of the the logarithm of the invariant. + * @dev Returns `sample`'s accumulator of the logarithm of the invariant. */ function _accLogInvariant(bytes32 sample) private pure returns (int256) { return sample.decodeInt53(_ACC_LOG_INVARIANT_OFFSET);