Skip to content

Commit

Permalink
docs: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
facuspagnuolo authored and rabmarut committed Jun 16, 2021
1 parent 0ae9259 commit dcf7ddb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions contracts/lib/helpers/WordCodec.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion contracts/pools/IPriceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions contracts/pools/oracle/Buffer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions contracts/pools/oracle/PoolPriceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand All @@ -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`,
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions contracts/pools/oracle/Samples.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit dcf7ddb

Please sign in to comment.