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

fix audit issue 174 #872

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions packages/nouns-contracts/contracts/StreamEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ contract StreamEscrow is IStreamEscrow {
uint32 streamLastTick = currentTick + streamLengthInTicks;
ethStreamEndingAtTick[streamLastTick] += ethPerTick;

// the remainder is immediately streamed to the DAO
uint256 remainder = msg.value % streamLengthInTicks;
sendETHToTreasury(remainder);

uint128 newEthStreamedPerTick = ethStreamedPerTick + ethPerTick;
ethStreamedPerTick = newEthStreamedPerTick;
streams[nounId] = Stream({ ethPerTick: ethPerTick, canceled: false, lastTick: streamLastTick });
emit StreamCreated(nounId, msg.value, streamLengthInTicks, ethPerTick, newEthStreamedPerTick, streamLastTick);

// the remainder is immediately streamed to the DAO
uint256 remainder = msg.value % streamLengthInTicks;
sendETHToTreasury(remainder);
}

/**
Expand All @@ -141,11 +141,13 @@ contract StreamEscrow is IStreamEscrow {

lastForwardTimestamp = toUint48(block.timestamp);

sendETHToTreasury(ethStreamedPerTick);
uint128 ethStreamedPerTick_ = ethStreamedPerTick;

(uint32 newTick, uint128 ethPerTickEnded) = increaseTicksAndFinishStreams();

emit StreamsForwarded(newTick, ethPerTickEnded, ethStreamedPerTick, lastForwardTimestamp);

sendETHToTreasury(ethStreamedPerTick_);
}

/**
Expand Down
Loading