Skip to content

Commit

Permalink
Merge pull request #44 from usePicnic/bug/adjusting-gamma-whitelist
Browse files Browse the repository at this point in the history
Bug/adjusting gamma whitelist
  • Loading branch information
joaoavf authored Jul 14, 2023
2 parents 983f94c + b2a8cb1 commit ce7c468
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions contracts/bridges/Gamma/GammaDepositBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,17 @@ contract GammaDepositBridge is IGammaDeposit {
hypervisorAddress,
tokens[1],
amountsIn[1]
);

if (startB > amountsIn[0]) {
return (amountsIn[0], Math.min(amountsIn[1], endB));
);

// * 9999 / 10000 is a hack to deal with unprecise math and avoid "improper ratio bug")
if (startA > amountsIn[0]) {
return (amountsIn[0], Math.min(amountsIn[1], endB * 9999/10000 ));
}
else if (startA > amountsIn[1]) {
return (Math.min(amountsIn[0], endA), amountsIn[1]);
else if (startB > amountsIn[1]) {
return (Math.min(amountsIn[0], endA * 9999/10000 ), amountsIn[1]);
}
else {
return (Math.min(amountsIn[0], endA), Math.min(amountsIn[1], endB));
return (Math.min(amountsIn[0], endA * 9999/10000 ), Math.min(amountsIn[1], endB * 9999/10000 ));
}
}
}

0 comments on commit ce7c468

Please sign in to comment.