Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix/g3m weight check #102

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Changes from 2 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
5 changes: 4 additions & 1 deletion src/GeometricMean/GeometricMean.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ contract GeometricMean is PairStrategy {
data, (uint256, uint256, uint256, uint256, uint256, address)
);

if (state.wX >= ONE) {
if (state.wX == 0 || state.wX >= ONE) {
revert InvalidWeightX();
}

Expand Down Expand Up @@ -129,6 +129,9 @@ contract GeometricMean is PairStrategy {
} else if (updateCode == UpdateCode.WeightX) {
(, uint256 targetWeightX, uint256 targetTimestamp) =
abi.decode(data, (UpdateCode, uint256, uint256));
if (targetWeightX == 0 || targetWeightX >= ONE) {
revert InvalidWeightX();
}
internalParams[poolId].wX.set(targetWeightX, targetTimestamp);
} else if (updateCode == UpdateCode.Controller) {
(, internalParams[poolId].controller) =
Expand Down
Loading