Skip to content

Instantly share code, notes, and snippets.

@zzzitron
Created September 1, 2022 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzzitron/216d67cc0c7def5450b921f9c7f9ae91 to your computer and use it in GitHub Desktop.
Save zzzitron/216d67cc0c7def5450b921f9c7f9ae91 to your computer and use it in GitHub Desktop.
git diff from Operator.t.sol
diff --git a/src/test/policies/Operator.t.sol b/src/test/policies/Operator.poc.sol
index e09aec1..5cbd382 100644
--- a/src/test/policies/Operator.t.sol
+++ b/src/test/policies/Operator.poc.sol
@@ -458,6 +458,32 @@ contract OperatorTest is Test {
/// [X] Cushion doesn't deploy when wall is down
/// [X] Bond purchases update capacity
+ function test_poc__lowCushionDeployWithWallspread10000Reverts() public {
+ /// Initialize operator
+ vm.prank(guardian);
+ operator.initialize();
+
+ /// if the wallspread is 10000 the operate might revert
+ vm.prank(policy);
+ operator.setSpreads(7000, 10000);
+
+ /// Confirm that the cushion is not deployed
+ assertTrue(!auctioneer.isLive(range.market(true)));
+
+ /// Set price on mock oracle into the lower cushion
+ /// given the lower wallspread is 10000
+ /// when the lower market should be deployed the operate reverts
+ price.setLastPrice(20 * 1e18);
+
+ /// Trigger the operate function manually
+ /// The operate will revert Error with "Division or modulo by 0"
+ /// But I could not figure out to catch with `expectRevert`
+ /// so just commenting out the assert
+ // vm.prank(guardian);
+ // /// vm.expectRevert(bytes("Division or module by 0")); // this cannot catch the revert...
+ // operator.operate();
+ }
+
function testCorrectness_highCushionDeployedInSpread() public {
/// Initialize operator
vm.prank(guardian);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment