Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename EPOCH_DEFAULT to EPOCH_NOT_INITIALIZED #118

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Jun1on
Copy link
Contributor

@Jun1on Jun1on commented Jun 5, 2024

Related Issue

improves code clarity

Description of changes

rename EPOCH_DEFAULT to EPOCH_NOT_INITIALIZED in LimitOrder.sol

@@ -159,7 +159,7 @@ contract LimitOrder is BaseHook {

function _fillEpoch(PoolKey calldata key, int24 lower, bool zeroForOne) internal {
Epoch epoch = getEpoch(key, lower, zeroForOne);
if (!epoch.equals(EPOCH_DEFAULT)) {
if (!epoch.equals(EPOCH_NOT_INITIALIZED)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm i actually find this harder to read..

if epoch does not equal epoch not initialized ? its like double negative

maybe could you provide some more context/motivation for this name change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel like it makes the logic easier to follow. it emphasizes that there is nothing in that specific epoch. "default" feels confusing. maybe change the constant to EPOCH_EMPTY?

@@ -57,7 +57,7 @@ contract LimitOrder is BaseHook {

bytes internal constant ZERO_BYTES = bytes("");

Epoch private constant EPOCH_DEFAULT = Epoch.wrap(0);
Epoch private constant EPOCH_EMPTY = Epoch.wrap(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i dont mind this - but i'd maybe go for ZERO_EPOCH? to match when we use things like ZERO_ADDRESS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants