From b4a71ce793d34b2249057cc661fb8fb5aae890bf Mon Sep 17 00:00:00 2001 From: Vitaly Galaichuk Date: Fri, 12 Apr 2024 21:22:49 +0700 Subject: [PATCH] chore: add tests for uint80 add collateral protection --- .gas-snapshot | 724 +++++++++--------- test/integrations-cash/AddCollateral.t.sol | 30 + test/integrations-cash/Transfer.t.sol | 40 + .../integrations-physical/AddCollateral.t.sol | 30 + test/integrations-physical/Transfer.t.sol | 40 + 5 files changed, 505 insertions(+), 359 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index f4411c6..ceb7a28 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,97 +1,95 @@ -CashEngineProxyTest:testCanUpgradeToAnotherUUPSContract() (gas: 623108) -CashEngineProxyTest:testCannotPermitAccountAccessCrossProxy() (gas: 499779) -CashEngineProxyTest:testCannotUpgradeFromNonOwner() (gas: 16148) -CashEngineProxyTest:testCannotUpgradeTov3() (gas: 1227812) +CashEngineProxyTest:testCanUpgradeToAnotherUUPSContract() (gas: 618125) +CashEngineProxyTest:testCannotPermitAccountAccessCrossProxy() (gas: 489549) +CashEngineProxyTest:testCannotUpgradeFromNonOwner() (gas: 16166) +CashEngineProxyTest:testCannotUpgradeTov3() (gas: 1217826) CashEngineProxyTest:testImplementationContractOwnerIsZero() (gas: 7723) -CashEngineProxyTest:testImplementationIsInitialized() (gas: 11024) -CashEngineProxyTest:testProxyIsInitialized() (gas: 15897) -CashEngineProxyTest:testProxyOwnerIsSelf() (gas: 12605) +CashEngineProxyTest:testImplementationIsInitialized() (gas: 11030) +CashEngineProxyTest:testProxyIsInitialized() (gas: 15915) +CashEngineProxyTest:testProxyOwnerIsSelf() (gas: 12617) CrossMarginCashEngineAccessTest:test() (gas: 164) -CrossMarginCashEngineAccessTest:testCanAccessAccountIfOriginIsFundAdmin() (gas: 161154) -CrossMarginCashEngineAccessTest:testCanAccessAccountIfOriginIsSender() (gas: 155519) -CrossMarginCashEngineAccessTest:testCannotAccessAccountIfCallerHasNoRole() (gas: 180375) -CrossMarginCashEngineAccessTest:testCannotAccessAccountIfOriginIsNotAdmin() (gas: 59992) -CrossMarginCashEngineAccessTest:testCannotAccessAccountIfOriginIsSenderNotFA() (gas: 54596) -CrossMarginCashEngineAccessTest:testCannotTransferToOverrideAnotherAccount() (gas: 139173) -CrossMarginCashEngineAccessTest:testCannotTransferUnAuthorizedAccount() (gas: 15573) -CrossMarginCashEngineAccessTest:testTransferCMAccount() (gas: 152220) +CrossMarginCashEngineAccessTest:testCanAccessAccountIfOriginIsFundAdmin() (gas: 161390) +CrossMarginCashEngineAccessTest:testCanAccessAccountIfOriginIsSender() (gas: 155771) +CrossMarginCashEngineAccessTest:testCannotAccessAccountIfCallerHasNoRole() (gas: 180722) +CrossMarginCashEngineAccessTest:testCannotAccessAccountIfOriginIsNotAdmin() (gas: 60091) +CrossMarginCashEngineAccessTest:testCannotAccessAccountIfOriginIsSenderNotFA() (gas: 54683) +CrossMarginCashEngineAccessTest:testCannotTransferToOverrideAnotherAccount() (gas: 139415) +CrossMarginCashEngineAccessTest:testCannotTransferUnAuthorizedAccount() (gas: 15585) +CrossMarginCashEngineAccessTest:testTransferCMAccount() (gas: 152492) CrossMarginCashEngineAccessTest:testUtils() (gas: 167) CrossMarginCashEngineSignedAccessTest:test() (gas: 164) -CrossMarginCashEngineSignedAccessTest:testCanSetAccess() (gas: 213805) -CrossMarginCashEngineSignedAccessTest:testCanSetAccessToZero() (gas: 208015) -CrossMarginCashEngineSignedAccessTest:testRevertsOnInvalidAccount() (gas: 48551) -CrossMarginCashEngineSignedAccessTest:testRevertsOnInvalidActor() (gas: 50701) -CrossMarginCashEngineSignedAccessTest:testRevertsOnInvalidExecutionsNum() (gas: 48578) -CrossMarginCashEngineSignedAccessTest:testRevertsOnInvalidNonce() (gas: 48571) -CrossMarginCashEngineSignedAccessTest:testRevertsOnInvalidPrivateKey() (gas: 46534) -CrossMarginCashEngineSignedAccessTest:testRevertsOnMismatchingAccount() (gas: 50528) -CrossMarginCashEngineSignedAccessTest:testRevertsOnNoSignature() (gas: 44047) +CrossMarginCashEngineSignedAccessTest:testCanSetAccess() (gas: 214214) +CrossMarginCashEngineSignedAccessTest:testCanSetAccessToZero() (gas: 208499) +CrossMarginCashEngineSignedAccessTest:testRevertsOnInvalidAccount() (gas: 48620) +CrossMarginCashEngineSignedAccessTest:testRevertsOnInvalidActor() (gas: 50770) +CrossMarginCashEngineSignedAccessTest:testRevertsOnInvalidExecutionsNum() (gas: 48647) +CrossMarginCashEngineSignedAccessTest:testRevertsOnInvalidNonce() (gas: 48640) +CrossMarginCashEngineSignedAccessTest:testRevertsOnInvalidPrivateKey() (gas: 46603) +CrossMarginCashEngineSignedAccessTest:testRevertsOnMismatchingAccount() (gas: 50597) +CrossMarginCashEngineSignedAccessTest:testRevertsOnNoSignature() (gas: 44071) CrossMarginCashEngineSignedAccessTest:testUtils() (gas: 189) CrossMarginPhysicalEngineAccessTest:test() (gas: 164) -CrossMarginPhysicalEngineAccessTest:testCanAccessAccountIfOriginIsFundAdmin() (gas: 161155) -CrossMarginPhysicalEngineAccessTest:testCanAccessAccountIfOriginIsSender() (gas: 155520) -CrossMarginPhysicalEngineAccessTest:testCannotAccessAccountIfCallerHasNoRole() (gas: 180327) -CrossMarginPhysicalEngineAccessTest:testCannotAccessAccountIfOriginIsNotAdmin() (gas: 59914) -CrossMarginPhysicalEngineAccessTest:testCannotAccessAccountIfOriginIsSenderNotFA() (gas: 54518) -CrossMarginPhysicalEngineAccessTest:testCannotTransferToOverrideAnotherAccount() (gas: 139241) -CrossMarginPhysicalEngineAccessTest:testCannotTransferUnAuthorizedAccount() (gas: 15616) +CrossMarginPhysicalEngineAccessTest:testCanAccessAccountIfOriginIsFundAdmin() (gas: 161331) +CrossMarginPhysicalEngineAccessTest:testCanAccessAccountIfOriginIsSender() (gas: 155712) +CrossMarginPhysicalEngineAccessTest:testCannotAccessAccountIfCallerHasNoRole() (gas: 180590) +CrossMarginPhysicalEngineAccessTest:testCannotAccessAccountIfOriginIsNotAdmin() (gas: 59989) +CrossMarginPhysicalEngineAccessTest:testCannotAccessAccountIfOriginIsSenderNotFA() (gas: 54581) +CrossMarginPhysicalEngineAccessTest:testCannotTransferToOverrideAnotherAccount() (gas: 139399) +CrossMarginPhysicalEngineAccessTest:testCannotTransferUnAuthorizedAccount() (gas: 15628) CrossMarginPhysicalEngineAccessTest:testForgeCoverageIgnoreThis() (gas: 208) -CrossMarginPhysicalEngineAccessTest:testTransferCMAccount() (gas: 152391) +CrossMarginPhysicalEngineAccessTest:testTransferCMAccount() (gas: 152555) CrossMarginPhysicalEngineAccessTest:testUtils() (gas: 167) CrossMarginPhysicalEngineSignedAccessTest:test() (gas: 164) -CrossMarginPhysicalEngineSignedAccessTest:testCanSetAccess() (gas: 213782) -CrossMarginPhysicalEngineSignedAccessTest:testCanSetAccessToZero() (gas: 207996) +CrossMarginPhysicalEngineSignedAccessTest:testCanSetAccess() (gas: 214131) +CrossMarginPhysicalEngineSignedAccessTest:testCanSetAccessToZero() (gas: 208420) CrossMarginPhysicalEngineSignedAccessTest:testForgeCoverageIgnoreThis() (gas: 208) -CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnInvalidAccount() (gas: 48507) -CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnInvalidActor() (gas: 50638) -CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnInvalidExecutionsNum() (gas: 48515) -CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnInvalidNonce() (gas: 48508) -CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnInvalidPrivateKey() (gas: 46471) -CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnMismatchingAccount() (gas: 50476) -CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnNoSignature() (gas: 43992) +CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnInvalidAccount() (gas: 48576) +CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnInvalidActor() (gas: 50707) +CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnInvalidExecutionsNum() (gas: 48584) +CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnInvalidNonce() (gas: 48577) +CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnInvalidPrivateKey() (gas: 46540) +CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnMismatchingAccount() (gas: 50545) +CrossMarginPhysicalEngineSignedAccessTest:testRevertsOnNoSignature() (gas: 44016) CrossMarginPhysicalEngineSignedAccessTest:testUtils() (gas: 189) -Deploy:testChill() (gas: 143) -Deploy:testUtils() (gas: 121) -DeployPhysicalMarginEngine:testChill() (gas: 143) -DeployPhysicalMarginEngine:testUtils() (gas: 121) +Deploy:testUtils() (gas: 98) +DeployPhysicalMarginEngine:testUtils() (gas: 98) General_CMC:test() (gas: 164) -General_CMC:testCannotCallAddLongWithExpiredToken() (gas: 47276) -General_CMC:testCannotCallAddLongWithNotAuthorizedEngine() (gas: 77178) -General_CMC:testCannotCallPayoutFromAnybody() (gas: 38606) -General_CMC:testCannotCallRemoveLongNotInAccount() (gas: 53069) -General_CMC:testGetMinCollateral() (gas: 303278) +General_CMC:testCannotCallAddLongWithExpiredToken() (gas: 47393) +General_CMC:testCannotCallAddLongWithNotAuthorizedEngine() (gas: 77331) +General_CMC:testCannotCallPayoutFromAnybody() (gas: 38663) +General_CMC:testCannotCallRemoveLongNotInAccount() (gas: 53186) +General_CMC:testGetMinCollateral() (gas: 303850) General_CMC:testUtils() (gas: 167) General_CMP:test() (gas: 209) -General_CMP:testCannotCallAddLongWithExpiredOption() (gas: 47241) -General_CMP:testCannotCallAddLongWithNotAuthorizedEngine() (gas: 72766) -General_CMP:testCannotCallPayoutFromAnybody() (gas: 38635) -General_CMP:testCannotCallRemoveLongNotInAccount() (gas: 53056) +General_CMP:testCannotCallAddLongWithExpiredOption() (gas: 47298) +General_CMP:testCannotCallAddLongWithNotAuthorizedEngine() (gas: 72859) +General_CMP:testCannotCallPayoutFromAnybody() (gas: 38692) +General_CMP:testCannotCallRemoveLongNotInAccount() (gas: 53113) General_CMP:testForgeCoverageIgnoreThis() (gas: 186) -General_CMP:testGetMinCollateral() (gas: 321660) +General_CMP:testGetMinCollateral() (gas: 321908) General_CMP:testUtils() (gas: 167) MockEngineV2:test() (gas: 162) MockWhitelist:test() (gas: 186) Permissioned_CMC:test() (gas: 186) -Permissioned_CMC:testAliceCanSettleOption() (gas: 362304) -Permissioned_CMC:testCanExecute() (gas: 147681) -Permissioned_CMC:testCannotExecute() (gas: 49319) -Permissioned_CMC:testCannotSettleOption() (gas: 362510) +Permissioned_CMC:testAliceCanSettleOption() (gas: 362834) +Permissioned_CMC:testCanExecute() (gas: 147887) +Permissioned_CMC:testCannotExecute() (gas: 49400) +Permissioned_CMC:testCannotSettleOption() (gas: 363031) Permissioned_CMC:testUtils() (gas: 167) Permissioned_CMP:test() (gas: 164) -Permissioned_CMP:testAliceCanSettleOption() (gas: 399867) -Permissioned_CMP:testCanExecute() (gas: 147892) -Permissioned_CMP:testCannotExecute() (gas: 49270) -Permissioned_CMP:testCannotSettleOption() (gas: 352063) +Permissioned_CMP:testAliceCanSettleOption() (gas: 400253) +Permissioned_CMP:testCanExecute() (gas: 148038) +Permissioned_CMP:testCannotExecute() (gas: 49327) +Permissioned_CMP:testCannotSettleOption() (gas: 352362) Permissioned_CMP:testForgeCoverageIgnoreThis() (gas: 208) Permissioned_CMP:testUtils() (gas: 167) -PhysicalEngineProxyTest:testCanUpgradeToAnotherUUPSContract() (gas: 623108) -PhysicalEngineProxyTest:testCannotPermitAccountAccessCrossProxy() (gas: 499927) -PhysicalEngineProxyTest:testCannotUpgradeFromNonOwner() (gas: 16148) -PhysicalEngineProxyTest:testCannotUpgradeTov3() (gas: 1227812) +PhysicalEngineProxyTest:testCanUpgradeToAnotherUUPSContract() (gas: 618125) +PhysicalEngineProxyTest:testCannotPermitAccountAccessCrossProxy() (gas: 489697) +PhysicalEngineProxyTest:testCannotUpgradeFromNonOwner() (gas: 16166) +PhysicalEngineProxyTest:testCannotUpgradeTov3() (gas: 1217826) PhysicalEngineProxyTest:testImplementationContractOwnerIsZero() (gas: 7757) -PhysicalEngineProxyTest:testImplementationIsInitialized() (gas: 11068) -PhysicalEngineProxyTest:testProxyIsInitialized() (gas: 15941) -PhysicalEngineProxyTest:testProxyOwnerIsSelf() (gas: 12639) +PhysicalEngineProxyTest:testImplementationIsInitialized() (gas: 11074) +PhysicalEngineProxyTest:testProxyIsInitialized() (gas: 15959) +PhysicalEngineProxyTest:testProxyOwnerIsSelf() (gas: 12651) PreviewCollateralReqBase_CMC:test() (gas: 164) PreviewCollateralReqBase_CMC:testIgnore() (gas: 188) PreviewCollateralReqBase_CMC:testUtils() (gas: 144) @@ -100,147 +98,151 @@ PreviewCollateralReqBase_CMP:testForgeCoverageIgnoreThis() (gas: 186) PreviewCollateralReqBase_CMP:testIgnore() (gas: 188) PreviewCollateralReqBase_CMP:testUtils() (gas: 144) PreviewCollateralReq_CMCM:test() (gas: 208) -PreviewCollateralReq_CMCM:testConversion() (gas: 115587) +PreviewCollateralReq_CMCM:testConversion() (gas: 116139) PreviewCollateralReq_CMCM:testIgnore() (gas: 232) -PreviewCollateralReq_CMCM:testIronCondor() (gas: 117357) -PreviewCollateralReq_CMCM:testLongPutSpread() (gas: 65994) -PreviewCollateralReq_CMCM:testLongStrangleSpread2() (gas: 112719) -PreviewCollateralReq_CMCM:testLongStrangles() (gas: 72596) -PreviewCollateralReq_CMCM:testMarginBinaryCallOption() (gas: 65374) -PreviewCollateralReq_CMCM:testMarginCallSpreadSameUnderlyingCollateral() (gas: 70206) -PreviewCollateralReq_CMCM:testMarginCallSpreadSameUnderlyingCollateralBiggerNumbers() (gas: 70206) -PreviewCollateralReq_CMCM:testMarginLongBinaryPut() (gas: 65966) -PreviewCollateralReq_CMCM:testMarginRequirement1() (gas: 155794) -PreviewCollateralReq_CMCM:testMarginRequirement2() (gas: 155796) -PreviewCollateralReq_CMCM:testMarginRequirement3() (gas: 158289) -PreviewCollateralReq_CMCM:testMarginRequirement4() (gas: 155791) -PreviewCollateralReq_CMCM:testMarginRequirementsVanillaCall() (gas: 56450) -PreviewCollateralReq_CMCM:testMarginRequirementsVanillaPut() (gas: 56836) -PreviewCollateralReq_CMCM:testMarginShortBinaryPut() (gas: 67801) -PreviewCollateralReq_CMCM:testMarginSimpleITMCall() (gas: 56471) -PreviewCollateralReq_CMCM:testMarginSimpleITMPut() (gas: 56838) -PreviewCollateralReq_CMCM:testMarginSimpleOTMCall() (gas: 56449) -PreviewCollateralReq_CMCM:testMarginSimplePut() (gas: 56837) -PreviewCollateralReq_CMCM:testMarginUnsortedStrikes() (gas: 155944) -PreviewCollateralReq_CMCM:testOneByTwoCall() (gas: 84067) -PreviewCollateralReq_CMCM:testOneByTwoPut() (gas: 89712) -PreviewCollateralReq_CMCM:testPutGreaterThanCalls() (gas: 115770) -PreviewCollateralReq_CMCM:testShortPutSpread() (gas: 68035) -PreviewCollateralReq_CMCM:testShortStrangles() (gas: 77446) -PreviewCollateralReq_CMCM:testStrangleSpread() (gas: 115054) -PreviewCollateralReq_CMCM:testStrangleSpread2() (gas: 114898) -PreviewCollateralReq_CMCM:testUpAndDown1() (gas: 65992) -PreviewCollateralReq_CMCM:testUpAndDown2() (gas: 68182) -PreviewCollateralReq_CMCM:testUpAndDown3() (gas: 91341) -PreviewCollateralReq_CMCM:testUpAndDown4() (gas: 114789) +PreviewCollateralReq_CMCM:testIronCondor() (gas: 117741) +PreviewCollateralReq_CMCM:testLongPutSpread() (gas: 66216) +PreviewCollateralReq_CMCM:testLongStrangleSpread2() (gas: 113067) +PreviewCollateralReq_CMCM:testLongStrangles() (gas: 72836) +PreviewCollateralReq_CMCM:testMarginBinaryCallOption() (gas: 65596) +PreviewCollateralReq_CMCM:testMarginCallSpreadSameUnderlyingCollateral() (gas: 70446) +PreviewCollateralReq_CMCM:testMarginCallSpreadSameUnderlyingCollateralBiggerNumbers() (gas: 70446) +PreviewCollateralReq_CMCM:testMarginLongBinaryPut() (gas: 66188) +PreviewCollateralReq_CMCM:testMarginRequirement1() (gas: 156232) +PreviewCollateralReq_CMCM:testMarginRequirement2() (gas: 156234) +PreviewCollateralReq_CMCM:testMarginRequirement3() (gas: 158745) +PreviewCollateralReq_CMCM:testMarginRequirement4() (gas: 156229) +PreviewCollateralReq_CMCM:testMarginRequirementsVanillaCall() (gas: 56654) +PreviewCollateralReq_CMCM:testMarginRequirementsVanillaPut() (gas: 57040) +PreviewCollateralReq_CMCM:testMarginShortBinaryPut() (gas: 68041) +PreviewCollateralReq_CMCM:testMarginSimpleITMCall() (gas: 56675) +PreviewCollateralReq_CMCM:testMarginSimpleITMPut() (gas: 57042) +PreviewCollateralReq_CMCM:testMarginSimpleOTMCall() (gas: 56653) +PreviewCollateralReq_CMCM:testMarginSimplePut() (gas: 57041) +PreviewCollateralReq_CMCM:testMarginUnsortedStrikes() (gas: 156382) +PreviewCollateralReq_CMCM:testOneByTwoCall() (gas: 84397) +PreviewCollateralReq_CMCM:testOneByTwoPut() (gas: 90060) +PreviewCollateralReq_CMCM:testPutGreaterThanCalls() (gas: 116136) +PreviewCollateralReq_CMCM:testShortPutSpread() (gas: 68275) +PreviewCollateralReq_CMCM:testShortStrangles() (gas: 77722) +PreviewCollateralReq_CMCM:testStrangleSpread() (gas: 115420) +PreviewCollateralReq_CMCM:testStrangleSpread2() (gas: 115264) +PreviewCollateralReq_CMCM:testUpAndDown1() (gas: 66214) +PreviewCollateralReq_CMCM:testUpAndDown2() (gas: 68422) +PreviewCollateralReq_CMCM:testUpAndDown3() (gas: 91635) +PreviewCollateralReq_CMCM:testUpAndDown4() (gas: 115155) PreviewCollateralReq_CMCM:testUtils() (gas: 234) PreviewCollateralReq_CMPM:test() (gas: 231) -PreviewCollateralReq_CMPM:testConversion() (gas: 108433) +PreviewCollateralReq_CMPM:testConversion() (gas: 108577) PreviewCollateralReq_CMPM:testForgeCoverageIgnoreThis() (gas: 208) PreviewCollateralReq_CMPM:testIgnore() (gas: 188) -PreviewCollateralReq_CMPM:testIronCondor() (gas: 110167) -PreviewCollateralReq_CMPM:testLongPutSpread() (gas: 62866) -PreviewCollateralReq_CMPM:testLongStrangles() (gas: 67929) -PreviewCollateralReq_CMPM:testMarginBinaryCallOption() (gas: 62256) -PreviewCollateralReq_CMPM:testMarginCallSpreadSameUnderlyingCollateral() (gas: 67163) -PreviewCollateralReq_CMPM:testMarginCallSpreadSameUnderlyingCollateralBiggerNumbers() (gas: 67141) -PreviewCollateralReq_CMPM:testMarginLongBinaryPut() (gas: 62772) -PreviewCollateralReq_CMPM:testMarginRequirement1() (gas: 150197) -PreviewCollateralReq_CMPM:testMarginRequirement2() (gas: 148854) -PreviewCollateralReq_CMPM:testMarginRequirement3() (gas: 151408) -PreviewCollateralReq_CMPM:testMarginRequirement4() (gas: 148847) -PreviewCollateralReq_CMPM:testMarginRequirementsVanillaCall() (gas: 53177) -PreviewCollateralReq_CMPM:testMarginRequirementsVanillaPut() (gas: 53586) -PreviewCollateralReq_CMPM:testMarginShortBinaryPut() (gas: 64735) -PreviewCollateralReq_CMPM:testMarginSimpleCall() (gas: 53178) -PreviewCollateralReq_CMPM:testMarginSimplePut() (gas: 53585) -PreviewCollateralReq_CMPM:testMarginUnsortedStrikes() (gas: 148935) -PreviewCollateralReq_CMPM:testOneByTwoCall() (gas: 79838) -PreviewCollateralReq_CMPM:testOneByTwoPut() (gas: 84015) -PreviewCollateralReq_CMPM:testPutGreaterThanCalls() (gas: 108429) -PreviewCollateralReq_CMPM:testShortPutSpread() (gas: 64947) -PreviewCollateralReq_CMPM:testShortStrangles() (gas: 72847) -PreviewCollateralReq_CMPM:testStrangleSpread() (gas: 107779) -PreviewCollateralReq_CMPM:testStrangleSpread2() (gas: 107645) -PreviewCollateralReq_CMPM:testUpAndDown1() (gas: 62842) -PreviewCollateralReq_CMPM:testUpAndDown2() (gas: 65094) -PreviewCollateralReq_CMPM:testUpAndDown3() (gas: 85352) -PreviewCollateralReq_CMPM:testUpAndDown4() (gas: 107492) +PreviewCollateralReq_CMPM:testIronCondor() (gas: 110275) +PreviewCollateralReq_CMPM:testLongPutSpread() (gas: 62908) +PreviewCollateralReq_CMPM:testLongStrangles() (gas: 67989) +PreviewCollateralReq_CMPM:testMarginBinaryCallOption() (gas: 62298) +PreviewCollateralReq_CMPM:testMarginCallSpreadSameUnderlyingCollateral() (gas: 67211) +PreviewCollateralReq_CMPM:testMarginCallSpreadSameUnderlyingCollateralBiggerNumbers() (gas: 67189) +PreviewCollateralReq_CMPM:testMarginLongBinaryPut() (gas: 62814) +PreviewCollateralReq_CMPM:testMarginRequirement1() (gas: 150299) +PreviewCollateralReq_CMPM:testMarginRequirement2() (gas: 148956) +PreviewCollateralReq_CMPM:testMarginRequirement3() (gas: 151516) +PreviewCollateralReq_CMPM:testMarginRequirement4() (gas: 148949) +PreviewCollateralReq_CMPM:testMarginRequirementsVanillaCall() (gas: 53225) +PreviewCollateralReq_CMPM:testMarginRequirementsVanillaPut() (gas: 53634) +PreviewCollateralReq_CMPM:testMarginShortBinaryPut() (gas: 64783) +PreviewCollateralReq_CMPM:testMarginSimpleCall() (gas: 53226) +PreviewCollateralReq_CMPM:testMarginSimplePut() (gas: 53633) +PreviewCollateralReq_CMPM:testMarginUnsortedStrikes() (gas: 149037) +PreviewCollateralReq_CMPM:testOneByTwoCall() (gas: 79904) +PreviewCollateralReq_CMPM:testOneByTwoPut() (gas: 84099) +PreviewCollateralReq_CMPM:testPutGreaterThanCalls() (gas: 108531) +PreviewCollateralReq_CMPM:testShortPutSpread() (gas: 64995) +PreviewCollateralReq_CMPM:testShortStrangles() (gas: 72919) +PreviewCollateralReq_CMPM:testStrangleSpread() (gas: 107881) +PreviewCollateralReq_CMPM:testStrangleSpread2() (gas: 107747) +PreviewCollateralReq_CMPM:testUpAndDown1() (gas: 62884) +PreviewCollateralReq_CMPM:testUpAndDown2() (gas: 65142) +PreviewCollateralReq_CMPM:testUpAndDown3() (gas: 85430) +PreviewCollateralReq_CMPM:testUpAndDown4() (gas: 107594) PreviewCollateralReq_CMPM:testUtils() (gas: 212) TestAddCollateral_CMC:test() (gas: 209) -TestAddCollateral_CMC:testAddCollateralChangeStorage() (gas: 147814) -TestAddCollateral_CMC:testAddCollateralLoopMoveBalances() (gas: 162417) -TestAddCollateral_CMC:testAddCollateralMoveBalance() (gas: 149273) -TestAddCollateral_CMC:testAddMultipleCollateralHasNoSideEffects() (gas: 234870) -TestAddCollateral_CMC:testCanAddDifferentCollateralToSameAccount() (gas: 217382) -TestAddCollateral_CMC:testCannotAddCollatFromOthers() (gas: 48439) +TestAddCollateral_CMC:testAddCollateralChangeStorage() (gas: 148086) +TestAddCollateral_CMC:testAddCollateralLoopMoveBalances() (gas: 162946) +TestAddCollateral_CMC:testAddCollateralMoveBalance() (gas: 149490) +TestAddCollateral_CMC:testAddMultipleCollateralHasNoSideEffects() (gas: 235318) +TestAddCollateral_CMC:testCanAddDifferentCollateralToSameAccount() (gas: 217797) +TestAddCollateral_CMC:testCannotAddCollatFromOthers() (gas: 48676) +TestAddCollateral_CMC:testCannotAddCollateralMoreThanMax() (gas: 63910) +TestAddCollateral_CMC:testCannotAddCollateralMoreThanMaxSplit() (gas: 183007) TestAddCollateral_CMC:testUtils() (gas: 167) -TestAddCollateral_CMP:test() (gas: 187) -TestAddCollateral_CMP:testAddCollateralChangeStorage() (gas: 147889) -TestAddCollateral_CMP:testAddCollateralLoopMoveBalances() (gas: 162562) -TestAddCollateral_CMP:testAddCollateralMoveBalance() (gas: 149303) -TestAddCollateral_CMP:testAddMultipleCollateralHasNoSideEffects() (gas: 234991) -TestAddCollateral_CMP:testCanAddDifferentCollateralToSameAccount() (gas: 217594) -TestAddCollateral_CMP:testCannotAddCollatFromOthers() (gas: 48414) -TestAddCollateral_CMP:testForgeCoverageIgnoreThis() (gas: 164) +TestAddCollateral_CMP:test() (gas: 209) +TestAddCollateral_CMP:testAddCollateralChangeStorage() (gas: 148123) +TestAddCollateral_CMP:testAddCollateralLoopMoveBalances() (gas: 162947) +TestAddCollateral_CMP:testAddCollateralMoveBalance() (gas: 149460) +TestAddCollateral_CMP:testAddMultipleCollateralHasNoSideEffects() (gas: 235353) +TestAddCollateral_CMP:testCanAddDifferentCollateralToSameAccount() (gas: 217901) +TestAddCollateral_CMP:testCannotAddCollatFromOthers() (gas: 48627) +TestAddCollateral_CMP:testCannotAddCollateralMoreThanMax() (gas: 63861) +TestAddCollateral_CMP:testCannotAddCollateralMoreThanMaxSplit() (gas: 182971) +TestAddCollateral_CMP:testForgeCoverageIgnoreThis() (gas: 186) TestAddCollateral_CMP:testUtils() (gas: 167) TestAddLong_CMC:test() (gas: 164) -TestAddLong_CMC:testAddLongCallToken() (gas: 544364) -TestAddLong_CMC:testAddLongPutToken() (gas: 544969) +TestAddLong_CMC:testAddLongCallToken() (gas: 545523) +TestAddLong_CMC:testAddLongPutToken() (gas: 546128) TestAddLong_CMC:testUtils() (gas: 144) TestAddLong_CMP:test() (gas: 187) -TestAddLong_CMP:testAddLongCallToken() (gas: 586536) -TestAddLong_CMP:testAddLongPutToken() (gas: 586987) +TestAddLong_CMP:testAddLongCallToken() (gas: 587011) +TestAddLong_CMP:testAddLongPutToken() (gas: 587462) TestAddLong_CMP:testForgeCoverageIgnoreThis() (gas: 186) TestAddLong_CMP:testUtils() (gas: 167) TestBatchExecute_CMC:test() (gas: 186) -TestBatchExecute_CMC:testMintSpreadChecksCollateralAfterBatch() (gas: 615756) -TestBatchExecute_CMC:testMintTwoSidedStructure() (gas: 663126) -TestBatchExecute_CMC:testMintTwoSidesSameOption() (gas: 610778) +TestBatchExecute_CMC:testMintSpreadChecksCollateralAfterBatch() (gas: 616927) +TestBatchExecute_CMC:testMintTwoSidedStructure() (gas: 664309) +TestBatchExecute_CMC:testMintTwoSidesSameOption() (gas: 611913) TestBatchExecute_CMC:testUtils() (gas: 167) TestBatchExecute_CMP:test() (gas: 164) TestBatchExecute_CMP:testForgeCoverageIgnoreThis() (gas: 208) -TestBatchExecute_CMP:testMintSpreadChecksCollateralAfterBatch() (gas: 658099) -TestBatchExecute_CMP:testMintTwoSidedStructure() (gas: 705560) -TestBatchExecute_CMP:testMintTwoSidesSameOption() (gas: 631140) +TestBatchExecute_CMP:testMintSpreadChecksCollateralAfterBatch() (gas: 658586) +TestBatchExecute_CMP:testMintTwoSidedStructure() (gas: 706047) +TestBatchExecute_CMP:testMintTwoSidesSameOption() (gas: 631603) TestBatchExecute_CMP:testUtils() (gas: 167) TestBurnOptionFromAccount_CMC:test() (gas: 164) -TestBurnOptionFromAccount_CMC:testBurnFromAccount() (gas: 122358) -TestBurnOptionFromAccount_CMC:testCanBurnFromSubAccount() (gas: 286082) -TestBurnOptionFromAccount_CMC:testCannotBurnFromEmptySubAccount() (gas: 75548) -TestBurnOptionFromAccount_CMC:testCannotBurnFromUnAuthorizedAccount() (gas: 51954) -TestBurnOptionFromAccount_CMC:testCannotBurnFromWithWrongTokenId() (gas: 68927) -TestBurnOptionFromAccount_CMC:testCannotBurnWhenOptionTokenBalanceIsLow() (gas: 148845) +TestBurnOptionFromAccount_CMC:testBurnFromAccount() (gas: 122596) +TestBurnOptionFromAccount_CMC:testCanBurnFromSubAccount() (gas: 286708) +TestBurnOptionFromAccount_CMC:testCannotBurnFromEmptySubAccount() (gas: 75689) +TestBurnOptionFromAccount_CMC:testCannotBurnFromUnAuthorizedAccount() (gas: 52053) +TestBurnOptionFromAccount_CMC:testCannotBurnFromWithWrongTokenId() (gas: 69056) +TestBurnOptionFromAccount_CMC:testCannotBurnWhenOptionTokenBalanceIsLow() (gas: 149064) TestBurnOptionFromAccount_CMC:testUtils() (gas: 167) TestBurnOptionFromAccount_CMP:test() (gas: 209) -TestBurnOptionFromAccount_CMP:testBurnFromAccount() (gas: 127244) -TestBurnOptionFromAccount_CMP:testCanBurnFromSubAccount() (gas: 288423) -TestBurnOptionFromAccount_CMP:testCannotBurnFromEmptySubAccount() (gas: 75669) -TestBurnOptionFromAccount_CMP:testCannotBurnFromUnAuthorizedAccount() (gas: 51931) -TestBurnOptionFromAccount_CMP:testCannotBurnFromWithWrongTokenId() (gas: 68864) -TestBurnOptionFromAccount_CMP:testCannotBurnWhenOptionTokenBalanceIsLow() (gas: 148874) +TestBurnOptionFromAccount_CMP:testBurnFromAccount() (gas: 127356) +TestBurnOptionFromAccount_CMP:testCanBurnFromSubAccount() (gas: 288712) +TestBurnOptionFromAccount_CMP:testCannotBurnFromEmptySubAccount() (gas: 75726) +TestBurnOptionFromAccount_CMP:testCannotBurnFromUnAuthorizedAccount() (gas: 51982) +TestBurnOptionFromAccount_CMP:testCannotBurnFromWithWrongTokenId() (gas: 68933) +TestBurnOptionFromAccount_CMP:testCannotBurnWhenOptionTokenBalanceIsLow() (gas: 148985) TestBurnOptionFromAccount_CMP:testForgeCoverageIgnoreThis() (gas: 208) TestBurnOptionFromAccount_CMP:testUtils() (gas: 167) TestBurnOption_CMC:test() (gas: 164) -TestBurnOption_CMC:testBurn() (gas: 89054) -TestBurnOption_CMC:testCannotBurnForEmptyAccount() (gas: 55594) -TestBurnOption_CMC:testCannotBurnFromUnAuthorizedAccount() (gas: 86119) -TestBurnOption_CMC:testCannotBurnWhenOptionTokenBalanceIsLow() (gas: 125257) -TestBurnOption_CMC:testCannotBurnWithWrongTokenId() (gas: 60121) +TestBurnOption_CMC:testBurn() (gas: 89237) +TestBurnOption_CMC:testCannotBurnForEmptyAccount() (gas: 55705) +TestBurnOption_CMC:testCannotBurnFromUnAuthorizedAccount() (gas: 86218) +TestBurnOption_CMC:testCannotBurnWhenOptionTokenBalanceIsLow() (gas: 125410) +TestBurnOption_CMC:testCannotBurnWithWrongTokenId() (gas: 60232) TestBurnOption_CMC:testUtils() (gas: 167) TestBurnOption_CMP:test() (gas: 209) -TestBurnOption_CMP:testBurn() (gas: 90138) -TestBurnOption_CMP:testCannotBurnForEmptyAccount() (gas: 55649) -TestBurnOption_CMP:testCannotBurnFromUnAuthorizedAccount() (gas: 86096) -TestBurnOption_CMP:testCannotBurnWhenOptionTokenBalanceIsLow() (gas: 125336) -TestBurnOption_CMP:testCannotBurnWithWrongTokenId() (gas: 62254) +TestBurnOption_CMP:testBurn() (gas: 90237) +TestBurnOption_CMP:testCannotBurnForEmptyAccount() (gas: 55700) +TestBurnOption_CMP:testCannotBurnFromUnAuthorizedAccount() (gas: 86147) +TestBurnOption_CMP:testCannotBurnWhenOptionTokenBalanceIsLow() (gas: 125405) +TestBurnOption_CMP:testCannotBurnWithWrongTokenId() (gas: 62305) TestBurnOption_CMP:testForgeCoverageIgnoreThis() (gas: 208) TestBurnOption_CMP:testUtils() (gas: 167) TestCornerCases_CMCM:testIronCondor() (gas: 65811) TestCornerCases_CMCM:testOneByTwoCall() (gas: 45677) TestCornerCases_CMCM:testOneByTwoCall2() (gas: 45691) TestCornerCases_CMCM:testOneByTwoPut() (gas: 46216) -TestCornerCases_CMCM:testPotentialBreakOnZeroWeight() (gas: 34525) +TestCornerCases_CMCM:testPotentialBreakOnZeroWeight() (gas: 34543) TestCornerCases_CMCM:testPutGreaterThanCalls() (gas: 91588) TestCornerCases_CMCM:testUpAndDown1() (gas: 52258) TestCornerCases_CMCM:testUpAndDown2() (gas: 52377) @@ -250,220 +252,220 @@ TestCornerCases_CMPM:testIronCondor() (gas: 65811) TestCornerCases_CMPM:testOneByTwoCall() (gas: 45677) TestCornerCases_CMPM:testOneByTwoCall2() (gas: 45691) TestCornerCases_CMPM:testOneByTwoPut() (gas: 46216) -TestCornerCases_CMPM:testPotentialBreakOnZeroWeight() (gas: 34525) +TestCornerCases_CMPM:testPotentialBreakOnZeroWeight() (gas: 34543) TestCornerCases_CMPM:testPutGreaterThanCalls() (gas: 91588) TestCornerCases_CMPM:testUpAndDown1() (gas: 52258) TestCornerCases_CMPM:testUpAndDown2() (gas: 52377) TestCornerCases_CMPM:testUpAndDown3() (gas: 67801) TestCornerCases_CMPM:testUpAndDown4() (gas: 74190) TestExerciseLongPositions_CMP:test() (gas: 209) -TestExerciseLongPositions_CMP:testCanClearLongCallAfterExpiryBeforeWindowClosed() (gas: 455204) -TestExerciseLongPositions_CMP:testCanClearLongPastExerciseWindow() (gas: 359068) -TestExerciseLongPositions_CMP:testCanClearLongPortion() (gas: 502153) -TestExerciseLongPositions_CMP:testCanClearMultipleLongCallAfterExpiryBeforeWindowClosed() (gas: 647806) -TestExerciseLongPositions_CMP:testCanClearPortionPut() (gas: 455563) -TestExerciseLongPositions_CMP:testCanClearPutBeforeWindowClosed() (gas: 455583) -TestExerciseLongPositions_CMP:testCannotClearLongCallAfterWindowClosed() (gas: 351204) -TestExerciseLongPositions_CMP:testCannotClearLongPutAfterWindowClosed() (gas: 351478) -TestExerciseLongPositions_CMP:testCannotClearLongWithExceededAmount() (gas: 407474) +TestExerciseLongPositions_CMP:testCanClearLongCallAfterExpiryBeforeWindowClosed() (gas: 455697) +TestExerciseLongPositions_CMP:testCanClearLongPastExerciseWindow() (gas: 359394) +TestExerciseLongPositions_CMP:testCanClearLongPortion() (gas: 502715) +TestExerciseLongPositions_CMP:testCanClearMultipleLongCallAfterExpiryBeforeWindowClosed() (gas: 648478) +TestExerciseLongPositions_CMP:testCanClearPortionPut() (gas: 456056) +TestExerciseLongPositions_CMP:testCanClearPutBeforeWindowClosed() (gas: 456076) +TestExerciseLongPositions_CMP:testCannotClearLongCallAfterWindowClosed() (gas: 351554) +TestExerciseLongPositions_CMP:testCannotClearLongPutAfterWindowClosed() (gas: 351828) +TestExerciseLongPositions_CMP:testCannotClearLongWithExceededAmount() (gas: 407806) TestExerciseLongPositions_CMP:testForgeCoverageIgnoreThis() (gas: 186) TestExerciseLongPositions_CMP:testUtils() (gas: 167) TestLongShortSettlement:test() (gas: 164) -TestLongShortSettlement:testShortsAreSettledBeforeLongs() (gas: 620703) +TestLongShortSettlement:testShortsAreSettledBeforeLongs() (gas: 622192) TestLongShortSettlement:testUtils() (gas: 144) TestMintIntoAccount_CMC:test() (gas: 164) -TestMintIntoAccount_CMC:testMintIntoAccountCall() (gas: 358696) +TestMintIntoAccount_CMC:testMintIntoAccountCall() (gas: 359295) TestMintIntoAccount_CMC:testUtils() (gas: 144) TestMintIntoAccount_CMP:test() (gas: 187) TestMintIntoAccount_CMP:testForgeCoverageIgnoreThis() (gas: 186) -TestMintIntoAccount_CMP:testMintIntoAccountCall() (gas: 380850) +TestMintIntoAccount_CMP:testMintIntoAccountCall() (gas: 381113) TestMintIntoAccount_CMP:testUtils() (gas: 167) TestMintWithPartialMarginBeta_CMC:test() (gas: 186) -TestMintWithPartialMarginBeta_CMC:testCannotMintTooLittleCollateral() (gas: 482010) -TestMintWithPartialMarginBeta_CMC:testMintCall() (gas: 302041) -TestMintWithPartialMarginBeta_CMC:testMintCallWithHigherValueCollateral() (gas: 310097) -TestMintWithPartialMarginBeta_CMC:testMintCallWithSimilarCollateral() (gas: 395247) -TestMintWithPartialMarginBeta_CMC:testMintMixedBag() (gas: 666988) -TestMintWithPartialMarginBeta_CMC:testMintMixedBagWithVariableValueCollateral() (gas: 675815) -TestMintWithPartialMarginBeta_CMC:testMintPut() (gas: 302425) -TestMintWithPartialMarginBeta_CMC:testMintPutWithHigherValueCollateral() (gas: 310499) -TestMintWithPartialMarginBeta_CMC:testMintPutWithSimilarCollateral() (gas: 395777) -TestMintWithPartialMarginBeta_CMC:testRemovePartialMarginMask() (gas: 106929) -TestMintWithPartialMarginBeta_CMC:testSameAssetPartialMarginMask() (gas: 24820) +TestMintWithPartialMarginBeta_CMC:testCannotMintTooLittleCollateral() (gas: 482779) +TestMintWithPartialMarginBeta_CMC:testMintCall() (gas: 302523) +TestMintWithPartialMarginBeta_CMC:testMintCallWithHigherValueCollateral() (gas: 310579) +TestMintWithPartialMarginBeta_CMC:testMintCallWithSimilarCollateral() (gas: 395885) +TestMintWithPartialMarginBeta_CMC:testMintMixedBag() (gas: 668152) +TestMintWithPartialMarginBeta_CMC:testMintMixedBagWithVariableValueCollateral() (gas: 676943) +TestMintWithPartialMarginBeta_CMC:testMintPut() (gas: 302907) +TestMintWithPartialMarginBeta_CMC:testMintPutWithHigherValueCollateral() (gas: 310981) +TestMintWithPartialMarginBeta_CMC:testMintPutWithSimilarCollateral() (gas: 396415) +TestMintWithPartialMarginBeta_CMC:testRemovePartialMarginMask() (gas: 107217) +TestMintWithPartialMarginBeta_CMC:testSameAssetPartialMarginMask() (gas: 24856) TestMintWithPartialMarginBeta_CMC:testUtils() (gas: 167) TestMintWithPartialMarginBeta_CMP:test() (gas: 164) -TestMintWithPartialMarginBeta_CMP:testCannotMintTooLittleCollateral() (gas: 529556) +TestMintWithPartialMarginBeta_CMP:testCannotMintTooLittleCollateral() (gas: 529995) TestMintWithPartialMarginBeta_CMP:testForgeCoverageIgnoreThis() (gas: 208) -TestMintWithPartialMarginBeta_CMP:testMintCall() (gas: 326933) -TestMintWithPartialMarginBeta_CMP:testMintCallWithHigherValueCollateral() (gas: 334978) -TestMintWithPartialMarginBeta_CMP:testMintCallWithSimilarCollateral() (gas: 441985) -TestMintWithPartialMarginBeta_CMP:testMintMixedBag() (gas: 743889) -TestMintWithPartialMarginBeta_CMP:testMintMixedBagWithVariableValueCollateral() (gas: 749808) -TestMintWithPartialMarginBeta_CMP:testMintPut() (gas: 325283) -TestMintWithPartialMarginBeta_CMP:testMintPutWithHigherValueCollateral() (gas: 333358) -TestMintWithPartialMarginBeta_CMP:testMintPutWithSimilarCollateral() (gas: 440381) +TestMintWithPartialMarginBeta_CMP:testMintCall() (gas: 327181) +TestMintWithPartialMarginBeta_CMP:testMintCallWithHigherValueCollateral() (gas: 335226) +TestMintWithPartialMarginBeta_CMP:testMintCallWithSimilarCollateral() (gas: 442281) +TestMintWithPartialMarginBeta_CMP:testMintMixedBag() (gas: 744573) +TestMintWithPartialMarginBeta_CMP:testMintMixedBagWithVariableValueCollateral() (gas: 750444) +TestMintWithPartialMarginBeta_CMP:testMintPut() (gas: 325531) +TestMintWithPartialMarginBeta_CMP:testMintPutWithHigherValueCollateral() (gas: 333606) +TestMintWithPartialMarginBeta_CMP:testMintPutWithSimilarCollateral() (gas: 440677) TestMintWithPartialMarginBeta_CMP:testUtils() (gas: 167) TestMint_CMC:test() (gas: 186) -TestMint_CMC:testCanMintOnBehalfOf() (gas: 323842) -TestMint_CMC:testCannotMintCallSpread() (gas: 149930) -TestMint_CMC:testCannotMintCallWithLittleCollateral() (gas: 288655) -TestMint_CMC:testCannotMintExpiredOption() (gas: 131344) -TestMint_CMC:testCannotMintPutSpread() (gas: 149911) -TestMint_CMC:testCannotMintPutWithLittleCollateral() (gas: 287113) -TestMint_CMC:testCannotMintWithoutCollateral() (gas: 197846) -TestMint_CMC:testMintCall() (gas: 290138) -TestMint_CMC:testMintCallAndPutInSameAccount() (gas: 469943) -TestMint_CMC:testMintPut() (gas: 290496) +TestMint_CMC:testCanMintOnBehalfOf() (gas: 324378) +TestMint_CMC:testCannotMintCallSpread() (gas: 150172) +TestMint_CMC:testCannotMintCallWithLittleCollateral() (gas: 289101) +TestMint_CMC:testCannotMintExpiredOption() (gas: 131509) +TestMint_CMC:testCannotMintPutSpread() (gas: 150153) +TestMint_CMC:testCannotMintPutWithLittleCollateral() (gas: 287559) +TestMint_CMC:testCannotMintWithoutCollateral() (gas: 198161) +TestMint_CMC:testMintCall() (gas: 290620) +TestMint_CMC:testMintCallAndPutInSameAccount() (gas: 470760) +TestMint_CMC:testMintPut() (gas: 290978) TestMint_CMC:testUtils() (gas: 167) TestMint_CMP:test() (gas: 164) -TestMint_CMP:testCanMintOnBehalfOf() (gas: 340055) -TestMint_CMP:testCannotMintCallWithLittleCollateral() (gas: 312065) -TestMint_CMP:testCannotMintExpiredOption() (gas: 133517) -TestMint_CMP:testCannotMintPutWithLittleCollateral() (gas: 308972) -TestMint_CMP:testCannotMintWithoutCollateral() (gas: 219713) +TestMint_CMP:testCanMintOnBehalfOf() (gas: 340291) +TestMint_CMP:testCannotMintCallWithLittleCollateral() (gas: 312289) +TestMint_CMP:testCannotMintExpiredOption() (gas: 133598) +TestMint_CMP:testCannotMintPutWithLittleCollateral() (gas: 309178) +TestMint_CMP:testCannotMintWithoutCollateral() (gas: 219824) TestMint_CMP:testForgeCoverageIgnoreThis() (gas: 208) -TestMint_CMP:testMintCall() (gas: 312172) -TestMint_CMP:testMintCallAndPutInSameAccount() (gas: 516822) -TestMint_CMP:testMintPut() (gas: 312456) +TestMint_CMP:testMintCall() (gas: 312390) +TestMint_CMP:testMintCallAndPutInSameAccount() (gas: 517231) +TestMint_CMP:testMintPut() (gas: 312674) TestMint_CMP:testUtils() (gas: 167) TestPMRemoveCollateral_CMC:test() (gas: 164) -TestPMRemoveCollateral_CMC:testEqualCallSpreadCollateralWithdraw() (gas: 751043) -TestPMRemoveCollateral_CMC:testEqualPutSpreadCollateralWithdraw() (gas: 746670) -TestPMRemoveCollateral_CMC:testEqualShortLongAllowCollateralWithdraw() (gas: 674055) +TestPMRemoveCollateral_CMC:testEqualCallSpreadCollateralWithdraw() (gas: 752937) +TestPMRemoveCollateral_CMC:testEqualPutSpreadCollateralWithdraw() (gas: 748564) +TestPMRemoveCollateral_CMC:testEqualShortLongAllowCollateralWithdraw() (gas: 675961) TestPMRemoveCollateral_CMC:testUtils() (gas: 167) TestPMRemoveCollateral_CMP:test() (gas: 209) -TestPMRemoveCollateral_CMP:testEqualCallSpreadCollateralWithdraw() (gas: 791768) -TestPMRemoveCollateral_CMP:testEqualPutSpreadCollateralWithdraw() (gas: 787260) -TestPMRemoveCollateral_CMP:testEqualShortLongAllowCollateralWithdraw() (gas: 691217) +TestPMRemoveCollateral_CMP:testEqualCallSpreadCollateralWithdraw() (gas: 792522) +TestPMRemoveCollateral_CMP:testEqualPutSpreadCollateralWithdraw() (gas: 788014) +TestPMRemoveCollateral_CMP:testEqualShortLongAllowCollateralWithdraw() (gas: 691959) TestPMRemoveCollateral_CMP:testForgeCoverageIgnoreThis() (gas: 186) TestPMRemoveCollateral_CMP:testUtils() (gas: 167) TestPMSettleLongCalls_CMC:test() (gas: 164) -TestPMSettleLongCalls_CMC:testSettleLongCallITMIncreasesCollateral() (gas: 194305) -TestPMSettleLongCalls_CMC:testSettleLongCallOTMNoIncreaseInCollateral() (gas: 143958) -TestPMSettleLongCalls_CMC:testSettleMultipleLongCallsITMIncreasesCollateral() (gas: 387072) -TestPMSettleLongCalls_CMC:testSettleMultipleLongCallsOTMNoIncreaseInCollateral() (gas: 339077) -TestPMSettleLongCalls_CMC:testSettleOnlyExpiredLongCallOTMNoIncreaseInCollateral() (gas: 357419) +TestPMSettleLongCalls_CMC:testSettleLongCallITMIncreasesCollateral() (gas: 194626) +TestPMSettleLongCalls_CMC:testSettleLongCallOTMNoIncreaseInCollateral() (gas: 144219) +TestPMSettleLongCalls_CMC:testSettleMultipleLongCallsITMIncreasesCollateral() (gas: 388058) +TestPMSettleLongCalls_CMC:testSettleMultipleLongCallsOTMNoIncreaseInCollateral() (gas: 339938) +TestPMSettleLongCalls_CMC:testSettleOnlyExpiredLongCallOTMNoIncreaseInCollateral() (gas: 358375) TestPMSettleLongCalls_CMC:testUtils() (gas: 167) TestPMSettleLongPutsCM:test() (gas: 164) -TestPMSettleLongPutsCM:testSettleLongCallITMIncreasesCollateral() (gas: 193864) -TestPMSettleLongPutsCM:testSettleLongCallOTMNoIncreaseInCollateral() (gas: 143539) +TestPMSettleLongPutsCM:testSettleLongCallITMIncreasesCollateral() (gas: 194185) +TestPMSettleLongPutsCM:testSettleLongCallOTMNoIncreaseInCollateral() (gas: 143800) TestPMSettleLongPutsCM:testUtils() (gas: 167) TestPMSettleLongStrangleSpreadCM:test() (gas: 164) -TestPMSettleLongStrangleSpreadCM:testSettleLongCallInnerITM() (gas: 358681) -TestPMSettleLongStrangleSpreadCM:testSettleLongCallOuterITM() (gas: 364600) -TestPMSettleLongStrangleSpreadCM:testSettleLongPutInnerITM() (gas: 356659) -TestPMSettleLongStrangleSpreadCM:testSettleLongPutOuterITM() (gas: 364618) -TestPMSettleLongStrangleSpreadCM:testSettleShortPutOTM() (gas: 314353) +TestPMSettleLongStrangleSpreadCM:testSettleLongCallInnerITM() (gas: 359353) +TestPMSettleLongStrangleSpreadCM:testSettleLongCallOuterITM() (gas: 365416) +TestPMSettleLongStrangleSpreadCM:testSettleLongPutInnerITM() (gas: 357321) +TestPMSettleLongStrangleSpreadCM:testSettleLongPutOuterITM() (gas: 365434) +TestPMSettleLongStrangleSpreadCM:testSettleShortPutOTM() (gas: 314891) TestPMSettleLongStrangleSpreadCM:testUtils() (gas: 167) TestPreviewCollateralAvailablePM_CMC:test() (gas: 186) -TestPreviewCollateralAvailablePM_CMC:testPreviewCollateralAvailableCall() (gas: 81485) -TestPreviewCollateralAvailablePM_CMC:testPreviewCollateralAvailablePut() (gas: 83487) -TestPreviewCollateralAvailablePM_CMC:testPreviewCollateralEqualCallSpread() (gas: 77587) -TestPreviewCollateralAvailablePM_CMC:testPreviewCollateralEqualPutSpread() (gas: 75656) -TestPreviewCollateralAvailablePM_CMC:testPreviewCollateralEqualShortLong() (gas: 55461) -TestPreviewCollateralAvailablePM_CMC:testPreviewMixedBagWithVariableValueCollateral() (gas: 157852) -TestPreviewCollateralAvailablePM_CMC:testPreviewWithHigherValueCollatCall() (gas: 81015) -TestPreviewCollateralAvailablePM_CMC:testPreviewWithHigherValueCollatPut() (gas: 83167) +TestPreviewCollateralAvailablePM_CMC:testPreviewCollateralAvailableCall() (gas: 81773) +TestPreviewCollateralAvailablePM_CMC:testPreviewCollateralAvailablePut() (gas: 83775) +TestPreviewCollateralAvailablePM_CMC:testPreviewCollateralEqualCallSpread() (gas: 77911) +TestPreviewCollateralAvailablePM_CMC:testPreviewCollateralEqualPutSpread() (gas: 75986) +TestPreviewCollateralAvailablePM_CMC:testPreviewCollateralEqualShortLong() (gas: 55737) +TestPreviewCollateralAvailablePM_CMC:testPreviewMixedBagWithVariableValueCollateral() (gas: 158332) +TestPreviewCollateralAvailablePM_CMC:testPreviewWithHigherValueCollatCall() (gas: 81303) +TestPreviewCollateralAvailablePM_CMC:testPreviewWithHigherValueCollatPut() (gas: 83455) TestPreviewCollateralAvailablePM_CMC:testUtils() (gas: 167) TestPreviewCollateralAvailablePM_CMP:test() (gas: 164) TestPreviewCollateralAvailablePM_CMP:testForgeCoverageIgnoreThis() (gas: 208) -TestPreviewCollateralAvailablePM_CMP:testPreviewCollateralAvailableCall() (gas: 80902) -TestPreviewCollateralAvailablePM_CMP:testPreviewCollateralAvailablePut() (gas: 81119) -TestPreviewCollateralAvailablePM_CMP:testPreviewCollateralEqualCallSpread() (gas: 74712) -TestPreviewCollateralAvailablePM_CMP:testPreviewCollateralEqualPutSpread() (gas: 72780) -TestPreviewCollateralAvailablePM_CMP:testPreviewCollateralEqualShortLong() (gas: 52478) -TestPreviewCollateralAvailablePM_CMP:testPreviewMixedBagWithVariableValueCollateral() (gas: 160052) -TestPreviewCollateralAvailablePM_CMP:testPreviewWithHigherValueCollatCall() (gas: 80432) -TestPreviewCollateralAvailablePM_CMP:testPreviewWithHigherValueCollatPut() (gas: 80735) +TestPreviewCollateralAvailablePM_CMP:testPreviewCollateralAvailableCall() (gas: 80992) +TestPreviewCollateralAvailablePM_CMP:testPreviewCollateralAvailablePut() (gas: 81209) +TestPreviewCollateralAvailablePM_CMP:testPreviewCollateralEqualCallSpread() (gas: 74772) +TestPreviewCollateralAvailablePM_CMP:testPreviewCollateralEqualPutSpread() (gas: 72846) +TestPreviewCollateralAvailablePM_CMP:testPreviewCollateralEqualShortLong() (gas: 52514) +TestPreviewCollateralAvailablePM_CMP:testPreviewMixedBagWithVariableValueCollateral() (gas: 160304) +TestPreviewCollateralAvailablePM_CMP:testPreviewWithHigherValueCollatCall() (gas: 80522) +TestPreviewCollateralAvailablePM_CMP:testPreviewWithHigherValueCollatPut() (gas: 80825) TestPreviewCollateralAvailablePM_CMP:testUtils() (gas: 167) TestPreviewCollateralAvailable_CMC:test() (gas: 164) -TestPreviewCollateralAvailable_CMC:testPreviewCollateralAvailable() (gas: 95680) -TestPreviewCollateralAvailable_CMC:testPreviewCollateralAvailableNoCollat() (gas: 20164) -TestPreviewCollateralAvailable_CMC:testPreviewCollateralAvailableUnderwater() (gas: 63152) -TestPreviewCollateralAvailable_CMC:testPreviewCollateralAvailableUnusedCollat() (gas: 25360) -TestPreviewCollateralAvailable_CMC:testPreviewCollateralAvailableUsingHalf() (gas: 96148) +TestPreviewCollateralAvailable_CMC:testPreviewCollateralAvailable() (gas: 96082) +TestPreviewCollateralAvailable_CMC:testPreviewCollateralAvailableNoCollat() (gas: 20338) +TestPreviewCollateralAvailable_CMC:testPreviewCollateralAvailableUnderwater() (gas: 63440) +TestPreviewCollateralAvailable_CMC:testPreviewCollateralAvailableUnusedCollat() (gas: 25558) +TestPreviewCollateralAvailable_CMC:testPreviewCollateralAvailableUsingHalf() (gas: 96550) TestPreviewCollateralAvailable_CMC:testUtils() (gas: 167) TestPreviewCollateralAvailable_CMP:test() (gas: 209) TestPreviewCollateralAvailable_CMP:testForgeCoverageIgnoreThis() (gas: 186) -TestPreviewCollateralAvailable_CMP:testPreviewCollateralAvailable() (gas: 94221) -TestPreviewCollateralAvailable_CMP:testPreviewCollateralAvailableNoCollat() (gas: 20319) -TestPreviewCollateralAvailable_CMP:testPreviewCollateralAvailableUnderwater() (gas: 60069) -TestPreviewCollateralAvailable_CMP:testPreviewCollateralAvailableUnusedCollat() (gas: 25541) -TestPreviewCollateralAvailable_CMP:testPreviewCollateralAvailableUsingHalf() (gas: 94667) +TestPreviewCollateralAvailable_CMP:testPreviewCollateralAvailable() (gas: 94359) +TestPreviewCollateralAvailable_CMP:testPreviewCollateralAvailableNoCollat() (gas: 20337) +TestPreviewCollateralAvailable_CMP:testPreviewCollateralAvailableUnderwater() (gas: 60129) +TestPreviewCollateralAvailable_CMP:testPreviewCollateralAvailableUnusedCollat() (gas: 25559) +TestPreviewCollateralAvailable_CMP:testPreviewCollateralAvailableUsingHalf() (gas: 94805) TestPreviewCollateralAvailable_CMP:testUtils() (gas: 167) TestRemoveCollateral_CMC:test() (gas: 164) -TestRemoveCollateral_CMC:testCannotRemoveDifferentCollateral() (gas: 57065) -TestRemoveCollateral_CMC:testCannotRemoveMoreThanOwn() (gas: 57762) -TestRemoveCollateral_CMC:testMultipleCollateralsAddRemove() (gas: 326842) -TestRemoveCollateral_CMC:testRemoveCollateralChangeStorage() (gas: 82562) -TestRemoveCollateral_CMC:testRemoveCollateralMoveBalance() (gas: 85247) -TestRemoveCollateral_CMC:testRemoveCollateralRetainBalances() (gas: 139454) +TestRemoveCollateral_CMC:testCannotRemoveDifferentCollateral() (gas: 57194) +TestRemoveCollateral_CMC:testCannotRemoveMoreThanOwn() (gas: 57885) +TestRemoveCollateral_CMC:testMultipleCollateralsAddRemove() (gas: 328873) +TestRemoveCollateral_CMC:testRemoveCollateralChangeStorage() (gas: 82754) +TestRemoveCollateral_CMC:testRemoveCollateralMoveBalance() (gas: 85427) +TestRemoveCollateral_CMC:testRemoveCollateralRetainBalances() (gas: 139789) TestRemoveCollateral_CMC:testUtils() (gas: 167) TestRemoveCollateral_CMP:test() (gas: 209) -TestRemoveCollateral_CMP:testCannotRemoveDifferentCollateral() (gas: 57076) -TestRemoveCollateral_CMP:testCannotRemoveMoreThanOwn() (gas: 57785) +TestRemoveCollateral_CMP:testCannotRemoveDifferentCollateral() (gas: 57145) +TestRemoveCollateral_CMP:testCannotRemoveMoreThanOwn() (gas: 57836) TestRemoveCollateral_CMP:testForgeCoverageIgnoreThis() (gas: 186) -TestRemoveCollateral_CMP:testMultipleCollateralsAddRemove() (gas: 328227) -TestRemoveCollateral_CMP:testRemoveCollateralChangeStorage() (gas: 82625) -TestRemoveCollateral_CMP:testRemoveCollateralMoveBalance() (gas: 85289) -TestRemoveCollateral_CMP:testRemoveCollateralRetainBalances() (gas: 139644) +TestRemoveCollateral_CMP:testMultipleCollateralsAddRemove() (gas: 329262) +TestRemoveCollateral_CMP:testRemoveCollateralChangeStorage() (gas: 82721) +TestRemoveCollateral_CMP:testRemoveCollateralMoveBalance() (gas: 85373) +TestRemoveCollateral_CMP:testRemoveCollateralRetainBalances() (gas: 139823) TestRemoveCollateral_CMP:testUtils() (gas: 167) TestRemoveLong_CMC:test() (gas: 164) -TestRemoveLong_CMC:testRemoveLongToken() (gas: 409739) +TestRemoveLong_CMC:testRemoveLongToken() (gas: 410660) TestRemoveLong_CMC:testUtils() (gas: 144) TestRemoveLong_CMP:test() (gas: 187) TestRemoveLong_CMP:testForgeCoverageIgnoreThis() (gas: 186) -TestRemoveLong_CMP:testRemoveLongToken() (gas: 429058) +TestRemoveLong_CMP:testRemoveLongToken() (gas: 429507) TestRemoveLong_CMP:testUtils() (gas: 167) TestSettleCollateralizedPut_CMC:test() (gas: 164) -TestSettleCollateralizedPut_CMC:testSellerCanClearOnlyExpiredOptions() (gas: 295016) -TestSettleCollateralizedPut_CMC:testSellerCollateralIsReducedIfExpiresITM() (gas: 134355) -TestSettleCollateralizedPut_CMC:testShouldGetNothingIfExpiresOTM() (gas: 124388) -TestSettleCollateralizedPut_CMC:testShouldGetPayoutIfExpiresIMT() (gas: 130104) +TestSettleCollateralizedPut_CMC:testSellerCanClearOnlyExpiredOptions() (gas: 295975) +TestSettleCollateralizedPut_CMC:testSellerCollateralIsReducedIfExpiresITM() (gas: 134682) +TestSettleCollateralizedPut_CMC:testShouldGetNothingIfExpiresOTM() (gas: 124478) +TestSettleCollateralizedPut_CMC:testShouldGetPayoutIfExpiresIMT() (gas: 130194) TestSettleCollateralizedPut_CMC:testUtils() (gas: 167) TestSettleCollateralizedPut_CMP:test() (gas: 209) TestSettleCollateralizedPut_CMP:testForgeCoverageIgnoreThis() (gas: 186) -TestSettleCollateralizedPut_CMP:testShouldGetPutPayoutAndDeductedDebt() (gas: 224066) -TestSettleCollateralizedPut_CMP:testShouldGetPutPayoutAndDeductedDebtFromSender() (gas: 251992) +TestSettleCollateralizedPut_CMP:testShouldGetPutPayoutAndDeductedDebt() (gas: 224246) +TestSettleCollateralizedPut_CMP:testShouldGetPutPayoutAndDeductedDebtFromSender() (gas: 252190) TestSettleCollateralizedPut_CMP:testUtils() (gas: 167) TestSettleCoveredCall_CMC:test() (gas: 164) -TestSettleCoveredCall_CMC:testSellerCanClearDebtIfExpiresOTM() (gas: 127860) -TestSettleCoveredCall_CMC:testSellerCanClearMultipleExpiredOptions() (gas: 273993) -TestSettleCoveredCall_CMC:testSellerCanClearOnlyExpiredOptions() (gas: 298032) -TestSettleCoveredCall_CMC:testSellerCollateralIsReducedIfExpiresITM() (gas: 135399) -TestSettleCoveredCall_CMC:testShouldGetNothingIfExpiresOTM() (gas: 124832) -TestSettleCoveredCall_CMC:testShouldGetPayoutIfExpiresIMT() (gas: 148293) +TestSettleCoveredCall_CMC:testSellerCanClearDebtIfExpiresOTM() (gas: 128091) +TestSettleCoveredCall_CMC:testSellerCanClearMultipleExpiredOptions() (gas: 274766) +TestSettleCoveredCall_CMC:testSellerCanClearOnlyExpiredOptions() (gas: 298991) +TestSettleCoveredCall_CMC:testSellerCollateralIsReducedIfExpiresITM() (gas: 135726) +TestSettleCoveredCall_CMC:testShouldGetNothingIfExpiresOTM() (gas: 124922) +TestSettleCoveredCall_CMC:testShouldGetPayoutIfExpiresIMT() (gas: 148383) TestSettleCoveredCall_CMC:testUtils() (gas: 189) TestSettleCoveredCall_CMP:test() (gas: 209) TestSettleCoveredCall_CMP:testForgeCoverageIgnoreThis() (gas: 186) -TestSettleCoveredCall_CMP:testShouldGetCallPayoutAndDeductedDebt() (gas: 206896) -TestSettleCoveredCall_CMP:testShouldGetCallPayoutAndDeductedDebtFromSender() (gas: 252013) +TestSettleCoveredCall_CMP:testShouldGetCallPayoutAndDeductedDebt() (gas: 207076) +TestSettleCoveredCall_CMP:testShouldGetCallPayoutAndDeductedDebtFromSender() (gas: 252211) TestSettleCoveredCall_CMP:testUtils() (gas: 167) TestSettleOptionPartialMargin_CMC:test() (gas: 164) -TestSettleOptionPartialMargin_CMC:testCallITM() (gas: 372447) -TestSettleOptionPartialMargin_CMC:testPutITM() (gas: 369636) +TestSettleOptionPartialMargin_CMC:testCallITM() (gas: 373286) +TestSettleOptionPartialMargin_CMC:testPutITM() (gas: 370475) TestSettleOptionPartialMargin_CMC:testUtils() (gas: 144) TestSettleOptionPartialMargin_CMP:test() (gas: 209) -TestSettleOptionPartialMargin_CMP:testCall() (gas: 449482) +TestSettleOptionPartialMargin_CMP:testCall() (gas: 449997) TestSettleOptionPartialMargin_CMP:testForgeCoverageIgnoreThis() (gas: 186) -TestSettleOptionPartialMargin_CMP:testPut() (gas: 472736) +TestSettleOptionPartialMargin_CMP:testPut() (gas: 473251) TestSettleOptionPartialMargin_CMP:testUtils() (gas: 167) TestSettleOption_CMP:test() (gas: 187) TestSettleOption_CMP:testForgeCoverageIgnoreThis() (gas: 186) -TestSettleOption_CMP:testGetsNothingFromOptionPastExerciseWindow() (gas: 59075) +TestSettleOption_CMP:testGetsNothingFromOptionPastExerciseWindow() (gas: 59111) TestSettleOption_CMP:testUtils() (gas: 167) TestSettleShortPositions_CMP:test() (gas: 164) TestSettleShortPositions_CMP:testForgeCoverageIgnoreThis() (gas: 208) -TestSettleShortPositions_CMP:testSellerCanClearCallDebtAfterWindowClosed() (gas: 293184) -TestSettleShortPositions_CMP:testSellerCanClearPartialCallDebtAfterWindowClosed() (gas: 463896) -TestSettleShortPositions_CMP:testSellerCanClearPartialPutDebtAfterWindowClosed() (gas: 464276) -TestSettleShortPositions_CMP:testSellerCanClearPutDebtAfterWindowClosed() (gas: 293444) -TestSettleShortPositions_CMP:testSellerCannotClearCallDebtAfterExpiryBeforeWindowClosed() (gas: 365114) -TestSettleShortPositions_CMP:testSellerCannotClearPutDebtAfterExpiryBeforeWindowClosed() (gas: 365656) +TestSettleShortPositions_CMP:testSellerCanClearCallDebtAfterWindowClosed() (gas: 293489) +TestSettleShortPositions_CMP:testSellerCanClearPartialCallDebtAfterWindowClosed() (gas: 464381) +TestSettleShortPositions_CMP:testSellerCanClearPartialPutDebtAfterWindowClosed() (gas: 464761) +TestSettleShortPositions_CMP:testSellerCanClearPutDebtAfterWindowClosed() (gas: 293749) +TestSettleShortPositions_CMP:testSellerCannotClearCallDebtAfterExpiryBeforeWindowClosed() (gas: 365437) +TestSettleShortPositions_CMP:testSellerCannotClearPutDebtAfterExpiryBeforeWindowClosed() (gas: 365979) TestSettleShortPositions_CMP:testUtils() (gas: 167) TestSettleSocializedLosses_CMP:test() (gas: 187) TestSettleSocializedLosses_CMP:testForgeCoverageIgnoreThis() (gas: 186) -TestSettleSocializedLosses_CMP:testSocializeLoss() (gas: 596984) +TestSettleSocializedLosses_CMP:testSocializeLoss() (gas: 597774) TestSettleSocializedLosses_CMP:testUtils() (gas: 167) TestStrangles_CMCM:testLongStrangle() (gas: 44567) TestStrangles_CMCM:testShortStrangles() (gas: 38588) @@ -471,58 +473,62 @@ TestStrangles_CMCM:testStrangleSpread() (gas: 164287) TestStrangles_CMPM:testLongStrangle() (gas: 44567) TestStrangles_CMPM:testShortStrangles() (gas: 38588) TestStrangles_CMPM:testStrangleSpread() (gas: 164287) -TestStructures_CMM:testConversion() (gas: 92824) -TestStructures_CMM:testMarginBinaryCallOption() (gas: 78128) -TestStructures_CMM:testMarginCallSpreadSameUnderlyingCollateral() (gas: 79924) -TestStructures_CMM:testMarginCallSpreadSameUnderlyingCollateralBiggerNumbers() (gas: 79924) -TestStructures_CMM:testMarginLongBinaryPut() (gas: 73932) -TestStructures_CMM:testMarginPutSpread1() (gas: 73937) +TestStructures_CMM:testConversion() (gas: 92838) +TestStructures_CMM:testMarginBinaryCallOption() (gas: 78138) +TestStructures_CMM:testMarginCallSpreadSameUnderlyingCollateral() (gas: 79934) +TestStructures_CMM:testMarginCallSpreadSameUnderlyingCollateralBiggerNumbers() (gas: 79934) +TestStructures_CMM:testMarginLongBinaryPut() (gas: 73941) +TestStructures_CMM:testMarginPutSpread1() (gas: 73947) TestStructures_CMM:testMarginRequirement1() (gas: 100300) -TestStructures_CMM:testMarginRequirement2() (gas: 103685) -TestStructures_CMM:testMarginRequirement3() (gas: 103891) -TestStructures_CMM:testMarginRequirement4() (gas: 104196) -TestStructures_CMM:testMarginShortBinaryPut() (gas: 73954) -TestStructures_CMM:testMarginSimpleITMCall() (gas: 72889) -TestStructures_CMM:testMarginSimpleITMPut() (gas: 73131) -TestStructures_CMM:testMarginSimpleOTMCall() (gas: 72872) -TestStructures_CMM:testMarginSimpleOTMPut() (gas: 73112) -TestStructures_CMM:testMarginUnsortedStrikes() (gas: 141523) -TestStructures_CMM:testVerifyInputs2() (gas: 45988) -TestStructures_CMM:testVerifyInputs3() (gas: 74496) -TestStructures_CMM:testVerifyInputs4() (gas: 55793) -TestStructures_CMPM:testConversion() (gas: 92806) -TestStructures_CMPM:testMarginBinaryCallOption() (gas: 78111) -TestStructures_CMPM:testMarginCallSpreadSameUnderlyingCollateral() (gas: 79924) -TestStructures_CMPM:testMarginCallSpreadSameUnderlyingCollateralBiggerNumbers() (gas: 79924) -TestStructures_CMPM:testMarginLongBinaryPut() (gas: 73932) -TestStructures_CMPM:testMarginPutSpread1() (gas: 73973) +TestStructures_CMM:testMarginRequirement2() (gas: 103691) +TestStructures_CMM:testMarginRequirement3() (gas: 103897) +TestStructures_CMM:testMarginRequirement4() (gas: 104208) +TestStructures_CMM:testMarginShortBinaryPut() (gas: 73964) +TestStructures_CMM:testMarginSimpleITMCall() (gas: 72894) +TestStructures_CMM:testMarginSimpleITMPut() (gas: 73136) +TestStructures_CMM:testMarginSimpleOTMCall() (gas: 72876) +TestStructures_CMM:testMarginSimpleOTMPut() (gas: 73116) +TestStructures_CMM:testMarginUnsortedStrikes() (gas: 141559) +TestStructures_CMM:testVerifyInputs2() (gas: 46000) +TestStructures_CMM:testVerifyInputs3() (gas: 74526) +TestStructures_CMM:testVerifyInputs4() (gas: 55823) +TestStructures_CMPM:testConversion() (gas: 92820) +TestStructures_CMPM:testMarginBinaryCallOption() (gas: 78120) +TestStructures_CMPM:testMarginCallSpreadSameUnderlyingCollateral() (gas: 79934) +TestStructures_CMPM:testMarginCallSpreadSameUnderlyingCollateralBiggerNumbers() (gas: 79934) +TestStructures_CMPM:testMarginLongBinaryPut() (gas: 73941) +TestStructures_CMPM:testMarginPutSpread1() (gas: 73983) TestStructures_CMPM:testMarginRequirement1() (gas: 100300) -TestStructures_CMPM:testMarginRequirement2() (gas: 103751) -TestStructures_CMPM:testMarginRequirement3() (gas: 103891) -TestStructures_CMPM:testMarginRequirement4() (gas: 104241) -TestStructures_CMPM:testMarginShortBinaryPut() (gas: 73954) -TestStructures_CMPM:testMarginSimpleCall() (gas: 72836) -TestStructures_CMPM:testMarginSimplePut() (gas: 73111) -TestStructures_CMPM:testMarginUnsortedStrikes() (gas: 141523) -TestStructures_CMPM:testVerifyInputs2() (gas: 45988) -TestStructures_CMPM:testVerifyInputs3() (gas: 74496) -TestStructures_CMPM:testVerifyInputs4() (gas: 55771) +TestStructures_CMPM:testMarginRequirement2() (gas: 103757) +TestStructures_CMPM:testMarginRequirement3() (gas: 103897) +TestStructures_CMPM:testMarginRequirement4() (gas: 104253) +TestStructures_CMPM:testMarginShortBinaryPut() (gas: 73964) +TestStructures_CMPM:testMarginSimpleCall() (gas: 72841) +TestStructures_CMPM:testMarginSimplePut() (gas: 73116) +TestStructures_CMPM:testMarginUnsortedStrikes() (gas: 141559) +TestStructures_CMPM:testVerifyInputs2() (gas: 46000) +TestStructures_CMPM:testVerifyInputs3() (gas: 74526) +TestStructures_CMPM:testVerifyInputs4() (gas: 55801) TestTransfer_CMC:test() (gas: 186) -TestTransfer_CMC:testCannotTransferCollateralWhenShortExists() (gas: 144054) -TestTransfer_CMC:testCannotTransferLongWhenTooLittleCollateral() (gas: 196776) -TestTransfer_CMC:testCannotTransferShortWhenReceiverHasTooLittleCollateral() (gas: 196511) -TestTransfer_CMC:testCannotTransferShortWithNoAccess() (gas: 59112) -TestTransfer_CMC:testTransferCollateral() (gas: 288360) +TestTransfer_CMC:testCanTransferCollateralUpToMax() (gas: 246277) +TestTransfer_CMC:testCannotTransferCollateralMoreThanMax() (gas: 197488) +TestTransfer_CMC:testCannotTransferCollateralWhenShortExists() (gas: 144477) +TestTransfer_CMC:testCannotTransferLongWhenTooLittleCollateral() (gas: 197091) +TestTransfer_CMC:testCannotTransferShortWhenReceiverHasTooLittleCollateral() (gas: 196868) +TestTransfer_CMC:testCannotTransferShortWithNoAccess() (gas: 59229) +TestTransfer_CMC:testTransferCollateral() (gas: 289093) TestTransfer_CMC:testUtils() (gas: 189) TestTransfer_CMP:test() (gas: 164) -TestTransfer_CMP:testCannotTransferCollateralWhenShortExists() (gas: 141145) -TestTransfer_CMP:testCannotTransferLongWhenTooLittleCollateral() (gas: 193506) -TestTransfer_CMP:testCannotTransferShortWhenReceiverHasTooLittleCollateral() (gas: 193541) -TestTransfer_CMP:testCannotTransferShortWithNoAccess() (gas: 59058) +TestTransfer_CMP:testCanTransferCollateralUpToMax() (gas: 241717) +TestTransfer_CMP:testCannotTransferCollateralMoreThanMax() (gas: 194122) +TestTransfer_CMP:testCannotTransferCollateralWhenShortExists() (gas: 141244) +TestTransfer_CMP:testCannotTransferLongWhenTooLittleCollateral() (gas: 193639) +TestTransfer_CMP:testCannotTransferShortWhenReceiverHasTooLittleCollateral() (gas: 193692) +TestTransfer_CMP:testCannotTransferShortWithNoAccess() (gas: 59127) TestTransfer_CMP:testForgeCoverageIgnoreThis() (gas: 208) -TestTransfer_CMP:testTransferCollateral() (gas: 285964) +TestTransfer_CMP:testTransferCollateral() (gas: 286157) TestTransfer_CMP:testUtils() (gas: 189) TestVanillaCall_CMM:testMarginRequirementVanillaCall1() (gas: 25566) TestVanillaCall_CMPM:testMarginRequirementVanillaCall1() (gas: 25566) -TestVanillaPut_CMCM:testMarginRequirement1() (gas: 25828) -TestVanillaPut_CMPM:testMarginRequirement1() (gas: 25828) \ No newline at end of file +TestVanillaPut_CMCM:testMarginRequirement1() (gas: 25834) +TestVanillaPut_CMPM:testMarginRequirement1() (gas: 25834) \ No newline at end of file diff --git a/test/integrations-cash/AddCollateral.t.sol b/test/integrations-cash/AddCollateral.t.sol index a0dee3e..b4338f6 100644 --- a/test/integrations-cash/AddCollateral.t.sol +++ b/test/integrations-cash/AddCollateral.t.sol @@ -2,7 +2,9 @@ pragma solidity ^0.8.0; // import test base and helpers. +import {stdError} from "forge-std/Test.sol"; import {CrossMarginCashFixture} from "./CrossMarginCashFixture.t.sol"; +import {CM_ExceedsMaxAmount} from "../../src/config/errors.sol"; import "grappa/config/enums.sol"; import "grappa/config/types.sol"; @@ -122,4 +124,32 @@ contract TestAddCollateral_CMC is CrossMarginCashFixture { vm.expectRevert(BM_InvalidFromAddress.selector); engine.execute(address(this), actions); } + + function testCannotAddCollateralMoreThanMax() public { + // mint a lot of tokens to test the max amount + usdc.mint(address(this), type(uint80).max); + + ActionArgs[] memory actions = new ActionArgs[](1); + actions[0] = createAddCollateralAction(usdcId, address(this), type(uint80).max); + vm.expectRevert(CM_ExceedsMaxAmount.selector); + engine.execute(address(this), actions); + } + + function testCannotAddCollateralMoreThanMaxSplit() public { + // mint a lot of tokens to test the max amount + usdc.mint(address(this), type(uint80).max); + + // deposit twice for half the max amount to fill the max precision + ActionArgs[] memory actions = new ActionArgs[](2); + actions[0] = createAddCollateralAction(usdcId, address(this), type(uint80).max / 2); + actions[1] = createAddCollateralAction(usdcId, address(this), type(uint80).max / 2); + + engine.execute(address(this), actions); + + actions = new ActionArgs[](1); + // tip over to overflow on the third deposit, separate execution to catch revert + actions[0] = createAddCollateralAction(usdcId, address(this), 10); + vm.expectRevert(stdError.arithmeticError); + engine.execute(address(this), actions); + } } diff --git a/test/integrations-cash/Transfer.t.sol b/test/integrations-cash/Transfer.t.sol index 117be93..4c20c6c 100644 --- a/test/integrations-cash/Transfer.t.sol +++ b/test/integrations-cash/Transfer.t.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.0; // import test base and helpers. +import {stdError} from "forge-std/Test.sol"; import {CrossMarginCashFixture} from "./CrossMarginCashFixture.t.sol"; import "grappa/config/types.sol"; @@ -120,4 +121,43 @@ contract TestTransfer_CMC is CrossMarginCashFixture { vm.expectRevert(NoAccess.selector); engine.execute(address(this), actions); } + + function testCanTransferCollateralUpToMax() public { + weth.mint(alice, type(uint80).max - depositAmount); + + // one deposit amount is already in the account from the setup + // take away one more from add call to make room for possible transfer + ActionArgs[] memory actions = new ActionArgs[](1); + actions[0] = createAddCollateralAction(wethId, alice, type(uint80).max - depositAmount * 2); + engine.execute(alice, actions); + + // add and transfer collateral, tip over the limit by 1 + actions = new ActionArgs[](2); + actions[0] = createAddCollateralAction(wethId, address(this), depositAmount); + actions[1] = createTransferCollateralAction(depositAmount, wethId, alice); + + engine.execute(address(this), actions); + + // check the collateral amount in alice's account is the max + (,, Balance[] memory aliceCollaterals) = engine.marginAccounts(alice); + assertEq(aliceCollaterals[0].amount, type(uint80).max); + } + + function testCannotTransferCollateralMoreThanMax() public { + weth.mint(alice, type(uint80).max - depositAmount); + + // one deposit amount is already in the account from the setup + // take away one more from add call to make room for possible transfer + ActionArgs[] memory actions = new ActionArgs[](1); + actions[0] = createAddCollateralAction(wethId, alice, type(uint80).max - depositAmount * 2); + engine.execute(alice, actions); + + // add and transfer collateral, tip over the limit by 1 + actions = new ActionArgs[](2); + actions[0] = createAddCollateralAction(wethId, address(this), depositAmount); + actions[1] = createTransferCollateralAction(depositAmount + 1, wethId, alice); + + vm.expectRevert(stdError.arithmeticError); + engine.execute(address(this), actions); + } } diff --git a/test/integrations-physical/AddCollateral.t.sol b/test/integrations-physical/AddCollateral.t.sol index 8d8533b..93837d1 100644 --- a/test/integrations-physical/AddCollateral.t.sol +++ b/test/integrations-physical/AddCollateral.t.sol @@ -2,7 +2,9 @@ pragma solidity ^0.8.0; // import test base and helpers. +import {stdError} from "forge-std/Test.sol"; import {CrossMarginPhysicalFixture} from "./CrossMarginPhysicalFixture.t.sol"; +import {CM_ExceedsMaxAmount} from "../../src/config/errors.sol"; import "pomace/config/enums.sol"; import "pomace/config/types.sol"; @@ -122,4 +124,32 @@ contract TestAddCollateral_CMP is CrossMarginPhysicalFixture { vm.expectRevert(BM_InvalidFromAddress.selector); engine.execute(address(this), actions); } + + function testCannotAddCollateralMoreThanMax() public { + // mint a lot of tokens to test the max amount + usdc.mint(address(this), type(uint80).max); + + ActionArgs[] memory actions = new ActionArgs[](1); + actions[0] = createAddCollateralAction(usdcId, address(this), type(uint80).max); + vm.expectRevert(CM_ExceedsMaxAmount.selector); + engine.execute(address(this), actions); + } + + function testCannotAddCollateralMoreThanMaxSplit() public { + // mint a lot of tokens to test the max amount + usdc.mint(address(this), type(uint80).max); + + // deposit twice for half the max amount to fill the max precision + ActionArgs[] memory actions = new ActionArgs[](2); + actions[0] = createAddCollateralAction(usdcId, address(this), type(uint80).max / 2); + actions[1] = createAddCollateralAction(usdcId, address(this), type(uint80).max / 2); + + engine.execute(address(this), actions); + + actions = new ActionArgs[](1); + // tip over to overflow on the third deposit, separate execution to catch revert + actions[0] = createAddCollateralAction(usdcId, address(this), 10); + vm.expectRevert(stdError.arithmeticError); + engine.execute(address(this), actions); + } } diff --git a/test/integrations-physical/Transfer.t.sol b/test/integrations-physical/Transfer.t.sol index 5916bd5..e1adb4d 100644 --- a/test/integrations-physical/Transfer.t.sol +++ b/test/integrations-physical/Transfer.t.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.0; // import test base and helpers. +import {stdError} from "forge-std/Test.sol"; import {CrossMarginPhysicalFixture} from "./CrossMarginPhysicalFixture.t.sol"; import "pomace/config/enums.sol"; @@ -119,4 +120,43 @@ contract TestTransfer_CMP is CrossMarginPhysicalFixture { vm.expectRevert(NoAccess.selector); engine.execute(address(this), actions); } + + function testCanTransferCollateralUpToMax() public { + weth.mint(alice, type(uint80).max - depositAmount); + + // one deposit amount is already in the account from the setup + // take away one more from add call to make room for possible transfer + ActionArgs[] memory actions = new ActionArgs[](1); + actions[0] = createAddCollateralAction(wethId, alice, type(uint80).max - depositAmount * 2); + engine.execute(alice, actions); + + // add and transfer collateral, tip over the limit by 1 + actions = new ActionArgs[](2); + actions[0] = createAddCollateralAction(wethId, address(this), depositAmount); + actions[1] = createTransferCollateralAction(depositAmount, wethId, alice); + + engine.execute(address(this), actions); + + // check the collateral amount in alice's account is the max + (,, Balance[] memory aliceCollaterals) = engine.marginAccounts(alice); + assertEq(aliceCollaterals[0].amount, type(uint80).max); + } + + function testCannotTransferCollateralMoreThanMax() public { + weth.mint(alice, type(uint80).max - depositAmount); + + // one deposit amount is already in the account from the setup + // take away one more from add call to make room for possible transfer + ActionArgs[] memory actions = new ActionArgs[](1); + actions[0] = createAddCollateralAction(wethId, alice, type(uint80).max - depositAmount * 2); + engine.execute(alice, actions); + + // add and transfer collateral, tip over the limit by 1 + actions = new ActionArgs[](2); + actions[0] = createAddCollateralAction(wethId, address(this), depositAmount); + actions[1] = createTransferCollateralAction(depositAmount + 1, wethId, alice); + + vm.expectRevert(stdError.arithmeticError); + engine.execute(address(this), actions); + } }