Skip to content

Commit

Permalink
Remove one level of indentation (no code changes).
Browse files Browse the repository at this point in the history
  • Loading branch information
saurik committed Sep 16, 2019
1 parent d8474a9 commit 3f09831
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions dir-ethereum/directory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -236,56 +236,56 @@ contract OrchidDirectory is IOrchidDirectory {
lift(key, stake, -amount, stakee);

if (stake.amount_ == 0) {
Primary storage pivot = turn(key, stake);
Primary storage child = stake.before_ > stake.after_ ? stake.left_ : stake.right_;

if (nope(child))
kill(pivot);
else {
Primary storage last = child;
Stake storage current = stakes_[name(child)];
for (;;) {
Primary storage next = current.before_ > current.after_ ? current.left_ : current.right_;
if (nope(next))
break;
last = next;
current = stakes_[name(next)];
}
Primary storage pivot = turn(key, stake);
Primary storage child = stake.before_ > stake.after_ ? stake.left_ : stake.right_;

if (nope(child))
kill(pivot);
else {
Primary storage last = child;
Stake storage current = stakes_[name(child)];
for (;;) {
Primary storage next = current.before_ > current.after_ ? current.left_ : current.right_;
if (nope(next))
break;
last = next;
current = stakes_[name(next)];
}

bytes32 direct = current.parent_;
copy(pivot, last);
current.parent_ = stake.parent_;

if (direct == key) {
Primary storage other = stake.before_ > stake.after_ ? stake.right_ : stake.left_;
if (!nope(other))
stakes_[name(other)].parent_ = name(last);

if (name(stake.left_) == key) {
current.right_ = stake.right_;
current.after_ = stake.after_;
} else {
current.left_ = stake.left_;
current.before_ = stake.before_;
}
} else {
if (!nope(stake.left_))
stakes_[name(stake.left_)].parent_ = name(last);
if (!nope(stake.right_))
stakes_[name(stake.right_)].parent_ = name(last);
bytes32 direct = current.parent_;
copy(pivot, last);
current.parent_ = stake.parent_;

if (direct == key) {
Primary storage other = stake.before_ > stake.after_ ? stake.right_ : stake.left_;
if (!nope(other))
stakes_[name(other)].parent_ = name(last);

if (name(stake.left_) == key) {
current.right_ = stake.right_;
current.after_ = stake.after_;

} else {
current.left_ = stake.left_;
current.before_ = stake.before_;

stake.parent_ = direct;
copy(last, staker, stakee);
step(key, stake, -current.amount_, current.parent_);
kill(last);
}
} else {
if (!nope(stake.left_))
stakes_[name(stake.left_)].parent_ = name(last);
if (!nope(stake.right_))
stakes_[name(stake.right_)].parent_ = name(last);

current.right_ = stake.right_;
current.after_ = stake.after_;

current.left_ = stake.left_;
current.before_ = stake.before_;

stake.parent_ = direct;
copy(last, staker, stakee);
step(key, stake, -current.amount_, current.parent_);
kill(last);
}
}

delete stakes_[key];
}
Expand Down

0 comments on commit 3f09831

Please sign in to comment.